case 4002
This commit is contained in:
@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
public string PluginVersion
|
||||
{
|
||||
get { return "7.6.1-alpha.134"; }
|
||||
get { return "7.6.1-alpha.135"; }
|
||||
}
|
||||
|
||||
public string About
|
||||
@@ -501,6 +501,7 @@ namespace AyaNova.PlugIn.V8
|
||||
await ExportPartAssemblies(progress);
|
||||
await ExportProjects(progress);
|
||||
await ExportPurchaseOrders(progress);
|
||||
await ExportInventoryAdjustments(progress);
|
||||
await ExportUnitModels(progress);
|
||||
await ExportUnits(progress);
|
||||
await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late
|
||||
@@ -510,7 +511,7 @@ namespace AyaNova.PlugIn.V8
|
||||
await ExportWorkOrderItemPriorities(progress);
|
||||
await ExportQuotes(progress);
|
||||
await ExportPMs(progress);
|
||||
await SynchronizeSerials(progress);
|
||||
//await SynchronizeSerials(progress);
|
||||
await ExportServiceWorkorders(progress);
|
||||
await ExportUnitMeterReadings(progress);
|
||||
|
||||
@@ -2293,6 +2294,76 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
#endregion PurchaseOrders
|
||||
|
||||
#region Inventory adjustments
|
||||
private async System.Threading.Tasks.Task ExportInventoryAdjustments(ProgressForm progress)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
|
||||
|
||||
progress.Op("Start inventory adjustments");
|
||||
progress.SubOp("");
|
||||
|
||||
//Step 2: export the objects
|
||||
PartInventoryAdjustmentList pil = PartInventoryAdjustmentList.GetList(
|
||||
"<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><GRIDCRITERIA> <COLUMNITEM CM=\"aPartInventoryAdjustment.aDateAdjusted\" UI=\"LT_PartInventoryAdjustment_Label_DateAdjusted\" PIN=\"0\" WIDTH=\"118\" SORT=\"ASC\" /> <COLUMNITEM CM=\"aPartInventoryAdjustment.AADJUSTMENTNUMBER\" UI=\"LT_PartInventoryAdjustment_Label_AdjustmentNumber\" PIN=\"0\" WIDTH=\"87\" /></GRIDCRITERIA>");
|
||||
progress.Append("Exporting " + pil.Count.ToString()+" inventory adjustments");
|
||||
foreach (PartInventoryAdjustmentList.PartInventoryAdjustmentListInfo i in pil)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
|
||||
PartInventoryAdjustment c = PartInventoryAdjustment.GetItem(i.LT_PartInventoryAdjustment_Label_AdjustmentNumber.Value);
|
||||
foreach (PartInventoryAdjustmentItem pi in c.Items)
|
||||
{
|
||||
progress.Op("Adjustment " + c.AdjustmentNumber.ToString());
|
||||
dynamic d = new JObject();
|
||||
d.description = "v7Adjustment " + c.AdjustmentNumber.ToString() + " " + c.ReasonForAdjustment + " on " + c.DateAdjusted.ToString();
|
||||
d.partId = await Getv7v8IdMap(pi.PartID, RootObjectTypes.Part);
|
||||
d.partWarehouseId = await Getv7v8IdMap(pi.PartWarehouseID, RootObjectTypes.PartWarehouse);
|
||||
d.quantity = pi.QuantityAdjustment;
|
||||
await util.PostAsync("part-inventory", d);
|
||||
|
||||
//post to part-inventory route
|
||||
|
||||
//now, separately, do serial numbers if any
|
||||
if (pi.SerialNumbers.Count > 0)
|
||||
{
|
||||
//get the part serial record
|
||||
var a = await util.GetAsync("part/serials/" + d.partId.ToString());
|
||||
dynamic f = a.ObjectResponse["data"];
|
||||
//turn the v8 serials into a string list
|
||||
var v = (JArray)f;
|
||||
List<string> v8Serials = new List<string>();
|
||||
foreach (JValue j in v)
|
||||
v8Serials.Add(j.Value<string>());
|
||||
|
||||
if (pi.QuantityAdjustment < 0)
|
||||
{
|
||||
//remove serials
|
||||
foreach (PartSerial ps in pi.SerialNumbers)
|
||||
v8Serials.Remove(ps.SerialNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
//append serials
|
||||
foreach (PartSerial ps in pi.SerialNumbers)
|
||||
v8Serials.Add(ps.SerialNumber);
|
||||
}
|
||||
|
||||
foreach (PartSerial ps in pi.SerialNumbers)
|
||||
{
|
||||
dynamic dItem = new JObject();
|
||||
dItem = ps.SerialNumber;
|
||||
f.Add(dItem);
|
||||
}
|
||||
await util.PutAsync("part/serials/" + d.partId.ToString(), new JArray(v8Serials));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}//end of inventory item loop
|
||||
}
|
||||
#endregion inventory adjustments
|
||||
|
||||
#region Synchronize serials
|
||||
private async System.Threading.Tasks.Task SynchronizeSerials(ProgressForm progress)
|
||||
{
|
||||
@@ -5884,7 +5955,7 @@ namespace AyaNova.PlugIn.V8
|
||||
//can we see it?
|
||||
if (!File.Exists(doc.URL))
|
||||
{
|
||||
NonFileUrls += ( "v8Migrate - Assigned doc. file not found: " + doc.Description + " " + doc.URL + "\n");
|
||||
NonFileUrls += ("v8Migrate - Assigned doc. file not found: " + doc.Description + " " + doc.URL + "\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user