This commit is contained in:
@@ -266,6 +266,9 @@ namespace AyaNova.PlugIn.V8
|
|||||||
private long ClosedWorkOrderStatus = 0;
|
private long ClosedWorkOrderStatus = 0;
|
||||||
private long ServiceCompletedWorkOrderStatus = 0;
|
private long ServiceCompletedWorkOrderStatus = 0;
|
||||||
|
|
||||||
|
private bool V7UseInventory = false;
|
||||||
|
private List<long> Allv8WarehouseIds = new List<long>();
|
||||||
|
|
||||||
//UNKNOWN / MISSING RECORD OBJECT STAND INs
|
//UNKNOWN / MISSING RECORD OBJECT STAND INs
|
||||||
private long UnknownV7PartId = 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
|
||||||
|
|
||||||
@@ -287,6 +290,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
progress.Op("Preparing to export....");
|
progress.Op("Preparing to export....");
|
||||||
ResetUniqueUserNames();
|
ResetUniqueUserNames();
|
||||||
ResetUniqueNames();
|
ResetUniqueNames();
|
||||||
|
Allv8WarehouseIds.Clear();
|
||||||
V7ToV8IdMap.Clear();
|
V7ToV8IdMap.Clear();
|
||||||
V7ToV8WorkOrderItemStatusIdMap.Clear();
|
V7ToV8WorkOrderItemStatusIdMap.Clear();
|
||||||
TagMap.Clear();
|
TagMap.Clear();
|
||||||
@@ -369,6 +373,10 @@ namespace AyaNova.PlugIn.V8
|
|||||||
ExportClientNoteTypes(progress);
|
ExportClientNoteTypes(progress);
|
||||||
|
|
||||||
progress.Op("Exporting Business objects");
|
progress.Op("Exporting Business objects");
|
||||||
|
|
||||||
|
//are we using inventory for this?
|
||||||
|
V7UseInventory = AyaBizUtils.GlobalSettings.UseInventory;
|
||||||
|
|
||||||
//BIZ objects
|
//BIZ objects
|
||||||
await ExportLocales(progress);
|
await ExportLocales(progress);
|
||||||
await ExportStaffUsers(progress);
|
await ExportStaffUsers(progress);
|
||||||
@@ -378,10 +386,11 @@ namespace AyaNova.PlugIn.V8
|
|||||||
await ExportHeadOffices(progress);
|
await ExportHeadOffices(progress);
|
||||||
await ExportClients(progress);
|
await ExportClients(progress);
|
||||||
await ExportVendors(progress);
|
await ExportVendors(progress);
|
||||||
await TurnOffInventory(progress);
|
|
||||||
await ExportWarehouses(progress);
|
await ExportWarehouses(progress);
|
||||||
await ExportLoanItems(progress);
|
await ExportLoanItems(progress);
|
||||||
await ExportParts(progress);
|
await ExportParts(progress);
|
||||||
|
await InitInventory(progress);
|
||||||
await ExportProjects(progress);
|
await ExportProjects(progress);
|
||||||
|
|
||||||
//PURCHASE ORDERS deferred to possibly never if people can live without it
|
//PURCHASE ORDERS deferred to possibly never if people can live without it
|
||||||
@@ -1505,20 +1514,22 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region TurnOffInventory
|
#region InitInventory
|
||||||
private async System.Threading.Tasks.Task TurnOffInventory(ProgressForm progress)
|
private async System.Threading.Tasks.Task InitInventory(ProgressForm progress)
|
||||||
{
|
{
|
||||||
ResetUniqueNames();
|
|
||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
progress.Op("Turning off v8 inventory");
|
if (!V7UseInventory)
|
||||||
|
{
|
||||||
var a = await util.GetAsync("global-biz-setting");
|
progress.Append("v7 Use inventory is OFF, not migrating inventory");
|
||||||
dynamic d = a.ObjectResponse["data"];
|
var a = await util.GetAsync("global-biz-setting");
|
||||||
d.useInventory = false;
|
dynamic d = a.ObjectResponse["data"];
|
||||||
await util.PutAsync("global-biz-setting", d.ToString());
|
d.useInventory = false;
|
||||||
|
await util.PutAsync("global-biz-setting", d.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
progress.Append("v7 Use inventory is Active; parts will be exported with initial inventory to allow migration and adjusted to balance v7 at end of migration");
|
||||||
}
|
}
|
||||||
#endregion TurnOffInventory
|
#endregion InitInventory
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1612,6 +1623,20 @@ namespace AyaNova.PlugIn.V8
|
|||||||
//Event log fixup
|
//Event log fixup
|
||||||
await util.EventLog(util.AyaType.Part, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
|
await util.EventLog(util.AyaType.Part, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
|
||||||
|
|
||||||
|
//INVENTORY?
|
||||||
|
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 = RavenId;
|
||||||
|
di.partWarehouseId = l;
|
||||||
|
di.quantity = 1000000000m;//one billion should cover it
|
||||||
|
await util.PostAsync("part-inventory", di.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//UntrackedV7PartId
|
//UntrackedV7PartId
|
||||||
@@ -1650,6 +1675,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
if (i.ID == PartWarehouse.DefaultWarehouseID)
|
if (i.ID == PartWarehouse.DefaultWarehouseID)
|
||||||
{
|
{
|
||||||
|
Allv8WarehouseIds.Add(1);
|
||||||
Addv7v8IdMap(i.ID, 1);
|
Addv7v8IdMap(i.ID, 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1666,6 +1692,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
var rMainObject = await util.PostAsync("part-warehouse", d.ToString());
|
var rMainObject = await util.PostAsync("part-warehouse", d.ToString());
|
||||||
long RavenId = util.IdFromResponse(rMainObject);
|
long RavenId = util.IdFromResponse(rMainObject);
|
||||||
Addv7v8IdMap(i.ID, RavenId);
|
Addv7v8IdMap(i.ID, RavenId);
|
||||||
|
Allv8WarehouseIds.Add(RavenId);
|
||||||
await util.EventLog(util.AyaType.PartWarehouse, RavenId, SafeGetUserMap(i.Creator), SafeGetUserMap(i.Modifier), i.Created, i.Modified);
|
await util.EventLog(util.AyaType.PartWarehouse, RavenId, SafeGetUserMap(i.Creator), SafeGetUserMap(i.Modifier), i.Created, i.Modified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2737,10 +2764,38 @@ namespace AyaNova.PlugIn.V8
|
|||||||
dwip.workorderItemId = ravenwoitemid;
|
dwip.workorderItemId = ravenwoitemid;
|
||||||
dwip.quantity = wip.Quantity;
|
dwip.quantity = wip.Quantity;
|
||||||
var tryPartId = Getv7v8IdMapNullOk(wip.PartID);
|
var tryPartId = Getv7v8IdMapNullOk(wip.PartID);
|
||||||
if (tryPartId==null)
|
if (tryPartId == null)
|
||||||
{
|
{
|
||||||
dwip.partId = UnknownV7PartId;
|
dwip.partId = UnknownV7PartId;
|
||||||
if (wip.Quantity == 0 && string.IsNullOrWhiteSpace(wip.Description))
|
if (wip.Quantity == 0 && string.IsNullOrWhiteSpace(wip.Description))
|
||||||
|
continue; //no part record, no quantity, no text at all, just skip it
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dwip.partId = tryPartId;
|
||||||
|
dwip.partWarehouseId = Getv7v8IdMap(wip.PartWarehouseID, "warehouse");
|
||||||
|
dwip.taxPartSaleId = Getv7v8IdMapNullOk(wip.TaxPartSaleID);
|
||||||
|
dwip.priceOverride = wip.Price;
|
||||||
|
dwip.price = wip.Price;
|
||||||
|
dwip.cost = wip.Cost;
|
||||||
|
dwip.description = wip.Description;
|
||||||
|
if (wip.PartSerialID != Guid.Empty)
|
||||||
|
dwip.serials = PartSerial.GetSerialNumberFromPartSerialID(wip.PartSerialID);
|
||||||
|
await util.PostAsync("workorder/items/parts", dwip.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//##### WORKORDER ITEM PART
|
||||||
|
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;
|
||||||
|
var tryPartId = Getv7v8IdMapNullOk(wip.PartID);
|
||||||
|
if (tryPartId == null)
|
||||||
|
{
|
||||||
|
dwip.partId = UnknownV7PartId;
|
||||||
|
if (wip.Quantity == 0 && string.IsNullOrWhiteSpace(wip.Description))
|
||||||
continue; //no part record, no quantity, no text at all, just skip it
|
continue; //no part record, no quantity, no text at all, just skip it
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user