woitemparts now working
This commit is contained in:
@@ -131,13 +131,13 @@ namespace AyaNova.PlugIn.V8
|
||||
return;
|
||||
}
|
||||
|
||||
#if(!DEBUG)
|
||||
#if(!DEBUG)
|
||||
if (!AyaBizUtils.AyaNovaConnectionSetting.SingleUserConnection)
|
||||
{
|
||||
MessageBox.Show("** WARNING: before proceeding ensure no other users are logged into AyaNova to ensure the integrity of your exported data. Failing to do so *will* result in damaged data. ***");
|
||||
MessageBox.Show("** WARNING: before proceeding make sure your AyaNova Generator service is STOPPED to ensure the integrity of your exported data. Failing to do so *will* result in damaged data. ***");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
util.Initialized = false;
|
||||
Auth d = new Auth();
|
||||
@@ -265,6 +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
|
||||
|
||||
/// <summary>
|
||||
/// Dump the objects into a temporary directory as a series of JSON files
|
||||
@@ -375,6 +376,7 @@ namespace AyaNova.PlugIn.V8
|
||||
await ExportHeadOffices(progress);
|
||||
await ExportClients(progress);
|
||||
await ExportVendors(progress);
|
||||
await TurnOffInventory(progress);
|
||||
await ExportWarehouses(progress);
|
||||
await ExportLoanItems(progress);
|
||||
await ExportParts(progress);
|
||||
@@ -1498,6 +1500,27 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
#endregion LoanItems
|
||||
|
||||
|
||||
|
||||
|
||||
#region TurnOffInventory
|
||||
private async System.Threading.Tasks.Task TurnOffInventory(ProgressForm progress)
|
||||
{
|
||||
ResetUniqueNames();
|
||||
if (!progress.KeepGoing) return;
|
||||
progress.Op("Turning off v8 inventory");
|
||||
|
||||
var a = await util.GetAsync("global-biz-setting");
|
||||
dynamic d = a.ObjectResponse["data"];
|
||||
d.useInventory = false;
|
||||
await util.PutAsync("global-biz-setting", d.ToString());
|
||||
|
||||
}
|
||||
#endregion TurnOffInventory
|
||||
|
||||
|
||||
|
||||
|
||||
#region Parts
|
||||
private async System.Threading.Tasks.Task ExportParts(ProgressForm progress)
|
||||
{
|
||||
@@ -1588,6 +1611,24 @@ namespace AyaNova.PlugIn.V8
|
||||
await util.EventLog(util.AyaType.Part, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
|
||||
|
||||
}
|
||||
|
||||
//UntrackedV7PartId
|
||||
//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");
|
||||
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";
|
||||
List<string> dxtags = new List<string>();
|
||||
AddImportTag(dxtags);
|
||||
SetTags(dx, dxtags);
|
||||
UntrackedV7PartId = util.IdFromResponse(await util.PostAsync("part", dx.ToString()));
|
||||
}
|
||||
#endregion Parts
|
||||
|
||||
@@ -1605,7 +1646,8 @@ namespace AyaNova.PlugIn.V8
|
||||
foreach (PartWarehouse i in pl)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
if (i.ID == PartWarehouse.DefaultWarehouseID) {
|
||||
if (i.ID == PartWarehouse.DefaultWarehouseID)
|
||||
{
|
||||
Addv7v8IdMap(i.ID, 1);
|
||||
continue;
|
||||
}
|
||||
@@ -1628,8 +1670,6 @@ namespace AyaNova.PlugIn.V8
|
||||
#endregion warehouses
|
||||
|
||||
|
||||
|
||||
|
||||
#region Projects
|
||||
private async System.Threading.Tasks.Task ExportProjects(ProgressForm progress)
|
||||
{
|
||||
@@ -2577,7 +2617,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
}
|
||||
|
||||
//put the final object
|
||||
//put the header object
|
||||
await util.PutAsync("workorder", d.ToString());
|
||||
//-----
|
||||
|
||||
@@ -2690,11 +2730,22 @@ 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;
|
||||
dwip.partId = Getv7v8IdMap(wip.PartID, "part for workorder item part");
|
||||
if (wip.PartID == Guid.Empty)
|
||||
{
|
||||
dwip.partId = UntrackedV7PartId;
|
||||
if (wip.Quantity == 0 && string.IsNullOrWhiteSpace(wip.Description))
|
||||
{
|
||||
//no part record, no quantity, no text at all, just skip it
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
dwip.partId = Getv7v8IdMap(wip.PartID, "part for workorder item part");
|
||||
dwip.partWarehouseId = Getv7v8IdMap(wip.PartWarehouseID, "warehouse");
|
||||
dwip.taxPartSaleId = Getv7v8IdMapNullOk(wip.TaxPartSaleID);
|
||||
dwip.priceOverride = wip.Price;
|
||||
@@ -4592,14 +4643,7 @@ and this one
|
||||
|
||||
|
||||
#region OLD JSON EXPORT STUFF
|
||||
#region Global settings
|
||||
private void ExportGlobalSettings(ProgressForm progress)
|
||||
{
|
||||
|
||||
progress.Append("STUB: Dumping Global Settings");
|
||||
////DumpObjectToFolder(tempArchiveFolder, AyaBizUtils.GlobalSettings, "globalsettings", objectExcludeProperties, new TypeAndID(RootObjectTypes.Global, Address.GlobalAddressID));
|
||||
}
|
||||
#endregion globalsettings
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user