public void CreateInProcessLocationDetail(InProcessLocation inProcessLocation, OrderLocationTransaction outOrderLocationTransaction, IList <InventoryTransaction> inventoryTransactionList) { if (inventoryTransactionList != null && inventoryTransactionList.Count > 0) { InProcessLocationDetail mergedInProcessLocationDetail = null; foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList) { if (inventoryTransaction.Hu == null && !inventoryTransaction.IsConsignment) { #region 合并发货数量 //没有HU && 非寄售才可以合并 if (mergedInProcessLocationDetail == null) { mergedInProcessLocationDetail = new InProcessLocationDetail(); mergedInProcessLocationDetail.InProcessLocation = inProcessLocation; mergedInProcessLocationDetail.OrderLocationTransaction = outOrderLocationTransaction; } mergedInProcessLocationDetail.Qty += (0 - inventoryTransaction.Qty) / outOrderLocationTransaction.UnitQty; #endregion } else { InProcessLocationDetail inProcessLocationDetail = new InProcessLocationDetail(); inProcessLocationDetail.InProcessLocation = inProcessLocation; inProcessLocationDetail.OrderLocationTransaction = outOrderLocationTransaction; if (inventoryTransaction.Hu != null) { inProcessLocationDetail.HuId = inventoryTransaction.Hu.HuId; inProcessLocationDetail.LotNo = inventoryTransaction.Hu.LotNo; } inProcessLocationDetail.IsConsignment = inventoryTransaction.IsConsignment; inProcessLocationDetail.PlannedBill = inventoryTransaction.PlannedBill; inProcessLocationDetail.Qty = (0 - inventoryTransaction.Qty) / outOrderLocationTransaction.UnitQty; inProcessLocation.AddInProcessLocationDetail(inProcessLocationDetail); this.CreateInProcessLocationDetail(inProcessLocationDetail); } } if (mergedInProcessLocationDetail != null) { inProcessLocation.AddInProcessLocationDetail(mergedInProcessLocationDetail); this.CreateInProcessLocationDetail(mergedInProcessLocationDetail); } } }
public void CreateInProcessLocationDetail(InProcessLocation inProcessLocation, OrderLocationTransaction outOrderLocationTransaction, IList <Hu> huList) { if (huList != null && huList.Count > 0) { foreach (Hu hu in huList) { InProcessLocationDetail inProcessLocationDetail = new InProcessLocationDetail(); inProcessLocationDetail.InProcessLocation = inProcessLocation; inProcessLocationDetail.OrderLocationTransaction = outOrderLocationTransaction; inProcessLocationDetail.HuId = hu.HuId; inProcessLocationDetail.LotNo = hu.LotNo; inProcessLocationDetail.Qty = hu.Qty * hu.UnitQty / outOrderLocationTransaction.UnitQty; //先乘Hu.UnitQty转为基本单位,在除outOrderLocationTransaction.UnitQty转为订单单位。 inProcessLocation.AddInProcessLocationDetail(inProcessLocationDetail); this.CreateInProcessLocationDetail(inProcessLocationDetail); } } }