|
@@ -71,21 +71,20 @@ namespace PRSDesktop
|
|
|
|
|
|
public void Refresh()
|
|
|
{
|
|
|
- using (new WaitCursor())
|
|
|
+ Progress.ShowModal("Loading Data", (progress) =>
|
|
|
{
|
|
|
- Progress.Show("Loading Data");
|
|
|
-
|
|
|
data.Rows.Clear();
|
|
|
+ MultiQuery query = new MultiQuery();
|
|
|
|
|
|
- templates = new Client<ManufacturingTemplate>().Query(
|
|
|
+ query.Add(
|
|
|
new Filter<ManufacturingTemplate>(x => x.ID).IsNotEqualTo(Guid.Empty).TextSearch(_search, x => x.Code, x => x.Name),
|
|
|
new Columns<ManufacturingTemplate>(x => x.ID)
|
|
|
.Add(x => x.Name)
|
|
|
.Add(x => x.Code),
|
|
|
new SortOrder<ManufacturingTemplate>(x => x.Code)
|
|
|
- ).ToObjects<ManufacturingTemplate>().ToArray();
|
|
|
+ );
|
|
|
|
|
|
- var packets = new Client<ManufacturingPacket>().Query(
|
|
|
+ query.Add(
|
|
|
new Filter<ManufacturingPacket>(x => x.Completed).IsGreaterThanOrEqualTo(_from).And(x => x.Completed).IsLessThan(_to.AddDays(1)),
|
|
|
new Columns<ManufacturingPacket>
|
|
|
(
|
|
@@ -93,9 +92,9 @@ namespace PRSDesktop
|
|
|
x => x.ManufacturingTemplateLink.ID,
|
|
|
x => x.Quantity
|
|
|
)
|
|
|
- ).ToObjects<ManufacturingPacket>();
|
|
|
+ );
|
|
|
|
|
|
- var history = new Client<ManufacturingHistory>().Query(
|
|
|
+ query.Add(
|
|
|
new Filter<ManufacturingHistory>(x => x.Packet.Completed).IsGreaterThanOrEqualTo(_from).And(x => x.Packet.Completed)
|
|
|
.IsLessThan(_to.AddDays(1)),
|
|
|
new Columns<ManufacturingHistory>
|
|
@@ -105,13 +104,19 @@ namespace PRSDesktop
|
|
|
x => x.QADuration,
|
|
|
x => x.WorkDuration
|
|
|
)
|
|
|
- ).ToObjects<ManufacturingHistory>()
|
|
|
+ );
|
|
|
+
|
|
|
+ query.Query();
|
|
|
+ templates = query.Get<ManufacturingTemplate>().ToObjects<ManufacturingTemplate>().ToArray();
|
|
|
+ var packets = query.Get<ManufacturingPacket>().ToObjects<ManufacturingPacket>();
|
|
|
+ ;
|
|
|
+ var history = query.Get<ManufacturingHistory>().ToObjects<ManufacturingHistory>()
|
|
|
.GroupBy(x => x.Packet.ID)
|
|
|
.ToDictionary(x => x.Key, x => x.ToList());
|
|
|
|
|
|
foreach (var template in templates)
|
|
|
{
|
|
|
- Progress.SetMessage(string.Format("Processing {0}: {1}", template.Code, template.Name));
|
|
|
+ progress.Report(string.Format("Processing {0}: {1}", template.Code, template.Name));
|
|
|
|
|
|
var templateStageSections = (stages.GetValueOrDefault(template.ID) ?? Enumerable.Empty<ManufacturingTemplateStage>())
|
|
|
.Select(x => x.Section.ID).Where(x => sections.Any(y => x == y.ID));
|
|
@@ -136,8 +141,8 @@ namespace PRSDesktop
|
|
|
if (history.TryGetValue(p.ID, out var histories))
|
|
|
{
|
|
|
foreach (var section in templateStageSections)
|
|
|
- foreach (var hist in histories.Where(x => x.Section.ID == section))
|
|
|
- times[section] += hist.QADuration.Ticks + hist.WorkDuration.Ticks;
|
|
|
+ foreach (var hist in histories.Where(x => x.Section.ID == section))
|
|
|
+ times[section] += hist.QADuration.Ticks + hist.WorkDuration.Ticks;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -166,8 +171,7 @@ namespace PRSDesktop
|
|
|
data.Rows.Add(values.ToArray());
|
|
|
}
|
|
|
|
|
|
- Progress.Close();
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
public Dictionary<string, object[]> Selected()
|