| | |
| | | public IRepository<Dt_StockInfo> Repository => BaseDal; |
| | | private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository; |
| | | private readonly IOutboundOrderService _outboundOrderService; |
| | | private readonly IOutboundOrderDetailService _outboundOrderDetailService; |
| | | //private readonly IOutboundOrderDetailService _outboundOrderDetailService; |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService) : base(BaseDal) |
| | | public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService, IOutboundOrderService outboundOrderService) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _recordService = recordService; |
| | | _locationInfoService = locationInfoService; |
| | | _outboundOrderService = outboundOrderService; |
| | | _outboundOrderDetailService = outboundOrderDetailService; |
| | | //_outboundOrderDetailService = outboundOrderDetailService; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, string supplyCode, List<string> locationCodes) |
| | | { |
| | | var query = Db.Queryable<Dt_StockInfo>() |
| | | .Where(x => locationCodes.Contains(x.LocationCode) |
| | | .Where(x => locationCodes.Contains(x.LocationCode) && x.StockStatus==StockStatusEmun.å
¥åºå®æ.ObjToInt() |
| | | // && x.StockStatus == (int)StockStatusEmun.æ£å¸¸) |
| | | ).Includes(x => x.Details); |
| | | |
| | |
| | | } |
| | | |
| | | // è·ååºåºåæç»ï¼ç¨äºç¡®å®éè¦çæ¹æ¬¡åä¾åºå |
| | | var orderDetails = _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>().Where(x => x.OrderId == orderId && x.MaterielCode == materielCode).ToList(); |
| | | var orderDetails = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrderDetail>().Where(x => x.OrderId == orderId && x.MaterielCode == materielCode).ToList(); |
| | | |
| | | if (!orderDetails.Any()) |
| | | { |
| | |
| | | // æ§è¡æ¥è¯¢å¹¶æå
è¿å
åºæåº |
| | | var stocks = stockQuery.ToList() |
| | | .Where(x => x.Details.Any(d => |
| | | d.MaterielCode == materielCode && |
| | | d.BatchNo == orderDetail.BatchNo && |
| | | d.SupplyCode == orderDetail.SupplyCode && |
| | | d.MaterielCode == materielCode && |
| | | string.IsNullOrEmpty(orderDetail.BatchNo)?true: d.BatchNo == orderDetail.BatchNo&& |
| | | string.IsNullOrEmpty(orderDetail.BatchNo)?true:d.SupplyCode == orderDetail.SupplyCode && |
| | | d.StockQuantity > d.OutboundQuantity |
| | | )) |
| | | .OrderBy(x => x.CreateDate) |
| | |
| | | { |
| | | var relevantDetails = stock.Details |
| | | .Where(d => d.MaterielCode == materielCode && |
| | | d.BatchNo == orderDetail.BatchNo && |
| | | d.SupplyCode == orderDetail.SupplyCode && |
| | | string.IsNullOrEmpty(orderDetail.BatchNo) ? true : d.BatchNo == orderDetail.BatchNo && |
| | | string.IsNullOrEmpty(orderDetail.BatchNo) ? true : d.SupplyCode == orderDetail.SupplyCode && |
| | | d.StockQuantity > d.OutboundQuantity) |
| | | .ToList(); |
| | | |