dengjunjie
2024-11-14 c827fe7b0c5b3b444d76ba0d96a2649c764630dd
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs
@@ -57,6 +57,11 @@
            return Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First();
        }
        public Dt_StockInfo GetStockInfo(int id)
        {
            return Db.Queryable<Dt_StockInfo>().Where(x => x.Id == id).Includes(x => x.Details).First();
        }
        public List<Dt_StockInfo> GetStockInfos(string materielCode)
        {
            return Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList();
@@ -64,7 +69,15 @@
            //ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode));
            //return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => b).Includes(x => x.Details).ToList();
        }
        /// <summary>
        /// æ ¹æ®è´§ä½ç¼–号获取组盘库存信息
        /// </summary>
        /// <param name="locationCodes"></param>
        /// <returns></returns>
        public List<Dt_StockInfo> LocationCodesGetStockInfos(List<string> locationCodes, StockStatusEmun statusEmun = StockStatusEmun.已入库)
        {
            return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) /*&& x.StockStatus == statusEmun.ObjToInt()*/).Includes(x => x.Details).ToList();
        }
        public List<Dt_StockInfo> GetStockInfos(string materielCode, List<string> locationCodes)
        {
            return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList();
@@ -94,6 +107,16 @@
        {
            return Db.UpdateNav(stockInfo).Include(x => x.Details).ExecuteCommand();
        }
        public List<object> GetBatchNoStockInfo(string materielCode)
        {
            List<object> strings = new List<object>();
            var Dt_StockInfoDetails = Db.Queryable<Dt_StockInfoDetail>().Where(x => x.MaterielCode == materielCode && x.Status == StockStatusEmun.已入库.ObjToInt()).ToList().GroupBy(x => x.BatchNo).Select(x => x.Key);
            foreach (var item in Dt_StockInfoDetails)
            {
                strings.Add(item);
            }
            return strings;
        }
        public Dt_StockInfo GetPalletStockInfo(string roadwayNo)
        {