This commit is contained in:
2021-10-12 01:03:34 +00:00
parent a87da87cb8
commit 135931e630

View File

@@ -2314,6 +2314,7 @@ namespace AyaNova.PlugIn.V8
//if no serial then continue to the next one until there is
if (string.IsNullOrWhiteSpace(i.LT_Common_Label_SerialNumber)) continue;
if (i.LT_PartInventoryAdjustmentItem_Label_QuantityAdjustment == 0) continue;//don't know if this can be a thing but better safe than sorry
long partNumber = await Getv7v8IdMap(i.LT_O_Part.Value, RootObjectTypes.Part, false, false);
if (partNumber == 0)
@@ -2330,10 +2331,28 @@ namespace AyaNova.PlugIn.V8
dynamic d = a.ObjectResponse["data"];
//todo: if quantity adjustment is negative (ignore amount it's whack) then remove the one serial number from the collection
//and save if found
//if the quantity is positive then add the one serial number to the collection and save
dynamic dItem = new JObject();
dItem = i.LT_Common_Label_SerialNumber;
d.Add(dItem);
if (i.LT_PartInventoryAdjustmentItem_Label_QuantityAdjustment < 0)
{
foreach (JObject j in d.Children())
{
if (j.Value<string>() == i.LT_Common_Label_SerialNumber)
{
d.Remove(j);
}
}
}
else
{
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