| | |
| | | using System; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | public OutStockLockInfoService(IOutStockLockInfoRepository BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ·»å åºåºè¯¦æ
|
| | | /// </summary> |
| | | /// <param name="outboundOrder"></param> |
| | | /// <param name="outboundOrderDetail"></param> |
| | | /// <param name="outStocks"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_OutStockLockInfo> GetOutStockLockInfos(Dt_OutboundOrder outboundOrder, Dt_OutboundOrderDetail outboundOrderDetail, List<Dt_StockInfo> outStocks, int? taskNum = null) |
| | | { |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | |
| | | var OutStockLockInfos = GetByOrderDetailId(outboundOrderDetail.Id); |
| | | foreach (var item in outStocks) |
| | | { |
| | | Dt_OutStockLockInfo outStockLockInfo = new Dt_OutStockLockInfo() |
| | | Dt_OutStockLockInfo outStockLockInfo = OutStockLockInfos.FirstOrDefault(x => x.StockId == item.Id && x.OrderDetailId == outboundOrderDetail.Id); |
| | | if (outStockLockInfo == null) |
| | | { |
| | | outStockLockInfo = new Dt_OutStockLockInfo() |
| | | { |
| | | PalletCode = item.PalletCode, |
| | | AssignQuantity = item.Details.Where(x => x.MaterielCode == outboundOrderDetail.MaterielCode).Sum(x => x.OutboundQuantity), |
| | | MaterielCode = outboundOrderDetail.MaterielCode, |
| | | BatchNo = outboundOrderDetail.BatchNo, |
| | | BatchNo = item.Details.Select(x => x.BatchNo).FirstOrDefault(), |
| | | //BatchNo = outboundOrderDetail.BatchNo, |
| | | LocationCode = item.LocationCode, |
| | | MaterielName = outboundOrderDetail.MaterielName, |
| | | OrderDetailId = outboundOrderDetail.Id, |
| | | OrderNo = outboundOrder.OrderNo, |
| | | OrderType = outboundOrder.OrderType, |
| | | OriginalQuantity = item.Details.Where(x => x.MaterielCode == outboundOrderDetail.MaterielCode).Sum(x => x.StockQuantity), |
| | | Status = taskNum == null ? OutStockStatus.å·²åé
.ObjToInt() : OutStockStatus.åºåºä¸.ObjToInt(), |
| | | //Status = taskNum == null ? OutStockStatus.å·²åé
.ObjToInt() : OutStockStatus.åºåºä¸.ObjToInt(), |
| | | StockId = item.Id, |
| | | TaskNum = taskNum |
| | | }; |
| | | } |
| | | outStockLockInfo.Status = taskNum == null ? OutStockStatus.å·²åé
.ObjToInt() : OutStockStatus.åºåºä¸.ObjToInt(); |
| | | outStockLockInfos.Add(outStockLockInfo); |
| | | } |
| | | |