helongyang
2026-03-31 8fcd7a67e4391a5f1fbdb590c2a3f913aeb2a0a0
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -275,7 +275,7 @@
                                task.NextAddress = router.NextPosi;
                                task.DeviceCode = router.ChildPosi;
                            }
                            else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandPickOutbound.ObjToInt() || ((item.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() || item.TaskType == TaskTypeEnum.OutQuality.ObjToInt() || item.TaskType == TaskTypeEnum.OutInventory.ObjToInt()) && item.RoadWay.Contains("BC")))
                            else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandPickOutbound.ObjToInt() || ((item.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() || item.TaskType == TaskTypeEnum.OutQuality.ObjToInt() || item.TaskType == TaskTypeEnum.OutInventory.ObjToInt() || item.TaskType == TaskTypeEnum.Outbound.ObjToInt() || item.TaskType == TaskTypeEnum.OutSale.ObjToInt()) && item.RoadWay.Contains("BC")))
                            {
                                task.NextAddress = router.NextPosi;
                                task.DeviceCode = stationManger.StackerCraneCode;
@@ -354,49 +354,66 @@
                        if (taskTypeGroup == TaskTypeGroup.OutbondGroup)
                        {
                            task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyMMdd") + item.TaskNum;
                            List<Dt_Router> routers = routersAll.Where(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi).ToList();
                            if (routers.FirstOrDefault() == null)
                            if(item.AGVArea == "AGV_PP")
                            {
                                return WebResponseContent.Instance.Error($"未找到路由配置信息");
                            }
                            router = routers.FirstOrDefault();
                            task.NextAddress = router?.StartPosi ?? "";
                            task.DeviceCode = item.RoadWay;
                            if (item.RoadWay.Contains("ZH"))
                            {
                                task.TaskState = TaskStatusEnum.New.ObjToInt();
                                task.NextAddress = item.TargetAddress;
                                task.DeviceCode = item.RoadWay;
                            }
                            else
                            {
                                task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                List<Dt_Router> routers = routersAll.Where(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi).ToList();
                                if (routers.FirstOrDefault() == null)
                                {
                                    return WebResponseContent.Instance.Error($"未找到路由配置信息");
                                }
                                router = routers.FirstOrDefault();
                                task.NextAddress = router?.StartPosi ?? "";
                                task.DeviceCode = item.RoadWay;
                                if (item.RoadWay.Contains("ZH"))
                                {
                                    task.TaskState = TaskStatusEnum.New.ObjToInt();
                                }
                                else
                                {
                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                }
                            }
                        }
                        else
                        {
                            if (task.Roadway!="SC01_ZH")
                            if (item.AGVArea == "AGV_PP")
                            {
                                task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyMMdd") + item.TaskNum;
                            }
                            List<Dt_Router> routers = routersAll.Where(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi).ToList();
                            if (routers.FirstOrDefault() == null)
                            {
                                return WebResponseContent.Instance.Error($"未找到路由配置信息");
                            }
                            router = routers.FirstOrDefault();
                            Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x=>x.StationCode== router?.NextPosi);
                            if (stationManger == null)
                            {
                                return WebResponseContent.Instance.Error($"未找到站台配置信息");
                            }
                            task.NextAddress = stationManger?.AGVStationCode ?? "";
                            task.DeviceCode = stationManger?.Remark ?? "";
                            if (task.Roadway != "SC01_ZH")
                            {
                                task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt();
                                task.NextAddress = item.TargetAddress;
                                task.DeviceCode = item.RoadWay;
                            }
                            else
                            {
                                task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt();
                                if (task.Roadway != "SC01_ZH")
                                {
                                    task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyMMdd") + item.TaskNum;
                                }
                                List<Dt_Router> routers = routersAll.Where(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi).ToList();
                                if (routers.FirstOrDefault() == null)
                                {
                                    return WebResponseContent.Instance.Error($"未找到路由配置信息");
                                }
                                router = routers.FirstOrDefault();
                                Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == router?.NextPosi);
                                if (stationManger == null)
                                {
                                    return WebResponseContent.Instance.Error($"未找到站台配置信息");
                                }
                                task.NextAddress = stationManger?.AGVStationCode ?? "";
                                task.DeviceCode = stationManger?.Remark ?? "";
                                if (task.Roadway != "SC01_ZH")
                                {
                                    task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt();
                                }
                                else
                                {
                                    task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt();
                                }
                            }
                        }
                    }
@@ -1031,5 +1048,28 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        /// <summary>
        /// æŽ¥å—WMS手动取消任务
        /// </summary>
        /// <param name="taskNum"></param>
        /// <returns></returns>
        public WebResponseContent RecWMSTaskHandCancel(int taskNum)
        {
            try
            {
                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                if (task != null)
                {
                    task.TaskState = TaskStatusEnum.Cancel.ObjToInt();
                    BaseDal.DeleteAndMoveIntoHty(task, OperateTypeEnum.人工删除);
                }
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
    }
}