This commit is contained in:
2021-08-16 23:00:05 +00:00
parent 8f908a41be
commit b8d1e82a04
2 changed files with 19 additions and 21 deletions

View File

@@ -146,15 +146,9 @@ namespace AyaNova.PlugIn.V8
{
return;
}
#if(!DEBUG)
//check if in migrate mode
if (util.ServerState != "MigrateMode")
{
MessageBox.Show("The target server must be set to Server State - \"Migrate Mode\"\nbut is currently in Server State - \"" + util.ServerState + "\"\n\n- login to AyaNova 8 as the SuperUser\n- select \"Server Operations\" section then \"Server state\" page\n- set to \"Migrate mode\", save and logout\n- start V8Migrate",
"Target server is in \"Migrate mode\"");
return;
}
#endif
Opt dOpt = new Opt();
@@ -303,13 +297,17 @@ namespace AyaNova.PlugIn.V8
//admin user (not exported but is there already)
V7ToV8IdMap.Add(User.AdministratorID, 1);
//MIGRATE MODE
progress.Append("Setting v8 Server State to 'Migrate Mode'");
await util.PostAsync("server-state", "{\"serverState\":\"MigrateMode\"}");
//ERASE DB
progress.Op("Erasing AyaNova 8 data");
progress.Append("Erasing AyaNova 8 data");
var a = await util.PostAsync("license/permanently-erase-all-data", "\"I understand\"");
//delay to allow event log to properly show erase as the first operation
System.Threading.Thread.Sleep(2000);
// System.Threading.Thread.Sleep(2000);
//TAGS
@@ -398,6 +396,9 @@ namespace AyaNova.PlugIn.V8
End:
;
//MIGRATE MODE
progress.Append("Setting v8 Server State to 'Open'");
await util.PostAsync("server-state", "{\"serverState\":\"Open\"}");
}
catch (Exception ex)
{
@@ -3643,8 +3644,8 @@ namespace AyaNova.PlugIn.V8
{
progress.SubOp("sync part " + i.Name);
PartInventoryList v7inv = PartInventoryList.GetListForSingleItem(i.ID);
long v8PartId=Getv7v8IdMap(i.ID, "part id for synchronize inventory");
JObject v8inv = (await util.GetAsync("part/latest-inventory/" + v8PartId )).ObjectResponse;
long v8PartId = Getv7v8IdMap(i.ID, "part id for synchronize inventory");
JObject v8inv = (await util.GetAsync("part/latest-inventory/" + v8PartId)).ObjectResponse;
//iterate v8 inventory
foreach (JObject v8o in v8inv["data"])
{
@@ -3671,8 +3672,7 @@ namespace AyaNova.PlugIn.V8
dAdjust = v8OnHand * -1;
}
//ok we have our values, send to raven
foreach (long l in Allv8WarehouseIds)
//ok we have our values, send to raven
{
dynamic di = new JObject();
di.description = "v8 migrate synchronize inventory";
@@ -3694,8 +3694,8 @@ namespace AyaNova.PlugIn.V8
}
break;
}
}

View File

@@ -26,7 +26,7 @@ namespace AyaNova.PlugIn.V8
internal static string ApiBaseUrl { get; set; }
internal static string JWT { get; set; }
// public static bool Initialized { get; set; }
internal static string ServerState { get; set; }
// internal static string ServerState { get; set; }
//public util()
@@ -103,9 +103,7 @@ namespace AyaNova.PlugIn.V8
return false;
}
a = await GetAsync("server-state/");
ServerState = a.ObjectResponse["data"]["serverState"].Value<string>();
return true;
}