wangxinhui
2025-08-26 a23691d54a0142ba9a0668788d366638bd82349e
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/Ô­ÁÏ¿â/ConveyorLineJob_YL1ndFloor.cs
@@ -82,7 +82,7 @@
                            device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode);
                            WriteInfo(item.StationCode, $"请求入库条码:{conveyorLineInfoRead.WR_TMID}");
                        }
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID)) //一楼分配站台入库分配目标点
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && conveyorLineInfoRead.WR_Task <= 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID)) //一楼分配站台入库分配目标点
                        {
                            Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.WR_TMID && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.DeviceCode == device.DeviceCode);
                            if (task == null)
@@ -99,7 +99,45 @@
                                device.SetValue(WR_CLineYLDB.WR_ToHode, task.NextAddress, item.StationCode);
                                device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode);
                                _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
                                WriteInfo(item.StationCode, conveyorLineInfoRead.Serialize());
                                WriteInfo(item.StationCode, $"{conveyorLineInfoRead.Serialize()}");
                            }
                        }
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && conveyorLineInfoRead.WR_Task > 0) //一楼分配站台入库分配目标点
                        {
                            Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.WR_Task && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.AGV_Finish.ObjToInt() && x.DeviceCode == device.DeviceCode);
                            //发送任务
                            if (task != null)
                            {
                                if (string.IsNullOrEmpty(task.Roadway) && string.IsNullOrEmpty(task.NextAddress))
                                {
                                    WebResponseContent content = _taskService.AssignYLRoadwayNo(task.PalletCode);
                                    if (!content.Status)
                                    {
                                        WriteError(item.StationCode, $"请求入库失败:{content.Message}");
                                    }
                                    string roadWay = content.Data.ToString();
                                    //获取路由配置
                                    List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.CurrentAddress == x.StartPosi && x.ChildPosiDeviceCode== roadWay);
                                    Dt_Router router = routers.FirstOrDefault();
                                    if (router == null)
                                    {
                                        WriteError(item.StationName, $"任务号:{task.TaskNum}未找到路由配置信息");
                                        return Task.CompletedTask;
                                    }
                                    task.Roadway = roadWay;
                                    task.NextAddress = router.NextPosi;
                                    _taskService.UpdateTask(task,TaskStatusEnum.AGV_Finish);
                                }
                                else
                                {
                                    device.SetValue(WR_CLineYLDB.WR_Task, task.TaskNum, item.StationCode);
                                    device.SetValue(WR_CLineYLDB.WR_ToHode, task.NextAddress, item.StationCode);
                                    device.SetValue(WR_CLineYLDB.WR_Width, task.TaskLength, item.StationCode);
                                    device.SetValue(WR_CLineYLDB.WR_TMID, task.PalletCode, item.StationCode);
                                    device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode);
                                    _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
                                    WriteInfo(item.StationCode, $"请求入库成功:{conveyorLineInfoRead.Serialize()}");
                                }
                            }
                        }
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt() && conveyorLineInfoRead.WR_ToHode > 0 && conveyorLineInfoRead.WR_Request == 86 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID) && conveyorLineInfoRead.WR_Task>0) //入库站台申请
@@ -137,7 +175,14 @@
                                device.SetValue(WR_CLineYLDB.WR_TMID, task.PalletCode, item.StationCode);
                                device.SetValue(WR_CLineYLDB.WR_ToHode, task.NextAddress, item.StationCode);
                                device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode);
                                if (task.TaskType==TaskTypeEnum.OutPick.ObjToInt())
                                {
                                    task.Roadway = task.TargetAddress;
                                    task.TargetAddress = "";
                                    task.TaskType=TaskTypeEnum.InPick.ObjToInt();
                                }
                                _taskService.UpdateTask(task,TaskStatusEnum.Line_Executing);
                                WriteInfo(item.StationCode, $"任务号:{task.TaskNum}出库至{task.NextAddress}");
                            }
                        }
                        else if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && conveyorLineInfoRead.WR_Task > 0 && conveyorLineInfoRead.WR_Request == 98) //一楼老厂出库口完成