1
xiazhengtongxue
2026-01-28 b45155e1a5d76ca95d138025ab458fe2f3689748
ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -200,6 +200,7 @@
            WebResponseContent content = new WebResponseContent();
            try
            {
                WriteLog.Write_Log("容器入库创建任务", $"输送线信息", "开始入库", $"托盘号{containerFlowDTO.ContainerCode},设备{deviceCode}");
                List<Dt_LocationInfo> locationInfos = _locationInfoRepository.QueryData();
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.PalletCode == containerFlowDTO.ContainerCode);
                if (locationInfo != null) throw new Exception($"库位料箱号{containerFlowDTO.ContainerCode}已存在");
@@ -221,13 +222,14 @@
                    _taskExecuteDetailService.AddTaskExecuteDetail(new List<int>() { taskOld.TaskNum }, $"{oldSlotCode}换至{containerFlowDTO.SlotCode}入库");
                    return content.OK();
                }
                else if(taskOld != null)
                else if (taskOld != null)
                {
                    throw new Exception($"料箱号{containerFlowDTO.ContainerCode}" + (taskOld.TaskType == TaskTypeEnum.Inbound.ObjToInt() ? "入库AGV执行中": "出库AGV执行中"));
                    throw new Exception($"料箱号{containerFlowDTO.ContainerCode}" + (taskOld.TaskType == TaskTypeEnum.Inbound.ObjToInt() ? "入库AGV执行中" : "出库AGV执行中"));
                }
                Dt_LocationInfo? noInLocation = locationInfos.FirstOrDefault(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt());
                if (noInLocation == null) throw new Exception($"可用货位不足!");
                Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt() && x.StationDeviceCode == deviceCode);
                WriteLog.Write_Log("容器入库创建任务", $"站台信息", "查询站台", $"站台号{stationManger.StationCode},设备{stationManger.StationDeviceCode}");
                //创建任务
                Dt_Task task = new Dt_Task();
                task.PalletCode = containerFlowDTO.ContainerCode;
@@ -242,7 +244,8 @@
                task.TaskState = TaskStatusEnum.CL_Executing.ObjToInt();
                
                //添加任务
                BaseDal.AddData(task);
                int taskId = BaseDal.AddData(task);
                WriteLog.Write_Log("容器入库创建任务", $"任务信息", "创建入库", $"任务号:{taskId},托盘编号:{task.PalletCode}");
                if (type > 0)
                {
                    _taskExecuteDetailService.AddTaskExecuteDetail(new List<int>() { task.TaskNum }, "手动按钮入库");
@@ -255,6 +258,7 @@
            }
            catch (Exception ex)
            {
                WriteLog.Write_Log("容器入库创建任务", $"任务", "创建入库", $"失败:{ex.Message}");
                content.Error($"错误信息:{ex.Message}");
            }
            return content;