Пример #1
0
        /// <summary>
        /// 新增产品
        /// </summary>
        /// <param name="pdt"></param>
        /// <param name="sn">序列化产品的序列号</param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public bool AddIvtProduct(ivt_warehouse_product pdt, string sn, long userId)
        {
            pdt.id             = dal.GetNextIdCom();
            pdt.create_time    = Tools.Date.DateHelper.ToUniversalTimeStamp();
            pdt.create_user_id = userId;
            pdt.update_time    = pdt.create_time;
            pdt.update_user_id = userId;

            dal.Insert(pdt);
            OperLogBLL.OperLogAdd <ivt_warehouse_product>(pdt, pdt.id, userId, DTO.DicEnum.OPER_LOG_OBJ_CATE.INVENTORY_ITEM, "新增库存产品");

            SaveProductSn(sn, pdt.id, userId);

            return(true);
        }
Пример #2
0
        /// <summary>
        ///新增产品库存信息
        /// </summary>
        /// <param name="stock"></param>
        /// <param name="user_id"></param>
        /// <returns></returns>
        public ERROR_CODE InsertProductStock(ivt_warehouse_product stock, long user_id)
        {
            var user = UserInfoBLL.GetUserInfo(user_id);

            if (user == null)
            {   // 查询不到用户,用户丢失
                return(ERROR_CODE.USER_NOT_FIND);
            }
            //唯一性校验
            ivt_warehouse_product_dal kk = new ivt_warehouse_product_dal();
            var re = kk.FindSignleBySql <ivt_warehouse_product>($"select * from ivt_warehouse_product where product_id={stock.product_id} and warehouse_id={stock.warehouse_id} and delete_time=0");

            if (re != null)
            {
                return(ERROR_CODE.EXIST);
            }
            stock.id             = (int)(_dal.GetNextIdCom());
            stock.create_time    = stock.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            stock.create_user_id = stock.update_user_id = user_id;
            kk.Insert(stock);
            //操作日志
            var add_log = new sys_oper_log()
            {
                user_cate           = "用户",
                user_id             = (int)user.id,
                name                = user.name,
                phone               = user.mobile == null ? "" : user.mobile,
                oper_time           = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now),
                oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.WAREHOUSE_PRODUCT, //
                oper_object_id      = stock.id,                                 // 操作对象id
                oper_type_id        = (int)OPER_LOG_TYPE.ADD,
                oper_description    = _dal.AddValue(stock),
                remark              = "新增产品库存信息"
            };                                      // 创建日志

            new sys_oper_log_dal().Insert(add_log); // 插入日志

            return(ERROR_CODE.SUCCESS);
        }