Ejemplo n.º 1
0
        /// <summary>
        /// 新增盘点记录
        /// </summary>
        public int NewInventory(List <GoodsDto> list, InventoryType type)
        {
            InventoryOrderLDB inventoryOrder = new InventoryOrderLDB();
            var ran = new Random();

            inventoryOrder.create_time = System.DateTime.Now;
            inventoryOrder.type        = (int)type;

            //设置状态为待确认
            inventoryOrder.status = (int)InventoryStatus.Unconfirm;

            if (type == InventoryType.Manual)
            {
                inventoryOrder.operator_id   = 1;
                inventoryOrder.operator_name = ApplicationState.GetUserInfo().name;
                inventoryOrder.type          = (int)InventoryType.Manual;
            }
            else
            {
                inventoryOrder.type = (int)InventoryType.Auto;
            }

            inventoryOrder.code = "INV" + DateTime.Now.ToString("yyyyMMddHHmm") + ran.Next(9999);

            //生成记录

            int id = inventoryDal.NewInventory(inventoryOrder);

            InsertInventoryDetails(list, id);

            return(id);
        }