|  |  | 
 |  |  | using log4net.Core; | 
 |  |  | using Mapster; | 
 |  |  | using Masuit.Tools; | 
 |  |  | using Masuit.Tools.Models; | 
 |  |  | using WIDESEA_DTO.MOM; | 
 |  |  | using WIDESEA_DTO.WMS; | 
 |  |  | using WIDESEA_IStorageBasicRepository; | 
 |  |  | 
 |  |  |         //return _stockInfoRepository.QueryFirstNavAsync(x => x.AreaCode == areaCode && Convert.ToDateTime(x.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(x.SpecialParameterDuration)) < DateTime.Now | 
 |  |  |         //                        && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && roadways.Contains(x.LocationInfo.RoadwayNo) && x.StockInfoDetails.Any(x => x.Status == (int)StockStateEmun.已入库) && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).Result; | 
 |  |  |  | 
 |  |  |         var result = await _stockInfoRepository.QueryFirstNavAsync(x => | 
 |  |  |         var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>().Where(x => | 
 |  |  |             x.AreaCode == areaCode && | 
 |  |  |             Convert.ToDateTime(x.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(x.SpecialParameterDuration)) < DateTime.Now && | 
 |  |  |             x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && | 
 |  |  |             roadways.Contains(x.LocationInfo.RoadwayNo) && | 
 |  |  |             x.StockInfoDetails != null && x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.已入库)); | 
 |  |  |             Convert.ToDateTime(x.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(x.SpecialParameterDuration)) < DateTime.Now) | 
 |  |  |             .Includes(x => x.LocationInfo) | 
 |  |  |             .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && roadways.Contains(x.LocationInfo.RoadwayNo)) | 
 |  |  |             .Includes(x => x.StockInfoDetails) | 
 |  |  |             .Where(x => x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.已入库)) | 
 |  |  |             .OrderBy(x => x.CreateDate) | 
 |  |  |             .FirstAsync(); | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode, List<string> roadways) | 
 |  |  |     { | 
 |  |  |         //return _stockInfoRepository.QueryFirstNavAsync(x => x.StockInfoDetails.Any(x => x.MaterielCode == "空托盘") && roadways.Contains(x.LocationInfo.RoadwayNo) && x.StockInfoDetails.Any(x => x.Status == (int)StockStateEmun.已入库) && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).Result; | 
 |  |  |         var result = await _stockInfoRepository.QueryFirstNavAsync(x => | 
 |  |  |             x.StockInfoDetails != null && x.StockInfoDetails.Any(detail => detail.MaterielCode == "空托盘") && | 
 |  |  |             roadways.Contains(x.LocationInfo.RoadwayNo) && | 
 |  |  |             x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.已入库) && | 
 |  |  |             x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock); | 
 |  |  |         var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() | 
 |  |  |             .Includes(x => x.LocationInfo) | 
 |  |  |             .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && roadways.Contains(x.LocationInfo.RoadwayNo)) | 
 |  |  |             .Includes(x => x.StockInfoDetails) | 
 |  |  |             .Where(x => x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.已入库 && detail.MaterielCode == "空托盘")) | 
 |  |  |             .OrderBy(x => x.CreateDate) | 
 |  |  |             .FirstAsync(); | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  |