Beispiel #1
0
        public static ReturnValue Login(string userId, string passWord)
        {
            var         userDao = SqlSugarDB.Instance <tbl_HSCUSER>();
            ReturnValue rv      = new ReturnValue();
            MD5         d5      = MD5.Create();

            byte[] buffer    = Encoding.Default.GetBytes(passWord);
            byte[] md5buffer = d5.ComputeHash(buffer);
            string str       = null;

            foreach (byte b in md5buffer)
            {
                //得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符
                //但是在和对方测试过程中,发现我这边的MD5加密编码,经常出现少一位或几位的问题;
                //后来分析发现是 字符串格式符的问题, X 表示大写, x 表示小写,
                //X2和x2表示不省略首位为0的十六进制数字;
                str += b.ToString("x2");
            }
            try
            {
                tbl_HSCUSER user = userDao.Query().First(p => p.UserID == userId && p.UserPwd == str);
                if (user == null)
                {
                    return(rv.Fail("用户名或者密码错误!"));
                }
                userInfo = user;
                return(rv.Success("登录成功!"));
            }
            catch (Exception e)
            {
                return(rv.Fail(e.Message));
            }
        }
        /// <summary>
        /// 编辑物料对应关系
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnValue UpdateMatMapingInfo(MatMaping model)
        {
            ReturnValue rv     = new ReturnValue();
            var         matDao = SqlSugarDB.Instance <MatMaping>();

            try
            {
                int result = matDao.Update(model).ExecuteCommand();
                if (result > 0)
                {
                    return(rv.Success("更新成功!"));
                }
                else
                {
                    return(rv.Fail("物料对应关系更新失败!"));
                }
            }
            catch (Exception e)
            {
                return(rv.Fail(e.Message));
            }
        }
        /// <summary>
        /// 批量删除物料关系
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnValue DelMatMapingInfo(string[] batArrays)
        {
            ReturnValue rv           = new ReturnValue();
            var         matMapingDao = SqlSugarDB.Instance <MatMaping>();

            try
            {
                int result = matMapingDao.Delete(batArrays).ExecuteCommand();
                if (result > 0)
                {
                    return(rv.Success("删除成功!"));
                }
                else
                {
                    return(rv.Fail("物料对应关系删除失败!"));
                }
            }
            catch (Exception e)
            {
                return(rv.Fail(e.Message));
            }
        }
Beispiel #4
0
        public ReturnValue AddPackageInfo(packageInfo packageModel)
        {
            ReturnValue rv         = new ReturnValue();
            var         packageDao = SqlSugarDB.Instance <packageInfo>();

            //var packageDao = new DBHelper<packageInfo>();
            try
            {
                if (AfterPrinted != null)
                {
                    var package = packageDao.Query().First(p => p.seriesNo.Equals(packageModel.seriesNo));
                    if (package != null)
                    {
                        throw new Exception(string.Format("箱号:{0}已经存在,可能已经打印过了,请检查!", packageModel.seriesNo));
                    }
                    var result = packageDao.Insert(packageModel).ExecuteCommand();
                    if (result > 0)
                    {
                        string sdt          = packageModel.seriesNo.Substring(0, packageModel.seriesNo.Length - 5);
                        int    nextSnPre    = packageModel.seriesNo.Substring(packageModel.seriesNo.Length - 5, 5).ObjToInt() + 1;
                        string nextSeriesNo = sdt + nextSnPre.ToString().PadLeft(5, '0');
                        this.AfterPrinted(true, nextSeriesNo);
                        return(rv.Success(""));
                    }
                    else
                    {
                        return(rv.Fail("打印记录添加失败!"));
                    }
                }
                else
                {
                    return(rv.Fail("打印后续执行委托时异常!"));
                }
            }
            catch (Exception e)
            {
                return(rv.Fail(e.Message));
            }
        }
Beispiel #5
0
        /// <summary>
        /// 打印记录批量删除
        /// </summary>
        /// <param name="idArrays"></param>
        /// <returns></returns>
        public ReturnValue DeletePrintInfo(List <packageInfo> list)
        {
            ReturnValue rv         = new ReturnValue();
            var         packageDao = SqlSugarDB.Instance <packageInfo>();

            try
            {
                int result = packageDao.Update(list).ExecuteCommand();
                if (result > 0)
                {
                    return(rv.Success("删除成功!"));
                }
                else
                {
                    return(rv.Fail("标签记录删除失败!"));
                }
            }
            catch (Exception e)
            {
                return(rv.Fail(e.Message));
            }
        }
Beispiel #6
0
        /// <summary>
        /// 新增物料
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnValue AddMatInfo(tblMaterial model)
        {
            ReturnValue rv     = new ReturnValue();
            var         matDao = SqlSugarDB.Instance <tblMaterial>();

            try
            {
                int result = matDao.Insert(model).ExecuteCommand();
                if (result > 0)
                {
                    return(rv.Success("添加成功!"));
                }
                else
                {
                    return(rv.Fail("物料添加失败!"));
                }
            }
            catch (Exception e)
            {
                return(rv.Fail(e.Message));
            }
        }