wangxinhui
2026-04-08 6861434f1445d1685b67a24897890c34f8c54f85
´úÂë¹ÜÀí/WMS/WMSServices/WIDESEA_StockRepository/StockInfoRepository.cs
@@ -1,16 +1,9 @@
using Org.BouncyCastle.Crypto;
using SqlSugar;
using SqlSugar.Extensions;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.Enums;
using WIDESEA_DTO.Stock;
using WIDESEA_IBasicRepository;
using WIDESEA_IStockRepository;
using WIDESEA_Model.Models;
@@ -19,52 +12,10 @@
{
    public class StockInfoRepository : RepositoryBase<Dt_StockInfo>, IStockInfoRepository
    {
        public StockInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
        private readonly IBasicRepository _basicRepository;
        public StockInfoRepository(IUnitOfWorkManage unitOfWorkManage, IBasicRepository basicRepository) : base(unitOfWorkManage)
        {
        }
        public Dt_StockInfo GetStockInfo(string palletCode)
        {
            return Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).First();
        }
        public List<Dt_StockInfo> GetStockInfos(string materielCode)
        {
            return Db.Queryable<Dt_StockInfo>().Where(x => x.MaterielCode == materielCode).ToList();
        }
        public List<Dt_StockInfo> GetStockInfos(int materielId,decimal width,  List<string> locationCodes)
        {
            List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) && x.MaterielId == materielId && x.MaterielWide==width && x.StockOutLength<=0).OrderBy(x=>x.CreateDate).ToList();
            return stockInfos;
        }
        /// <summary>
        /// èŽ·å–ç”Ÿç®¡å¯ä½¿ç”¨åº“å­˜
        /// </summary>
        public List<Dt_StockInfo> GetStockInfos(string materielCode, decimal width, List<string> locationCodes)
        {
            List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) && x.MaterielCode.StartsWith(materielCode) && x.StockStatus == StockStatusEmun.入库完成.ObjToInt() && x.MaterielWide == width && x.StockOutLength <= 0 && x.StockLength > 0).OrderBy(x => x.CreateDate).ToList();
            return stockInfos;
        }
        public List<Dt_StockInfo> GetStockInfos(string materielCode,  List<string> locationCodes)
        {
            List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) && x.MaterielCode == materielCode && x.StockStatus == StockStatusEmun.入库完成.ObjToInt() && x.StockOutLength <= 0 && x.StockLength > 0).OrderBy(x => x.CreateDate).ToList();
            return stockInfos;
        }
        public List<Dt_StockInfo> GetStockInfosByIds(List<int> ids)
        {
            return Db.Queryable<Dt_StockInfo>().Where(x => ids.Contains(x.Id)).ToList();
        }
        public List<Dt_StockInfo> GetStockInfosByPalletCodes(List<string> palletCodes)
        {
            return Db.Queryable<Dt_StockInfo>().Where(x => palletCodes.Contains(x.PalletCode)).ToList();
        }
        public List<Dt_StockInfo> GetStockInfosExclude(string materielCode, List<string> palletCodes)
        {
            return Db.Queryable<Dt_StockInfo>().Where(x => !palletCodes.Contains(x.PalletCode) && x.MaterielCode == materielCode).ToList();
            _basicRepository = basicRepository;
        }
    }
}
}