|
|
@@ -79,6 +79,12 @@ namespace UAS_MES.Make
|
|
|
// 获取工单归属工单下一工序是否正确
|
|
|
if (LogicHandler.CheckStepSNAndMacode(ms_makecode.Text == "" ? oMakeCode : ms_makecode.Text, User.UserSourceCode, sncode.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage2))
|
|
|
{
|
|
|
+ string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
|
|
|
+ if (nextstepcode != User.CurrentStepCode)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("<<序列号:" + sncode.Text + "下一工序是" + nextstepcode + ",不是当前岗位的工序\n", Color.Red, sncode);
|
|
|
+ return;
|
|
|
+ }
|
|
|
sql.Clear();
|
|
|
sql.Append("select ma_code as ms_makecode,nvl(mcd_okqty,0),ma_prodcode,pr_detail,");
|
|
|
sql.Append("pr_spec,ma_qty - nvl(mcd_inqty, 0) mcd_remainqty,nvl(ma_unlimitin,0) ma_unlimitin from make left join makecraftdetail on ");
|
|
|
@@ -88,7 +94,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
ma_unlimitin = int.Parse(dt.Rows[0]["ma_unlimitin"].ToString());
|
|
|
BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
- dh.UpdateByCondition("makeserial", "ms_currentstepcode = '" + User.CurrentStepCode + "'", "ms_id = '" + oMsID + "'");
|
|
|
+ //dh.UpdateByCondition("makeserial", "ms_currentstepcode = '" + User.CurrentStepCode + "'", "ms_id = '" + oMsID + "'");
|
|
|
OperateResult.AppendText(">>请输入网标\n", Color.Black);
|
|
|
sn_code = sncode.Text;
|
|
|
sncode.Text = "";
|
|
|
@@ -110,19 +116,20 @@ namespace UAS_MES.Make
|
|
|
return;
|
|
|
}
|
|
|
#region
|
|
|
- //sql.Clear();
|
|
|
- //sql.Append("select psr_prefix,psr_length from productsnrelation where psr_prodcode = '" + ma_prodcode.Text + "' and psr_type = 'NETCODE'");
|
|
|
- //dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- //if (dt.Rows.Count > 0) {
|
|
|
- // int psr_length = int.Parse(dt.Rows[0][1].ToString());
|
|
|
- // string psr_prefix = dt.Rows[0][0].ToString();
|
|
|
- // if (sncode.Text.Length != psr_length || sncode.Text.Substring(0,psr_prefix.Length).ToString() != psr_prefix) {
|
|
|
- // sncode.Text = "";
|
|
|
- // sncode.Focus();
|
|
|
- // OperateResult.AppendText("<<所输入网标不符合定义要求\n", Color.Red);
|
|
|
- // return;
|
|
|
- // }
|
|
|
- //}
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select psr_prefix,psr_length from productsnrelation where psr_prodcode = '" + ma_prodcode.Text + "' and psr_type = 'NETCODE'");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ int psr_length = int.Parse(dt.Rows[0][1].ToString());
|
|
|
+ string psr_prefix = dt.Rows[0][0].ToString();
|
|
|
+ if (!checkLengthOrPre(psr_length, psr_prefix, "网标"))
|
|
|
+ {
|
|
|
+ sncode.Text = "";
|
|
|
+ sncode.Focus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
#endregion
|
|
|
OperateResult.AppendText("<<" + sncode.Text + "\n", Color.Black);
|
|
|
string ErrorMessage = "";
|
|
|
@@ -135,9 +142,16 @@ namespace UAS_MES.Make
|
|
|
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if (dh.CheckExist("sninfo", "si_netcode = '" + sncode.Text + "'"))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>录入错误,此网标:" + sncode.Text + "已被" + dh.getFieldDataByCondition("sninfo", "si_sn", "si_netcode = '" + sncode.Text + "'").ToString() + "使用\n", Color.Red, sncode);
|
|
|
+ OperateResult.AppendText(">>请输入网标\n", Color.Black);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (dh.CheckExist("makeserial", "ms_netcode = '" + sncode.Text + "'"))
|
|
|
{
|
|
|
- OperateResult.AppendText(">>录入错误,已存在此网标"+ sncode.Text + "\n", Color.Red, sncode);
|
|
|
+ OperateResult.AppendText(">>录入错误,此网标:" + sncode.Text + "已被" + dh.getFieldDataByCondition("makeserial", "ms_sncode", "ms_netcode = '" + sncode.Text + "'").ToString() + "使用\n", Color.Red, sncode);
|
|
|
OperateResult.AppendText(">>请输入网标\n", Color.Black);
|
|
|
return;
|
|
|
}
|
|
|
@@ -149,6 +163,15 @@ namespace UAS_MES.Make
|
|
|
if (ErrorMessage.Contains("AFTERSUCCESS"))
|
|
|
OperateResult.AppendText(">>" + ErrorMessage + "\n");
|
|
|
//dh.UpdateByCondition("makeserial", "ms_netcode = '" + sncode.Text + "'", "ms_id = '" + oMsID + "'");
|
|
|
+ string si_id = dh.getFieldDataByCondition("sninfo", "max(si_id) si_id", " si_sn in (select '" + sn_code + "' from dual union select sn from makesnrelation where beforesn = '" + sn_code + "' and sn <> ' ' union select beforesn from makesnrelation where sn = '" + sn_code + "' and beforesn <> ' ') ").ToString();
|
|
|
+ if (si_id != "")
|
|
|
+ {
|
|
|
+ dh.BatchInsert("update sninfo set si_netcode = :netcode,si_indate = sysdate where si_id = :osiId", new String[] { "netcode", "osiId" }, new string[] { sncode.Text },new string[] { si_id });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dh.BatchInsert("insert into sninfo (si_id,si_sn,si_netcode,si_indate) values (SnInfo_seq.nextval,:si_sn,:netcode,sysdate)", new String[] { "si_sn", "netcode"}, new string[] { sn_code }, new string[] { sncode.Text });
|
|
|
+ }
|
|
|
dh.BatchInsert("update makeserial set ms_netcode = :netcode where ms_id = :oMsId", new String[] { "netcode", "oMsId" }, new string[] { sncode.Text }, new string[] { oMsID.ToString() });
|
|
|
OperateResult.AppendText(">>网标采集完成,执行更新\n", Color.Green);
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "网标采集", "采集成功", sn_code, "");
|
|
|
@@ -183,6 +206,45 @@ namespace UAS_MES.Make
|
|
|
sncode.Focus();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 检验长度或者前缀是否合法
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="checkbox"></param>
|
|
|
+ /// <param name="c"></param>
|
|
|
+ /// <param name="info"></param>
|
|
|
+ private bool checkLengthOrPre(int psr_length, string psr_prefix, string TSNorSN)
|
|
|
+ {
|
|
|
+ //则判断输入转换前的序列号长度是否合法,不合法则提示
|
|
|
+ if (sncode.Text.Trim().Length != psr_length)
|
|
|
+ {
|
|
|
+ //序列号校验错误,长度错误
|
|
|
+ OperateResult.AppendText("<<" + TSNorSN + ":" + sncode.Text + "校验错误,长度错误\n", Color.Red, sncode);
|
|
|
+ OperateResult.AppendText(">>请重新输入" + TSNorSN + "\n", Color.Black);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ string[] pres = psr_prefix.Split('|');
|
|
|
+ bool f = false;
|
|
|
+ for (int i = 0; i < pres.Length; i++)
|
|
|
+ {
|
|
|
+ if (pres[i] == "" ? true : sncode.Text.StartsWith(pres[i]))
|
|
|
+ {
|
|
|
+ //满足其中一条即可
|
|
|
+ f = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //则判断输入转换前的序列号前缀是否合法,不合法则提示
|
|
|
+ if (!f)
|
|
|
+ {
|
|
|
+ //序列号校验错误,前缀错误
|
|
|
+ OperateResult.AppendText("<<" + TSNorSN + ":" + sncode.Text + "校验错误,前缀错误\n", Color.Red, sncode);
|
|
|
+ OperateResult.AppendText(">>请重新输入" + TSNorSN + "\n", Color.Black);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
private void deleteButton1_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
if (isnetcode)
|