| | |
| | | { |
| | | |
| | | private readonly IRepository<Dt_StockInfo_hty> _StockInfo_htyRepository; |
| | | private readonly IRepository<Dt_LocationInfo> _LocationInfoRepository; |
| | | |
| | | public StockService(IRepository<Dt_StockInfo> BaseDal, IRepository<Dt_StockInfo_hty> StockInfo_htyRepository) : base(BaseDal) |
| | | public StockService(IRepository<Dt_StockInfo> BaseDal, IRepository<Dt_StockInfo_hty> StockInfo_htyRepository, IRepository<Dt_LocationInfo> LocationInfoRepository) : base(BaseDal) |
| | | { |
| | | _StockInfo_htyRepository = StockInfo_htyRepository; |
| | | _LocationInfoRepository = LocationInfoRepository; |
| | | } |
| | | |
| | | public IRepository<Dt_StockInfo> Repository => BaseDal; |
| | |
| | | //鏌ヨ鐗╂枡鏁伴噺 |
| | | public int MaterielNum(string MaterielName) |
| | | { |
| | | int k = 0; |
| | | List<Dt_StockInfo> stockInfo = BaseDal.QueryData(x=>x.MaterielName == MaterielName); |
| | | int k = stockInfo.Count(); |
| | | if (stockInfo!=null && stockInfo.Count() != 0) |
| | | { |
| | | k = stockInfo.Count(); |
| | | } |
| | | else |
| | | { |
| | | List<Dt_LocationInfo> Location = _LocationInfoRepository.QueryData(x=>x.Remark == MaterielName); |
| | | k = Location.Count(); |
| | | } |
| | | return k; |
| | | } |
| | | |
| | | //浼樺厛鍑烘弧 |
| | | public List<Dt_StockInfo> PriorityBig(int Num, int Type) |
| | | public List<Dt_StockInfo> PriorityBig(int Num, string Type) |
| | | { |
| | | List<Dt_StockInfo> stockInfo = new List<Dt_StockInfo>(); |
| | | List<Dt_StockInfo> stockInfos = BaseDal.QueryData(x => x.StockType == Type && !x.MaterielCode1.Equals("") && !x.MaterielCode2.Equals("") && !x.MaterielCode3.Equals("") && !x.MaterielCode4.Equals("")).ToList(); |
| | | List<Dt_StockInfo> stockInfos = BaseDal.QueryData(x => x.MaterielName == Type && x.StockStatus == (int)StockStatusEmun.绌洪棽 && !x.MaterielCode1.Equals("") && !x.MaterielCode2.Equals("") && !x.MaterielCode3.Equals("") && !x.MaterielCode4.Equals("")).ToList(); |
| | | //鍒嗛厤鏁伴噺 |
| | | int k = stockInfos.Count(); |
| | | if (k >= Num) |
| | | { |
| | | stockInfo.AddRange(stockInfos.Take(Num)); |
| | | } |
| | | else |
| | | { |
| | | throw new Exception(string.Format("搴撳瓨鏁伴噺涓嶈冻")); |
| | | } |
| | | //閿佸畾搴撳瓨 |
| | | int s = stockInfo.Count() - 1; |
| | |
| | | } |
| | | |
| | | //浼樺厛鍑烘畫 |
| | | public List<Dt_StockInfo> PriorityLittle(int Num, int Type) |
| | | public List<Dt_StockInfo> PriorityLittle(int Num, string Type) |
| | | { |
| | | List<Dt_StockInfo> stockInfo = BaseDal.QueryData(x => x.StockType == Type && x.MaterielCode4.Equals("")).ToList(); |
| | | List<Dt_StockInfo> stockInfo = BaseDal.QueryData(x => x.MaterielName == Type && (x.MaterielCode4.Equals("") || x.MaterielCode4 == null) && x.StockStatus == (int)StockStatusEmun.绌洪棽).ToList(); |
| | | int k = stockInfo.Count(); |
| | | |
| | | //鍒嗛厤鏁伴噺 |
| | |
| | | { |
| | | stockInfo[i].StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | throw new Exception(string.Format("搴撳瓨鏁伴噺涓嶈冻")); |
| | | } |
| | | |
| | | return stockInfo; |