123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using UAS_MES_NEW.DataOperate;
- using UAS_MES_NEW.Entity;
- using UAS_MES_NEW.Make;
- using UAS_MES_NEW.PublicMethod;
- namespace UAS_MES_NEW.Special
- {
- public partial class Special_GetBad : Form
- {
- DataHelper dh;
- LogStringBuilder sql = new LogStringBuilder();
- DataTable dt;
- public Special_GetBad()
- {
- InitializeComponent();
- }
- private void Special_BoxSplit_Load(object sender, EventArgs e)
- {
- dh = SystemInf.dh;
- }
- private void Split_Click(object sender, EventArgs e)
- {
- if (SN.Text == "" || makecode.Text == null || makecode.Text == "")
- {
- OperatResult.AppendText(">>序列号和工单号不允许为空\n", Color.Red);
- }
- else
- {
- //如果存在送检批号则进行删除
- if (dh.CheckExist("oqcbatchdetail", "obd_sncode='" + SN.Text + "'"))
- {
- string checkno = dh.getFieldDataByCondition("oqcbatchdetail", "obd_checkno", "obd_sncode='" + SN.Text + "'").ToString();
- string ifng = dh.getFieldDataByCondition("oqcbatchdetail", "obd_ifng", "obd_sncode='" + SN.Text + "'").ToString();
- if (ifng == "-1")
- {
- dh.ExecuteSql("delete OQCITEMSAMPLES where ois_sncode = '" + SN.Text + "'", "select");
- dh.ExecuteSql("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1,ob_ngqty = ob_ngqty -1 where ob_checkno='" + checkno + "'", "update");
- }
- dh.ExecuteSql("delete from oqcbatchdetail where obd_sncode='" + SN.Text + "'", "delete");
- }
- //之前保存的不良就不再调用
- DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_stepcode", "nvl(ms_ifrework,0)ms_ifrework", "ms_status" }, "ms_sncode='" + SN.Text + "' and ms_makecode='" + makecode.Text + "'");
- if (dt.Rows.Count > 0)
- {
- string ifrework = dt.Rows[0]["ms_ifrework"].ToString();
- string ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
- string ms_status = dt.Rows[0]["ms_status"].ToString();
- if (ms_status == "2")
- {
- dh.UpdateByCondition("make", "ma_madeqty=nvl(ma_madeqty,0)-1", "ma_code='" + makecode.Text + "'");
- }
- dh.UpdateByCondition("makeserial", "ms_nextstepcode='',ms_status=3", "ms_sncode='" + SN.Text + "' and ms_makecode='" + makecode.Text + "' ");
- }
- LogicHandler.InsertMakeProcess(SN.Text, makecode.Text, User.UserSourceCode, "采集成不良", "特殊测试不良", User.UserCode);
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, makecode.Text, User.UserLineCode, User.UserSourceCode, "采集成不良", "特殊采集不良", SN.Text,"");
- OperatResult.AppendText(">>序列号:" + SN.Text + "不良采集成功\n", Color.Green);
- BaseUtil.CleanControls(this.Controls);
- }
- }
- private void SN_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- sql.Clear();
- sql.Append("select ms_makecode makecode from makeserial left join make ");
- sql.Append("on ms_makecode=ma_code where ms_sncode = '" + SN.Text + "' order by ms_id desc");
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- BaseUtil.SetFormValue(this.Controls, dt);
- string ms_paststep = "";
- if (!(dt.Rows.Count > 0))
- {
- OperatResult.AppendText(">>序列号:" + SN.Text + "不存在\n", Color.Red);
- BaseUtil.CleanForm(this);
- return;
- }
- }
- }
- private void NewBadCode_Click(object sender, EventArgs e)
- {
- if (SN.Text == "" || makecode.Text == null || makecode.Text == "")
- {
- OperatResult.AppendText(">>序列号和工单号不允许为空\n", Color.Red);
- }
- else
- {
- Make_NewBadCode badcode = new Make_NewBadCode(SN.Text, makecode.Text);
- // badcode.FormClosed += LoadBadInfTree;
- BaseUtil.SetFormCenter(badcode);
- badcode.ShowDialog();
- }
- }
- }
- }
|