This commit is contained in:
@@ -240,6 +240,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
private string MissingDataNamePrefix = "zV8migrate_substitute";//append guid to ensure uniqueness
|
private string MissingDataNamePrefix = "zV8migrate_substitute";//append guid to ensure uniqueness
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async System.Threading.Tasks.Task CreateSubstitute(Guid id, RootObjectTypes desiredType, long? extraV8Id = null)
|
private async System.Threading.Tasks.Task CreateSubstitute(Guid id, RootObjectTypes desiredType, long? extraV8Id = null)
|
||||||
{
|
{
|
||||||
//create the simplest possible version of this object desired
|
//create the simplest possible version of this object desired
|
||||||
@@ -373,7 +374,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
private bool V7UseInventory = false;
|
private bool V7UseInventory = false;
|
||||||
private List<long> Allv8WarehouseIds = new List<long>();
|
private List<long> Allv8WarehouseIds = new List<long>();
|
||||||
|
|
||||||
|
private long SmallestFileUploadRejectedAsTooBig = long.MaxValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -390,7 +391,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
progress.StartedImport();
|
progress.StartedImport();
|
||||||
progress.Append("Exporting data to AyaNova server @ " + util.ApiBaseUrl);
|
progress.Append("Exporting data to AyaNova server @ " + util.ApiBaseUrl);
|
||||||
progress.Append(util.PRE_RELEASE_VERSION_STRING);
|
progress.Append(util.PRE_RELEASE_VERSION_STRING);
|
||||||
|
|
||||||
Exception ExceptionDuringMigrate = null;
|
Exception ExceptionDuringMigrate = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -406,6 +407,9 @@ namespace AyaNova.PlugIn.V8
|
|||||||
V7ToV8WorkOrderItemStatusIdMap.Clear();
|
V7ToV8WorkOrderItemStatusIdMap.Clear();
|
||||||
TagMap.Clear();
|
TagMap.Clear();
|
||||||
LocaleMap.Clear();
|
LocaleMap.Clear();
|
||||||
|
SmallestFileUploadRejectedAsTooBig = long.MaxValue;
|
||||||
|
|
||||||
|
|
||||||
//add default raven language and codes
|
//add default raven language and codes
|
||||||
LocaleMap.Add("English", 1);
|
LocaleMap.Add("English", 1);
|
||||||
LocaleMap.Add("Español", 2);
|
LocaleMap.Add("Español", 2);
|
||||||
@@ -415,8 +419,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
V7ToV8IdMap.Add(User.AdministratorID, 1);
|
V7ToV8IdMap.Add(User.AdministratorID, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//ERASE DB
|
//ERASE DB
|
||||||
progress.Append("Erasing AyaNova 8 data");
|
progress.Append("Erasing AyaNova 8 data");
|
||||||
@@ -542,7 +546,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
await PostExportLogToV8(progress);
|
await PostExportLogToV8(progress);
|
||||||
|
|
||||||
progress.Append("\r\n************\r\nLog 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.Append("Export completed");
|
progress.Append("Export completed");
|
||||||
progress.Op("");
|
progress.Op("");
|
||||||
@@ -4273,7 +4277,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
ScheduleMarker c = ScheduleMarker.GetItem(i.LT_O_ScheduleMarker.Value);
|
ScheduleMarker c = ScheduleMarker.GetItem(i.LT_O_ScheduleMarker.Value);
|
||||||
|
|
||||||
|
|
||||||
//Many schedulemarkers may not have related records so allow for that!!
|
//Many schedulemarkers may not have related records so allow for that!!
|
||||||
if (c.IsFollowUp)
|
if (c.IsFollowUp)
|
||||||
{
|
{
|
||||||
@@ -4281,7 +4285,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
AddImportTag(tags);
|
AddImportTag(tags);
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
progress.Op("FollowUp " + c.ID.ToString());
|
progress.Op("FollowUp " + c.ID.ToString());
|
||||||
|
|
||||||
|
|
||||||
//export
|
//export
|
||||||
//FollowUps only ever apply to a single user in v7 so no need to split them out here it's just for one user
|
//FollowUps only ever apply to a single user in v7 so no need to split them out here it's just for one user
|
||||||
@@ -4334,7 +4338,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
v8FollowId = await Getv7v8IdMapNullOk(c.FollowID, RootObjectTypes.Workorder, false, true);
|
v8FollowId = await Getv7v8IdMapNullOk(c.FollowID, RootObjectTypes.Workorder, false, true);
|
||||||
if (v8FollowId == null)
|
if (v8FollowId == null)
|
||||||
{
|
{
|
||||||
progress.Append("Follow up for WO skipped due to WO non-existance");
|
progress.Append("Follow up for WO with ID: " + c.FollowID.ToString() + " skipped due to WO non-existance");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
d.objectId = v8FollowId;
|
d.objectId = v8FollowId;
|
||||||
@@ -4343,17 +4347,17 @@ namespace AyaNova.PlugIn.V8
|
|||||||
break;
|
break;
|
||||||
case RootObjectTypes.WorkorderQuote:
|
case RootObjectTypes.WorkorderQuote:
|
||||||
{
|
{
|
||||||
Guid woid=Guid.Empty;
|
Guid woid = Guid.Empty;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Workorder o = Workorder.GetWorkorderByRelativeNoMRU(RootObjectTypes.WorkorderQuote, c.FollowID);
|
Workorder o = Workorder.GetWorkorderByRelativeNoMRU(RootObjectTypes.WorkorderQuote, c.FollowID);
|
||||||
woid=o.ID;
|
woid = o.ID;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (ex is FetchException || ex is System.Security.SecurityException)//Note: workorder will throw a security exception if resulting ID is guid.empty for...reasons..
|
if (ex is FetchException || ex is System.Security.SecurityException)//Note: workorder will throw a security exception if resulting ID is guid.empty for...reasons..
|
||||||
{
|
{
|
||||||
progress.Append("Follow up for Quote skipped due to Quote non-existance");
|
progress.Append("Follow up for Quote with ID: " + c.FollowID.ToString() + " skipped due to Quote non-existance");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
@@ -4361,7 +4365,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
v8FollowId = await Getv7v8IdMapNullOk(woid, RootObjectTypes.Workorder, false, true);
|
v8FollowId = await Getv7v8IdMapNullOk(woid, RootObjectTypes.Workorder, false, true);
|
||||||
if (v8FollowId == null)
|
if (v8FollowId == null)
|
||||||
{
|
{
|
||||||
progress.Append("Follow up for quote skipped due to quote non-existance");
|
progress.Append("Follow up for Quote with ID: " + c.FollowID.ToString() + " skipped due to quote non-existance");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
d.objectId = v8FollowId;
|
d.objectId = v8FollowId;
|
||||||
@@ -4380,7 +4384,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
{
|
{
|
||||||
if (ex is FetchException || ex is System.Security.SecurityException)//Note: workorder will throw a security exception if resulting ID is guid.empty for...reasons..
|
if (ex is FetchException || ex is System.Security.SecurityException)//Note: workorder will throw a security exception if resulting ID is guid.empty for...reasons..
|
||||||
{
|
{
|
||||||
progress.Append("Follow up for PM skipped due to PM non-existance");
|
progress.Append("Follow up for PM with ID: " + c.FollowID.ToString() + " skipped due to PM non-existance");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
@@ -4388,7 +4392,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
v8FollowId = await Getv7v8IdMapNullOk(woid, RootObjectTypes.Workorder, false, true);
|
v8FollowId = await Getv7v8IdMapNullOk(woid, RootObjectTypes.Workorder, false, true);
|
||||||
if (v8FollowId == null)
|
if (v8FollowId == null)
|
||||||
{
|
{
|
||||||
progress.Append("Follow up for PM skipped due to PM non-existance");
|
progress.Append("Follow up for PM with ID: " + c.FollowID.ToString() + " skipped due to PM non-existance");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
d.objectId = v8FollowId;
|
d.objectId = v8FollowId;
|
||||||
@@ -4412,7 +4416,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
|
|
||||||
SetTags(d, tags);
|
SetTags(d, tags);
|
||||||
|
|
||||||
var rMainObject = await util.PostAsync("review", d);
|
var rMainObject = await util.PostAsync("review", d);
|
||||||
long RavenId = util.IdFromResponse(rMainObject);
|
long RavenId = util.IdFromResponse(rMainObject);
|
||||||
Addv7v8IdMap(c.ID, RavenId);
|
Addv7v8IdMap(c.ID, RavenId);
|
||||||
@@ -4665,7 +4669,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
{
|
{
|
||||||
//this is the match, do the fixup
|
//this is the match, do the fixup
|
||||||
//v8 inventory starts with 1 billion so every adjustment will always be *down*
|
//v8 inventory starts with 1 billion so every adjustment will always be *down*
|
||||||
|
|
||||||
if (v7o.LT_PartByWarehouseInventory_Label_QuantityOnHand < 0)
|
if (v7o.LT_PartByWarehouseInventory_Label_QuantityOnHand < 0)
|
||||||
{
|
{
|
||||||
//don't allow negative inventory, log and set to zero instead
|
//don't allow negative inventory, log and set to zero instead
|
||||||
@@ -5594,6 +5598,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
//iterate the files
|
//iterate the files
|
||||||
foreach (AssignedDoc doc in docs)
|
foreach (AssignedDoc doc in docs)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!progress.KeepGoing) return null;
|
if (!progress.KeepGoing) return null;
|
||||||
|
|
||||||
//is it a local file?
|
//is it a local file?
|
||||||
@@ -5614,6 +5619,13 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
progress.SubOp("Assigned doc: \"" + doc.URL + "\" " + AyaBizUtils.FileSizeDisplay((decimal)fi.Length));
|
progress.SubOp("Assigned doc: \"" + doc.URL + "\" " + AyaBizUtils.FileSizeDisplay((decimal)fi.Length));
|
||||||
|
|
||||||
|
|
||||||
|
if (fi.Length > SmallestFileUploadRejectedAsTooBig)
|
||||||
|
{
|
||||||
|
progress.Append("Assigned doc. file " + doc.Description + " " + doc.URL + " too large (" + fi.Length.ToString() + ") for this server. Adjust destination server settings to allow");
|
||||||
|
NonFileUrls += (ImportTag + " - Assigned doc. file " + doc.Description + " " + doc.URL + " too large (" + fi.Length.ToString() + ") for this server. Adjust destination server settings to allow.\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
//Compile the FileData property
|
//Compile the FileData property
|
||||||
|
|
||||||
DateTimeOffset dtLastModified = fi.LastWriteTimeUtc;
|
DateTimeOffset dtLastModified = fi.LastWriteTimeUtc;
|
||||||
@@ -5666,7 +5678,26 @@ namespace AyaNova.PlugIn.V8
|
|||||||
formDataContent.Add(AttachmentFile);
|
formDataContent.Add(AttachmentFile);
|
||||||
|
|
||||||
//Upload
|
//Upload
|
||||||
await util.PostFormDataAsync("attachment", formDataContent);
|
try
|
||||||
|
{
|
||||||
|
await util.PostFormDataAsync("attachment", formDataContent);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (ex.Message.Contains("413"))
|
||||||
|
{
|
||||||
|
if (SmallestFileUploadRejectedAsTooBig > fi.Length)
|
||||||
|
SmallestFileUploadRejectedAsTooBig = fi.Length;
|
||||||
|
progress.Append("Assigned doc. file " + doc.Description + " " + doc.URL + " too large (" + fi.Length.ToString() + ") for this server. Adjust destination server settings to allow");
|
||||||
|
NonFileUrls += (ImportTag + " - Assigned doc. file " + doc.Description + " " + doc.URL + " too large (" + fi.Length.ToString() + ") for this server. Adjust destination server settings to allow.\n");
|
||||||
|
continue;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
//No need to map it or save response as long as it works that's all that matters
|
//No need to map it or save response as long as it works that's all that matters
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
var responseAsString = await response.Content.ReadAsStringAsync();
|
var responseAsString = await response.Content.ReadAsStringAsync();
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
throw new Exception("GET error, route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase);
|
throw new Exception("GET error, code: " + (int)response.StatusCode + ", route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||||
@@ -247,7 +247,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(postJson))
|
if (string.IsNullOrWhiteSpace(postJson))
|
||||||
postJson = "n/a";
|
postJson = "n/a";
|
||||||
throw new Exception("POST error, route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase + "\r\nPOSTED OBJECT:\r\n" + postJson);
|
throw new Exception("POST error, code: " + (int)response.StatusCode + ", route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase + "\r\nPOSTED OBJECT:\r\n" + postJson);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||||
@@ -333,7 +333,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(putJson))
|
if (string.IsNullOrWhiteSpace(putJson))
|
||||||
putJson = "n/a";
|
putJson = "n/a";
|
||||||
throw new Exception("PUT error, route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase + "\r\nPUT OBJECT:\r\n" + putJson);
|
throw new Exception("PUT error, code: " + (int)response.StatusCode + ", route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase + "\r\nPUT OBJECT:\r\n" + putJson);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||||
@@ -370,6 +370,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async static Task<ApiResponse> TryPostFormDataAsync(string route, MultipartFormDataContent formContent)
|
private async static Task<ApiResponse> TryPostFormDataAsync(string route, MultipartFormDataContent formContent)
|
||||||
{
|
{
|
||||||
var requestMessage = new HttpRequestMessage(HttpMethod.Post, ApiBaseUrl + route);
|
var requestMessage = new HttpRequestMessage(HttpMethod.Post, ApiBaseUrl + route);
|
||||||
@@ -398,7 +400,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
var responseAsString = await response.Content.ReadAsStringAsync();
|
var responseAsString = await response.Content.ReadAsStringAsync();
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
throw new Exception("POST FORMDATA error, route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase);
|
throw new Exception("POST FORMDATA error, code: "+ (int)response.StatusCode + ", route: " + route + "\r\n" + responseAsString + "\r\n" + response.ReasonPhrase);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||||
|
|||||||
Reference in New Issue
Block a user