This commit is contained in:
2020-05-11 21:43:01 +00:00
parent 6d6c011fa3
commit c11ff167a8

View File

@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
public string PluginVersion public string PluginVersion
{ {
get { return "7.6 (Alpha)"; } get { return "7.6.1-alpha.8"; }
} }
public string About public string About
@@ -207,6 +207,7 @@ namespace AyaNova.PlugIn.V8
progress.Show(); progress.Show();
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);
try try
{ {
progress.Op("Preparing to export...."); progress.Op("Preparing to export....");
@@ -291,8 +292,10 @@ namespace AyaNova.PlugIn.V8
await ExportUnitModels(progress); await ExportUnitModels(progress);
await ExportVendors(progress); await ExportVendors(progress);
await ExportServiceWorkorders(progress); await ExportServiceWorkorders(progress);
await ExportQuotes(progress); //todo: these are now invalid and awaiting RAVEN end implementation
await ExportPMs(progress); //after which can copy mostly from service workorder block
// await ExportQuotes(progress);
// await ExportPMs(progress);
//NOTE: when get to PRIORITY, or WORKORDER STATUS be sure to add color code as per already done in USER export //NOTE: when get to PRIORITY, or WORKORDER STATUS be sure to add color code as per already done in USER export
@@ -1344,13 +1347,13 @@ namespace AyaNova.PlugIn.V8
progress.Op("Start Service workorders export"); progress.Op("Start Service workorders export");
progress.SubOp(""); progress.SubOp("");
var ObjectTypeName = "Workorder"; var ObjectTypeName = "Workorder";
var RavenObjectName = "WorkOrder"; var RavenRouteName = "workorders";
//TODO: this in the workorder Items loop //TODO: this in the workorder Items loop
////Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too //Step 1: export the CustomFields to FormCustom if applicable so that when doing individual items we can export their custom data too
//var ocf = ObjectHasCustomFieldDataToExport("WorkorderItem"); var ocf = ObjectHasCustomFieldDataToExport("WorkorderItem");
//bool ShouldExportCustom = ocf != null; bool ShouldExportCustom = ocf != null;
//var DateCustomFields = await ExportCustomFieldSchema(ocf, "WorkorderItem", "WorkOrderItem"); var DateCustomFields = await ExportCustomFieldSchema(ocf, "WorkorderItem", "WorkOrderItem");
//Step 2: export the objects //Step 2: export the objects
WorkorderServiceList pl = WorkorderServiceList.GetList(""); WorkorderServiceList pl = WorkorderServiceList.GetList("");
@@ -1366,7 +1369,7 @@ namespace AyaNova.PlugIn.V8
if (IsDuplicateMapItem(c.ID, c.WorkorderService.ServiceNumber.ToString(), progress)) continue; if (IsDuplicateMapItem(c.ID, c.WorkorderService.ServiceNumber.ToString(), progress)) continue;
var ObjectTID = new TypeAndID(RootObjectTypes.WorkorderService, c.ID); var ObjectTID = new TypeAndID(RootObjectTypes.WorkorderService, c.ID);
//make one on the server to update //make one on the server to update
var rMainObject = await util.PostAsync(RavenObjectName + "/Create?serial=" + c.WorkorderService.ServiceNumber); var rMainObject = await util.PostAsync(RavenRouteName);
long RavenId = util.IdFromResponse(rMainObject); long RavenId = util.IdFromResponse(rMainObject);
AddMap(c.ID, RavenId); AddMap(c.ID, RavenId);
@@ -1378,25 +1381,20 @@ namespace AyaNova.PlugIn.V8
Tagit(c.RegionID, tags); Tagit(c.RegionID, tags);
SetTags(d, tags); SetTags(d, tags);
////Custom fields?
//if (ShouldExportCustom)
// d.customFields = CustomFieldData(c, DateCustomFields);
// var rMainObject = await util.PostAsync(RavenObjectName, d.ToString());
//Attachments / FILES //Attachments / FILES
await ExportAttachments(ObjectTID, progress, util.AyaType.WorkOrder); await ExportAttachments(ObjectTID, progress, util.AyaType.WorkOrder);
//----- //-----
bool repost = false; d.serial = c.WorkorderService.ServiceNumber;
d = rMainObject.ObjectResponse["data"]; d = rMainObject.ObjectResponse["data"];
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
// await ExportAttachments(ObjectTID, progress); // await ExportAttachments(ObjectTID, progress);
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true;
} }
//docs //docs
@@ -1408,16 +1406,42 @@ namespace AyaNova.PlugIn.V8
//d.login = null; //d.login = null;
//d.password = null; //d.password = null;
d.notes = NonFileUrls + "\n-----------------\n" + d.notes; d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
repost = true;
} }
if (repost)
await util.PutAsync(RavenObjectName + "/" + RavenId.ToString(), d.ToString()); //put the final object
await util.PutAsync(RavenRouteName + "/" + RavenId.ToString(), d.ToString());
//----- //-----
//Event log fixup //Event log fixup
await util.EventLog(util.AyaType.WorkOrder, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified); await util.EventLog(util.AyaType.WorkOrder, RavenId, SafeGetUserMap(c.Creator), SafeGetUserMap(c.Modifier), c.Created, c.Modified);
//todo: workorder items etc //iterate all workorder items
foreach (WorkorderItem wi in c.WorkorderItems)
{
dynamic dwi = new JObject();
dwi.workOrderId = RavenId;
// d.concurrencyToken = util.CTokenFromResponse(rMainObject);
progress.Op("WorkorderItem " + wi.ID.ToString());
dwi.active = true;//probably can remove this at server, just stubbed in for now
Tagit(wi.TypeID, tags);
Tagit(wi.WorkorderItemUnitServiceTypeID, tags);
SetTags(dwi, tags);
////Custom fields?
if (ShouldExportCustom)
dwi.customFields = CustomFieldData(wi, DateCustomFields);
dwi.notes = "Summary:\n" + wi.Summary + "TechNotes: \n" + wi.TechNotes;
await util.PostAsync("workorders/items", d.ToString());
//and rest of tree below here...
}
} }
} }
#endregion Workorders #endregion Workorders