|
|
@@ -31,12 +31,12 @@ namespace UAS_MES.Make
|
|
|
|
|
|
string ms_id = "";
|
|
|
|
|
|
- StringBuilder sb ;
|
|
|
+ StringBuilder sb;
|
|
|
|
|
|
string sncode = "";
|
|
|
- StringBuilder oldData ;
|
|
|
+ StringBuilder oldData;
|
|
|
//记录新数据
|
|
|
- StringBuilder newData ;
|
|
|
+ StringBuilder newData;
|
|
|
public Make_UpdateCollectCode()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
@@ -62,15 +62,15 @@ namespace UAS_MES.Make
|
|
|
|
|
|
private void inputValue_KeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
- if (e.KeyCode==Keys.Enter)
|
|
|
+ if (e.KeyCode == Keys.Enter)
|
|
|
{
|
|
|
//输入不能为空
|
|
|
- if (inputValue.Text=="")
|
|
|
+ if (inputValue.Text == "")
|
|
|
{
|
|
|
OperateResult.AppendText("<<输入不能为空\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
- OperateResult.AppendText(">>"+inputValue.Text+"\n", Color.Black);
|
|
|
+ OperateResult.AppendText(">>" + inputValue.Text + "\n", Color.Black);
|
|
|
if (step == 0)
|
|
|
{
|
|
|
//判断是否有已勾选的项次
|
|
|
@@ -81,10 +81,10 @@ namespace UAS_MES.Make
|
|
|
list.Add((ctl as CheckBox));
|
|
|
}
|
|
|
}
|
|
|
- if (list.Count==0)
|
|
|
+ if (list.Count == 0)
|
|
|
{
|
|
|
//无勾选的内容
|
|
|
- OperateResult.AppendText("<<请先勾选需要更新的信息\n", Color.Red,inputValue);
|
|
|
+ OperateResult.AppendText("<<请先勾选需要更新的信息\n", Color.Red, inputValue);
|
|
|
return;
|
|
|
}
|
|
|
//判断TSN或者SN是否存在
|
|
|
@@ -96,9 +96,9 @@ namespace UAS_MES.Make
|
|
|
return;
|
|
|
}
|
|
|
//查询序列号状态
|
|
|
- dt = (DataTable)dh.ExecuteSql("select ms_status,ms_makecode from makeserial where ms_id='"+ms_id+"'", "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_status,ms_makecode from makeserial where ms_id='" + ms_id + "'", "select");
|
|
|
//序列号状态码必须是3
|
|
|
- if (dt.Rows[0]["ms_status"].ToString()!="3")
|
|
|
+ if (dt.Rows[0]["ms_status"].ToString() != "3")
|
|
|
{
|
|
|
OperateResult.AppendText("<<序列号必须是待维修状态\n", Color.Red, inputValue);
|
|
|
return;
|
|
|
@@ -106,9 +106,9 @@ namespace UAS_MES.Make
|
|
|
sql.Clear();
|
|
|
sql.Append("select * from (select rownum rn, ms_prodcode,ms_makecode,ms_salecode,");
|
|
|
sql.Append("ms_mac,ms_imei1,ms_bt,ms_netcode,ms_imei2,ms_imei3 from makeserial ");
|
|
|
- sql.Append("where ms_firstsn=(select ms_firstsn from makeserial where ms_id='"+ms_id+"')");
|
|
|
+ sql.Append("where ms_firstsn=(select ms_firstsn from makeserial where ms_id='" + ms_id + "')");
|
|
|
sql.Append(" and (nvl(ms_mac,' ')<>' ' or nvl(ms_bt,' ')<>' ' or nvl(ms_imei1,' ')<>' ' ) order by ms_id asc)where rn=1");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(),"select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
//无值则提示没有需要更新的信息
|
|
|
if (dt.Rows.Count == 0)
|
|
|
{
|
|
|
@@ -117,12 +117,12 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- info = (DataTable)dh.ExecuteSql("select psr_type,psr_prefix,psr_length from productsnrelation where psr_prodcode='"+dt.Rows[0]["ms_prodcode"].ToString() +"'", "select");
|
|
|
+ info = (DataTable)dh.ExecuteSql("select psr_type,psr_prefix,psr_length from productsnrelation where psr_prodcode='" + dt.Rows[0]["ms_prodcode"].ToString() + "'", "select");
|
|
|
//查询规则显示
|
|
|
collectCodeRules.DataSource = info;
|
|
|
}
|
|
|
step = 1;
|
|
|
- OperateResult.AppendText("<<请输入"+((CheckBox)list[0]).Text+"\n", Color.Green, inputValue);
|
|
|
+ OperateResult.AppendText("<<请输入" + ((CheckBox)list[0]).Text + "\n", Color.Green, inputValue);
|
|
|
sb = new StringBuilder();
|
|
|
oldData = new StringBuilder();
|
|
|
newData = new StringBuilder();
|
|
|
@@ -131,7 +131,7 @@ namespace UAS_MES.Make
|
|
|
//采集的关联采集信息
|
|
|
{
|
|
|
//从第一个开始
|
|
|
- switch (((CheckBox)list[step-1]).Text)
|
|
|
+ switch (((CheckBox)list[step - 1]).Text)
|
|
|
{
|
|
|
case "MAC/WIFI":
|
|
|
case "BT":
|
|
|
@@ -139,13 +139,13 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
//如果一样提示用户“MAC 不允许与原来的值一致”,“请采集MAC”;
|
|
|
OperateResult.AppendText("<<" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "不允许与原来的值一致\n", Color.Red);
|
|
|
- OperateResult.AppendText(">>请采集" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "\n", Color.Black,inputValue);
|
|
|
+ OperateResult.AppendText(">>请采集" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "\n", Color.Black, inputValue);
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//判断是否有合同号MAC范围
|
|
|
- if (dh.CheckExist("SaleMacBTRange", "sr_sacode='"+dt.Rows[0]["ms_salecode"].ToString()+"' and sr_type='"+ ((CheckBox)list[step - 1]).Text.Split('/')[0] + "'"))
|
|
|
+ if (dh.CheckExist("SaleMacBTRange", "sr_sacode='" + dt.Rows[0]["ms_salecode"].ToString() + "' and sr_type='" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "'"))
|
|
|
{
|
|
|
//有范围的情况下看是否在范围内
|
|
|
if (!dh.CheckExist("SaleMacBTRange", "sr_sacode='" + dt.Rows[0]["ms_salecode"].ToString() + "' and sr_type='" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "' AND '" + inputValue.Text + "' between sr_startcode and sr_endcode"))
|
|
|
@@ -156,19 +156,20 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
}
|
|
|
//验证长度前缀
|
|
|
- if (!checkPrefixAndLength()) {
|
|
|
+ if (!checkPrefixAndLength())
|
|
|
+ {
|
|
|
return;
|
|
|
}
|
|
|
//验证长度前缀通过,验证数据库
|
|
|
- if (dh.CheckExist("makeserial", "ms_status in (1,2,3) and nvl(ms_nextmacode,' ')<>' ' and ms_"+ ((CheckBox)list[step - 1]).Text.Split('/')[0] + " ='"+inputValue.Text+"'"))
|
|
|
+ if (dh.CheckExist("makeserial", "ms_status in (1,2,3) and nvl(ms_nextmacode,' ')<>' ' and ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + " ='" + inputValue.Text + "'"))
|
|
|
{
|
|
|
OperateResult.AppendText("<<" + ((CheckBox)list[step - 1]).Text + ":" + inputValue.Text + "错误,已被使用\n", Color.Red, inputValue);
|
|
|
return;
|
|
|
}
|
|
|
//通过校验
|
|
|
- sb.Append("ms_"+((CheckBox)list[step - 1]).Text.Split('/')[0]+" = '"+inputValue.Text+"',");
|
|
|
- oldData.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":"+ dt.Rows[0]["ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0]].ToString()+",");
|
|
|
- newData.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" +inputValue.Text+",");
|
|
|
+ sb.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + " = '" + inputValue.Text + "',");
|
|
|
+ oldData.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + dt.Rows[0]["ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0]].ToString() + ",");
|
|
|
+ newData.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + inputValue.Text + ",");
|
|
|
}
|
|
|
break;
|
|
|
case "网标":
|
|
|
@@ -176,7 +177,8 @@ namespace UAS_MES.Make
|
|
|
case "IMEI2":
|
|
|
case "IMEI3":
|
|
|
//验证长度前缀
|
|
|
- if (!checkPrefixAndLength()) {
|
|
|
+ if (!checkPrefixAndLength())
|
|
|
+ {
|
|
|
return;
|
|
|
}
|
|
|
//验证长度前缀通过,验证数据库
|
|
|
@@ -186,7 +188,7 @@ namespace UAS_MES.Make
|
|
|
return;
|
|
|
}
|
|
|
//通过校验
|
|
|
- sb.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text)+" = '"+inputValue.Text+"',");
|
|
|
+ sb.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + " = '" + inputValue.Text + "',");
|
|
|
oldData.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + ":" + dt.Rows[0]["ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text)].ToString() + ",");
|
|
|
newData.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + ":" + inputValue.Text + ",");
|
|
|
break;
|
|
|
@@ -197,19 +199,19 @@ namespace UAS_MES.Make
|
|
|
//更新数据库
|
|
|
sql.Clear();
|
|
|
sql.Append("update makeserial set ");
|
|
|
- sql.Append(sb.ToString().Substring(0,sb.ToString().Length-1));
|
|
|
- sql.Append(" where ms_id='"+ms_id+"'");
|
|
|
- dh.ExecuteSql(sql.GetString(),"update");
|
|
|
+ sql.Append(sb.ToString().Substring(0, sb.ToString().Length - 1));
|
|
|
+ sql.Append(" where ms_id='" + ms_id + "'");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "update");
|
|
|
//提示烧录成功
|
|
|
OperateResult.AppendText(">>烧录成功\n", Color.Green);
|
|
|
//记录日志
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, dt.Rows[0]["ms_makecode"].ToString(), User.UserLineCode, User.UserSourceCode, "更新烧录", "原数据:"+oldData.ToString()+"新数据:"+newData.ToString(), sncode,"");
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, dt.Rows[0]["ms_makecode"].ToString(), User.UserLineCode, User.UserSourceCode, "更新烧录", "原数据:" + oldData.ToString() + "新数据:" + newData.ToString(), sncode, "");
|
|
|
step = 0;
|
|
|
//清除规则
|
|
|
BaseUtil.CleanDataTableData(info);
|
|
|
//聚焦,提示
|
|
|
inputValue.Focus();
|
|
|
- OperateResult.AppendText("<<请采集SN\n", Color.Black,inputValue);
|
|
|
+ OperateResult.AppendText("<<请采集SN\n", Color.Black, inputValue);
|
|
|
//清除LIST
|
|
|
list.Clear();
|
|
|
}
|
|
|
@@ -217,7 +219,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
step++;
|
|
|
//请输入下一个
|
|
|
- OperateResult.AppendText(">>请输入" + ((CheckBox)list[step-1]).Text.Split('/')[0] + "\n", Color.Green,inputValue);
|
|
|
+ OperateResult.AppendText(">>请输入" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "\n", Color.Green, inputValue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -225,9 +227,9 @@ namespace UAS_MES.Make
|
|
|
private bool checkPrefixAndLength()
|
|
|
{
|
|
|
//找到对应的规则
|
|
|
- for(int i=0;i<info.Rows.Count;i++)
|
|
|
+ for (int i = 0; i < info.Rows.Count; i++)
|
|
|
{
|
|
|
- if ((((CheckBox)list[step - 1]).Text.Split('/')[0]=="网标"?"NETCODE": ((CheckBox)list[step - 1]).Text.Split('/')[0])==info.Rows[i]["psr_type"].ToString())
|
|
|
+ if ((((CheckBox)list[step - 1]).Text.Split('/')[0] == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text.Split('/')[0]) == info.Rows[i]["psr_type"].ToString())
|
|
|
{
|
|
|
//校验长度
|
|
|
if ((info.Rows[i]["psr_length"].ToString() == "" ? true : inputValue.Text.Length != int.Parse(info.Rows[i]["psr_length"].ToString())))
|
|
|
@@ -265,7 +267,7 @@ namespace UAS_MES.Make
|
|
|
private void Mac_CheckedChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
//当有checkBox状态改变的时候
|
|
|
- if (step!=0)
|
|
|
+ if (step != 0)
|
|
|
{
|
|
|
//步骤码归零
|
|
|
step = 0;
|