1
z8018
2025-05-06 7da6f394864ba0412c1ac58ba7752862de7d3f3d
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/GantryPositionJob.cs
@@ -13,7 +13,7 @@
    [DisallowConcurrentExecution]
    public class GantryPositionJob : JobBase, IJob
    {
        public GantryPositionJob()
        {
@@ -22,12 +22,13 @@
        public Task Execute(IJobExecutionContext context)
        {
            try
            bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
            if (flag && value != null && value is OtherDevice)
            {
                bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
                if (flag && value != null && value is OtherDevice)
                OtherDevice otherDevice = (OtherDevice)value;
                try
                {
                    OtherDevice otherDevice = (OtherDevice)value;
                    {
                        List<string> hDeviceChildCodes = otherDevice.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(OPositions.HPositions)).GroupBy(x => x.DeviceChildCode).Select(x => x.Key).ToList();
                        DeviceProDTO deviceProDTOH = otherDevice.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(OPositions.HPositions)).OrderBy(x => x.DeviceProOffset).First();
@@ -45,7 +46,10 @@
                                    PositionR = hPositions[i * 4 + 3]
                                };
                                OPositions.HPositions.TryAdd(hDeviceChildCodes[i], position);
                                if(!OPositions.HPositions.TryAdd(hDeviceChildCodes[i], position))
                                {
                                    OPositions.HPositions[hDeviceChildCodes[i]] = position;
                                }
                            }
                        }
                    }
@@ -67,20 +71,26 @@
                                    PositionR = zPositions[i * 4 + 3]
                                };
                                OPositions.ZPositions.TryAdd(zDeviceChildCodes[i], position);
                               if(! OPositions.ZPositions.TryAdd(zDeviceChildCodes[i], position))
                                {
                                    OPositions.ZPositions[zDeviceChildCodes[i]] = position;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", ex.Message, ex);
                }
            }
            catch (Exception ex)
            else
            {
                WriteError(nameof(GantryPositionJob), "閿欒", ex);
                WriteError(nameof(CommonConveyorLightJob), "鍙傛暟閿欒,鏈紶閫掕澶囧弬鏁版垨璁惧绫诲瀷閿欒");
            }
            return Task.CompletedTask;
        }
    }
}