|
|
@@ -28,12 +28,20 @@ internal class Update_8_57 : DatabaseUpdateScript
|
|
|
Columns.None<Setout>()
|
|
|
.Add(x => x.ID)
|
|
|
.Add(x => x.Status))
|
|
|
- .ToArray<Setout>();
|
|
|
- foreach(var setout in setouts)
|
|
|
+ .ToArray<Setout>()
|
|
|
+
|
|
|
+ .ToQueue();
|
|
|
+ var totalsetouts = setouts.Count;
|
|
|
+ var processedsetouts = 0;
|
|
|
+ while (setouts.Count > 0)
|
|
|
{
|
|
|
- setout.Status = SetoutStatus.Approved;
|
|
|
- }
|
|
|
- provider.Save(setouts);
|
|
|
+ Logger.Send(LogType.Information, "", $"Updating {setouts.Count} staging setouts; {processedsetouts}/{totalsetouts}");
|
|
|
+ var updates = setouts.Dequeue(100).ToArray();
|
|
|
+ foreach(var update in updates)
|
|
|
+ update.Status = SetoutStatus.Approved;
|
|
|
+ provider.Save(updates);
|
|
|
+ processedsetouts += updates.Length;
|
|
|
+ };
|
|
|
|
|
|
Logger.Send(LogType.Information, "", "Approving all old manufacturing packets");
|
|
|
var packets = provider.Query(
|
|
|
@@ -42,12 +50,20 @@ internal class Update_8_57 : DatabaseUpdateScript
|
|
|
.Add(x => x.ID)
|
|
|
.Add(x => x.Approved)
|
|
|
.Add(x => x.Created))
|
|
|
- .ToArray<ManufacturingPacket>();
|
|
|
- foreach(var packet in packets)
|
|
|
+ .ToArray<ManufacturingPacket>()
|
|
|
+ .ToQueue();
|
|
|
+ var totalpackets = packets.Count;
|
|
|
+ var processedpackets = 0;
|
|
|
+ while (packets.Count > 0)
|
|
|
{
|
|
|
- packet.Approved = packet.Created;
|
|
|
+ Logger.Send(LogType.Information, "", $"Updating {packets.Count} staging setouts; {processedpackets}/{totalpackets}");
|
|
|
+ var updates = packets.Dequeue(100).ToArray();
|
|
|
+ foreach(var update in updates)
|
|
|
+ update.Approved = update.Created;
|
|
|
+ provider.Save(updates);
|
|
|
+ processedpackets += updates.Length;
|
|
|
}
|
|
|
- provider.Save(packets);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public override bool Update()
|
|
|
@@ -95,7 +111,7 @@ internal class Update_8_57 : DatabaseUpdateScript
|
|
|
var stagingSetouts = stagingSetoutsQueue.Dequeue(100).ToArray();
|
|
|
|
|
|
ProcessStagingSetouts(provider, stagingSetouts);
|
|
|
-
|
|
|
+
|
|
|
processed += stagingSetouts.Length;
|
|
|
}
|
|
|
|
|
|
@@ -284,11 +300,14 @@ internal class Update_8_57 : DatabaseUpdateScript
|
|
|
{
|
|
|
setout.Status = SetoutStatus.Cancelled;
|
|
|
setout.Problem.AssignedTo.ID = stagingSetout.Task.EmployeeLink.ID;
|
|
|
- setout.Problem.Notes = new string[]
|
|
|
+ var notes = new List<string>()
|
|
|
{
|
|
|
stagingSetout.Task.Title,
|
|
|
stagingSetout.Task.Description,
|
|
|
- }.Concatenate(stagingSetout.Task.Notes);
|
|
|
+ };
|
|
|
+ if (stagingSetout.Task.Notes != null)
|
|
|
+ notes.AddRange(stagingSetout.Task.Notes);
|
|
|
+ setout.Problem.Notes = notes.ToArray();
|
|
|
setout.Problem.Resolved = stagingSetout.Task.Completed;
|
|
|
}
|
|
|
|