This commit is contained in:
@@ -517,15 +517,21 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
if (ExceptionDuringMigrate != null)
|
||||
{
|
||||
progress.Append("ERROR, During operation: \n" + progress.LastOp + "\n" + progress.LastSubOp);
|
||||
progress.Append("\n************\nExport failed with error:\n");
|
||||
progress.Append("ERROR, During operation: \r\n" + progress.LastOp + "\r\n" + progress.LastSubOp);
|
||||
progress.Append("\r\n************\r\nExport failed with error:\r\n");
|
||||
progress.Append(ExceptionDuringMigrate.Message);
|
||||
progress.Append("stack:\n" + ExceptionDuringMigrate.StackTrace);
|
||||
progress.Append("stack:\r\n" + ExceptionDuringMigrate.StackTrace);
|
||||
if (ExceptionDuringMigrate.InnerException != null)
|
||||
{
|
||||
progress.Append("\r\n************\r\nInner error:\r\n");
|
||||
progress.Append(ExceptionDuringMigrate.InnerException.Message);
|
||||
progress.Append("inner stack:\r\n" + ExceptionDuringMigrate.InnerException.StackTrace);
|
||||
}
|
||||
}
|
||||
progress.Op("Saving export log to v8 memo for SuperUser...");
|
||||
await PostExportLogToV8(progress);
|
||||
|
||||
progress.Append("Log and help links saved in v8 Memo to SuperUser account (Home->Memos)");
|
||||
progress.Append("\r\n************\r\nLog and help links saved in v8 Memo to SuperUser account (Home->Memos)");
|
||||
progress.FinishedImport();
|
||||
|
||||
progress.Append("Export completed");
|
||||
@@ -3281,15 +3287,15 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
}
|
||||
|
||||
long v8partrequestid = util.IdFromResponse(await util.PostAsync("workorder/items/part-requests", dwipr.ToString()));
|
||||
long v8partrequestid = util.IdFromResponse(await util.PostAsync("workorder/items/part-requests", dwipr));
|
||||
|
||||
//SAVE PO if fetched and updated here
|
||||
if (dPO != null && v8poitemtoupdate != null)
|
||||
{
|
||||
//save the PO
|
||||
v8poitemtoupdate["workorderItemPartRequestId"] = v8partrequestid;
|
||||
v8poitemtoupdate["workOrderItemPartRequestId"] = v8partrequestid;
|
||||
v8poitemtoupdate["vendorPartNumber"] = null;
|
||||
await util.PutAsync("purchase-order", dPO.ToString());
|
||||
await util.PutAsync("purchase-order", dPO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4563,7 +4569,7 @@ namespace AyaNova.PlugIn.V8
|
||||
ja.Add(dnew);
|
||||
}
|
||||
|
||||
await util.PutAsync("part/stock-levels/" + v8PartId, ja.ToString());
|
||||
await util.PutAsync("part/stock-levels/" + v8PartId, ja);//ja.ToString());
|
||||
}
|
||||
|
||||
|
||||
@@ -4656,7 +4662,7 @@ namespace AyaNova.PlugIn.V8
|
||||
dTransName.name = exportName;
|
||||
dTransName.stock = false;
|
||||
dTransName.cjkIndex = a.ObjectResponse["data"]["cjkIndex"];
|
||||
var vtemp = await util.PutAsync("translation", dTransName.ToString());
|
||||
var vtemp = await util.PutAsync("translation", dTransName);
|
||||
var ctoken = util.CTokenFromResponse(vtemp);
|
||||
//add to maps so can set user to it on export
|
||||
if (!LocaleMap.ContainsKey(i.Locale))
|
||||
@@ -4691,7 +4697,7 @@ namespace AyaNova.PlugIn.V8
|
||||
//update it
|
||||
progress.SubOp("Posting translation " + exportName + " to server ");
|
||||
await util.PutAsync("translation/updatetranslationitemsdisplaytext",
|
||||
JArray.FromObject(exportItems).ToString());
|
||||
JArray.FromObject(exportItems));// JArray.FromObject(exportItems).ToString());
|
||||
progress.Op("");
|
||||
progress.SubOp("");
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace AyaNova.PlugIn.V8
|
||||
public const string TEST_ROUTE = "notify/hello";
|
||||
public const string API_BASE_ROUTE = "api/v8/";
|
||||
private const int MAX_TRIES = 3;//max times to retry an api call before giving up
|
||||
private const int API_RETRY_DELAY = 3000;//pause in ms before retrying api call
|
||||
public static HttpClient client = new HttpClient();
|
||||
//url once known to be good
|
||||
internal static string ApiBaseUrl { get; set; }
|
||||
@@ -72,7 +73,7 @@ namespace AyaNova.PlugIn.V8
|
||||
{
|
||||
while (ex.InnerException != null)
|
||||
ex = ex.InnerException;
|
||||
return "Failed exception: \n" + ex.Message;
|
||||
return "Failed exception: \r\n" + ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,10 +133,11 @@ namespace AyaNova.PlugIn.V8
|
||||
if (FirstException == null)
|
||||
FirstException = ex;
|
||||
}
|
||||
await Task.Delay(API_RETRY_DELAY);
|
||||
}
|
||||
|
||||
//no luck re-throw the exception
|
||||
throw FirstException;
|
||||
throw new Exception("API call failed after " + MAX_TRIES.ToString() + " attempts", FirstException);
|
||||
}
|
||||
|
||||
private async static Task<ApiResponse> TryGetAsync(string route)
|
||||
@@ -156,14 +158,14 @@ namespace AyaNova.PlugIn.V8
|
||||
var InnerErr = "";
|
||||
if (ex.InnerException != null)
|
||||
InnerErr = ex.InnerException.Message;
|
||||
throw new Exception("GET error, route: " + route + "\nError:" + Err + "\nInner error:" + InnerErr + "\nStack:" + ex.StackTrace);
|
||||
throw new Exception("GET error, route: " + route + "\r\nError:" + Err + "\r\nInner error:" + InnerErr + "\r\nStack:" + ex.StackTrace);
|
||||
}
|
||||
|
||||
|
||||
var responseAsString = await response.Content.ReadAsStringAsync();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception("GET error, route: " + route + "\n" + responseAsString + "\n" + response.ReasonPhrase);
|
||||
throw new Exception("GET error, route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase);
|
||||
}
|
||||
else
|
||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||
@@ -187,10 +189,11 @@ namespace AyaNova.PlugIn.V8
|
||||
if (FirstException == null)
|
||||
FirstException = ex;
|
||||
}
|
||||
await Task.Delay(API_RETRY_DELAY);
|
||||
}
|
||||
|
||||
//no luck re-throw the exception
|
||||
throw FirstException;
|
||||
throw new Exception("API call failed after " + MAX_TRIES.ToString() + " attempts", FirstException);
|
||||
}
|
||||
|
||||
public async static Task<ApiResponse> PostAsync(string route, string s = null)
|
||||
@@ -208,10 +211,11 @@ namespace AyaNova.PlugIn.V8
|
||||
if (FirstException == null)
|
||||
FirstException = ex;
|
||||
}
|
||||
await Task.Delay(API_RETRY_DELAY);
|
||||
}
|
||||
|
||||
//no luck re-throw the exception
|
||||
throw FirstException;
|
||||
throw new Exception("API call failed after " + MAX_TRIES.ToString() + " attempts", FirstException);
|
||||
}
|
||||
|
||||
|
||||
@@ -236,14 +240,14 @@ namespace AyaNova.PlugIn.V8
|
||||
var InnerErr = "";
|
||||
if (ex.InnerException != null)
|
||||
InnerErr = ex.InnerException.Message;
|
||||
throw new Exception("POST error, route: " + route + "\nError:" + Err + "\nInner error:" + InnerErr + "\nStack:" + ex.StackTrace + "\nPOSTED OBJECT:\n" + postJson);
|
||||
throw new Exception("POST error, route: " + route + "\r\nError:" + Err + "\r\nInner error:" + InnerErr + "\r\nStack:" + ex.StackTrace + "\r\nPOSTED OBJECT:\r\n" + postJson);
|
||||
}
|
||||
var responseAsString = await response.Content.ReadAsStringAsync();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(postJson))
|
||||
postJson = "n/a";
|
||||
throw new Exception("POST error, route: " + route + "\n" + responseAsString + "\n" + response.ReasonPhrase + "\nPOSTED OBJECT:\n" + postJson);
|
||||
throw new Exception("POST error, route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase + "\r\nPOSTED OBJECT:\r\n" + postJson);
|
||||
}
|
||||
else
|
||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||
@@ -273,10 +277,11 @@ namespace AyaNova.PlugIn.V8
|
||||
if (FirstException == null)
|
||||
FirstException = ex;
|
||||
}
|
||||
await Task.Delay(API_RETRY_DELAY);
|
||||
}
|
||||
|
||||
//no luck re-throw the exception
|
||||
throw FirstException;
|
||||
throw new Exception("API call failed after " + MAX_TRIES.ToString() + " attempts", FirstException);
|
||||
}
|
||||
|
||||
public async static Task<ApiResponse> PutAsync(string route)
|
||||
@@ -294,10 +299,11 @@ namespace AyaNova.PlugIn.V8
|
||||
if (FirstException == null)
|
||||
FirstException = ex;
|
||||
}
|
||||
await Task.Delay(API_RETRY_DELAY);
|
||||
}
|
||||
|
||||
//no luck re-throw the exception
|
||||
throw FirstException;
|
||||
throw new Exception("API call failed after " + MAX_TRIES.ToString() + " attempts", FirstException);
|
||||
}
|
||||
|
||||
public async static Task<ApiResponse> TryPutAsync(string route, string putJson = null)
|
||||
@@ -320,14 +326,14 @@ namespace AyaNova.PlugIn.V8
|
||||
var InnerErr = "";
|
||||
if (ex.InnerException != null)
|
||||
InnerErr = ex.InnerException.Message;
|
||||
throw new Exception("PUT error, route: " + route + "\nError:" + Err + "\nInner error:" + InnerErr + "\nStack:" + ex.StackTrace + "\nPOSTED OBJECT:\n" + putJson);
|
||||
throw new Exception("PUT error, route: " + route + "\r\nError:" + Err + "\r\nInner error:" + InnerErr + "\r\nStack:" + ex.StackTrace + "\r\nPOSTED OBJECT:\r\n" + putJson);
|
||||
}
|
||||
var responseAsString = await response.Content.ReadAsStringAsync();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(putJson))
|
||||
putJson = "n/a";
|
||||
throw new Exception("PUT error, route: " + route + "\n" + responseAsString + "\n" + response.ReasonPhrase + "\nPUT OBJECT:\n" + putJson);
|
||||
throw new Exception("PUT error, route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase + "\r\nPUT OBJECT:\r\n" + putJson);
|
||||
}
|
||||
else
|
||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||
@@ -356,10 +362,11 @@ namespace AyaNova.PlugIn.V8
|
||||
if (FirstException == null)
|
||||
FirstException = ex;
|
||||
}
|
||||
await Task.Delay(API_RETRY_DELAY);
|
||||
}
|
||||
|
||||
//no luck re-throw the exception
|
||||
throw FirstException;
|
||||
throw new Exception("API call failed after " + MAX_TRIES.ToString() + " attempts", FirstException);
|
||||
}
|
||||
|
||||
|
||||
@@ -384,14 +391,14 @@ namespace AyaNova.PlugIn.V8
|
||||
var InnerErr = "";
|
||||
if (ex.InnerException != null)
|
||||
InnerErr = ex.InnerException.Message;
|
||||
throw new Exception("POST FORMDATA error, route: " + route + "\nError:" + Err + "\nInner error:" + InnerErr + "\nStack:" + ex.StackTrace);
|
||||
throw new Exception("POST FORMDATA error, route: " + route + "\r\nError:" + Err + "\r\nInner error:" + InnerErr + "\r\nStack:" + ex.StackTrace);
|
||||
}
|
||||
|
||||
|
||||
var responseAsString = await response.Content.ReadAsStringAsync();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception("POST FORMDATA error, route: " + route + "\n" + responseAsString + "\n" + response.ReasonPhrase);
|
||||
throw new Exception("POST FORMDATA error, route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase);
|
||||
}
|
||||
else
|
||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
|
||||
<!-- Development test MSSQL DB
|
||||
<!-- Development test MSSQL DB-->
|
||||
<ConnectionType>DataBase</ConnectionType>
|
||||
<DataBaseType>MSSQL</DataBaseType>
|
||||
<DataBaseConnectionString>Server=DEV-V7-LAPTOP\SQLEXPRESS;initial catalog=AyaNova;User Id=sa; Password = abraxis;</DataBaseConnectionString>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<!-- DEVELOPMENT embedded Firebird database -->
|
||||
<!-- DEVELOPMENT embedded Firebird database
|
||||
|
||||
<ConnectionType>DataBase</ConnectionType>
|
||||
<DataBaseType>FireBird</DataBaseType>
|
||||
<DataBaseConnectionString>ServerType=1;DataBase=C:\data\AyaNova\database\AYANOVA.fdb;Dialect=3;</DataBaseConnectionString>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<!-- DataPortal
|
||||
|
||||
Reference in New Issue
Block a user