|
|
@@ -106,239 +106,241 @@ namespace UAS_MES.Make
|
|
|
string ErrorMessage = "";
|
|
|
string oMakeCode = "";
|
|
|
string oMsid = "";
|
|
|
- //if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
|
|
|
- //勾选的是上料的步骤
|
|
|
- if (Loading.Checked)
|
|
|
+ if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
|
|
|
{
|
|
|
- //如果录入框和工单号均有输入
|
|
|
- if (code.Text != "" && ma_code.Text != "" && sn_code.Text == "")
|
|
|
+ if (Loading.Checked)
|
|
|
{
|
|
|
- //根据序列号查出ma_code,ma_prodcode,stepcode
|
|
|
- dt = (DataTable)dh.ExecuteSql("select ms_id,ms_makecode,ms_craftcode,ms_status,ms_nextstepcode,ms_prodcode,ms_code from makeserial where ms_sncode='" + code.Text + "' and ms_makecode<>'" + ma_code.Text + "' order by ms_id desc", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- ms_id = dt.Rows[0]["ms_id"].ToString();
|
|
|
- make_code = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
- ms_craftcode = dt.Rows[0]["ms_craftcode"].ToString();
|
|
|
- make_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
|
|
|
- nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
|
|
|
- ms_status = dt.Rows[0]["ms_status"].ToString();
|
|
|
- }
|
|
|
- //勾选了前一工单
|
|
|
- if (iflastsn.Checked)
|
|
|
+ //如果录入框和工单号均有输入
|
|
|
+ if (code.Text != "" && ma_code.Text != "" && sn_code.Text == "")
|
|
|
{
|
|
|
+ //根据序列号查出ma_code,ma_prodcode,stepcode
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_id,ms_makecode,ms_craftcode,ms_status,ms_nextstepcode,ms_prodcode,ms_code from makeserial where ms_sncode='" + code.Text + "' and ms_makecode<>'" + ma_code.Text + "' order by ms_id desc", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- //判断序列号的前一工单是否已经完工
|
|
|
- if (dt.Rows[0]["ms_makecode"].ToString() != ma_code.Text && dt.Rows[0]["ms_status"].ToString() == "2")
|
|
|
+ ms_id = dt.Rows[0]["ms_id"].ToString();
|
|
|
+ make_code = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
+ ms_craftcode = dt.Rows[0]["ms_craftcode"].ToString();
|
|
|
+ make_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
|
|
|
+ nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
|
|
|
+ ms_status = dt.Rows[0]["ms_status"].ToString();
|
|
|
+ }
|
|
|
+ //勾选了前一工单
|
|
|
+ if (iflastsn.Checked)
|
|
|
+ {
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- //验证当前工单是否存在序列号
|
|
|
- if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
|
|
|
+ //判断序列号的前一工单是否已经完工
|
|
|
+ if (dt.Rows[0]["ms_makecode"].ToString() != ma_code.Text && dt.Rows[0]["ms_status"].ToString() == "2")
|
|
|
{
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select sp_id from make inner join stepbom on ma_prodcode=sb_prodcode and ma_bomversion=sb_bomversion left ");
|
|
|
- sql.Append("join stepproduct on sp_sbid=sb_id where ma_code='" + ma_code.Text + "' and sp_craftcode='" + ma_craftcode.Text + "' ");
|
|
|
- sql.Append("and sp_stepcode='" + User.CurrentStepCode + "' and nvl(sp_ifforsn,0)<>0");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ //验证当前工单是否存在序列号
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
|
|
|
{
|
|
|
- string sp_id = dt.Rows[0]["sp_id"].ToString();
|
|
|
- if (!dh.CheckExist("Craftmaterial", "cm_makecode='" + ma_code.Text + "' and cm_sncode='" + code.Text + "'"))
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select sp_id from make inner join stepbom on ma_prodcode=sb_prodcode and ma_bomversion=sb_bomversion left ");
|
|
|
+ sql.Append("join stepproduct on sp_sbid=sb_id where ma_code='" + ma_code.Text + "' and sp_craftcode='" + ma_craftcode.Text + "' ");
|
|
|
+ sql.Append("and sp_stepcode='" + User.CurrentStepCode + "' and nvl(sp_ifforsn,0)<>0");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into Craftmaterial (cm_id, cm_makecode,cm_maid,cm_maprodcode,cm_soncode,cm_mscode,");
|
|
|
- sql.Append("cm_sncode,cm_stepcode,cm_stepname,cm_craftcode,cm_craftname,cm_barcode,cm_inqty,cm_indate");
|
|
|
- sql.Append(",cm_inman,cm_linecode,cm_wccode,cm_sourcecode,cm_spid,cm_status,cm_materialtype,cm_firstsn)");
|
|
|
- sql.Append("select Craftmaterial_seq.nextval, ma_code, ma_id, ma_prodcode, sp_soncode,'" + code.Text + "'");
|
|
|
- sql.Append(",'" + code.Text + "',mcd_stepcode,mcd_stepname,ma_craftcode,ma_craftname,'" + code.Text + "'");
|
|
|
- sql.Append(",1,sysdate,'" + User.UserName + "',ma_linecode,ma_wccode,'" + User.UserSourceCode + "',");
|
|
|
- sql.Append("'" + sp_id + "',0,1,ms_firstsn from make left join makeserial on ms_makecode=ma_code left ");
|
|
|
- sql.Append("join makecraftdetail on mcd_macode=ma_code left join stepproduct on sp_stepcode=mcd_stepcode ");
|
|
|
- sql.Append("where ma_code = '" + ma_code.Text + "'and sp_id = " + sp_id + " and mcd_stepcode=");
|
|
|
- sql.Append("'" + User.CurrentStepCode + "' and ms_sncode='" + code.Text + "'");
|
|
|
- dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
- OperateResult.AppendText(">>序列号" + code.Text + "上料成功\n", Color.Green, code);
|
|
|
+ string sp_id = dt.Rows[0]["sp_id"].ToString();
|
|
|
+ if (!dh.CheckExist("Craftmaterial", "cm_makecode='" + ma_code.Text + "' and cm_sncode='" + code.Text + "'"))
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into Craftmaterial (cm_id, cm_makecode,cm_maid,cm_maprodcode,cm_soncode,cm_mscode,");
|
|
|
+ sql.Append("cm_sncode,cm_stepcode,cm_stepname,cm_craftcode,cm_craftname,cm_barcode,cm_inqty,cm_indate");
|
|
|
+ sql.Append(",cm_inman,cm_linecode,cm_wccode,cm_sourcecode,cm_spid,cm_status,cm_materialtype,cm_firstsn)");
|
|
|
+ sql.Append("select Craftmaterial_seq.nextval, ma_code, ma_id, ma_prodcode, sp_soncode,'" + code.Text + "'");
|
|
|
+ sql.Append(",'" + code.Text + "',mcd_stepcode,mcd_stepname,ma_craftcode,ma_craftname,'" + code.Text + "'");
|
|
|
+ sql.Append(",1,sysdate,'" + User.UserName + "',ma_linecode,ma_wccode,'" + User.UserSourceCode + "',");
|
|
|
+ sql.Append("'" + sp_id + "',0,1,ms_firstsn from make left join makeserial on ms_makecode=ma_code left ");
|
|
|
+ sql.Append("join makecraftdetail on mcd_macode=ma_code left join stepproduct on sp_stepcode=mcd_stepcode ");
|
|
|
+ sql.Append("where ma_code = '" + ma_code.Text + "'and sp_id = " + sp_id + " and mcd_stepcode=");
|
|
|
+ sql.Append("'" + User.CurrentStepCode + "' and ms_sncode='" + code.Text + "'");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
+ OperateResult.AppendText(">>序列号" + code.Text + "上料成功\n", Color.Green, code);
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>序列号" + code.Text + "已经上料\n", Color.Red, code);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>序列号" + code.Text + "已经上料\n", Color.Red, code);
|
|
|
+ else OperateResult.AppendText(">>序列号" + code.Text + "不存在于其他工单\n", Color.Red, code);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>序列号" + code.Text + "不存在于其他工单\n", Color.Red, code);
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
|
|
|
+ else OperateResult.AppendText(">>序列号" + code.Text + "已被工单" + dt.Rows[0]["ms_makecode"].ToString() + "绑定,尚未完工\n", Color.Red, code);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>序列号" + code.Text + "已被工单" + dt.Rows[0]["ms_makecode"].ToString() + "绑定,尚未完工\n", Color.Red, code);
|
|
|
+ else OperateResult.AppendText(">>序列号" + code.Text + "不存在于其他工单\n", Color.Red, code);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>序列号" + code.Text + "不存在于其他工单\n", Color.Red, code);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //未勾选上一工序
|
|
|
- if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
|
|
|
+ else
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_sncode='" + code.Text + "' and ms_makecode='" + ma_code.Text + "' order by ms_id desc", "select");
|
|
|
- nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
|
|
|
- ms_status = dt.Rows[0]["ms_status"].ToString();
|
|
|
- //如果尚未开始工序或者已经在产线并且当前工序和人员负责工序一致
|
|
|
- if ((ms_status == "0" || ms_status == "1") && nextstepcode == User.CurrentStepCode)
|
|
|
+ //未勾选上一工序
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
|
|
|
{
|
|
|
- sn_code.Text = code.Text;
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select ma_code,ma_prodcode,pr_detail,ma_qty from makeserial left join product ");
|
|
|
- sql.Append(" on ms_prodcode=pr_code left join make on ms_makecode=ma_code left join ");
|
|
|
- sql.Append("makecraftdetail on mcd_macode=ms_makecode where ms_sncode='" + sn_code.Text + "'");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
- OperateResult.AppendText(">>获取序列号" + code.Text + "成功\n", Color.Green);
|
|
|
- GetCollectItem();
|
|
|
- code.Text = "";
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_sncode='" + code.Text + "' and ms_makecode='" + ma_code.Text + "' order by ms_id desc", "select");
|
|
|
+ nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
|
|
|
+ ms_status = dt.Rows[0]["ms_status"].ToString();
|
|
|
+ //如果尚未开始工序或者已经在产线并且当前工序和人员负责工序一致
|
|
|
+ if ((ms_status == "0" || ms_status == "1") && nextstepcode == User.CurrentStepCode)
|
|
|
+ {
|
|
|
+ sn_code.Text = code.Text;
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select ma_code,ma_prodcode,pr_detail,ma_qty from makeserial left join product ");
|
|
|
+ sql.Append(" on ms_prodcode=pr_code left join make on ms_makecode=ma_code left join ");
|
|
|
+ sql.Append("makecraftdetail on mcd_macode=ms_makecode where ms_sncode='" + sn_code.Text + "'");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
+ OperateResult.AppendText(">>获取序列号" + code.Text + "成功\n", Color.Green);
|
|
|
+ GetCollectItem();
|
|
|
+ code.Text = "";
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
|
|
|
}
|
|
|
else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
|
|
|
}
|
|
|
- }
|
|
|
- //输入框有值但未选择工单号
|
|
|
- else if (code.Text != "" && ma_code.Text == "" && sn_code.Text == "")
|
|
|
- GetCollectItem();
|
|
|
- //序列号不为空的时候
|
|
|
- else if (sn_code.Text != "")
|
|
|
- {
|
|
|
- //索引超出长度表示内容均已提醒
|
|
|
- if (RemainIndex >= RemainList.Length)
|
|
|
+ //输入框有值但未选择工单号
|
|
|
+ else if (code.Text != "" && ma_code.Text == "" && sn_code.Text == "")
|
|
|
+ GetCollectItem();
|
|
|
+ //序列号不为空的时候
|
|
|
+ else if (sn_code.Text != "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>当前序列号" + sn_code.Text + "没有需要采集的内容,请采集其他序列号\n", Color.Red);
|
|
|
- sn_code.Text = "";
|
|
|
- code.Text = "";
|
|
|
- return;
|
|
|
- }
|
|
|
- string sp_soncode = dt1.Rows[RemainIndex]["sp_soncode"].ToString();
|
|
|
- string sp_prefix = dt1.Rows[RemainIndex]["sp_prefix"].ToString();
|
|
|
- string sp_ifuseregex = dt1.Rows[RemainIndex]["sp_ifuseregex"].ToString();
|
|
|
- string sp_regex = dt1.Rows[RemainIndex]["sp_regex"].ToString();
|
|
|
- string length = dt1.Rows[RemainIndex]["sp_length"].ToString();
|
|
|
- string sp_id = dt1.Rows[RemainIndex]["sp_id"].ToString();
|
|
|
- string sp_ifforsn = dt1.Rows[RemainIndex]["sp_ifforsn"].ToString();
|
|
|
- string sp_tracekind = dt1.Rows[RemainIndex]["sp_tracekind"].ToString();
|
|
|
- int sp_length = int.Parse(length != "" ? length : "0");
|
|
|
- if (dt1.Rows[RemainIndex]["sp_type"].ToString() == "物料")
|
|
|
- {
|
|
|
- //序列号用作条码
|
|
|
- if (sp_ifforsn != "0")
|
|
|
+ //索引超出长度表示内容均已提醒
|
|
|
+ if (RemainIndex >= RemainList.Length)
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select count(1) from makeserial where ms_sncode='" + code.Text + "' and ms_status=2 and ms_prodcode='" + sp_soncode + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- if (dh.getRowCount("craftmaterial", "cm_sncode='" + sn_code.Text + "' and cm_barcode='" + code.Text + "' and cm_soncode='" + sp_soncode + "'") > 0)
|
|
|
- OperateResult.AppendText(">>条码" + code.Text + "已经上料\n", Color.Red);
|
|
|
- else
|
|
|
- Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
|
|
|
- }
|
|
|
- else OperateResult.AppendText(">>序列号不存在\n", Color.Red);
|
|
|
+ OperateResult.AppendText(">>当前序列号" + sn_code.Text + "没有需要采集的内容,请采集其他序列号\n", Color.Red);
|
|
|
+ sn_code.Text = "";
|
|
|
+ code.Text = "";
|
|
|
+ return;
|
|
|
}
|
|
|
- //单件管控物料
|
|
|
- else if (sp_tracekind == "1")
|
|
|
+ string sp_soncode = dt1.Rows[RemainIndex]["sp_soncode"].ToString();
|
|
|
+ string sp_prefix = dt1.Rows[RemainIndex]["sp_prefix"].ToString();
|
|
|
+ string sp_ifuseregex = dt1.Rows[RemainIndex]["sp_ifuseregex"].ToString();
|
|
|
+ string sp_regex = dt1.Rows[RemainIndex]["sp_regex"].ToString();
|
|
|
+ string length = dt1.Rows[RemainIndex]["sp_length"].ToString();
|
|
|
+ string sp_id = dt1.Rows[RemainIndex]["sp_id"].ToString();
|
|
|
+ string sp_ifforsn = dt1.Rows[RemainIndex]["sp_ifforsn"].ToString();
|
|
|
+ string sp_tracekind = dt1.Rows[RemainIndex]["sp_tracekind"].ToString();
|
|
|
+ int sp_length = int.Parse(length != "" ? length : "0");
|
|
|
+ if (dt1.Rows[RemainIndex]["sp_type"].ToString() == "物料")
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select bar_prodcode,bar_code from barcode where bar_code='" + code.Text + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ //序列号用作条码
|
|
|
+ if (sp_ifforsn != "0")
|
|
|
{
|
|
|
- if (sp_soncode != dt.Rows[0]["bar_prodcode"].ToString())
|
|
|
- OperateResult.AppendText(">>用户条码号对应的物料不是:" + sp_soncode + "\n");
|
|
|
- else
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select count(1) from makeserial where ms_sncode='" + code.Text + "' and ms_status=2 and ms_prodcode='" + sp_soncode + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select cm_id from craftmaterial where cm_soncode='" + sp_soncode + "' and cm_barcode='" + code.Text + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- OperateResult.AppendText(">>条码" + code.Text + "已采集过\n", Color.Red, code);
|
|
|
+ if (dh.getRowCount("craftmaterial", "cm_sncode='" + sn_code.Text + "' and cm_barcode='" + code.Text + "' and cm_soncode='" + sp_soncode + "'") > 0)
|
|
|
+ OperateResult.AppendText(">>条码" + code.Text + "已经上料\n", Color.Red);
|
|
|
else
|
|
|
Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
|
|
|
}
|
|
|
+ else OperateResult.AppendText(">>序列号不存在\n", Color.Red);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>条码不存在\n", Color.Red, code);
|
|
|
- }
|
|
|
- //不管控
|
|
|
- else if (sp_tracekind == "0")
|
|
|
- {
|
|
|
- //进行前缀匹配
|
|
|
- if (code.Text.Substring(0, sp_prefix.Length) == sp_prefix || sp_prefix == "")
|
|
|
+ //单件管控物料
|
|
|
+ else if (sp_tracekind == "1")
|
|
|
{
|
|
|
- //进行长度匹配
|
|
|
- if (code.Text.Length == sp_length || sp_length == 0)
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select bar_prodcode,bar_code from barcode where bar_code='" + code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- if (sp_ifuseregex != "0")
|
|
|
+ if (sp_soncode != dt.Rows[0]["bar_prodcode"].ToString())
|
|
|
+ OperateResult.AppendText(">>用户条码号对应的物料不是:" + sp_soncode + "\n");
|
|
|
+ else
|
|
|
{
|
|
|
- //进行正则表达式匹配
|
|
|
- Regex re = new Regex(sp_regex);
|
|
|
- if (re.IsMatch(code.Text))
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cm_id from craftmaterial where cm_soncode='" + sp_soncode + "' and cm_barcode='" + code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ OperateResult.AppendText(">>条码" + code.Text + "已采集过\n", Color.Red, code);
|
|
|
+ else
|
|
|
Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
|
|
|
- else OperateResult.AppendText(">>正则表达式不匹配\n", Color.Red);
|
|
|
}
|
|
|
- else Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>长度不匹配\n", Color.Red);
|
|
|
+ else OperateResult.AppendText(">>条码不存在\n", Color.Red, code);
|
|
|
+ }
|
|
|
+ //不管控
|
|
|
+ else if (sp_tracekind == "0")
|
|
|
+ {
|
|
|
+ //进行前缀匹配
|
|
|
+ if (code.Text.Substring(0, sp_prefix.Length) == sp_prefix || sp_prefix == "")
|
|
|
+ {
|
|
|
+ //进行长度匹配
|
|
|
+ if (code.Text.Length == sp_length || sp_length == 0)
|
|
|
+ {
|
|
|
+ if (sp_ifuseregex != "0")
|
|
|
+ {
|
|
|
+ //进行正则表达式匹配
|
|
|
+ Regex re = new Regex(sp_regex);
|
|
|
+ if (re.IsMatch(code.Text))
|
|
|
+ Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
|
|
|
+ else OperateResult.AppendText(">>正则表达式不匹配\n", Color.Red);
|
|
|
+ }
|
|
|
+ else Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>长度不匹配\n", Color.Red);
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>前缀不匹配\n", Color.Red);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>前缀不匹配\n", Color.Red);
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //如果sp_type!='物料'的话
|
|
|
- //Wifi和蓝牙公用一个字段
|
|
|
- switch (dt1.Rows[RemainIndex]["sp_type"].ToString())
|
|
|
+ else
|
|
|
{
|
|
|
- case "MAC":
|
|
|
- dh.UpdateByCondition("makeserial", "ms_mac='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
- break;
|
|
|
- case "BT":
|
|
|
- dh.UpdateByCondition("makeserial", "ms_bt='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
- break;
|
|
|
- case "WIFI":
|
|
|
- dh.UpdateByCondition("makeserial", "ms_bt='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
- break;
|
|
|
- case "IMEI1":
|
|
|
- dh.UpdateByCondition("makeserial", "ms_imei1='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
- break;
|
|
|
- case "IMEI2":
|
|
|
- dh.UpdateByCondition("makeserial", "ms_imei2='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ //如果sp_type!='物料'的话
|
|
|
+ //Wifi和蓝牙公用一个字段
|
|
|
+ switch (dt1.Rows[RemainIndex]["sp_type"].ToString())
|
|
|
+ {
|
|
|
+ case "MAC":
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_mac='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
+ break;
|
|
|
+ case "BT":
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_bt='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
+ break;
|
|
|
+ case "WIFI":
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_bt='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
+ break;
|
|
|
+ case "IMEI1":
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_imei1='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
+ break;
|
|
|
+ case "IMEI2":
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_imei2='" + code.Text + "'", "ms_id=" + ms_id);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
|
|
|
}
|
|
|
- Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- //勾选了下料的时候
|
|
|
- else if (UnLoading.Checked)
|
|
|
- {
|
|
|
- if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
|
|
|
+ //勾选了下料的时候
|
|
|
+ else if (UnLoading.Checked)
|
|
|
{
|
|
|
- if (sn_code.Text != "")
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select cm_id,cm_stepcode,ms_makecode,cm_mccode from craftmaterial left join makeserial on cm_makecode=ms_makecode and cm_sncode=ms_sncode where ms_sncode='" + sn_code.Text + "' and cm_barcode='" + code.Text + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ if (sn_code.Text != "")
|
|
|
{
|
|
|
- string cm_id = dt.Rows[0]["cm_id"].ToString();
|
|
|
- string ms_macode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
- string cm_stepcode = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
- string cm_mccode = dt.Rows[0]["cm_mccode"].ToString();
|
|
|
- dh.ExecuteSql("delete from Craftmaterial where cm_id=" + cm_id, "delete");
|
|
|
- LogicHandler.InsertMakeProcess(ms_macode, sn_code.Text, User.UserSourceCode, "上料采集操作", "下料成功", User.UserName);
|
|
|
- int count = dh.getRowCount("craftMaterial", "cm_mccode='" + cm_mccode + "' and cm_stepcode='" + cm_stepcode + "' and cm_sncode='" + sn_code.Text + "'");
|
|
|
- if (count == 0)
|
|
|
- dh.UpdateByCondition("makecraftdetail ", "mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty = mcd_okqty - 1", "mcd_mccode='" + cm_mccode + "' and mcd_stepcode='" + cm_stepcode + "'");
|
|
|
- OperateResult.AppendText(">>下料成功\n", Color.Green, code);
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cm_id,cm_stepcode,ms_makecode,cm_mccode from craftmaterial left join makeserial on cm_makecode=ms_makecode and cm_sncode=ms_sncode where ms_sncode='" + sn_code.Text + "' and cm_barcode='" + code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string cm_id = dt.Rows[0]["cm_id"].ToString();
|
|
|
+ string ms_macode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
+ string cm_stepcode = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
+ string cm_mccode = dt.Rows[0]["cm_mccode"].ToString();
|
|
|
+ dh.ExecuteSql("delete from Craftmaterial where cm_id=" + cm_id, "delete");
|
|
|
+ LogicHandler.InsertMakeProcess(ms_macode, sn_code.Text, User.UserSourceCode, "上料采集操作", "下料成功", User.UserName);
|
|
|
+ int count = dh.getRowCount("craftMaterial", "cm_mccode='" + cm_mccode + "' and cm_stepcode='" + cm_stepcode + "' and cm_sncode='" + sn_code.Text + "'");
|
|
|
+ if (count == 0)
|
|
|
+ dh.UpdateByCondition("makecraftdetail ", "mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty = mcd_okqty - 1", "mcd_mccode='" + cm_mccode + "' and mcd_stepcode='" + cm_stepcode + "'");
|
|
|
+ OperateResult.AppendText(">>下料成功\n", Color.Green, code);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else if (sn_code.Text == "")
|
|
|
- {
|
|
|
- dt = (DataTable)dh.ExecuteSql("select cm_id from craftmaterial where cm_sncode='" + sn_code.Text + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ else if (sn_code.Text == "")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>请采集需要下料的序列号\n", Color.Black, code);
|
|
|
- sn_code.Text = code.Text;
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cm_id from craftmaterial where cm_sncode='" + sn_code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>请采集需要下料的序列号\n", Color.Black, code);
|
|
|
+ sn_code.Text = code.Text;
|
|
|
+ }
|
|
|
+ else OperateResult.AppendText(">>该序列号未上料,无需下料\n", Color.Red, code);
|
|
|
}
|
|
|
- else OperateResult.AppendText(">>该序列号未上料,无需下料\n", Color.Red, code);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
|
|
|
}
|
|
|
}
|
|
|
|