| | |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | /// <summary> |
| | | /// éç¨ä¼ é带ç¯å
æ§å¶ä»»å¡ <br/> |
| | | /// ä»PLC读åç«ç¹ç¶æåéæ¾ä¿¡å·ï¼æ´æ°ç¯å
ç¶æåå
¸ï¼å¹¶è®¾ç½®å¯¹åºçPLCä¿¡å· <br/> |
| | | /// 主è¦åè½ï¼ <br/> |
| | | /// 1. 读åPLCä¸DB15.922.0åDB15.924.0ç16ä½å¸å°æ°ç»ä½ä¸ºç«ç¹ç¶æåéæ¾ä¿¡å· <br/> |
| | | /// 2. æ ¹æ®è®¾å¤åç åç»æ´æ°LightStatusStorageä¸çç¶æåå
¸ <br/> |
| | | /// 3. æ ¹æ®å½åç¯å
ç¶æè®¾ç½®PLC对åºç宿/é误/å·¥ä½ä¸/è¯é³ä¿¡å· <br/> |
| | | /// å¼å¸¸å¤çï¼è®°å½è®¾å¤ä»£ç ååç§°ç¸å
³çå¼å¸¸ä¿¡æ¯ |
| | | /// </summary> |
| | | [DisallowConcurrentExecution] |
| | | public class CommonConveyorLightJob : JobBase, IJob |
| | | { |
| | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); |
| | | if (flag && value != null && value is OtherDevice) |
| | | if (flag && value != null && value is OtherDevice otherDevice) |
| | | { |
| | | OtherDevice otherDevice = (OtherDevice)value; |
| | | try |
| | | { |
| | | bool[] stationStatusArray = otherDevice.Communicator.Read<bool>("DB15.922.0", 16); |
| | |
| | | |
| | | if (otherDevice.GetValue<LightStatusEnum, bool>(LightStatusEnum.LightVoice, deviceChildCodes[i])) |
| | | otherDevice.SetValue(LightStatusEnum.LightVoice, false, deviceChildCodes[i]); |
| | | } |
| | | else if (LightStatusStorage.LightStatusDic[deviceChildCodes[i]] == LightStatusEnum.ReadyRelease) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.NextAddress.Contains(deviceChildCodes[i])); |
| | | if (task == null) |
| | | { |
| | | Dt_Container container = _containerRepository.QueryFirst(x => x.ContainerCode == deviceChildCodes[i]); |
| | | if (container != null && container.ContainerStatus == ContainerStatusEnum.ReadyRelease.ObjToInt()) |
| | | { |
| | | container.ContainerStatus = ContainerStatusEnum.Release.ObjToInt(); |
| | | |
| | | _containerRepository.UpdateData(container); |
| | | |
| | | if (!otherDevice.GetValue<LightStatusEnum, bool>(LightStatusEnum.LightCompleted, deviceChildCodes[i])) |
| | | otherDevice.SetValue(LightStatusEnum.LightCompleted, true, deviceChildCodes[i]); |
| | | |
| | | if (otherDevice.GetValue<LightStatusEnum, bool>(LightStatusEnum.LightError, deviceChildCodes[i])) |
| | | otherDevice.SetValue(LightStatusEnum.LightError, false, deviceChildCodes[i]); |
| | | |
| | | if (otherDevice.GetValue<LightStatusEnum, bool>(LightStatusEnum.LightWorking, deviceChildCodes[i])) |
| | | otherDevice.SetValue(LightStatusEnum.LightWorking, false, deviceChildCodes[i]); |
| | | |
| | | if (otherDevice.GetValue<LightStatusEnum, bool>(LightStatusEnum.LightVoice, deviceChildCodes[i])) |
| | | otherDevice.SetValue(LightStatusEnum.LightVoice, false, deviceChildCodes[i]); |
| | | |
| | | //_webSocketServeråéæ°æ® |
| | | _webSocketServer.PublishAllClientPayload(new |
| | | { |
| | | stationCode = deviceChildCodes[i], |
| | | release = 1, |
| | | }.Serialize()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | else if (LightStatusStorage.LightStatusDic[deviceChildCodes[i]] == LightStatusEnum.Ready) |
| | | { |