wangxinhui
2025-03-15 efaf0b8aeb26aca6536a4b384c912cc3cac4d070
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs
@@ -1,9 +1,11 @@
锘縰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;
@@ -14,5 +16,24 @@
        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;
        }
    }
}