This commit is contained in:
2021-10-12 00:37:11 +00:00
parent 8c4ab1e95c
commit 47e5bad23d

View File

@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
public string PluginVersion
{
get { return "7.6.1-alpha.132"; }
get { return "7.6.1-alpha.133"; }
}
public string About
@@ -1945,7 +1945,6 @@ namespace AyaNova.PlugIn.V8
#endregion Parts
#region Part assemblies
private async System.Threading.Tasks.Task ExportPartAssemblies(ProgressForm progress)
{
@@ -1995,8 +1994,6 @@ namespace AyaNova.PlugIn.V8
}
#endregion part assemblies
#region Warehouses
private async System.Threading.Tasks.Task ExportWarehouses(ProgressForm progress)
{
@@ -2043,7 +2040,6 @@ namespace AyaNova.PlugIn.V8
}
#endregion warehouses
#region Projects
private async System.Threading.Tasks.Task ExportProjects(ProgressForm progress)
{
@@ -2296,6 +2292,62 @@ namespace AyaNova.PlugIn.V8
#endregion PurchaseOrders
#region Inventory adjustment serials
private async System.Threading.Tasks.Task ExportAdjustmentSerials(ProgressForm progress)
{
if (!progress.KeepGoing) return;
progress.Op("Start part inventory adjustment serial numbers export");
progress.SubOp("");
//Step 2: export the objects
PartInventoryAdjustmentListDetailed pl = PartInventoryAdjustmentListDetailed.GetList(
"<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><GRIDCRITERIA> <COLUMNITEM CM=\"aPartInventoryAdjustment.AADJUSTMENTNUMBER\" UI=\"LT_PartInventoryAdjustment_Label_AdjustmentNumber\" PIN=\"0\" WIDTH=\"85\" SORT=\"ASC\" /> <COLUMNITEM CM=\"aPartInventoryAdjustment.aReasonForAdjustment\" UI=\"LT_PartInventoryAdjustment_Label_ReasonForAdjustment\" PIN=\"0\" WIDTH=\"106\" /> <COLUMNITEM CM=\"aPartInventoryAdjustment.aDateAdjusted\" UI=\"LT_PartInventoryAdjustment_Label_DateAdjusted\" PIN=\"0\" WIDTH=\"118\" /> <COLUMNITEM CM=\"aUser.aLastName\" UI=\"LT_Common_Label_Creator\" PIN=\"0\" WIDTH=\"141\" /> <COLUMNITEM CM=\"aPartWarehouse.aName\" UI=\"LT_O_PartWarehouse\" PIN=\"0\" WIDTH=\"127\" /> <COLUMNITEM CM=\"aPart.aName\" UI=\"LT_O_Part\" PIN=\"0\" WIDTH=\"142\" /> <COLUMNITEM CM=\"aPartInventoryAdjustmentItem.aQuantityAdjustment\" UI=\"LT_PartInventoryAdjustmentItem_Label_QuantityAdjustment\" PIN=\"0\" WIDTH=\"154\" /> <COLUMNITEM CM=\"aPartSerial.aSerialNumber\" UI=\"LT_Common_Label_SerialNumber\" PIN=\"0\" WIDTH=\"118\" /></GRIDCRITERIA>");
foreach (PartInventoryAdjustmentListDetailed.PartInventoryAdjustmentListDetailedInfo i in pl)
{
if (!progress.KeepGoing) return;
//if no serial then continue to the next one until there is
if (string.IsNullOrWhiteSpace(i.LT_Common_Label_SerialNumber)) continue;
long partNumber = await Getv7v8IdMap(i.LT_O_Part.Value, RootObjectTypes.Part, false, false);
if (partNumber == 0)
{
//log here or skip it as old adjustments could have invalid parts or not exported
//maybe append just to be safe
progress.Append("Part inventory adjustment part missing; skipping serial number '" + i.LT_Common_Label_SerialNumber + "' export: PartID " + i.LT_O_Part.Value.ToString());
continue;
}
//get the part serial record
var a = await util.GetAsync("part/serials/" + partNumber.ToString());
dynamic d = a.ObjectResponse["data"];
dynamic dItem = new JObject();
dItem = i.LT_Common_Label_SerialNumber;
d.Add(dItem);
//list should only have a serial number in it if it's staying, removed ones are removed entirely from the list as well due to quirk
//so the list should only have one serial per part per adjustment item in the list in theory and no negative removed ones
//get new part number
//get existing serials because the same part may be adjusted multiple times
//PUT at route /part/serials/v8partid array of strings which are *all* serial numbers for that part (warehouse no longer relevant)
await util.PutAsync("part/serials/" + partNumber, d);
}//end of adjustmentitem loop
}
#endregion Inventory adjustment serials
#region Task groups
private async System.Threading.Tasks.Task ExportTaskGroups(ProgressForm progress)
{
@@ -2343,8 +2395,6 @@ namespace AyaNova.PlugIn.V8
}
#endregion Task groups
#region Units
private async System.Threading.Tasks.Task ExportUnits(ProgressForm progress)
{