This commit is contained in:
@@ -19,8 +19,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
private async void btnTest_Click(object sender, EventArgs e)
|
private async void btnTest_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!ValidateAndCleanServerAddress()) return;
|
if (!ValidateAndCleanServerAddress()) return;
|
||||||
btnOk.Enabled=btnTest.Enabled = false;
|
btnOk.Enabled = btnTest.Enabled = false;
|
||||||
var result = await util.TestUrlAsync(edServerUrl.Text);
|
var result = await util.InitAndConfirmAddressAsync(edServerUrl.Text);
|
||||||
btnOk.Enabled = btnTest.Enabled = true;
|
btnOk.Enabled = btnTest.Enabled = true;
|
||||||
if (result == "OK")
|
if (result == "OK")
|
||||||
{
|
{
|
||||||
@@ -35,17 +35,17 @@ namespace AyaNova.PlugIn.V8
|
|||||||
{
|
{
|
||||||
if (!ValidateAndCleanServerAddress()) return;
|
if (!ValidateAndCleanServerAddress()) return;
|
||||||
btnOk.Enabled = btnTest.Enabled = false;
|
btnOk.Enabled = btnTest.Enabled = false;
|
||||||
if (!util.Initialized)
|
// if (!util.Initialized)
|
||||||
|
//{
|
||||||
|
var result = await util.InitAndConfirmAddressAsync(edServerUrl.Text);
|
||||||
|
if (result != "OK")
|
||||||
{
|
{
|
||||||
var result = await util.TestUrlAsync(edServerUrl.Text);
|
MessageBox.Show("Server could not be reached at that URL\n" + result);
|
||||||
if (result != "OK")
|
btnOk.Enabled = btnTest.Enabled = true;
|
||||||
{
|
return;
|
||||||
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);
|
// }
|
||||||
|
var res = await util.AuthenticateAsync(edUserName.Text, edPassword.Text);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
MessageBox.Show("AyaNova 8 SuperUser account login failed");
|
MessageBox.Show("AyaNova 8 SuperUser account login failed");
|
||||||
@@ -80,8 +80,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
|
|
||||||
private bool ValidateAndCleanServerAddress()
|
private bool ValidateAndCleanServerAddress()
|
||||||
{
|
{
|
||||||
var serverUrl=edServerUrl.Text;
|
var serverUrl = edServerUrl.Text;
|
||||||
Uri u;
|
Uri u;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -89,7 +89,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
var scheme = u.Scheme;
|
var scheme = u.Scheme;
|
||||||
var host = u.Host;
|
var host = u.Host;
|
||||||
var port = u.Port;
|
var port = u.Port;
|
||||||
edServerUrl.Text= scheme + "://" + host + ":" + port + "/" + util.API_BASE_ROUTE;
|
edServerUrl.Text = scheme + "://" + host + ":" + port + "/" + util.API_BASE_ROUTE;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1520,7 +1520,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
await util.PutAsync("global-biz-setting", d.ToString());
|
await util.PutAsync("global-biz-setting", d.ToString());
|
||||||
return;
|
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
|
#endregion InitInventory
|
||||||
|
|
||||||
@@ -1619,6 +1619,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
//INVENTORY?
|
//INVENTORY?
|
||||||
if (V7UseInventory)
|
if (V7UseInventory)
|
||||||
{
|
{
|
||||||
|
progress.SubOp("Creating temp opening inventory for part in all warehouses");
|
||||||
foreach (long l in Allv8WarehouseIds)
|
foreach (long l in Allv8WarehouseIds)
|
||||||
{
|
{
|
||||||
//create opening initial inventory just so migrate can proceed without v8 balking
|
//create opening initial inventory just so migrate can proceed without v8 balking
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ namespace AyaNova.PlugIn.V8
|
|||||||
//url once known to be good
|
//url once known to be good
|
||||||
internal static string ApiBaseUrl { get; set; }
|
internal static string ApiBaseUrl { get; set; }
|
||||||
internal static string JWT { 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; }
|
internal static string ServerState { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public util()
|
public util()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
// Initialized = false;
|
||||||
JWT = string.Empty;
|
JWT = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,17 +39,17 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#region INIT / AUTH
|
#region INIT / AUTH
|
||||||
private static void InitClient()
|
private static void InitClient()
|
||||||
{
|
{
|
||||||
if (Initialized) return;
|
// if (Initialized) return;
|
||||||
//if (client != null)
|
//if (client != null)
|
||||||
// client.Dispose();
|
// client.Dispose();
|
||||||
//client = null;
|
//client = null;
|
||||||
//client = new HttpClient();
|
//client = new HttpClient();
|
||||||
client.Timeout = new TimeSpan(0, 1, 0);
|
client.Timeout = new TimeSpan(0, 0, 45);
|
||||||
client.BaseAddress = new Uri(ApiBaseUrl);
|
client.BaseAddress = new Uri(ApiBaseUrl);
|
||||||
client.DefaultRequestHeaders.Accept.Clear();
|
client.DefaultRequestHeaders.Accept.Clear();
|
||||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
// client.DefaultRequestHeaders.Add("X-AY-Import-Mode", "true");
|
// client.DefaultRequestHeaders.Add("X-AY-Import-Mode", "true");
|
||||||
Initialized = true;
|
//Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -57,7 +57,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverUrl"></param>
|
/// <param name="serverUrl"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static async Task<string> TestUrlAsync(string serverUrl)
|
public static async Task<string> InitAndConfirmAddressAsync(string serverUrl)
|
||||||
{
|
{
|
||||||
ApiBaseUrl = serverUrl;
|
ApiBaseUrl = serverUrl;
|
||||||
InitClient();
|
InitClient();
|
||||||
|
|||||||
Reference in New Issue
Block a user