This commit is contained in:
2021-08-12 17:24:20 +00:00
parent d2f1aa310d
commit 41d8f0c5dd

View File

@@ -265,7 +265,7 @@ namespace AyaNova.PlugIn.V8
private long ClosedWorkOrderStatus = 0;
private long ServiceCompletedWorkOrderStatus = 0;
private long UntrackedV7PartId = 0;//used when there is no part id on a workorderitempart record
private long UnknownV7PartId = 0;//used when there is no part id on a workorderitempart record
/// <summary>
/// Dump the objects into a temporary directory as a series of JSON files
@@ -1616,19 +1616,19 @@ namespace AyaNova.PlugIn.V8
//create a part just to hold untracked parts from v7 which are partid guid.empty on workorderitempart records which was allowed in v7 but not in v8
dynamic dx = new JObject();
dx.name = "v7 untracked / missing part";
dx.partNumber = GetUniqueName("untracked");
dx.name = "v8 Migrate untracked / missing v7 part";
dx.partNumber = GetUniqueName("v8 Migrate part");
progress.Op(ObjectTypeName + " " + dx.partNumber + " " + dx.name);
dx.cost = 0;
dx.retail = 0;
dx.uPC = string.Empty;
dx.unitOfMeasure = "each";
dx.active = true;
dx.notes = "This part created by v8 migrate plugin so work order item part records with no selected part can be migrated to v8\nv7 allowed work order item part entry without a corresponding Part record but v8 does not\nThis part stands in for those missing parts from v7\nThis record can be deleted after migration if no work order item parts rely on it";
dx.notes = "This part created by v8 migrate plugin so work order item part records with no (or no valid) selected part can be migrated to v8\nv7 allowed work order item part entry without a corresponding Part record but v8 does not\nThis part stands in for those missing parts from v7\nThis record can be deleted after migration if no work order item parts rely on it";
List<string> dxtags = new List<string>();
AddImportTag(dxtags);
SetTags(dx, dxtags);
UntrackedV7PartId = util.IdFromResponse(await util.PostAsync("part", dx.ToString()));
UnknownV7PartId = util.IdFromResponse(await util.PostAsync("part", dx.ToString()));
}
#endregion Parts
@@ -2730,22 +2730,19 @@ namespace AyaNova.PlugIn.V8
foreach (WorkorderItemPart wip in wi.Parts)
{
progress.Op("WorkorderItemPart " + wip.ID.ToString());
dynamic dwip = new JObject();
dwip.workOrderId = RavenId;
dwip.workorderItemId = ravenwoitemid;
dwip.quantity = wip.Quantity;
if (wip.PartID == Guid.Empty)
var tryPartId = Getv7v8IdMapNullOk(wip.PartID);
if (tryPartId==null)
{
dwip.partId = UntrackedV7PartId;
dwip.partId = UnknownV7PartId;
if (wip.Quantity == 0 && string.IsNullOrWhiteSpace(wip.Description))
{
//no part record, no quantity, no text at all, just skip it
continue;
}
continue; //no part record, no quantity, no text at all, just skip it
}
else
dwip.partId = Getv7v8IdMap(wip.PartID, "part for workorder item part");
dwip.partId = tryPartId;
dwip.partWarehouseId = Getv7v8IdMap(wip.PartWarehouseID, "warehouse");
dwip.taxPartSaleId = Getv7v8IdMapNullOk(wip.TaxPartSaleID);
dwip.priceOverride = wip.Price;
@@ -2754,7 +2751,6 @@ namespace AyaNova.PlugIn.V8
dwip.description = wip.Description;
if (wip.PartSerialID != Guid.Empty)
dwip.serials = PartSerial.GetSerialNumberFromPartSerialID(wip.PartSerialID);
await util.PostAsync("workorder/items/parts", dwip.ToString());
}