示例#1
0
        /// <summary>
        /// 库存明细入库
        /// </summary>
        /// <param name="entity">库存明细</param>
        /// <param name="StorageID"></param>
        /// <param name="inventoryDate"></param>
        /// <param name="OperatorID"></param>
        public static void CreateInventoryDetail(InventoryInfo entity, InventoryExecOrder orderExec, int StorageID, DateTime inventoryDate, long OperatorID)
        {
            InventoryDetailRepository mrDetail   = new InventoryDetailRepository();
            InventoryDetailInfo       infoDetail = new InventoryDetailInfo();

            if (entity != null)
            {
                infoDetail.InventoryID   = entity.InventoryID;
                infoDetail.OrderType     = OrderType.RKD.ToString();
                infoDetail.OrderNo       = orderExec.OrderNo;
                infoDetail.OrderID       = orderExec.OrderID;
                infoDetail.GoodsID       = entity.GoodsID;
                infoDetail.StorageID     = StorageID;
                infoDetail.Quantity      = entity.Quantity;
                infoDetail.CustomerID    = entity.CustomerID;
                infoDetail.InventoryType = entity.InventoryType;
                infoDetail.BatchNumber   = entity.BatchNumber;
                infoDetail.ProductDate   = entity.ProductDate;
                infoDetail.InventoryDate = inventoryDate;
                infoDetail.UnitPrice     = entity.UnitPrice;
                infoDetail.Remark        = entity.Remark;
                infoDetail.OperatorID    = OperatorID;
                infoDetail.CreateDate    = DateTime.Now;
                infoDetail.ChangeDate    = DateTime.Now;
                mrDetail.CreateNew(infoDetail);
            }
        }
示例#2
0
        public static int insertInventory(List <ImportInventoryEntity> list, long operatorID)
        {
            int count = 0;
            InventoryRepository mr = new InventoryRepository();

            if (list != null && list.Count > 0)
            {
                List <InventoryInfo> listInv = new List <InventoryInfo>();
                foreach (ImportInventoryEntity entity in list)
                {
                    InventoryInfo info = new InventoryInfo();
                    if (entity != null)
                    {
                        count++;
                        //List<GoodsEntity> listGoods = GoodsService.GetGoodsByRule(entity.GoodsNo, -1);
                        //GoodsEntity entityGood = listGoods != null && listGoods.Count > 0 ? listGoods[0] : null;
                        List <StorageEntity> listStorage   = StorageService.GetStorageByRule(entity.StorageName, -1);
                        StorageEntity        entityStorage = listStorage != null && listStorage.Count > 0 ? listStorage[0] : null;

                        List <CustomerEntity> listCustomer   = CustomerService.GetCustomerByRule(entity.CustomerName, -1);
                        CustomerEntity        entityCustomer = listCustomer != null && listCustomer.Count > 0 ? listCustomer[0] : null;
                        info.GoodsID       = entity.GoodsID;
                        info.StorageID     = entityStorage != null ? entityStorage.StorageID : 0;
                        info.Quantity      = entity.Quantity.ToInt(0);
                        info.CustomerID    = entityCustomer != null ? entityCustomer.CustomerID : 0;
                        info.InventoryType = Common.InventoryType.入库.ToString();
                        info.BatchNumber   = entity.BatchNumber;
                        info.ProductDate   = DateTime.Parse(entity.ProductDate);
                        info.InventoryDate = DateTime.Now;
                        info.UnitPrice     = 0;
                        info.Remark        = "库存导入";
                        info.OperatorID    = operatorID;
                        info.CreateDate    = DateTime.Now;
                        info.ChangeDate    = DateTime.Now;
                        listInv.Add(info);
                    }
                }
                //生成入库单
                InventoryExecOrder orderExec = OrderService.CreateOrderByInventory(listInv);

                if (listInv != null && listInv.Count > 0)
                {
                    foreach (InventoryInfo info in listInv)
                    {
                        //插入库存
                        info.InventoryID = mr.CreateNew(info);
                        //库存明细保存
                        CreateInventoryDetail(info, orderExec, info.StorageID, info.InventoryDate, operatorID);
                    }
                }
            }
            return(count);
        }
示例#3
0
        /// <summary>
        /// 库存处理
        /// </summary>
        /// <param name="listInv">入库数据</param>
        /// <param name="tempType">温区</param>
        /// <param name="StorageID">仓库编号</param>
        /// <param name="inventoryDate">入库时间</param>
        /// <param name="OperatorID">操作人</param>
        public static void InventoryProcess(List <InventoryInfo> listInv, string tempType, int StorageID, string inventoryDate, long OperatorID)
        {
            //生成入库单
            InventoryExecOrder orderExec = OrderService.CreateOrderByInventory(listInv, tempType);

            if (listInv != null && listInv.Count > 0)
            {
                foreach (InventoryInfo info in listInv)
                {
                    InventoryRepository mr = new InventoryRepository();
                    //插入库存
                    info.InventoryID = mr.CreateNew(info);

                    //库存明细保存
                    CreateInventoryDetail(info, orderExec, StorageID, DateTime.Parse(inventoryDate), OperatorID);
                }
            }
        }