From b8d1e82a04ee952318cb74ea44f79833958171af Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 16 Aug 2021 23:00:05 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.V8/V8.cs | 34 ++++++++++++------------ source/Plugins/AyaNova.Plugin.V8/util.cs | 6 ++--- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index b98c48d..25ed35d 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -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; } - - + + } diff --git a/source/Plugins/AyaNova.Plugin.V8/util.cs b/source/Plugins/AyaNova.Plugin.V8/util.cs index 047f97b..557c651 100644 --- a/source/Plugins/AyaNova.Plugin.V8/util.cs +++ b/source/Plugins/AyaNova.Plugin.V8/util.cs @@ -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(); - + return true; }