|
|
@@ -23,6 +23,12 @@ namespace UAS_MES.Make
|
|
|
|
|
|
string errorMessage = "";
|
|
|
|
|
|
+ string startNo = "";//起始序列
|
|
|
+
|
|
|
+ string endNo = "";//终止序列
|
|
|
+
|
|
|
+ string system = "";//进制
|
|
|
+
|
|
|
public Make_SeqTransform()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
@@ -150,6 +156,13 @@ namespace UAS_MES.Make
|
|
|
//bsncode不为空,说明输入的是转换后的序列号
|
|
|
else
|
|
|
{
|
|
|
+ //判断输入的转换后序列号是否符合起始终止
|
|
|
+ if (!checkStartAndEnd())
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>序列号" + sncode.Text + "校验错误,不在工单防呆规则指定范围内!\n", Color.Red);
|
|
|
+ sncode.Text = "";
|
|
|
+ return;
|
|
|
+ }
|
|
|
//判断用户是否锁定输入转换后序列号长度,
|
|
|
if (!checkLengthOrPre(afterTransSNLength_checkBox, afterTransSNLength, "长度"))
|
|
|
return;
|
|
|
@@ -273,7 +286,7 @@ namespace UAS_MES.Make
|
|
|
afterTransSNPre_checkBox.Enabled = true;
|
|
|
afterTransSNLength_checkBox.Enabled = true;
|
|
|
//查询表工单序列号防呆规则表
|
|
|
- dt = (DataTable)dh.ExecuteSql("select msr_type, msr_prefix ,msr_length from makesnrule where msr_makecode='" + ma_code.Text + "'", "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select msr_startno,msr_endno,msr_system,msr_type, msr_prefix ,msr_length from makesnrule where msr_makecode='" + ma_code.Text + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
@@ -315,6 +328,8 @@ namespace UAS_MES.Make
|
|
|
//临时变量记录
|
|
|
string length = dr["msr_length"].ToString();
|
|
|
string prefix = dr["msr_prefix"].ToString();
|
|
|
+ //记录进制
|
|
|
+ system = dr["msr_system"].ToString();
|
|
|
//不为空
|
|
|
if (prefix != "" && prefix != null)
|
|
|
{
|
|
|
@@ -325,7 +340,12 @@ namespace UAS_MES.Make
|
|
|
//勾选
|
|
|
afterTransSNPre_checkBox.Checked = true;
|
|
|
afterTransSNPre_checkBox.Enabled = false;
|
|
|
+ //记录起止序列号
|
|
|
+ startNo = dr["msr_startno"].ToString().Substring(prefix.Length - 1);
|
|
|
+ endNo = dr["msr_endno"].ToString().Substring(prefix.Length - 1);
|
|
|
}
|
|
|
+ startNo = dr["msr_startno"].ToString();
|
|
|
+ endNo = dr["msr_endno"].ToString();
|
|
|
if (length != "" && length != null)
|
|
|
{
|
|
|
//赋值
|
|
|
@@ -399,5 +419,52 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 检测转换后的序列号是否满足起止序列号范围
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool checkStartAndEnd()
|
|
|
+ {
|
|
|
+ if (system == "decimal")
|
|
|
+ {
|
|
|
+ //十进制
|
|
|
+ if (afterTransSNPre.Text.Trim() == "")
|
|
|
+ {
|
|
|
+ if (int.Parse(sncode.Text) >= int.Parse(startNo) && int.Parse(sncode.Text) <= int.Parse(endNo))
|
|
|
+ {
|
|
|
+ //满足范围条件
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length-1))>= int.Parse(startNo)&& int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length - 1)) <= int.Parse(endNo))
|
|
|
+ {
|
|
|
+ //满足
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //十六进制
|
|
|
+ if (afterTransSNPre.Text.Trim() == "")
|
|
|
+ {
|
|
|
+ if (int.Parse(sncode.Text) >= int.Parse(startNo,System.Globalization.NumberStyles.HexNumber) && int.Parse(sncode.Text) <= int.Parse(endNo, System.Globalization.NumberStyles.HexNumber))
|
|
|
+ {
|
|
|
+ //满足范围条件
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length - 1)) >= int.Parse(startNo, System.Globalization.NumberStyles.HexNumber) && int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length - 1)) <= int.Parse(endNo, System.Globalization.NumberStyles.HexNumber))
|
|
|
+ {
|
|
|
+ //满足
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|