Sfoglia il codice sorgente

采集关联采集信息时,如果长度大于40则截取40位比对长度

shim 8 anni fa
parent
commit
afe15f2c51
1 ha cambiato i file con 18 aggiunte e 5 eliminazioni
  1. 18 5
      UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

+ 18 - 5
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -395,12 +395,25 @@ namespace UAS_MES.Make
                     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())))
+            if (code.Text.Length > 40)
             {
-                OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"] + "长度需为"+ ListA.Rows[step - 2]["psr_length"].ToString() + "校验不通过,请重新输入\n", Color.Red);
-                OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black, code);
-                return false;
+                //如果前缀和长度都满足的话
+                if ((ListA.Rows[step - 2]["psr_length"].ToString() == "0" ? false : code.Text.Substring(0,40).Length != int.Parse(ListA.Rows[step - 2]["psr_length"].ToString())))
+                {
+                    OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"] + "长度需为" + ListA.Rows[step - 2]["psr_length"].ToString() + "校验不通过,请重新输入\n", Color.Red);
+                    OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black, code);
+                    return false;
+                }
+            }
+            else
+            {
+                //如果前缀和长度都满足的话
+                if ((ListA.Rows[step - 2]["psr_length"].ToString() == "0" ? false : code.Text.Length != int.Parse(ListA.Rows[step - 2]["psr_length"].ToString())))
+                {
+                    OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"] + "长度需为" + ListA.Rows[step - 2]["psr_length"].ToString() + "校验不通过,请重新输入\n", Color.Red);
+                    OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black, code);
+                    return false;
+                }
             }
             //以|符号分割前缀
             string[] preFixs = ListA.Rows[step - 2]["psr_prefix"].ToString().Split('|');