wangxinhui
14 小时以前 67348f250a1b7970059698002949a5e0a5f3c52f
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/³ÉÆ·²Ö/ConveyorLineJob_CPB.cs
@@ -76,8 +76,10 @@
                    if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null && deviceProWrite != null)
                    {
                        R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress);
                        //二楼入库扫码请求工位
                        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);
                            if (task != null)
                            {
@@ -94,7 +96,6 @@
                                    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);
@@ -105,20 +106,14 @@
                                task.Roadway = "SC02_CP";
                                task.DeviceCode = router.ChildPosiDeviceCode;
                                _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
                                WriteError(item.StationName, $"任务号{conveyorLineInfoRead.TaskNo}下一步");
                                //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;
                                //}
                                WriteInfo(item.StationName, $"任务号{conveyorLineInfoRead.TaskNo}下一步");
                            }
                        }
                    }
                    else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && deviceProRead != null)
                    {
                        R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress);
                        //入库RGV接驳位交互
                        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);
@@ -139,20 +134,14 @@
                                device.SetValue(W_ConveyorLineCPDB.W_Command, 2, item.StationCode);
                                task.NextAddress = router.NextPosi;
                                _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
                                WriteError(item.StationName, $"任务号{conveyorLineInfoRead.TaskNo}下一步");
                                //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;
                                //}
                                WriteInfo(item.StationName, $"任务号{conveyorLineInfoRead.TaskNo}下一步");
                            }
                        }
                    }
                    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));
@@ -173,17 +162,11 @@
                                    WarehouseId = 1,
                                    PalletType = 1
                                };
                                WriteError(item.StationName, $"任务号{conveyorLineInfoRead.TaskNo}生成,下一步");
                                WriteInfo(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);
@@ -191,7 +174,7 @@
                            {
                                //任务完成
                                device.SetValue(W_ConveyorLineCPDB.W_Command, 2, item.StationCode);
                                WriteError(item.StationName, $"任务号{conveyorLineInfoRead.TaskNo}叠盘位出库完成");
                                WriteInfo(item.StationName, $"任务号{conveyorLineInfoRead.TaskNo}叠盘位出库完成");
                            }
                        }
                    }