| | |
| | | 锘縰sing System; |
| | | 锘縰sing Microsoft.IdentityModel.Tokens; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | |
| | | public ProStockInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) |
| | | { |
| | | } |
| | | //鏍规嵁鏄庣粏鏁版嵁鏌ユ壘鍙敤搴撳瓨搴撳瓨 |
| | | public List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos) |
| | | { |
| | | List<Dt_ProStockInfo>? proStockInfos = null; |
| | | bool isCanLot= !string.IsNullOrEmpty(proOutOrderDetail.PLot); |
| | | bool isCanDate = !string.IsNullOrEmpty(proOutOrderDetail.DateCode); |
| | | proStockInfos = Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Contains(x.LocationCode)) |
| | | .Includes(x => x.proStockInfoDetails) |
| | | .Where(x => x.proStockInfoDetails |
| | | .Any(x => x.SaleOrder == proOutOrderDetail.SaleOrder |
| | | && x.ProductCode == proOutOrderDetail.PCode |
| | | && x.ProductVersion == proOutOrderDetail.PVer |
| | | && (isCanLot ? x.LotNumber == proOutOrderDetail.PLot : true) |
| | | && (isCanDate ? x.DateCode == proOutOrderDetail.DateCode : true) |
| | | )) |
| | | .ToList(); |
| | | proStockInfos = proStockInfos.OrderBy(x => x.proStockInfoDetails.FirstOrDefault().DateCode).ToList(); |
| | | return proStockInfos; |
| | | } |
| | | } |
| | | } |