1
dengjunjie
2026-03-10 aa75f3cbdcfce80d7ebd3c4f2bcfeea850949209
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -89,49 +89,99 @@
            WebResponseContent content = new WebResponseContent();
            try
            {
                List<object> objects = new List<object>();
                foreach (var item in taskDTOs)
                {
                    foreach (var task in item.tasks)
                    {
                        #region åˆ¤æ–­
                        content = TaskHelpMethods.isOkTaskInfo(task, true, true);
                        if (!content.Status) throw new Exception(content.Message);
                        if (!content.Status)
                        {
                            objects.Add(new
                            {
                                taskCode = task.taskCode,
                                Message = $"任务号【{task.taskCode}】{content.Message}"
                            });
                            continue;
                            //throw new Exception(content.Message);
                        }
                        if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode) != null)
                            throw new Exception($"任务号【{task.taskCode}】已存在任务");
                        {
                            objects.Add(new
                            {
                                taskCode = task.taskCode,
                                Message = $"任务号【{task.taskCode}】已存在任务"
                            });
                            continue;
                            //throw new Exception($"任务号【{task.taskCode}】已存在任务");
                        }
                        if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode) != null)
                            throw new Exception($"托盘号【{task.containerCode}】已存在任务");
                        {
                            objects.Add(new
                            {
                                taskCode = task.taskCode,
                                Message = $"托盘号【{task.containerCode}】已存在任务"
                            });
                            continue;
                            //throw new Exception($"托盘号【{task.containerCode}】已存在任务");
                        }
                        if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode) != null)
                            throw new Exception($"起点位置【{task.containerCode}】已存在任务");
                        {
                            objects.Add(new
                            {
                                taskCode = task.taskCode,
                                Message = $"起点位置【{task.containerCode}】已存在任务"
                            });
                            continue;
                            //throw new Exception($"起点位置【{task.containerCode}】已存在任务");
                        }
                        #endregion
                        switch (item.taskType)
                        {
                            case (int)TaskTypeEnum.MLInbound:
                                CreateKLSNewInTask(task, item.taskType);
                                content = CreateKLSNewInTask(task, item.taskType);
                                objects.Add(content.Data);
                                break;
                            case (int)TaskTypeEnum.MLOutbound:
                                CreateKLSNewOutTask(task, item.taskType);
                                content = CreateKLSNewOutTask(task, item.taskType);
                                objects.Add(content.Data);
                                break;
                            case (int)TaskTypeEnum.CPInbound:
                                CreateRGVNewInTask(task, item.taskType);
                                content= CreateRGVNewInTask(task, item.taskType);
                                objects.Add(content.Data);
                                break;
                            case (int)TaskTypeEnum.CPOutbound:
                                CreateRGVNewOutTask(task, item.taskType);
                                content= CreateRGVNewOutTask(task, item.taskType);
                                objects.Add(content.Data);
                                break;
                            case (int)TaskTypeEnum.CJInbound:
                                CreateHKNewInTask(task, item.taskType);
                                content = CreateHKNewInTask(task, item.taskType);
                                objects.Add(content.Data);
                                break;
                            case (int)TaskTypeEnum.CJOutbound:
                                CreateHKNewOutTask(task, item.taskType);
                                content = CreateHKNewOutTask(task, item.taskType);
                                objects.Add(content.Data);
                                break;
                            case (int)TaskTypeEnum.Carry:
                                CarryTask(task, item.taskType);
                                content = CarryTask(task, item.taskType);
                                objects.Add(content.Data);
                                break;
                            case (int)TaskTypeEnum.CJCarry:
                                CJCarryTaske(task, item.taskType);
                                content = CJCarryTaske(task, item.taskType);
                                objects.Add(content.Data);
                                break;
                            default:
                                objects.Add(new
                                {
                                    taskCode = task.taskCode,
                                    Message = $"未定义的任务类型"
                                });
                                break;
                        }
                    }
                }
                content.Data = objects;
            }
            catch (Exception ex)
            {
@@ -1120,7 +1170,7 @@
                };
                string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOToccupyStation.Serialize());
                FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                if (fOURBOTReturn.returnCode != 0 && fOURBOTReturn.returnUserMsg != $"站点已被占用,(podID={iQC.ContainerCode})")
                if (fOURBOTReturn.returnCode != 0 /*&& fOURBOTReturn.returnUserMsg != $"站点已被占用,(podID={iQC.ContainerCode})"*/)
                    throw new Exception(fOURBOTReturn.returnUserMsg);
                #endregion