Skip to content

Commit 16054ed

Browse files
author
Stuart Rhea
authored
Merge pull request #209 from knelson-farmbeltnorth/parent_product_allocations
Parent product allocations
2 parents 16c565c + e869b1d commit 16054ed

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

ISOv4Plugin/ISOv4Plugin.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0</TargetFrameworks>
@@ -13,7 +13,7 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="AgGatewayADAPTFramework" Version="3.0.0" />
16+
<PackageReference Include="AgGatewayADAPTFramework" Version="3.0.2" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

ISOv4Plugin/Mappers/TimeLogMapper.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,27 @@ protected IEnumerable<OperationData> ImportTimeLog(ISOTask loggedTask, ISOTimeLo
340340
ISOTime time = GetTimeElementFromTimeLog(isoTimeLog);
341341

342342
//Identify unique devices represented in this TimeLog data
343-
IEnumerable<string> deviceElementIDs = time.DataLogValues.Where(d => !d.ProcessDataDDI.EqualsIgnoreCase("DFFF") && !d.ProcessDataDDI.EqualsIgnoreCase("DFFE"))
343+
List<string> deviceElementIDs = time.DataLogValues.Where(d => !d.ProcessDataDDI.EqualsIgnoreCase("DFFF") && !d.ProcessDataDDI.EqualsIgnoreCase("DFFE"))
344344
.Select(d => d.DeviceElementIdRef).Distinct().ToList();
345+
346+
//Supplement the list with any parent device elements which although don't log data in the TLG
347+
//May require a vrProductIndex working data based on product allocations
348+
HashSet<string> parentsToAdd = new HashSet<string>();
349+
foreach (string deviceElementID in deviceElementIDs)
350+
{
351+
ISODeviceElement isoDeviceElement = TaskDataMapper.DeviceElementHierarchies.GetISODeviceElementFromID(deviceElementID);
352+
if (isoDeviceElement != null)
353+
{
354+
while (isoDeviceElement.Parent != null &&
355+
isoDeviceElement.Parent is ISODeviceElement parentDet)
356+
{
357+
parentsToAdd.Add(parentDet.DeviceElementId);
358+
isoDeviceElement= parentDet;
359+
}
360+
}
361+
}
362+
deviceElementIDs.AddRange(parentsToAdd);
363+
345364
Dictionary<ISODevice, HashSet<string>> loggedDeviceElementsByDevice = new Dictionary<ISODevice, HashSet<string>>();
346365
foreach (string deviceElementID in deviceElementIDs)
347366
{

0 commit comments

Comments
 (0)