|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); | 
|---|
|  |  |  | List<int> detailKeys = new List<int>(); | 
|---|
|  |  |  | foreach (var model in models) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (purchaseOrderNos.FirstOrDefault(x => x == model.PurchaseOrderNo) == null) | 
|---|
|  |  |  | 
|---|
|  |  |  | return WebResponseContent.Instance.Error($"æªå¨æ¶è´§åæç»ä¸æ¾å°è¯¥éè´å"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Dt_InboundOrderDetail? notGroupDetail = inboundOrderDetails.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt() && x.OrderQuantity == model.Quantity && !detailKeys.Contains(x.Id) && x.OrderQuantity > x.ReceiptQuantity).FirstOrDefault(); | 
|---|
|  |  |  | Dt_InboundOrderDetail? notGroupDetail = inboundOrderDetails.Where(x => x.OrderDetailStatus < OrderDetailStatusEnum.Inbounding.ObjToInt() && x.MaterielCode==model.MaterielCode && x.BatchNo==model.LotNo && x.OrderQuantity > x.ReceiptQuantity).FirstOrDefault(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (notGroupDetail == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return WebResponseContent.Instance.Error($"è¯¥ç©æå¨è¯¥å
¥åºåä¸å·²å
¨é¨ç»ç宿"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | detailKeys.Add(notGroupDetail.Id); | 
|---|
|  |  |  | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | BatchNo = model.LotNo, | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | stockInfoDetails.Add(stockInfoDetail); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | notGroupDetail.ReceiptQuantity = model.Quantity; | 
|---|
|  |  |  | notGroupDetail.OrderDetailStatus = OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); | 
|---|
|  |  |  | notGroupDetail.ReceiptQuantity += model.Quantity; | 
|---|
|  |  |  | if (notGroupDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | notGroupDetail.OrderDetailStatus = OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | float totalQuantity = stockInfo.Details.Sum(x => x.StockQuantity); | 
|---|