shim 8 gadi atpakaļ
vecāks
revīzija
ae8d55f346

+ 42 - 21
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -66,6 +66,8 @@ namespace UAS_MES.Make
         StringBuilder toSi;//存更新sninfo的值
 
         string macOrBt = "";//存储去掉":"或者"-"的mac和bt
+
+        string imeif = "";
         public Make_SeqProgramTransform()
         {
             InitializeComponent();
@@ -291,6 +293,7 @@ namespace UAS_MES.Make
                                     if (errorMessage.Contains("AFTERSUCCESS"))
                                         OperateResult.AppendText(">>" + errorMessage + "\n");
                                     onlyPass = false;
+                                    show_sncode.Text = "";
                                     ChangeResult.Enabled = true;
                                     step = 0;
                                 }
@@ -411,7 +414,25 @@ namespace UAS_MES.Make
             //将type中的mac和bt中的"-"和":"号去掉
             if (type == "MAC" || type == "BT")
             {
-                macOrBt = code.Text.Replace(":", "").Replace("-", "");
+                if (code.Text.Length > 40)
+                {
+                    macOrBt = code.Text.Substring(0, 40).Replace(":", "").Replace("-", "");
+                }
+                else
+                {
+                    macOrBt = code.Text.Replace(":", "").Replace("-", "");
+                }
+            }
+            else
+            {
+                if (code.Text.Length > 40)
+                {
+                    imeif = code.Text.Substring(0, 40);
+                }
+                else
+                {
+                    imeif = code.Text;
+                }
             }
             //如果前缀和长度都满足的话
             if ((ListA.Rows[step - 2]["psr_length"].ToString() == "0" ? false : code.Text.Length != int.Parse(ListA.Rows[step - 2]["psr_length"].ToString())))
@@ -444,35 +465,35 @@ namespace UAS_MES.Make
                 case "IMEI1":
                 case "IMEI2":
                 case "IMEI3":
-                    if (!ChangeResult.Checked && checkExist("(ms_imei1='" + code.Text + "' or ms_imei2 = '" + code.Text + "' or ms_imei3 = '" + code.Text + "') and  ms_status in (0,1,2,3)")
-                        || ChangeResult.Checked && checkExist("(ms_imei1='" + code.Text + "' or ms_imei2 = '" + code.Text + "' or ms_imei3 = '" + code.Text + "') and  ms_status in (0,1,2,3)  and ms_id <> '" + oMsid + "'"))
+                    if (!ChangeResult.Checked && checkExist("(ms_imei1='" + imeif + "' or ms_imei2 = '" + imeif + "' or ms_imei3 = '" + imeif + "') and  ms_status in (0,1,2,3)")
+                        || ChangeResult.Checked && checkExist("(ms_imei1='" + imeif + "' or ms_imei2 = '" + imeif + "' or ms_imei3 = '" + imeif + "') and  ms_status in (0,1,2,3)  and ms_id <> '" + oMsid + "'"))
                     {
-                        OperateResult.AppendText(">>" + type + ":" + code.Text + "错误,不允许重复\n", Color.Red);
+                        OperateResult.AppendText(">>" + type + ":" + imeif + "错误,不允许重复\n", Color.Red);
                         OperateResult.AppendText(">>请输入" + type + "\n", Color.Black, code);
                         return false;
                     }
                     else
                     {   //校验sninfo中是否已经存在这个
-                        if (dh.CheckExist("sninfo", "(si_imei1='" + code.Text + "' or si_imei2 = '" + code.Text + "' or si_imei3 = '" + code.Text + "') and si_id <>'" + siid + "'"))
+                        if (dh.CheckExist("sninfo", "(si_imei1='" + imeif + "' or si_imei2 = '" + imeif + "' or si_imei3 = '" + imeif + "') and si_id <>'" + siid + "'"))
                         {
-                            OperateResult.AppendText(">>" + type + ":" + code.Text + "错误,不允许重复\n", Color.Red);
+                            OperateResult.AppendText(">>" + type + ":" + imeif + "错误,不允许重复\n", Color.Red);
                             OperateResult.AppendText(">>请输入" + type + "\n", Color.Black, code);
                             return false;
                         }
                         //判断IMEI1,IMEI2,IMEI3中是否已经有这个号了
-                        if (imei.ToString().Contains(code.Text))
+                        if (imei.ToString().Contains(imeif))
                         {
-                            OperateResult.AppendText(">>" + type + ":" + code.Text + "已录,请重新输入\n", Color.Red);
+                            OperateResult.AppendText(">>" + type + ":" + imeif + "已录,请重新输入\n", Color.Red);
                             OperateResult.AppendText(">>请输入" + type + "\n", Color.Black, code);
                             return false;
                         }
                     }
                     //通过校验,将包含IMEI的值拼接
-                    imei.Append("'" + code.Text + "',");
-                    s1.Append("MS_" + type + " = '" + code.Text + "',");
+                    imei.Append("'" + imeif + "',");
+                    s1.Append("MS_" + type + " = '" + imeif + "',");
                     insertSninfoFields.Append("si_" + type + ",");
-                    insertSninfoValues.Append("'" + code.Text + "',");
-                    toSi.Append("si_" + type + " = '" + code.Text + "',");
+                    insertSninfoValues.Append("'" + imeif + "',");
+                    toSi.Append("si_" + type + " = '" + imeif + "',");
                     break;
                 case "BT":
                 case "MAC":
@@ -514,28 +535,28 @@ namespace UAS_MES.Make
                     toSi.Append("si_" + type + " = '" + macOrBt + "',");
                     break;
                 case "NETCODE":
-                    if (!ChangeResult.Checked && checkExist("MS_" + type + "='" + code.Text + "' and  ms_status in (0,1,2,3)")
-                        || ChangeResult.Checked && checkExist("MS_" + type + "='" + code.Text + "' and  ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "'"))
+                    if (!ChangeResult.Checked && checkExist("MS_" + type + "='" + imeif + "' and  ms_status in (0,1,2,3)")
+                        || ChangeResult.Checked && checkExist("MS_" + type + "='" + imeif + "' and  ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "'"))
                     {
-                        OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,不允许重复\n", Color.Red);
+                        OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + imeif + "错误,不允许重复\n", Color.Red);
                         OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code);
                         return false;
                     }
                     else
                     {
                         //校验在sninfo表中是否存在
-                        if (dh.CheckExist("sninfo", "si_" + type + "='" + code.Text + "' and si_id <>'" + siid + "'"))
+                        if (dh.CheckExist("sninfo", "si_" + type + "='" + imeif + "' and si_id <>'" + siid + "'"))
                         {
-                            OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,不允许重复\n", Color.Red);
+                            OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + imeif + "错误,不允许重复\n", Color.Red);
                             OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code);
                             return false;
                         }
                     }
                     //通过校验,将包含IMEI的值拼接
-                    s1.Append("MS_" + type + " = '" + code.Text + "',");
+                    s1.Append("MS_" + type + " = '" + imeif + "',");
                     insertSninfoFields.Append("si_" + type + ",");
-                    insertSninfoValues.Append("'" + code.Text + "',");
-                    toSi.Append("si_" + type + " = '" + code.Text + "',");
+                    insertSninfoValues.Append("'" + imeif + "',");
+                    toSi.Append("si_" + type + " = '" + imeif + "',");
                     break;
             }
             //满足规则,则采集
@@ -545,7 +566,7 @@ namespace UAS_MES.Make
             }
             else
             {
-                hs.Add(ListA.Rows[step - 2]["psr_type"].ToString(), code.Text);
+                hs.Add(ListA.Rows[step - 2]["psr_type"].ToString(), imeif);
             }
             //说明已经是最后一个校验规则
             if (step == ListA.Rows.Count + 1)

+ 1 - 0
UAS-MES/FunctionCode/Make/Make_SeqTransform.cs

@@ -266,6 +266,7 @@ namespace UAS_MES.Make
                                         OperateResult.AppendText(">>" + errorMessage + "\n");
                                     flag = false;
                                     ChangeResult.Enabled = true;
+                                    show_sncode.Text = "";
                                     bsncode = "";
                                 }
                                 else