刘磊
2024-12-24 e2bb2738c6ddb1d013837924dc639b0f6f63662b
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -163,6 +163,8 @@
    private async Task<Dt_Task> CreateInToOutTaskAsync(RequestTaskDto input, Dt_StationManager stationManager)
    {
        try
        {
        //if (stationManager.stationType != 5) throw new Exception("错误的调取");
        input.EquiCodeMOM = "24MEJQ11-1006-1";
@@ -181,7 +183,7 @@
        // 如果状态为false,则返回content
        if (!content.Status) throw new Exception(content.Message);
        // 添加组盘信息
            // 组盘信息
        // 将content.Data转换为ResultTrayCellsStatus对象
        var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
        if (result.SerialNos.Count <= 0)
@@ -210,6 +212,7 @@
            }
            else
            {
                    //无电芯 → 当空框? 还是返回异常?
                return null;
            }
        }
@@ -233,20 +236,29 @@
                    PalletCode = input.PalletCode,
                    SourceAddress = stationManager.stationLocation,
                    TaskState = (int)TaskInStatusEnum.Line_InFinish,
                    TaskType = (int)TaskOutboundTypeEnum.OutNG,
                        TaskType = (int)TaskOutboundTypeEnum.InToOut,
                    TaskNum = await BaseDal.GetTaskNo(),
                    Creater = "Systeam"
                };
                return taskNG;
            }
                else
                {
                    Console.WriteLine($"站台{stationManager.stationChildCode}MOM返回电芯异常:{result.MOMMessage}");
                    return null;
        }
            }
            //else
            //{
            //    throw new Exception($"站台{stationManager.stationChildCode}MOM返回电芯异常:{result.MOMMessage}");
            //}
        var targetStation = _stationManagerRepository.QueryFirst(x => x.stationPLC == stationManager.stationPLC && x.Roadway == stationManager.Roadway && x.stationType == 2);
        var task = new Dt_Task
        {
            CurrentAddress = input.Position,
            Grade = 1,
                Grade = 3,
            Roadway = input.Roadways,
            TargetAddress = targetStation.stationLocation,
            Dispatchertime = DateTime.Now,
@@ -260,8 +272,12 @@
            TaskNum = await BaseDal.GetTaskNo(),
            Creater = "Systeam"
        };
        return task;
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
    #endregion 直接出库任务
@@ -521,7 +537,8 @@
        {
            //添加历史
            var taskHty = CreateHistoricalTask(task);
            // 添加历史任务
            var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0;
            //删除任务
            BaseDal.DeleteData(task);
@@ -578,7 +595,7 @@
                var Epmtytask = new Dt_Task
                {
                    CurrentAddress = input.Position,
                    Grade = 3,  //优先处理异常排出口的任务 防止正常需排出异常口的任务堵线
                    Grade = 4,  //优先处理异常排出口的任务 防止正常需排出异常口的任务堵线
                    Roadway = input.Roadways,
                    TargetAddress = EmptylocationInfo.LocationCode,
                    Dispatchertime = DateTime.Now,
@@ -846,20 +863,21 @@
        WebResponseContent content = new WebResponseContent();
        try
        {
            Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position);
            Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position && x.stationType == 12 && x.stationArea == "Call");
            DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == station.productLine);
            if (stockInfo == null) throw new Exception("库内无满足条件的库存可出库");
            Dt_StationManager OutStation = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1016" && x.stationType == 10);
            DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.AreaId == 5 && x.LocationCode == stockInfo.LocationCode);
            Dt_StationManager OutStation = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1016" && x.stationType == 10 && x.Roadway == locationInfo.RoadwayNo && x.stationStatus == "1");
            // 创建新任务实例
            var task = new Dt_Task
            {
                CurrentAddress = stockInfo.LocationInfo.RoadwayNo,
                CurrentAddress = locationInfo.RoadwayNo,
                Grade = 1,
                Roadway = stockInfo.LocationInfo.RoadwayNo,
                Roadway = locationInfo.RoadwayNo,
                TargetAddress = json.Position,
                Dispatchertime = DateTime.Now,
                MaterialNo = "",
@@ -880,6 +898,7 @@
        }
        catch (Exception ex)
        {
            Console.WriteLine($"CW3至包装出库异常:{ex.ToString()}");
            return content.Error($"失败:{ex.Message}");
        }
    }