1
刘磊
2024-12-26 e5642daf4b6820d0706967e486b16e8d33a46d6d
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -865,7 +865,15 @@
        {
            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);
            var stockInfo = _stockInfoRepository.Db.Queryable<DtStockInfo>()
                    .Includes(x => x.LocationInfo) // 预加载LocationInfo
                    .Includes(x => x.StockInfoDetails) // 预加载StockInfoDetails
                    .Where(x => x.AreaCode == "CWSC3" && x.IsFull == true) // 过滤条件
                    .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock) // 过滤条件
                    .OrderBy(x => x.OutboundTime) // 排序
                    .First(); // 获取第一个元素
            //DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == station.productLine);
            if (stockInfo == null) throw new Exception("库内无满足条件的库存可出库");
            DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.AreaId == 5 && x.LocationCode == stockInfo.LocationCode);
@@ -875,7 +883,7 @@
            // 创建新任务实例
            var task = new Dt_Task
            {
                CurrentAddress = locationInfo.RoadwayNo,
                CurrentAddress = stockInfo.LocationCode,
                Grade = 1,
                Roadway = locationInfo.RoadwayNo,
                TargetAddress = json.Position,
@@ -893,6 +901,9 @@
            WMSTaskDTO taskDTO = CreateTaskDTO(task);
            BaseDal.AddData(task);
            stockInfo.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable;
            _locationRepository.UpdateData(stockInfo.LocationInfo);
            return content.OK(data: taskDTO);
        }
@@ -916,7 +927,7 @@
            if (emergencyTask == null) throw new Exception("火警参数为空");
            DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.Row == emergencyTask.row && x.Column == emergencyTask.column && x.Layer == emergencyTask.layer && x.RoadwayNo == emergencyTask.Roadway);
            DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.Row == emergencyTask.row && x.Column == emergencyTask.column && x.Layer == emergencyTask.layer && x.AreaId == emergencyTask.zone);
            if (locationInfo == null)
            {
                throw new Exception("未知库位");