/// <summary> /// 处理团购抢购销量库存 /// </summary> /// <param name="orderId"></param> /// <param name="inoutDetailList"></param> public void SetEventStock(string orderId, List <InoutDetailInfo> inoutDetailList) { PanicbuyingEventOrderMappingBLL panicbuyingEventOrderMappingBll = new PanicbuyingEventOrderMappingBLL(CurrentUserInfo); var panicbuyingEventOrderMappingEntity = panicbuyingEventOrderMappingBll.QueryByEntity(new PanicbuyingEventOrderMappingEntity() { OrderId = orderId }, null).FirstOrDefault(); PanicbuyingEventItemMappingBLL panicbuyingEventItemMappingBll = new PanicbuyingEventItemMappingBLL(CurrentUserInfo); PanicbuyingEventSkuMappingBLL panicbuyingEventSkuMappingBll = new PanicbuyingEventSkuMappingBLL(CurrentUserInfo); foreach (var i in inoutDetailList) { //Item表销量处理 var itemEntity = panicbuyingEventItemMappingBll.GetPanicbuyingEventEntity(panicbuyingEventOrderMappingEntity.EventId.ToString(), i.sku_id); if (itemEntity != null) { itemEntity.SoldQty -= Convert.ToInt32(i.enter_qty); itemEntity.LastUpdateTime = DateTime.Now; panicbuyingEventItemMappingBll.Update(itemEntity); //Sku表销量处理 var skuEntity = panicbuyingEventSkuMappingBll.QueryByEntity(new PanicbuyingEventSkuMappingEntity() { SkuId = i.sku_id, EventItemMappingId = itemEntity.EventItemMappingId }, null).FirstOrDefault(); skuEntity.SoldQty -= Convert.ToInt32(i.enter_qty); skuEntity.LastUpdateTime = DateTime.Now; panicbuyingEventSkuMappingBll.Update(skuEntity); } } }
/// <summary> /// 处理砍价商品的库存销量相关信息 /// </summary> /// <param name="orderId"></param> /// <param name="inoutDetailList"></param> public void SetKJEventOrder(string customerId, string orderId, string eventId, string KJEventJoinId, List <InoutDetailInfo> inoutDetailList) { PanicbuyingKJEventItemMappingBLL panicbuyingKJEventItemMappingBll = new PanicbuyingKJEventItemMappingBLL(CurrentUserInfo); PanicbuyingKJEventSkuMappingBLL panicbuyingKJEventSkuMappingBll = new PanicbuyingKJEventSkuMappingBLL(CurrentUserInfo); PanicbuyingEventOrderMappingBLL panicbuyingEventOrderMappingBll = new PanicbuyingEventOrderMappingBLL(CurrentUserInfo); PanicbuyingKJEventJoinBLL panicbuyingKJEventJoinBll = new PanicbuyingKJEventJoinBLL(CurrentUserInfo); foreach (var i in inoutDetailList) { var itemEntity = panicbuyingKJEventItemMappingBll.GetPanicbuyingEventEntity(eventId, i.sku_id); itemEntity.SoldQty += Convert.ToInt32(i.enter_qty); itemEntity.LastUpdateTime = DateTime.Now; panicbuyingKJEventItemMappingBll.Update(itemEntity); var skuEntity = panicbuyingKJEventSkuMappingBll.QueryByEntity(new PanicbuyingKJEventSkuMappingEntity() { SkuID = i.sku_id, EventItemMappingID = itemEntity.EventItemMappingID.ToString() }, null).FirstOrDefault(); skuEntity.SoldQty += Convert.ToInt32(i.enter_qty); skuEntity.LastUpdateTime = DateTime.Now; panicbuyingKJEventSkuMappingBll.Update(skuEntity); } PanicbuyingEventOrderMappingEntity PanicbuyingEventOrderMappingEntity = new PanicbuyingEventOrderMappingEntity() { MappingId = Guid.NewGuid(), EventId = new Guid(eventId), OrderId = orderId, CustomerID = customerId }; panicbuyingEventOrderMappingBll.Create(PanicbuyingEventOrderMappingEntity); var panicbuyingKJEventJoinEntity = panicbuyingKJEventJoinBll.GetByID(KJEventJoinId); panicbuyingKJEventJoinEntity.EventOrderMappingId = PanicbuyingEventOrderMappingEntity.MappingId; panicbuyingKJEventJoinBll.Update(panicbuyingKJEventJoinEntity); }