From 39793dc7e44132b67df3cd36d021868a20029f7c Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 12 Aug 2021 18:04:30 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.V8/V8.cs | 36 ++++++++++++++++---------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index e62e767..37274a5 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -386,26 +386,19 @@ namespace AyaNova.PlugIn.V8 await ExportHeadOffices(progress); await ExportClients(progress); await ExportVendors(progress); - - await ExportWarehouses(progress); await ExportLoanItems(progress); - await ExportParts(progress); await InitInventory(progress); + await ExportWarehouses(progress); + await ExportParts(progress); await ExportProjects(progress); - //PURCHASE ORDERS deferred to possibly never if people can live without it // await ExportPurchaseOrders(progress); - - - await ExportUnitModels(progress); await ExportUnits(progress); await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late await ExportMemos(progress); - await ExportWorkorderStatus(progress);//item and workorder both as split in v8 await ExportWorkOrderItemPriorities(progress); - await ExportServiceWorkorders(progress); //MIGRATE_OUTSTANDING - here can fixup loanitem workorder id's @@ -1656,6 +1649,20 @@ namespace AyaNova.PlugIn.V8 AddImportTag(dxtags); SetTags(dx, dxtags); UnknownV7PartId = util.IdFromResponse(await util.PostAsync("part", dx.ToString())); + + if (V7UseInventory) + { + foreach (long l in Allv8WarehouseIds) + { + //create opening initial inventory just so migrate can proceed without v8 balking + dynamic di = new JObject(); + di.description = "v8 migrate temporary initial inventory to allow migration"; + di.partId = UnknownV7PartId; + di.partWarehouseId = l; + di.quantity = 1000000000m;//one billion should cover it + await util.PostAsync("part-inventory", di.ToString()); + } + } } #endregion Parts @@ -2656,6 +2663,7 @@ namespace AyaNova.PlugIn.V8 //######### STATE ####### //if closed then set that state as well but always first set the current state { + progress.SubOp("STATE"); if (c.WorkorderService.WorkorderStatusID != Guid.Empty) { dynamic state = new JObject(); @@ -2691,7 +2699,7 @@ namespace AyaNova.PlugIn.V8 foreach (WorkorderItem wi in c.WorkorderItems) { List witags = new List(); - progress.Op("WorkorderItem " + wi.ID.ToString()); + progress.SubOp("WorkorderItem " + wi.ID.ToString()); dynamic dwi = new JObject(); dwi.workOrderId = RavenId; dwi.sequence = ++nSequence; @@ -2726,7 +2734,7 @@ namespace AyaNova.PlugIn.V8 if (ravUnitId != null) { //we have a legit unit record, make it for v8 - progress.Op("WorkorderItemUnit " + wi.UnitID.ToString()); + progress.SubOp("WorkorderItemUnit " + wi.UnitID.ToString()); dynamic dwiu = new JObject(); dwiu.workOrderId = RavenId; dwiu.workorderItemId = ravenwoitemid; @@ -2742,7 +2750,7 @@ namespace AyaNova.PlugIn.V8 //##### WORKORDER ITEM SCHEDULED USER foreach (WorkorderItemScheduledUser wisu in wi.ScheduledUsers) { - progress.Op("WorkorderItemScheduledUser " + wisu.ID.ToString()); + progress.SubOp("WorkorderItemScheduledUser " + wisu.ID.ToString()); dynamic dwisu = new JObject(); dwisu.workOrderId = RavenId; dwisu.workorderItemId = ravenwoitemid; @@ -2758,7 +2766,7 @@ namespace AyaNova.PlugIn.V8 //##### WORKORDER ITEM PART foreach (WorkorderItemPart wip in wi.Parts) { - progress.Op("WorkorderItemPart " + wip.ID.ToString()); + progress.SubOp("WorkorderItemPart " + wip.ID.ToString()); dynamic dwip = new JObject(); dwip.workOrderId = RavenId; dwip.workorderItemId = ravenwoitemid; @@ -2786,7 +2794,7 @@ namespace AyaNova.PlugIn.V8 //##### WORKORDER ITEM PART foreach (WorkorderItemPart wip in wi.Parts) { - progress.Op("WorkorderItemPart " + wip.ID.ToString()); + progress.SubOp("WorkorderItemPart " + wip.ID.ToString()); dynamic dwip = new JObject(); dwip.workOrderId = RavenId; dwip.workorderItemId = ravenwoitemid;