| | |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | /// <summary> |
| | | /// é¾é¨ä½ç½®ä½ä¸ä»»å¡ï¼ç¨äºè¯»åå¹¶æ´æ°HåZ轴设å¤çä½ç½®ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <remarks> |
| | | /// 1. ä»JobParamsä¸è·å设å¤åæ° <br/> |
| | | /// 2. 读åH轴设å¤ä½ç½®å¹¶æ´æ°å°OPositions.HPositionsåå
¸ <br/> |
| | | /// 3. 读åZ轴设å¤ä½ç½®å¹¶æ´æ°å°OPositions.ZPositionsåå
¸ <br/> |
| | | /// 4. å¤çè¿ç¨ä¸æè·å¹¶è®°å½å¼å¸¸ |
| | | /// </remarks> |
| | | [DisallowConcurrentExecution] |
| | | public class GantryPositionJob : JobBase, IJob |
| | | { |
| | | |
| | | |
| | | public GantryPositionJob() |
| | | { |
| | | |
| | |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); |
| | | if (flag && value != null && value is OtherDevice otherDevice) |
| | | { |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); |
| | | if (flag && value != null && value is OtherDevice) |
| | | 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(); |
| | |
| | | PositionR = hPositions[i * 4 + 3] |
| | | }; |
| | | |
| | | OPositions.HPositions.TryAdd(hDeviceChildCodes[i], position); |
| | | if(!OPositions.HPositions.TryAdd(hDeviceChildCodes[i], position)) |
| | | { |
| | | OPositions.HPositions[hDeviceChildCodes[i]] = position; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |