private void SetItemStockInfo <T>(T item, AllocatedItemInventoryInfo allocatedInfo) where T : OrderItem { //设置分仓成功商品的出库仓库,没有分仓成功的商品最后会全部集中到一个子单中 if (allocatedInfo != null) { item.WarehouseNumber = allocatedInfo.WarehouseNumber; item.WarehouseName = allocatedInfo.WarehouseName; item.WarehouseCountryCode = allocatedInfo.WarehouseCountryCode; } }
private void SetWarehouseAllocateResult(OrderInfo orderInfo, List <AllocatedItemInventoryInfo> allocateItemInventoryInfoList) { //设置分仓结果 if (orderInfo.OrderItemGroupList != null) { foreach (OrderItemGroup itemGroup in orderInfo.OrderItemGroupList) { if (itemGroup.ProductItemList != null) { itemGroup.ProductItemList.ForEach(masterItem => { AllocatedItemInventoryInfo allocatedInfo = allocateItemInventoryInfoList.Find(item => item.ProductID == masterItem.ProductSysNo); SetItemStockInfo(masterItem, allocatedInfo); }); } } if (orderInfo.GiftItemList != null) { orderInfo.GiftItemList.ForEach(gift => { AllocatedItemInventoryInfo allocatedInfo = allocateItemInventoryInfoList.Find(item => item.ProductID == gift.ProductSysNo); SetItemStockInfo(gift, allocatedInfo); }); } if (orderInfo.AttachmentItemList != null) { orderInfo.AttachmentItemList.ForEach(attachment => { AllocatedItemInventoryInfo allocatedInfo = allocateItemInventoryInfoList.Find(item => item.ProductID == attachment.ProductSysNo); SetItemStockInfo(attachment, allocatedInfo); }); } //加够商品 if (orderInfo.PlusPriceItemList != null) { orderInfo.PlusPriceItemList.ForEach(plusPrice => { AllocatedItemInventoryInfo allocatedInfo = allocateItemInventoryInfoList.Find(item => item.ProductID == plusPrice.ProductSysNo); SetItemStockInfo(plusPrice, allocatedInfo); }); } } }