using System; using System.Windows.Forms; using UAS_MES_NEW.DataOperate; using UAS_MES_NEW.Entity; using UAS_MES_NEW.PublicMethod; using static DevExpress.Utils.Drawing.Helpers.NativeMethods; namespace UAS_MES_NEW.Special { public partial class Special_MakeBad : Form { DataHelper dh; LogStringBuilder sql = new LogStringBuilder(); public Special_MakeBad() { InitializeComponent(); } private void Special_BoxSplit_Load(object sender, EventArgs e) { dh = SystemInf.dh; ma_code.TableName = "make left join product on pr_code=ma_prodcode"; ma_code.DBTitle = "工单号查询"; ma_code.SelectField = "ma_code # 工单号,ma_qty # 工单数量,pr_detail # 产品名称,pr_code # 产品编号"; ma_code.SetValueField = new string[] { "ma_code", "pr_detail", "pr_code" }; ma_code.FormName = Name; li_code.TableName = "line"; li_code.Condition = "li_code like '%贴片%'"; li_code.DBTitle = "线别查询"; li_code.SelectField = "li_code # 线别编号"; li_code.SetValueField = new string[] { "li_code" }; li_code.FormName = Name; pr_code.TableName = "product"; pr_code.DBTitle = "产品查询"; pr_code.SelectField = "pr_code # 产品编号,pr_detail # 产品名称 ,pr_spec # 产品规格"; pr_code.SetValueField = new string[] { "pr_code" }; pr_code.FormName = Name; bc_code.TableName = "(select bc_code,bc_name from badcode left join DATAINPUTRECORD ON bc_name = DIR_COMMENT AND DIR_GROUP = '不良代码组' and DIR_SOURCECODE = '" + User.UserSourceCode + "' where bc_groupcode='SMT' ORDER BY NVL(DIR_NUMBER,0) DESC)"; bc_code.Field = "bc_name"; bc_code.ValueField = "bc_code"; bc_code.Condition = " 1=1 ORDER BY ROWNUM asc"; nrg_name.TableName = "(select nrg_name,nrg_code from QUA_NGREASONGROUP left join DATAINPUTRECORD ON NRG_NAME = DIR_COMMENT AND DIR_GROUP = '不良原因组' and DIR_SOURCECODE = '" + User.UserSourceCode + "' ORDER BY NVL(DIR_NUMBER,0) DESC)"; nrg_name.Field = "nrg_name"; nrg_name.ValueField = "nrg_code"; nrg_name.Condition = " 1=1 ORDER BY ROWNUM asc"; nr_name.TableName = "QUA_NGREASONGROUPDET left join QUA_NGREASONGROUP on nrgd_nrgid=nrg_id left join QUA_NGReason on nrgd_nrcode=nr_code left join DATAINPUTRECORD ON nr_name = DIR_COMMENT AND DIR_GROUP = '不良原因' and DIR_SOURCECODE = '" + User.UserSourceCode + "' "; nr_name.Field = "nr_name"; nr_name.ValueField = "nr_code"; mbr_dutyname.TableName = "(select nd_name,nd_code from ngduty left join DATAINPUTRECORD ON nd_name = DIR_COMMENT AND DIR_GROUP = '责任别' and DIR_SOURCECODE = '" + User.UserSourceCode + "' ORDER BY NVL(DIR_NUMBER,0) DESC) "; mbr_dutyname.Field = "nd_name"; mbr_dutyname.ValueField = "nd_code"; mbr_dutyname.Condition = " 1=1 ORDER BY ROWNUM asc"; so_name.TableName = "(select so_name,so_code from solution left join DATAINPUTRECORD ON so_name = DIR_COMMENT AND DIR_GROUP = '解决方案' and DIR_SOURCECODE = '" + User.UserSourceCode + "' ORDER BY NVL(DIR_NUMBER,0) DESC)"; so_name.Field = "so_name"; so_name.ValueField = "so_code"; so_name.Condition = " 1=1 ORDER BY ROWNUM asc"; so_name.SendToBack(); mb_badlocation.SendToBack(); mbr_inman.SendToBack(); } private void Split_Click(object sender, EventArgs e) { } private void SaveRepairInf_Click(object sender, EventArgs e) { if (sn_code.Text == "") { OperateResult.AppendText("序列号不允许为空\n", System.Drawing.Color.Red, sn_code); return; } if (dh.CheckExist("makebadreason", "MBR_SNCODE='" + sn_code.Text + "'")) { OperateResult.AppendText("序列号" + sn_code.Text + "已录入\n", System.Drawing.Color.Red, sn_code); return; } if (!dh.CheckExist("product", "pr_code='" + pr_code.Text + "'")) { OperateResult.AppendText("产品编号" + pr_code.Text + "不存在\n", System.Drawing.Color.Red, sn_code); return; } if (nrg_name.Text == "" || nr_name.Text == "" || mbr_dutyname.Text == "" || so_name.Text == "") { OperateResult.AppendText("请完善维修信息\n", System.Drawing.Color.Red, sn_code); return; } dh.ExecuteSql("insert into makebadreason(MBR_ID,mbr_badlocation,MBR_BADCODE, MBR_SNCODE, MBR_MAKECODE, MBR_SOLUTIONNAME, MBR_DUTYNAME,mbr_linecode,MBR_INMAN,mbr_prodcode,mbr_reason)values(makebadreason_seq.nextval,'" + mb_badlocation.Text + "','" + bc_code.Text + "','" + sn_code.Text + "','" + ma_code.Text + "','" + so_name.Text + "','" + mbr_dutyname.Text + "','" + li_code.Text + "','" + (mbr_inman.Text == "" ? User.UserName : mbr_inman.Text) + "','" + pr_code.Text + "','"+ nr_name.Text + "')", "insert"); OperateResult.AppendText("序列号" + sn_code.Text + "记录维修信息成功\n", System.Drawing.Color.Green, sn_code); sn_code.Focus(); //nrg_name.Text = ""; //nr_name.Text = ""; //mbr_dutyname.Text = ""; //so_name.Text = ""; //bc_code.Text = ""; //mb_badlocation.Text = ""; } } }