|
|
@@ -62,6 +62,8 @@ namespace UAS_MES.Make
|
|
|
StringBuilder insertSninfoValues;//存插入sninfo的值
|
|
|
|
|
|
StringBuilder toSi;//存更新sninfo的值
|
|
|
+
|
|
|
+ string macOrBt = "";//存储去掉":"或者"-"的mac和bt
|
|
|
public Make_SeqProgramTransform()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
@@ -357,18 +359,23 @@ namespace UAS_MES.Make
|
|
|
private bool checkRules(int step)
|
|
|
{
|
|
|
type = ListA.Rows[step - 2]["psr_type"].ToString() == "WIFI" ? "MAC" : ListA.Rows[step - 2]["psr_type"].ToString();
|
|
|
+ //将type中的mac和bt中的"-"和":"号去掉
|
|
|
+ if (type == "MAC" || type == "BT")
|
|
|
+ {
|
|
|
+ macOrBt = code.Text.Replace(":", "").Replace("-", "");
|
|
|
+ }
|
|
|
//如果前缀和长度都满足的话
|
|
|
if ((ListA.Rows[step - 2]["psr_length"].ToString() == "" ? true : code.Text.Length != int.Parse(ListA.Rows[step - 2]["psr_length"].ToString())))
|
|
|
{
|
|
|
OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"] + "长度校验不通过,请重新输入\n", Color.Red);
|
|
|
- OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black,code);
|
|
|
+ OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black, code);
|
|
|
return false;
|
|
|
}
|
|
|
//以|符号分割前缀
|
|
|
string[] preFixs = ListA.Rows[step - 2]["psr_prefix"].ToString().Split('|');
|
|
|
//只要满足其中一个前缀条件即可
|
|
|
bool isfit = false;
|
|
|
- for (int i=0;i<preFixs.Length;i++) {
|
|
|
+ for (int i = 0; i < preFixs.Length; i++) {
|
|
|
if (preFixs[i] == "" ? true : code.Text.StartsWith(preFixs[i]))
|
|
|
{
|
|
|
//满足其中一条即可
|
|
|
@@ -379,7 +386,7 @@ namespace UAS_MES.Make
|
|
|
if (!isfit)
|
|
|
{
|
|
|
OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"] + "前缀校验不通过,请重新输入\n", Color.Red);
|
|
|
- OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black,code);
|
|
|
+ OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black, code);
|
|
|
return false;
|
|
|
}
|
|
|
switch (type)
|
|
|
@@ -387,20 +394,26 @@ namespace UAS_MES.Make
|
|
|
case "IMEI1":
|
|
|
case "IMEI2":
|
|
|
case "IMEI3":
|
|
|
- if (!ChangeResult.Checked&&checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and (ms_imei1='" + code.Text + "' or ms_imei2 = '" + code.Text + "' or ms_imei3 = '" + code.Text + "')")
|
|
|
- || ChangeResult.Checked && checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and (ms_imei1='" + code.Text + "' or ms_imei2 = '" + code.Text + "' or ms_imei3 = '" + code.Text + "') and ms_id <> '"+oMsid+"'"))
|
|
|
+ if (!ChangeResult.Checked && checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and (ms_imei1='" + code.Text + "' or ms_imei2 = '" + code.Text + "' or ms_imei3 = '" + code.Text + "')")
|
|
|
+ || ChangeResult.Checked && checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and (ms_imei1='" + code.Text + "' or ms_imei2 = '" + code.Text + "' or ms_imei3 = '" + code.Text + "') and ms_id <> '" + oMsid + "'"))
|
|
|
{
|
|
|
OperateResult.AppendText(">>" + type + ":" + code.Text + "错误,不允许重复\n", Color.Red);
|
|
|
- OperateResult.AppendText(">>请输入" + type + "\n", Color.Black,code);
|
|
|
+ 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 + "'"))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>" + type + ":" + code.Text + "错误,不允许重复\n", Color.Red);
|
|
|
+ OperateResult.AppendText(">>请输入" + type + "\n", Color.Black, code);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
//判断IMEI1,IMEI2,IMEI3中是否已经有这个号了
|
|
|
if (imei.ToString().Contains(code.Text))
|
|
|
{
|
|
|
OperateResult.AppendText(">>" + type + ":" + code.Text + "已录,请重新输入\n", Color.Red);
|
|
|
- OperateResult.AppendText(">>请输入" + type + "\n", Color.Black,code);
|
|
|
+ OperateResult.AppendText(">>请输入" + type + "\n", Color.Black, code);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -408,19 +421,52 @@ namespace UAS_MES.Make
|
|
|
imei.Append("'" + code.Text + "',");
|
|
|
s1.Append("MS_" + type + " = '" + code.Text + "',");
|
|
|
insertSninfoFields.Append("si_" + type + ",");
|
|
|
- insertSninfoValues.Append("'"+code.Text+"',");
|
|
|
+ insertSninfoValues.Append("'" + code.Text + "',");
|
|
|
toSi.Append("si_" + type + " = '" + code.Text + "',");
|
|
|
break;
|
|
|
case "BT":
|
|
|
case "MAC":
|
|
|
+ if (!ChangeResult.Checked && checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + type + "='" + macOrBt + "'")
|
|
|
+ || ChangeResult.Checked && checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + type + "='" + macOrBt + "' 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() + "\n", Color.Black, code);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //校验在sninfo表中是否存在
|
|
|
+ if (dh.CheckExist("sninfo", "si_" + type + "='" + macOrBt + "'"))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,不允许重复\n", Color.Red);
|
|
|
+ OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //通过校验,将包含IMEI的值拼接
|
|
|
+ s1.Append("MS_" + type + " = '" + macOrBt + "',");
|
|
|
+ insertSninfoFields.Append("si_" + type + ",");
|
|
|
+ insertSninfoValues.Append("'" + macOrBt + "',");
|
|
|
+ toSi.Append("si_" + type + " = '" + macOrBt + "',");
|
|
|
+ break;
|
|
|
case "NETCODE":
|
|
|
- if (!ChangeResult.Checked&&checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + type + "='" + code.Text + "'")
|
|
|
- || ChangeResult.Checked && checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + type + "='" + code.Text + "' and ms_id <> '"+oMsid+"'"))
|
|
|
+ if (!ChangeResult.Checked && checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + type + "='" + code.Text + "'")
|
|
|
+ || ChangeResult.Checked && checkExist("ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + type + "='" + code.Text + "' 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() + "\n", Color.Black,code);
|
|
|
+ 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 + "'"))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,不允许重复\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 + "',");
|
|
|
insertSninfoFields.Append("si_" + type + ",");
|
|
|
@@ -429,7 +475,14 @@ namespace UAS_MES.Make
|
|
|
break;
|
|
|
}
|
|
|
//满足规则,则采集
|
|
|
- hs.Add(ListA.Rows[step - 2]["psr_type"].ToString(), code.Text);
|
|
|
+ if (type == "MAC" || type == "BT")
|
|
|
+ {
|
|
|
+ hs.Add(ListA.Rows[step - 2]["psr_type"].ToString(), macOrBt);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ hs.Add(ListA.Rows[step - 2]["psr_type"].ToString(), code.Text);
|
|
|
+ }
|
|
|
//说明已经是最后一个校验规则
|
|
|
if (step == ListA.Rows.Count + 1)
|
|
|
{
|
|
|
@@ -441,8 +494,8 @@ namespace UAS_MES.Make
|
|
|
//遍历判断已采集的信息是否已存在
|
|
|
foreach (DictionaryEntry de in hs)
|
|
|
{
|
|
|
- if (!ChangeResult.Checked &&dh.CheckExist("makeserial", "ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + (de.Key.ToString() == "WIFI" ? "MAC" : de.Key) + "='" + de.Value + "'")
|
|
|
- ||(ChangeResult.Checked&& dh.CheckExist("makeserial", "ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + (de.Key.ToString() == "WIFI" ? "MAC" : de.Key) + "='" + de.Value + "' and ms_id <> '"+oMsid+"'")))
|
|
|
+ if (!ChangeResult.Checked && dh.CheckExist("makeserial", "ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + (de.Key.ToString() == "WIFI" ? "MAC" : de.Key) + "='" + de.Value + "'")
|
|
|
+ || (ChangeResult.Checked && dh.CheckExist("makeserial", "ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and MS_" + (de.Key.ToString() == "WIFI" ? "MAC" : de.Key) + "='" + de.Value + "' and ms_id <> '" + oMsid + "'")))
|
|
|
{
|
|
|
flag = false;
|
|
|
OperateResult.AppendText(">>" + de.Key + "已被使用,请重新输入TSN,重新转换\n", Color.Red);
|
|
|
@@ -450,6 +503,18 @@ namespace UAS_MES.Make
|
|
|
clearInfo();
|
|
|
break;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //校验sninfo中是否存在
|
|
|
+ if (dh.CheckExist("sninfo", "si_" + (de.Key.ToString() == "WIFI" ? "MAC" : de.Key) + "='" + de.Value + "'"))
|
|
|
+ {
|
|
|
+ flag = false;
|
|
|
+ OperateResult.AppendText(">>" + de.Key + "已被使用,请重新输入TSN,重新转换\n", Color.Red);
|
|
|
+ //清空信息
|
|
|
+ clearInfo();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//根据flag判断关联采集信息二次校验结果
|