This commit is contained in:
2021-08-10 15:35:42 +00:00
parent 955e548586
commit 5ef621add9

View File

@@ -254,6 +254,9 @@ namespace AyaNova.PlugIn.V8
}
private bool ExportAssignedDocs = false;
private long ClosedWorkOrderStatus = 0;
/// <summary>
/// Dump the objects into a temporary directory as a series of JSON files
/// then zip it all up into a single archive file and then erase the temporary folder
@@ -2350,6 +2353,27 @@ namespace AyaNova.PlugIn.V8
}
//Third export for service completed / closed status
ResetUniqueNames();
{
if (!progress.KeepGoing) return;
dynamic d = new JObject();
d.name = GetUniqueName("Closed / Service Completed");
progress.Op("WorkOrder status " + d.name);
d.active = true;
d.locked = true;
d.completed = true;
d.selectRoles = 1290;//biz-admin, service full, service tech, subcontractor
d.removeRoles = 10;//bizadmin,servicefull
d.color = "#000000";
d.notes = "This status automatically created by the v8 migrate process for closed work orders";
SetTags(d, tags);
var rMainObject = await util.PostAsync("work-order-status", d.ToString());
ClosedWorkOrderStatus = util.IdFromResponse(rMainObject);
//Event log fixup
//await util.EventLog(util.AyaType.WorkOrderStatus, RavenId, SafeGetUserMap(s.Creator), SafeGetUserMap(s.Modifier), s.Created, s.Modified);
}
//------
@@ -2435,7 +2459,7 @@ namespace AyaNova.PlugIn.V8
}
//TODO: signatures, items*
//TODO: signatures
@@ -2482,6 +2506,31 @@ namespace AyaNova.PlugIn.V8
//Event log fixup
await util.EventLog(util.AyaType.WorkOrder, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
//######### STATE #######
//if closed then set that state as well but always first set the current state
{
if (c.WorkorderService.WorkorderStatusID != Guid.Empty)
{
dynamic state = new JObject();
state.workOrderId = RavenId;
state.workOrderStatusId = Getv7v8IdMap(c.WorkorderService.WorkorderStatusID,"Workorder status");
state.created = util.DateToV8(c.Created, true);
state.userId = Getv7v8IdMap(c.Creator, "Workorder creator for status");
await util.PostAsync("workorder/states", state.ToString());
}
if (c.Closed)
{
dynamic state = new JObject();
state.workOrderId = RavenId;
state.workOrderStatusId =ClosedWorkOrderStatus;
state.created = util.DateToV8(c.Created, true);
state.userId = Getv7v8IdMap(c.Creator, "Workorder creator for status");
await util.PostAsync("workorder/states", state.ToString());
}
//todo:? maybe if service completed but not closed we have a separate state for that??
}
//iterate all workorder items
foreach (WorkorderItem wi in c.WorkorderItems)
{