Exemplo n.º 1
0
        /// <summary>
        /// 处理砍价活动销量库存
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="inoutDetailList"></param>
        public void SetKJEventStock(string orderId, List <InoutDetailInfo> inoutDetailList)
        {
            PanicbuyingEventOrderMappingBLL panicbuyingEventOrderMappingBll = new PanicbuyingEventOrderMappingBLL(CurrentUserInfo);
            var panicbuyingEventOrderMappingEntity = panicbuyingEventOrderMappingBll.QueryByEntity(new PanicbuyingEventOrderMappingEntity()
            {
                OrderId = orderId
            }, null).FirstOrDefault();

            PanicbuyingKJEventItemMappingBLL panicbuyingKJEventItemMappingBll = new PanicbuyingKJEventItemMappingBLL(CurrentUserInfo);
            PanicbuyingKJEventSkuMappingBLL  panicbuyingKJEventSkuMappingBll  = new PanicbuyingKJEventSkuMappingBLL(CurrentUserInfo);

            foreach (var i in inoutDetailList)
            {
                //Item表销量处理
                var itemEntity = panicbuyingKJEventItemMappingBll.GetPanicbuyingEventEntity(panicbuyingEventOrderMappingEntity.EventId.ToString(), i.sku_id);
                itemEntity.SoldQty       -= Convert.ToInt32(i.enter_qty);
                itemEntity.LastUpdateTime = DateTime.Now;
                panicbuyingKJEventItemMappingBll.Update(itemEntity);

                //Sku表销量处理
                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);
            }
        }
Exemplo n.º 2
0
        /// <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);
        }