| | |
| | | try |
| | | { |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); |
| | | bool isUpdate = false; |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | |
| | | { |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null) |
| | | if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null && deviceProWrite != null) |
| | | { |
| | | R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); |
| | | //ç åæ»¡ççæRGVæ¬è¿ä»»å¡ |
| | |
| | | Dt_Task taskNew = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && (x.TaskState == TaskStatusEnum.New.ObjToInt())); |
| | | if (taskNew != null) |
| | | { |
| | | device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); |
| | | _taskService.UpdateTask(taskNew, TaskStatusEnum.RGV_Execute); |
| | | } |
| | | } |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | if (conveyorLineInfoRead != null && conveyorLineInfoRead.StatusPV == 2 && conveyorLineInfoRead.Command == 10) |
| | | if (conveyorLineInfoRead != null && conveyorLineInfoRead.StatusPV == 2 && conveyorLineInfoRead.Command == 10 && item.IsOccupied == 1) |
| | | { |
| | | item.IsOccupied = 0; |
| | | isUpdate = true; |
| | | WriteInfo("ç åå·¥ä½ç¶ææ´æ°",$"{item.StationCode}{DateTime.Now}æ´æ°å·¥ä½ç¶æ:{conveyorLineInfoRead.Command}"); |
| | | } |
| | | else |
| | | else if ((conveyorLineInfoRead == null ||(conveyorLineInfoRead != null && conveyorLineInfoRead.Command != 10 && item.IsOccupied == 0))) |
| | | { |
| | | item.IsOccupied = 1; |
| | | isUpdate = true; |
| | | WriteInfo("ç åå·¥ä½ç¶ææ´æ°", $"{item.StationCode}{DateTime.Now}æ´æ°å·¥ä½ç¶æä¸å¯ç¨"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | _stationMangerRepository.UpdateData(stationMangers); |
| | | if (isUpdate) |
| | | { |
| | | _stationMangerRepository.UpdateData(stationMangers); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |