chengsc
2024-09-09 0c9661af88f5533ac73fbab82da39ea78d42853b
修改托盘码生成规则
2个文件已修改
51 ■■■■ 已修改文件
Wms/WMS.BLL/SysServer/PalletsServer.cs 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Wms/Controllers/SysController.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/SysServer/PalletsServer.cs
@@ -71,13 +71,17 @@
        {
            try
            {
                var time = DateTime.Now.ToString("yyyy");
                var time2 = time.Substring(2, 2);
                int codeId;
                //var time = DateTime.Now.ToString("yyyy");
                //var time2 = time.Substring(2, 2);
                int liuShuiCode ;
                if (!string.IsNullOrWhiteSpace(palletNo))
                {
                    var code = PalletsRst.GetAllWhereAsync(m => m.PalletNo == palletNo).First();
                    if (code == null)
                    {
                        throw new Exception("托盘码在系统中未查询到");
                    }
                    return code.PalletNo;
                }
                else
@@ -86,22 +90,14 @@
                    if (code != null)
                    {
                        string riQi = code.PalletNo.Substring(1, 2);
                        if (riQi == time2)
                        {
                            codeId = int.Parse(code.PalletNo.Substring(3, 5)) + 1;
                        liuShuiCode = int.Parse(code.PalletNo.Substring(2, 6)) + 1;
                        }
                        else
                        {
                            codeId = int.Parse("00001");
                        liuShuiCode = int.Parse("000001");
                        }
                    }
                    else
                    {
                        codeId = int.Parse("00001");
                    }
                    int liuShuiId = codeId;
                    var pallet = "T"+time2 + Convert.ToString(liuShuiId).PadLeft(5, '0');
                    var pallet = "LN" + Convert.ToString(liuShuiCode).PadLeft(6, '0');
                    return pallet;
                }
            }
@@ -120,21 +116,24 @@
                {
                    throw new Exception("组数需大于0");
                }
                //托盘条码规则  LN+6位流水  例如 LN000001
                var pallNo = db.Queryable<SysPallets>().Max(m => m.PalletNo);
                var str = pallNo.Substring(3, 5);
                string remove = pallNo.Substring(0, 3);
                if (string.IsNullOrWhiteSpace(pallNo))
                {
                    pallNo = "LN000000";
                }
                var str = pallNo.Substring(2, 6);   //
                string remove = pallNo.Substring(0, 2);
                int sibelius = Convert.ToInt16(str);
                var num = 0;
                for (int i = 0; i < groupCount; i++)
                {
                    sibelius += 1;
                    if (sibelius>99999)
                    if (sibelius>999999)
                    {
                        throw new Exception("托盘码位数已达上线");
                    }
                    string code = remove + Convert.ToString(sibelius).PadLeft(5, '0');
                    string code = remove + Convert.ToString(sibelius).PadLeft(6, '0');
                    if (db.Queryable<SysPallets>().Count(m=>m.PalletNo == code)>=1)
                    {
                        continue;
Wms/Wms/Controllers/SysController.cs
@@ -1374,17 +1374,21 @@
                {
                    throw new Exception("当前显示的条码不是最新条码,请重新添加");
                }
                string str = model.PalletNo.Substring(3, 5);
                string remove = model.PalletNo.Substring(0, 3);
                string str = model.PalletNo.Substring(2, 6);
                string remove = model.PalletNo.Substring(0, 2);
                int sibelius = Convert.ToInt16(str);
                for (int i = 0; i < model.GroupCount; i++)
                {
                    if (sibelius>999999)
                    {
                        throw new Exception("托盘组中已有托盘码位数已达上线");
                    }
                    if (i != 0)
                    {
                        sibelius += 1;
                    }
                    string code = remove + Convert.ToString(sibelius).PadLeft(5, '0');
                    string code = remove + Convert.ToString(sibelius).PadLeft(6, '0');
                    for (int j = 0; j < model.SameCount; j++)
                    {
                        var re = BarcodeHelper.GetCodeBarBase64(code, 80, 50);