This commit is contained in:
@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
public string PluginVersion
|
public string PluginVersion
|
||||||
{
|
{
|
||||||
get { return "7.6.1-alpha.125"; }
|
get { return "7.6.1-alpha.126"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string About
|
public string About
|
||||||
@@ -2364,6 +2364,53 @@ namespace AyaNova.PlugIn.V8
|
|||||||
await util.EventLog(util.AyaType.Unit, ThisUnitRavenId, await Getv7v8IdMap(c.Creator, RootObjectTypes.User), await Getv7v8IdMap(c.Modifier, RootObjectTypes.User), c.Created, c.Modified);
|
await util.EventLog(util.AyaType.Unit, ThisUnitRavenId, await Getv7v8IdMap(c.Creator, RootObjectTypes.User), await Getv7v8IdMap(c.Modifier, RootObjectTypes.User), c.Created, c.Modified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private async System.Threading.Tasks.Task ExportUnitMeterReadings(ProgressForm progress)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!progress.KeepGoing) return;
|
||||||
|
|
||||||
|
progress.Op("Start Unit meter readings export");
|
||||||
|
progress.SubOp("");
|
||||||
|
|
||||||
|
//Step 2: export the objects
|
||||||
|
UnitPickList pl = UnitPickList.GetListOfAll();
|
||||||
|
progress.Append("Checking " + pl.Count.ToString() + " units for exportable meter readings");
|
||||||
|
|
||||||
|
foreach (UnitPickList.UnitPickListInfo i in pl)
|
||||||
|
{
|
||||||
|
if (!progress.KeepGoing) return;
|
||||||
|
Unit c = Unit.GetItem(i.ID);
|
||||||
|
|
||||||
|
//METER READINGS
|
||||||
|
if (c.Metered)
|
||||||
|
{
|
||||||
|
var RavenId = Getv7v8IdMap(c.ID, RootObjectTypes.Unit, false, false);
|
||||||
|
UnitMeterReadingList uml = UnitMeterReadingList.GetList(c.ID, null);
|
||||||
|
if (uml.Count > 0)
|
||||||
|
{
|
||||||
|
progress.Op(c.Serial + " exporting " + uml.Count.ToString() + " readings");
|
||||||
|
foreach (UnitMeterReadingList.UnitMeterReadingListInfo ui in uml)
|
||||||
|
{
|
||||||
|
dynamic dm = new JObject();
|
||||||
|
dm.meter = ui.LT_UnitMeterReading_Label_Meter;
|
||||||
|
dm.meterDate = util.DateToV8(ui.LT_UnitMeterReading_Label_MeterDate, true);
|
||||||
|
dm.notes = ui.LT_UnitMeterReading_Label_Description;
|
||||||
|
dm.unitId = RavenId;
|
||||||
|
if (ui.LT_UnitMeterReading_Label_WorkorderItemID.Value != Guid.Empty)
|
||||||
|
{
|
||||||
|
//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);
|
||||||
|
}
|
||||||
|
await util.PostAsync("unit/meter-reading", dm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion Units
|
#endregion Units
|
||||||
|
|
||||||
#region UnitModels
|
#region UnitModels
|
||||||
@@ -4443,7 +4490,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
d.unitId = await Getv7v8IdMapNullOk(c.UnitID, RootObjectTypes.Unit, true, false, await Getv7v8IdMap(c.ClientID, RootObjectTypes.Client));
|
d.unitId = await Getv7v8IdMapNullOk(c.UnitID, RootObjectTypes.Unit, true, false, await Getv7v8IdMap(c.ClientID, RootObjectTypes.Client));
|
||||||
|
|
||||||
//can't substitute a workorder item if missing so report it and export with null link and move on
|
//can't substitute a workorder item if missing so report it and export with null link and move on
|
||||||
if (c.WorkorderItemID != Guid.Empty ) {
|
if (c.WorkorderItemID != Guid.Empty)
|
||||||
|
{
|
||||||
if (V7ToV8IdMap.ContainsKey(c.WorkorderItemID))
|
if (V7ToV8IdMap.ContainsKey(c.WorkorderItemID))
|
||||||
{
|
{
|
||||||
d.workOrderItemId = V7ToV8IdMap[c.WorkorderItemID];
|
d.workOrderItemId = V7ToV8IdMap[c.WorkorderItemID];
|
||||||
|
|||||||
Reference in New Issue
Block a user