From 58e3d0991d101402b2e34cbe9c44c7646165623f Mon Sep 17 00:00:00 2001 From: Andrew Vardeman Date: Mon, 15 Jun 2026 08:21:44 -0500 Subject: [PATCH] Make GetOperationTypeFromLoggingDevices respect just the device under consideration rather than all devices for a time log. Signed-off-by: Andrew Vardeman --- ISOv4Plugin/Mappers/TimeLogMapper.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ISOv4Plugin/Mappers/TimeLogMapper.cs b/ISOv4Plugin/Mappers/TimeLogMapper.cs index 47430c8..617357f 100644 --- a/ISOv4Plugin/Mappers/TimeLogMapper.cs +++ b/ISOv4Plugin/Mappers/TimeLogMapper.cs @@ -418,7 +418,8 @@ protected IEnumerable ImportTimeLog(ISOTask loggedTask, ISOTimeLo operationData.DeviceElementUses = sectionMapper.ConvertToBaseTypes(sections.ToList()); operationData.GetDeviceElementUses = x => operationData.DeviceElementUses.Where(s => s.Depth == x).ToList(); operationData.PrescriptionId = prescriptionID; - operationData.OperationType = GetOperationType(productIDs, time, workingDatas); + var adaptDeviceModelId = TaskDataMapper.InstanceIDMap.GetADAPTID(dvc.DeviceId); + operationData.OperationType = GetOperationType(productIDs, time, workingDatas, adaptDeviceModelId); operationData.ProductIds = productIDs; if (!useDeferredExecution) { @@ -662,7 +663,7 @@ private void AddProductAllocationsForDeviceElement(Dictionary productIds, ISOTime time, List workingDatas) + private OperationTypeEnum GetOperationType(List productIds, ISOTime time, List workingDatas, int? adaptDeviceModelId) { var productCategories = productIds .Select(x => TaskDataMapper.AdaptDataModel.Catalog.Products.FirstOrDefault(y => y.Id.ReferenceId == x)) @@ -670,7 +671,7 @@ private OperationTypeEnum GetOperationType(List productIds, ISOTime time, L .Select(x => x.Category) .ToList(); - var deviceOperationType = GetOperationTypeFromLoggingDevices(time); + var deviceOperationType = GetOperationTypeFromLoggingDevices(time, adaptDeviceModelId); // Prefer product category to determine operation type where possible switch (productCategories.FirstOrDefault()) @@ -718,7 +719,7 @@ private OperationTypeEnum GetOperationType(List productIds, ISOTime time, L } } - private OperationTypeEnum GetOperationTypeFromLoggingDevices(ISOTime time) + private OperationTypeEnum GetOperationTypeFromLoggingDevices(ISOTime time, int? adaptDeviceModelId) { HashSet representedTypes = new HashSet(); IEnumerable distinctDeviceElementIDs = time.DataLogValues.Select(d => d.DeviceElementIdRef).Distinct(); @@ -728,7 +729,7 @@ private OperationTypeEnum GetOperationTypeFromLoggingDevices(ISOTime time) if (deviceElementID.HasValue) { DeviceElement deviceElement = DataModel.Catalog.DeviceElements.FirstOrDefault(d => d.Id.ReferenceId == deviceElementID.Value); - if (deviceElement != null && deviceElement.DeviceClassification != null) + if (deviceElement != null && deviceElement.DeviceClassification != null && deviceElement.DeviceModelId == adaptDeviceModelId) { DeviceOperationType deviceOperationType = DeviceOperationTypes.FirstOrDefault(d => d.MachineEnumerationMember.ToModelEnumMember().Value == deviceElement.DeviceClassification.Value.Value); if (deviceOperationType != null)