1
huangxiaoqiang
6 天以前 60f86b0fba3ab82e245654cddfa5abc62fe1f9e8
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/³ÉÆ·²Ö/ConveyorLineJob_CPB.cs
@@ -77,36 +77,39 @@
                    {
                        R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress);
                        //二楼入库扫码请求工位
                        if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 5 && conveyorLineInfoRead.TaskNo > 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode))
                        if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 5 && conveyorLineInfoRead.TaskNo > 0)//&& !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode) todo临时删除条件限制
                        {
                            //查找对应任务
                            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, "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;
                                }
                                if (routers.Count > 1)
                                {
                                    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.PalletType = 1;
                                task.PalletCode = conveyorLineInfoRead.PalletCode;
                                task.Roadway = "SC02_CP";
                                task.DeviceCode = router.ChildPosiDeviceCode;
                                _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
                                WriteInfo(item.StationName, $"任务号{conveyorLineInfoRead.TaskNo}下一步");
                                //string roadWay = _taskService.AssignCPRoadwayNo().Data.ToString();
                                //if (!string.IsNullOrEmpty(roadWay))
                                //{
                                    List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, "SC01_CP", task.TaskType);
                                    Dt_Router? router = routers.FirstOrDefault();
                                    if (routers == null || routers.Count == 0 || router == null)
                                    {
                                        WriteError(item.StationName, $"未找到对应路由信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                        continue;
                                    }
                                    if (routers.Count > 1)
                                    {
                                        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.PalletCode = DateTime.Now.ToString("yyMMddHHmmss");//todo临时
                                    task.Roadway = "SC01_CP";
                                    task.DeviceCode = router.ChildPosiDeviceCode;
                                    _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
                                    WriteInfo(item.StationName, $"任务号{conveyorLineInfoRead.TaskNo}下一步");
                                //}
                            }
                        }
                    }
@@ -139,9 +142,9 @@
                        }
                    }
                    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));