From bddfb425081c94a5eb383ddcc51bf08a37bb6bc1 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 24 Aug 2021 22:03:11 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.V8/V8.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index ad6d316..8a46a90 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -483,6 +483,8 @@ namespace AyaNova.PlugIn.V8 await ExportPMs(progress); await ExportServiceWorkorders(progress); //todo: fixup pm,quote links on service wo, should I export them first?? + await ExportUnitMeterReadings(progress); + //Must be after all root objects due to followups await ExportScheduleMarkers(progress); @@ -2387,7 +2389,7 @@ namespace AyaNova.PlugIn.V8 //METER READINGS if (c.Metered) { - var RavenId = Getv7v8IdMap(c.ID, RootObjectTypes.Unit, false, false); + var RavenId = await Getv7v8IdMap(c.ID, RootObjectTypes.Unit, false, false); UnitMeterReadingList uml = UnitMeterReadingList.GetList(c.ID, null); if (uml.Count > 0) { @@ -2403,7 +2405,7 @@ namespace AyaNova.PlugIn.V8 { //workorder items in v7 are only mapped for this one op and only return the workorderitemUnit id which is //what v8 uses here if it fails, then if fails and null is ok here - dm.workOrderItemUnitId = Getv7v8IdMapNullOk(ui.LT_UnitMeterReading_Label_WorkorderItemID.Value, RootObjectTypes.WorkorderItem, false); + dm.workOrderItemUnitId = await Getv7v8IdMapNullOk(ui.LT_UnitMeterReading_Label_WorkorderItemID.Value, RootObjectTypes.WorkorderItem, false); } await util.PostAsync("unit/meter-reading", dm); } @@ -3239,7 +3241,13 @@ namespace AyaNova.PlugIn.V8 List wiutags = new List(); TagFromv7Guid(wi.WorkorderItemUnitServiceTypeID, wiutags); SetTags(dwiu, wiutags); - await util.PostAsync("workorder/items/units", dwiu.ToString()); + long v8woitemunitid= util.IdFromResponse(await util.PostAsync("workorder/items/units", dwiu.ToString())); + //Map used for unit meter reading later, this is the ONLY use for this + //The map required is v7woitemid to v7woitemunitid for meter reading so that's what this saves + //any other use would be broken like if it needed the v8woitemid for something in future + Addv7v8IdMap(wi.ID, v8woitemunitid); + + } }