| | |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | |
| | | { |
| | | 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 && deviceProWrite!=null) |
| | | if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null && deviceProWrite != null) |
| | | { |
| | | R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); |
| | | if (conveyorLineInfoRead.Command == 5 && conveyorLineInfoRead.TaskNo>0 && !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode)) |
| | | if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 5 && conveyorLineInfoRead.TaskNo > 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode)) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x =>x.TaskNum== conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode==device.DeviceCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode); |
| | | if (task != null) |
| | | { |
| | | //åé
å··é åå
¥æçæ°æ® |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, "SC01_CP", task.TaskType); |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, "SC02_CP", task.TaskType); |
| | | Dt_Router? router = routers.FirstOrDefault(); |
| | | if (routers == null || routers.Count == 0 || router == null) |
| | | { |
| | |
| | | WriteError(item.StationName, $"è·¯ç±ä¿¡æ¯é
ç½®é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | device.SetValue(W_ConveyorLineCPDB.W_TargetAddress, router.NextPosi, item.StationCode); |
| | | device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); |
| | | task.CurrentAddress = item.StationCode; |
| | | task.NextAddress=router.NextPosi; |
| | | task.NextAddress = router.NextPosi; |
| | | task.PalletType = 1; |
| | | task.PalletCode = conveyorLineInfoRead.PalletCode; |
| | | task.Roadway = "SC01_CP"; |
| | | task.Roadway = "SC02_CP"; |
| | | task.DeviceCode = router.ChildPosiDeviceCode; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | WriteError(item.StationName, $"ä»»å¡å·{conveyorLineInfoRead.TaskNo}ä¸ä¸æ¥"); |
| | |
| | | else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && deviceProRead != null) |
| | | { |
| | | R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); |
| | | if (conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo > 0) |
| | | if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo > 0) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode); |
| | | if (task != null) |
| | |
| | | } |
| | | } |
| | | } |
| | | else if (item.StationType == StationTypeEnum.StationType_StackingPlates.ObjToInt() && deviceProRead != null && deviceProWrite != null) |
| | | { |
| | | R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); |
| | | if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 7 && conveyorLineInfoRead.TaskNo <= 0) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TargetAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType)); |
| | | if (task == null) |
| | | { |
| | | //请æ±ä»»å¡ |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | { |
| | | Id = 1, |
| | | SourceAddress = "SC02_CP-001-064-001-01", |
| | | TaskNum = DateTime.Now.ToString("mmss").ObjToInt(), |
| | | PalletCode = "" + DateTime.Now.ToString("mmss"), |
| | | RoadWay = "SC02_CP", |
| | | TaskType = 160, |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TargetAddress = item.StationCode, |
| | | Grade = 0, |
| | | WarehouseId = 1, |
| | | PalletType = 1 |
| | | }; |
| | | WriteError(item.StationName, $"ä»»å¡å·{conveyorLineInfoRead.TaskNo}çæï¼ä¸ä¸æ¥"); |
| | | _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP"); |
| | | //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt()) |
| | | //{ |
| | | // WriteError(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | // continue; |
| | | //} |
| | | |
| | | } |
| | | } |
| | | else if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 8 && conveyorLineInfoRead.TaskNo > 0) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode); |
| | | if (task != null) |
| | | { |
| | | //ä»»å¡å®æ |
| | | device.SetValue(W_ConveyorLineCPDB.W_Command, 2, item.StationCode); |
| | | WriteError(item.StationName, $"ä»»å¡å·{conveyorLineInfoRead.TaskNo}å çä½åºåºå®æ"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°è®¾å¤åç¼å·{item.StationCode}çå议信æ¯"); |