Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="GoodsID"></param>
        /// <param name="InventoryID"></param>
        /// <param name="StorageID"></param>
        /// <param name="BatchNumber"></param>
        /// <param name="Quantity"></param>
        public static void ApiInInventoty(int GoodsID, int InventoryID, int StorageID, string BatchNumber, int Quantity, long OperatorID)
        {
            // 商品信息
            GoodsEntity goodsEntity = GoodsService.GetGoodsEntityById(GoodsID);
            // 入库

            List <InventoryInfo> listInv = buildInventoryList(goodsEntity, StorageID, Quantity, BatchNumber, OperatorID);

            InventoryService.InventoryProcess(listInv, "", StorageID, DateTime.Now.ToShortDateString(), OperatorID);
        }
Example #2
0
        private static OrderDetailEntity TranslateOrderDetailEntity(OrderDetailInfo info)
        {
            OrderDetailEntity entity = new OrderDetailEntity();

            if (info != null)
            {
                entity.ID          = info.ID;
                entity.OrderID     = info.OrderID;
                entity.GoodsID     = info.GoodsID;
                entity.InventoryID = info.InventoryID;
                entity.GoodsNo     = info.GoodsNo;
                entity.GoodsName   = info.GoodsName;
                entity.GoodsModel  = info.GoodsModel;
                entity.Quantity    = info.Quantity;
                entity.Units       = info.Units;
                entity.Weight      = info.Weight;
                entity.TotalWeight = string.IsNullOrEmpty(info.Weight) ? "0" : (info.Weight.ToInt(0) * info.Quantity).ToString();
                entity.BatchNumber = info.BatchNumber;
                entity.ProductDate = info.ProductDate;
                entity.ExceedDate  = info.ExceedDate;
                entity.CreateDate  = info.CreateDate;
                entity.ChangeDate  = info.ChangeDate;
                entity.CreateDate  = info.CreateDate;
                entity.ChangeDate  = info.ChangeDate;

                entity.goods = new GoodsEntity();
                if (entity.GoodsID > 0)
                {
                    entity.goods = GoodsService.GetGoodsEntityById(entity.GoodsID);
                }

                entity.inventory = new InventoryEntity();
                if (entity.InventoryID > 0)
                {
                    entity.inventory = InventoryService.GetInventoryById(entity.InventoryID);
                }
                entity.WaitQuantity   = entity.inventory != null ? entity.inventory.Quantity : 0;
                entity.CanUseQuantity = entity.Quantity - entity.WaitQuantity;
            }

            return(entity);
        }
Example #3
0
        /// <summary>
        /// 出库操作
        /// </summary>
        /// <param name="GoodsID"></param>
        /// <param name="InventoryID"></param>
        /// <param name="BatchNumber"></param>
        /// <param name="OutQuantity"></param>
        /// <param name="UserID"></param>
        public static void InventoryOut(int GoodsID, int InventoryID, string BatchNumber, int OutQuantity, long UserID)
        {
            // 当前库存信息
            InventoryEntity entity = InventoryService.GetInventoryEntityById(InventoryID);
            // 商品信息
            GoodsEntity goodsEntity = GoodsService.GetGoodsEntityById(GoodsID);

            if (entity != null && goodsEntity != null)
            {
                // 库存可用数量=库存数量-待出库数量
                int canQuantity = entity.Quantity - entity.WaitQuantity;
                if (canQuantity >= OutQuantity)
                {
                    entity.Quantity = canQuantity - OutQuantity;
                    // 商品库存扣减
                    OrderInventoryService.ModifyQuantity(entity);

                    //记录库存明细
                    createInventoryDetail(entity, goodsEntity, UserID);
                }
            }
        }