wanshenmean
2025-03-22 fac71280bbbda8d7a3b068d1cfaa49ac540eb7ae
CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
@@ -9,6 +9,7 @@
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob.Models;
namespace WIDESEAWCS_TaskInfoService
{
@@ -222,11 +223,11 @@
                    return content.Error("当前托盘存在任务");
                }
                // 检查是否已存在直接出库任务
                if (await HasDirectOutboundTask(stationManager))
                {
                    return content.Error($"【{stationManager.stationChildCode}】已存在直接出库任务任务");
                }
                //// 检查是否已存在直接出库任务
                //if (await HasDirectOutboundTask(stationManager))
                //{
                //    return content.Error($"【{stationManager.stationChildCode}】已存在直接出库任务任务");
                //}
                //if (stationManager.stationType == 7)
                //{
@@ -400,12 +401,43 @@
                if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                {
                    var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationLocation == taskDTO.TargetAddress && x.Roadway == taskDTO.RoadWay);
                    task.TaskState = (int)TaskOutStatusEnum.OutNew;
                    task.CurrentAddress = taskDTO.RoadWay;
                    task.NextAddress = stationinfo.stationChildCode;
                    task.SourceAddress = taskDTO.SourceAddress;
                    task.TargetAddress = taskDTO.TargetAddress;
                    if (task.TaskType == (int)TaskOutboundTypeEnum.OutTray)
                    {
                        // 查询下一个路由
                        List<Dt_Router> routers = _routerService.QueryNextRoutes(taskDTO.RoadWay, taskDTO.TargetAddress);
                        if (routers.Count > 0)
                        {
                            // 设置任务状态为出库新建
                            task.TaskState = (int)TaskOutStatusEnum.OutNew;
                            // 设置当前地址为源地址
                            task.CurrentAddress = taskDTO.SourceAddress;
                            // 设置下一个地址为第一个子位置
                            task.NextAddress = routers.FirstOrDefault().ChildPosi;
                        }
                        else
                        {
                            // 查询从源地址到目标地址的路由
                            routers = _routerService.QueryNextRoutes(taskDTO.SourceAddress, taskDTO.TargetAddress);
                            if (routers.Count > 0)
                            {
                                // 设置任务状态为出库完成
                                task.TaskState = (int)TaskOutStatusEnum.SC_OutFinish;
                                // 设置当前地址为源地址
                                task.CurrentAddress = taskDTO.SourceAddress;
                                // 设置下一个地址为第一个子位置
                                task.NextAddress = routers.FirstOrDefault().ChildPosi;
                            }
                        }
                    }
                    else
                    {
                        var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationLocation == taskDTO.TargetAddress && x.Roadway == taskDTO.RoadWay);
                        task.TaskState = (int)TaskOutStatusEnum.OutNew;
                        task.CurrentAddress = taskDTO.RoadWay;
                        task.NextAddress = stationinfo.stationChildCode;
                        task.SourceAddress = taskDTO.SourceAddress;
                        task.TargetAddress = taskDTO.TargetAddress;
                    }
                }
                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                {