| | |
| | | return GetStockInfos(materielCode, batchNo, supplyCode, locationCodes); |
| | | } |
| | | |
| | | |
| | | public List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo, string supplyCode, string wearhouseCode, string factoryCode) |
| | | { |
| | | List<string> locationCodes = _locationInfoService.GetCanOutLocationCodes(); |
| | | |
| | | return GetStockInfos(materielCode, batchNo, supplyCode, locationCodes,wearhouseCode,factoryCode); |
| | | } |
| | | |
| | | public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, string supplyCode, List<string> locationCodes, string wearhouseCode, string factoryCode) |
| | | { |
| | | if (string.IsNullOrWhiteSpace(wearhouseCode)) |
| | | { |
| | | throw new ArgumentNullException("浠撳簱涓嶈兘涓虹┖"); |
| | | } |
| | | if (string.IsNullOrWhiteSpace(factoryCode)) |
| | | { |
| | | throw new ArgumentNullException("鍘傚尯涓嶈兘涓虹┖"); |
| | | } |
| | | var query = Db.Queryable<Dt_StockInfo>() |
| | | .Where(x => locationCodes.Contains(x.LocationCode) && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() |
| | | // && x.StockStatus == (int)StockStatusEmun.姝e父) |
| | | ).Includes(x => x.Details); |
| | | query = query.Where(x => x.Details.Any(d => d.WarehouseCode == wearhouseCode)); |
| | | query = query.Where(x => x.Details.Any(d => d.FactoryArea == factoryCode)); |
| | | if (!string.IsNullOrEmpty(materielCode)) |
| | | { |
| | | query = query.Where(x => x.Details.Any(d => d.MaterielCode == materielCode)); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(lotNo)) |
| | | { |
| | | query = query.Where(x => x.Details.Any(d => d.BatchNo == lotNo)); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(supplyCode)) |
| | | { |
| | | query = query.Where(x => x.Details.Any(d => d.SupplyCode == supplyCode)); |
| | | } |
| | | |
| | | return query.OrderBy(x => x.CreateDate).ToList(); |
| | | //ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>().Where(x => locationCodes.Contains(x.LocationCode)); |
| | | //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).OrderBy(a => a.CreateDate).Includes(a => a.Details).ToList(); |
| | | } |
| | | |
| | | public Dt_StockInfo GetPalletStockInfo(int locationType) |
| | | { |
| | | |
| | |
| | | |
| | | // 鎵ц鏌ヨ骞舵寜鍏堣繘鍏堝嚭鎺掑簭 |
| | | var Qstocks = stockQuery.Where(x => x.Details.Any(d => d.MaterielCode == materielCode && d.StockQuantity > d.OutboundQuantity)); |
| | | Qstocks = stockQuery.Where(x => x.Details.Any(d => d.FactoryArea == outboundOrder.FactoryArea)); |
| | | Qstocks = stockQuery.Where(x => x.Details.Any(d => d.WarehouseCode == orderDetail.WarehouseCode)); |
| | | |
| | | if (!string.IsNullOrEmpty(orderDetail.BatchNo)) |
| | | { |
| | | |
| | | Qstocks = stockQuery.Where(x => x.Details.Any(d => d.BatchNo == orderDetail.BatchNo)); |
| | | |
| | | } |
| | | if (!string.IsNullOrEmpty(orderDetail.SupplyCode)) |
| | | { |
| | | |
| | | Qstocks = stockQuery.Where(x => x.Details.Any(d => d.SupplyCode == orderDetail.SupplyCode)); |
| | | |
| | | } |
| | | |
| | | var stocks = Qstocks.OrderBy(x => x.CreateDate).ToList(); |
| | |
| | | // 鎵ц鏌ヨ骞舵寜鍏堣繘鍏堝嚭鎺掑簭 |
| | | var Qstocks = stockQuery.Where(x => x.Details.Any(d => d.MaterielCode == materielCode && d.StockQuantity > d.OutboundQuantity)); |
| | | |
| | | Qstocks = stockQuery.Where(x => x.Details.Any(d => d.FactoryArea == outboundOrder.FactoryArea)); |
| | | Qstocks = stockQuery.Where(x => x.Details.Any(d => d.WarehouseCode == orderDetail.WarehouseCode)); |
| | | |
| | | if (!string.IsNullOrEmpty(orderDetail.BatchNo)) |
| | | { |
| | | |
| | | Qstocks = stockQuery.Where(x => x.Details.Any(d => d.BatchNo == orderDetail.BatchNo)); |
| | | |
| | | } |
| | | if (!string.IsNullOrEmpty(orderDetail.SupplyCode)) |
| | | { |
| | | |
| | | Qstocks = stockQuery.Where(x => x.Details.Any(d => d.SupplyCode == orderDetail.SupplyCode)); |
| | | |
| | | } |
| | | |
| | | var stocks = Qstocks.OrderBy(x => x.CreateDate).ToList(); |