private void SuccessfulGroupBuyProcess(GroupBuyingInfo gbInfo) { List <SOItemInfo> GroupBuyItemList = SODA.GetGroupBuySOItemByGroupBuySysNo(gbInfo.SysNo.Value); SOProcessor soProcessor = ObjectFactory <SOProcessor> .Instance; foreach (SOItemInfo groupBuyItem in GroupBuyItemList) { //更新订单 try { //修改团购商品价格 SOInfo soInfo = SODA.GetSOBySOSysNo(groupBuyItem.SOSysNo.Value); soProcessor.ProcessSO(new SOAction.SOCommandInfo { Command = SOAction.SOCommand.Job, SOInfo = soInfo, Parameter = new object[] { groupBuyItem.ProductSysNo } }); } catch (Exception ex) { SODA.UpdateGroupBuySOAndItemSettlementStatus(groupBuyItem.SOSysNo.Value, groupBuyItem.ProductSysNo.Value, SettlementStatus.Fail); ExceptionHelper.HandleException(ex); continue; } } ExternalDomainBroker.UpdateGroupBuySettlementStatus(gbInfo.SysNo.Value, GroupBuyingSettlementStatus.Yes); }
/// <summary> /// 调整仓库,返还库存 /// </summary> protected virtual void AdjustInventory() { List <BizEntity.Inventory.InventoryAdjustItemInfo> adjustItemList = new List <BizEntity.Inventory.InventoryAdjustItemInfo>(); SOProcessor sopro = new SOProcessor(); DateTime? SOCreatDate = CurrentSO.BaseInfo.CreateTime; int SOSysNo = int.Parse(CurrentSO.BaseInfo.SOID); foreach (SOItemInfo soItem in CurrentSO.Items) { //如果订单已经支付直接返还库存 if (sopro.NetpaySOCheckReturnInventory(SOSysNo)) { switch (soItem.ProductType.Value) { case SOProductType.Product: case SOProductType.Gift: case SOProductType.Award: case SOProductType.SelfGift: case SOProductType.Accessory: adjustItemList.Add(new BizEntity.Inventory.InventoryAdjustItemInfo { AdjustQuantity = soItem.Quantity.Value, ProductSysNo = soItem.ProductSysNo.Value, StockSysNo = soItem.StockSysNo.Value }); break; case SOProductType.Coupon: case SOProductType.ExtendWarranty: break; } } else { //开启促销活动里的商品支持付款后扣减在线库存 if (AppSettingManager.GetSetting(SOConst.DomainName, "PaymentInventory").ToString().ToLower() == "true") { //判断商品是否是在促销活动时间里买的商品,如果是,就返还库存 if (sopro.CheckReturnInventory(soItem.ProductSysNo.Value, SOCreatDate.Value)) { switch (soItem.ProductType.Value) { case SOProductType.Product: case SOProductType.Gift: case SOProductType.Award: case SOProductType.SelfGift: case SOProductType.Accessory: adjustItemList.Add(new BizEntity.Inventory.InventoryAdjustItemInfo { AdjustQuantity = soItem.Quantity.Value, ProductSysNo = soItem.ProductSysNo.Value, StockSysNo = soItem.StockSysNo.Value }); break; case SOProductType.Coupon: case SOProductType.ExtendWarranty: break; } } } else { switch (soItem.ProductType.Value) { case SOProductType.Product: case SOProductType.Gift: case SOProductType.Award: case SOProductType.SelfGift: case SOProductType.Accessory: adjustItemList.Add(new BizEntity.Inventory.InventoryAdjustItemInfo { AdjustQuantity = soItem.Quantity.Value, ProductSysNo = soItem.ProductSysNo.Value, StockSysNo = soItem.StockSysNo.Value }); break; case SOProductType.Coupon: case SOProductType.ExtendWarranty: break; } } } } ExternalDomainBroker.AdjustProductInventory(new BizEntity.Inventory.InventoryAdjustContractInfo { ReferenceSysNo = SOSysNo.ToString(), SourceActionName = IsImmediatelyReturnStock ? BizEntity.Inventory.InventoryAdjustSourceAction.Abandon_RecoverStock : BizEntity.Inventory.InventoryAdjustSourceAction.Abandon, IsOutStockAbandon = IsOutStockOrder ? true : false, SourceBizFunctionName = BizEntity.Inventory.InventoryAdjustSourceBizFunction.SO_Order, AdjustItemList = adjustItemList }); }