This commit is contained in:
2021-08-13 18:36:54 +00:00
parent 5ea07cd003
commit f8609e59ec
3 changed files with 22 additions and 21 deletions

View File

@@ -20,7 +20,7 @@ namespace AyaNova.PlugIn.V8
{
if (!ValidateAndCleanServerAddress()) return;
btnOk.Enabled = btnTest.Enabled = false;
var result = await util.TestUrlAsync(edServerUrl.Text);
var result = await util.InitAndConfirmAddressAsync(edServerUrl.Text);
btnOk.Enabled = btnTest.Enabled = true;
if (result == "OK")
{
@@ -35,16 +35,16 @@ namespace AyaNova.PlugIn.V8
{
if (!ValidateAndCleanServerAddress()) return;
btnOk.Enabled = btnTest.Enabled = false;
if (!util.Initialized)
{
var result = await util.TestUrlAsync(edServerUrl.Text);
// if (!util.Initialized)
//{
var result = await util.InitAndConfirmAddressAsync(edServerUrl.Text);
if (result != "OK")
{
MessageBox.Show("Server could not be reached at that URL\n" + result);
btnOk.Enabled = btnTest.Enabled = true;
return;
}
}
// }
var res = await util.AuthenticateAsync(edUserName.Text, edPassword.Text);
if (!res)
{

View File

@@ -1520,7 +1520,7 @@ namespace AyaNova.PlugIn.V8
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");
progress.Append("Info: v7 Use inventory is Active");
}
#endregion InitInventory
@@ -1619,6 +1619,7 @@ namespace AyaNova.PlugIn.V8
//INVENTORY?
if (V7UseInventory)
{
progress.SubOp("Creating temp opening inventory for part in all warehouses");
foreach (long l in Allv8WarehouseIds)
{
//create opening initial inventory just so migrate can proceed without v8 balking

View File

@@ -25,13 +25,13 @@ namespace AyaNova.PlugIn.V8
//url once known to be good
internal static string ApiBaseUrl { get; set; }
internal static string JWT { get; set; }
public static bool Initialized { get; set; }
// public static bool Initialized { get; set; }
internal static string ServerState { get; set; }
public util()
{
Initialized = false;
// Initialized = false;
JWT = string.Empty;
}
@@ -39,17 +39,17 @@ namespace AyaNova.PlugIn.V8
#region INIT / AUTH
private static void InitClient()
{
if (Initialized) return;
// if (Initialized) return;
//if (client != null)
// client.Dispose();
//client = null;
//client = new HttpClient();
client.Timeout = new TimeSpan(0, 1, 0);
client.Timeout = new TimeSpan(0, 0, 45);
client.BaseAddress = new Uri(ApiBaseUrl);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// client.DefaultRequestHeaders.Add("X-AY-Import-Mode", "true");
Initialized = true;
//Initialized = true;
}
/// <summary>
@@ -57,7 +57,7 @@ namespace AyaNova.PlugIn.V8
/// </summary>
/// <param name="serverUrl"></param>
/// <returns></returns>
public static async Task<string> TestUrlAsync(string serverUrl)
public static async Task<string> InitAndConfirmAddressAsync(string serverUrl)
{
ApiBaseUrl = serverUrl;
InitClient();