wxw
2025-07-18 3e7b82e73d972972bab8c67dac7a5a6078f30a8b
修改问题
1个文件已修改
59 ■■■■ 已修改文件
Wms/WMS.DAL/Common.cs 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.DAL/Common.cs
@@ -20,7 +20,7 @@
    {
        //public static readonly DataContext Db = new DataContext();
        private readonly object GetMaxNoLock = new object();
        /// <summary>
        /// 获取深度为1的储位号(根据深度为2的储位号)
        /// </summary>
@@ -163,40 +163,43 @@
        /// <returns></returns>
        public string GetMaxNo(string codeFlag)
        {
            try
            {
                var maxNo = "";
                //获取异常号
                maxNo = SelectMaxNo(codeFlag);
                if (!string.IsNullOrEmpty(maxNo))
            lock (GetMaxNoLock)
            {
                try
                {
                    maxNo = maxNo.Substring(codeFlag.Length);
                }
                //获取数据库时间八位
                string date = DateTime.Now.ToString("yyyyMMdd").Trim();
                string no = "";
                if (string.IsNullOrEmpty(maxNo))
                {
                    no = codeFlag + date + "00001";
                }
                else
                {
                    if (maxNo.Substring(0, 8) == date)
                    var maxNo = "";
                    //获取异常号
                    maxNo = SelectMaxNo(codeFlag);
                    if (!string.IsNullOrEmpty(maxNo))
                    {
                        int lastNo = Convert.ToInt32(maxNo.Substring(8, 5)) + 1;
                        no = codeFlag + date + (lastNo.ToString().PadLeft(5, '0'));
                        maxNo = maxNo.Substring(codeFlag.Length);
                    }
                    else
                    //获取数据库时间八位
                    string date = DateTime.Now.ToString("yyyyMMdd").Trim();
                    string no = "";
                    if (string.IsNullOrEmpty(maxNo))
                    {
                        no = codeFlag + date + "00001";
                    }
                    else
                    {
                        if (maxNo.Substring(0, 8) == date)
                        {
                            int lastNo = Convert.ToInt32(maxNo.Substring(8, 5)) + 1;
                            no = codeFlag + date + (lastNo.ToString().PadLeft(5, '0'));
                        }
                        else
                        {
                            no = codeFlag + date + "00001";
                        }
                    }
                    return no;
                }
                return no;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }
        }
        /// <summary>