|
@@ -206,7 +206,7 @@ namespace UAS_MES.Make
|
|
|
//没有勾选,只能修改一次
|
|
|
//核对TSN是否正确
|
|
|
//string beforesn = dh.getFieldDataByCondition("makeserial", "ms_beforesn", "ms_sncode='" + code.Text + "'").ToString().Trim();
|
|
|
- if (dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "' and ms_id='" + oMsid + "' and ms_beforesn is null"))
|
|
|
+ if (dh.CheckExist("makeserial", "ms_id='" + oMsid + "' and ms_sncode='" + code.Text + "' and ms_beforesn is null"))
|
|
|
{
|
|
|
step = 1;
|
|
|
|
|
@@ -221,7 +221,7 @@ namespace UAS_MES.Make
|
|
|
//不为空,进行过转换。不勾选修改结果,就不能再修改
|
|
|
{
|
|
|
//修改转换结果时,输入两次SN直接过站
|
|
|
- if (dh.CheckExist("MakeSerial", "ms_sncode='" + code.Text + "' and ms_id='" + oMsid + "' and ms_beforesn is not null"))
|
|
|
+ if (dh.CheckExist("MakeSerial", "ms_id='" + oMsid + "' and ms_sncode='" + code.Text + "' and ms_beforesn is not null"))
|
|
|
{
|
|
|
step = 1;
|
|
|
TSN = code.Text;
|
|
@@ -245,7 +245,7 @@ namespace UAS_MES.Make
|
|
|
//判断工单是否导入了序列号清单
|
|
|
if (dh.CheckExist("makesnlist", "msl_makecode='" + ms_macode.Text + "' and msl_type='after'"))
|
|
|
{
|
|
|
- if (!dh.CheckExist("makesnlist", "msl_makecode='" + ms_macode.Text + "' and msl_sncode='" + code.Text + "' and msl_type='after'"))
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + code.Text + "' and msl_makecode='" + ms_macode.Text + "' and msl_type='after'"))
|
|
|
{
|
|
|
//有序列号清单,输入的序列号却不在范围内
|
|
|
OperateResult.AppendText(">>SN号" + code.Text + "错误,不在工单设定的转换后序列号清单中\n", Color.Red, code);
|
|
@@ -297,7 +297,7 @@ namespace UAS_MES.Make
|
|
|
return;
|
|
|
}
|
|
|
//开始录入SN
|
|
|
- if ((ChangeResult.Checked && dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "' and ms_id='" + oMsid + "'")) || !dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "'") || (!ChangeResult.Checked && (TSN == code.Text)))
|
|
|
+ if ((ChangeResult.Checked && dh.CheckExist("makeserial", " ms_id='" + oMsid + "' and ms_sncode='" + code.Text + "'")) || !dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "'") || (!ChangeResult.Checked && (TSN == code.Text)))
|
|
|
{
|
|
|
//SN校验成功,合法,记录下SN
|
|
|
SN = code.Text;
|
|
@@ -440,7 +440,7 @@ 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 + "')")
|
|
|
+ if (!ChangeResult.Checked && checkExist("(ms_imei1='" + code.Text + "' or ms_imei2 = '" + code.Text + "' or ms_imei3 = '" + code.Text + "') and ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' '")
|
|
|
|| 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);
|
|
@@ -486,8 +486,8 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
}
|
|
|
//验证是否已被使用
|
|
|
- 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 + "'"))
|
|
|
+ if (!ChangeResult.Checked && checkExist("MS_" + type + "='" + macOrBt + "' and ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' '")
|
|
|
+ || ChangeResult.Checked && checkExist("MS_" + type + "='" + macOrBt + "' and ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' 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);
|
|
@@ -510,8 +510,8 @@ namespace UAS_MES.Make
|
|
|
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_" + type + "='" + code.Text + "' and ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' '")
|
|
|
+ || ChangeResult.Checked && checkExist("MS_" + type + "='" + code.Text + "' and ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' 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);
|
|
@@ -548,14 +548,14 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
//校验已经完成,此时要再次校验之前的SN和关联采集信息
|
|
|
//再次校验SN
|
|
|
- if ((ChangeResult.Checked && dh.CheckExist("makeserial", "ms_sncode='" + SN + "' and ms_id='" + oMsid + "'")) || !dh.CheckExist("makeserial", "ms_sncode='" + SN + "'") || (!ChangeResult.Checked && (TSN == SN)))
|
|
|
+ if ((ChangeResult.Checked && dh.CheckExist("makeserial", "ms_id='" + oMsid + "' and ms_sncode='" + SN + "'")) || !dh.CheckExist("makeserial", "ms_sncode='" + SN + "'") || (!ChangeResult.Checked && (TSN == SN)))
|
|
|
{
|
|
|
bool flag = true;
|
|
|
//遍历判断已采集的信息是否已存在
|
|
|
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_" + (de.Key.ToString() == "WIFI" ? "MAC" : de.Key) + "='" + de.Value + "' and ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' '")
|
|
|
+ || (ChangeResult.Checked && dh.CheckExist("makeserial", "MS_" + (de.Key.ToString() == "WIFI" ? "MAC" : de.Key) + "='" + de.Value + "' and ms_status in (1,2,3) and nvl(ms_nextmacode,' ')=' ' and ms_id <> '" + oMsid + "'")))
|
|
|
{
|
|
|
flag = false;
|
|
|
OperateResult.AppendText(">>" + de.Key + "已被使用,请重新输入TSN,重新转换\n", Color.Red);
|
|
@@ -587,17 +587,17 @@ namespace UAS_MES.Make
|
|
|
if (ChangeResult.Checked)
|
|
|
{
|
|
|
//查询ms_firstsn
|
|
|
- firstsn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", "ms_beforesn='" + TSN + "' and ms_id='" + oMsid + "'").ToString();
|
|
|
+ firstsn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", "ms_id='" + oMsid + "' and ms_beforesn='" + TSN + "'").ToString();
|
|
|
//记录本次修改,存入makesnrelation表中
|
|
|
- updateSql = "update makeserial set ms_sncode='" + SN + "'," + s1.Remove(s1.Length - 1, 1).ToString() + " where ms_beforesn='" + TSN + "' and ms_id='" + oMsid + "'";
|
|
|
+ updateSql = "update makeserial set ms_sncode='" + SN + "'," + s1.Remove(s1.Length - 1, 1).ToString() + " where ms_id='" + oMsid + "' and ms_beforesn='" + TSN + "'";
|
|
|
}
|
|
|
//未勾选修改转换结果
|
|
|
else
|
|
|
{
|
|
|
//查询ms_firstsn
|
|
|
- firstsn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", "ms_sncode='" + TSN + "' and ms_id='" + oMsid + "'").ToString();
|
|
|
+ firstsn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", " ms_id='" + oMsid + "' and ms_sncode='" + TSN + "'").ToString();
|
|
|
//记录本次修改,存入makesnrelation表中
|
|
|
- updateSql = "update makeserial set ms_sncode='" + SN + "', ms_beforesn='" + TSN + "'," + s1.Remove(s1.Length - 1, 1).ToString() + " where ms_sncode='" + TSN + "' and ms_id='" + oMsid + "'";
|
|
|
+ updateSql = "update makeserial set ms_sncode='" + SN + "', ms_beforesn='" + TSN + "'," + s1.Remove(s1.Length - 1, 1).ToString() + " where ms_id='" + oMsid + "' and ms_sncode='" + TSN + "'";
|
|
|
}
|
|
|
string insertSql = "insert into makesnrelation (BEFORESN,SN,FIRSTSN,MAKECODE,msr_indate, msr_inman)values('" + TSN + "','" + SN + "','" + firstsn + "','" + ms_macode.Text + "', sysdate ,'" + User.UserCode + "')";
|
|
|
dh.ExecuteSQLTran(updateSql, insertSql);
|
|
@@ -611,7 +611,7 @@ namespace UAS_MES.Make
|
|
|
if (ChangeResult.Checked)
|
|
|
{
|
|
|
//删除最近一条转换记录
|
|
|
- dh.ExecuteSql("delete from makesnrelation where sn <> '"+SN+"' and BEFORESN='" + TSN + "' and makecode='" + ms_macode.Text + "'", "delete");
|
|
|
+ dh.ExecuteSql("delete from makesnrelation where BEFORESN='" + TSN + "' and makecode='" + ms_macode.Text + "' and sn <> '" + SN + "'", "delete");
|
|
|
}
|
|
|
//输出提示用户“>>序列号转换成功”,“>>关联采集成功”
|
|
|
//完成该道工序 setFinish
|