using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Windows.Forms; using UAS_MES_NEW.DataOperate; using UAS_MES_NEW.Entity; using UAS_MES_NEW.PublicMethod; namespace UAS_MES_NEW.Special { public partial class Special_Repair : Form { DataHelper dh = null; LogStringBuilder sql = new LogStringBuilder(); List sqls = new List(); DataTable dt = null; AutoSizeFormClass asc = new AutoSizeFormClass(); public Special_Repair() { InitializeComponent(); } private void Make_Repair_Load(object sender, EventArgs e) { dh = SystemInf.dh; GetSNCode.Focus(); //工厂复测确认 as_recheck.TableName = "aftersaleinf"; as_recheck.Field = "ASI_VALUES"; as_recheck.ValueField = "ASI_VALUES"; as_recheck.Condition = " asi_type='原因定位' "; as_location.TableName = "aftersaleinf"; as_location.Field = "ASI_VALUES"; as_location.ValueField = "ASI_VALUES"; as_location.Condition = " asi_type='位置' "; as_badpro.TableName = "aftersaleinf"; as_badpro.Field = "ASI_VALUES"; as_badpro.ValueField = "ASI_VALUES"; as_badpro.Condition = " asi_type='不良属性' "; as_method.TableName = "aftersaleinf"; as_method.Field = "ASI_VALUES"; as_method.ValueField = "ASI_VALUES"; as_method.Condition = " asi_type='处置动作' "; as_type.TableName = "aftersaleinf"; as_type.Field = "ASI_VALUES"; as_type.ValueField = "ASI_VALUES"; as_type.Condition = " asi_type='不良类别' "; as_image1.TableName = "aftersaleinf"; as_image1.Field = "ASI_VALUES"; as_image1.ValueField = "ASI_VALUES"; as_image1.Condition = " asi_type='不良现象' "; //屏幕外观确认 as_lcdconfirm.Properties.Items.Add("有"); as_lcdconfirm.Properties.Items.Add("无"); //壳体外观确认 as_shellconfirm.Properties.Items.Add("有"); as_shellconfirm.Properties.Items.Add("无"); //配件确认 dt = (DataTable)dh.ExecuteSql("select ASI_VALUES from aftersaleinf where asi_type='配件确认'", "select"); for (int i = 0; i < dt.Rows.Count; i++) { as_changerconfirm.Properties.Items.Add(dt.Rows[i][0].ToString()); } //位置1 dt = (DataTable)dh.ExecuteSql("select ASI_VALUES from aftersaleinf where asi_type='位置1'", "select"); for (int i = 0; i < dt.Rows.Count; i++) { as_location1.Properties.Items.Add(dt.Rows[i][0].ToString()); } //责任归属2 as_duty2.Properties.Items.Add("小度"); as_duty2.Properties.Items.Add("欧度利方"); asc.controllInitializeSize(this); as_lcdconfirm.SendToBack(); as_badpro.SendToBack(); as_type.SendToBack(); as_image1.SendToBack(); as_method.SendToBack(); as_recheck.SendToBack(); as_location.SendToBack(); as_location1.SendToBack(); as_process.SendToBack(); as_shellconfirm.SendToBack(); as_changerconfirm.SendToBack(); AS_DUTY.SendToBack(); as_duty2.SendToBack(); GetSNCode.SendToBack(); } private void GetSNCode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (GetSNCode.Text == "") { OperatResult.AppendText(">>序列号不允许为空\n", Color.Red); BaseUtil.CleanForm(this); return; } sql.Clear(); sql.Append("select * from aftersale left join makeserial on as_sn=ms_sncode left join make "); sql.Append("on ms_makecode=ma_code where as_sn = '" + GetSNCode.Text + "' order by as_id desc"); DataTable dt_ = (DataTable)dh.ExecuteSql(sql.GetString(), "select"); if (dt_.Rows.Count == 0) { OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "不存在导入清单中\n", Color.Red); BaseUtil.CleanForm(this); return; } as_outdate.Text = "否"; dt = (DataTable)dh.ExecuteSql("select * from prodiomac where pim_mac='" + GetSNCode.Text + "' and PIM_INOROUT='OUT' and sysdate-547>序列号:" + GetSNCode.Text + "出货已超过1年半\n", Color.Red); //BaseUtil.CleanForm(this); //return; } BaseUtil.SetFormValue(this.Controls, dt_); } } private void Make_Repair_SizeChanged(object sender, EventArgs e) { asc.controlAutoSize(this); } private void Clean_Click(object sender, EventArgs e) { OperatResult.Clear(); } private void Make_Repair_FormClosing(object sender, FormClosingEventArgs e) { dh.Dispose(); } public void RefreshData() { GetSNCode_KeyDown(new object(), new KeyEventArgs(Keys.Enter)); } private void Save_Click(object sender, EventArgs e) { sql.Clear(); sql.Append("update aftersale set "); if (as_recheck.Text != "") { sql.Append("as_recheck='" + as_recheck.Text + "',"); } if (as_lcdconfirm.Text != "") { sql.Append("as_lcdconfirm='" + as_lcdconfirm.Text + "',"); } if (as_shellconfirm.Text != "") { sql.Append("as_shellconfirm='" + as_shellconfirm.Text + "',"); } if (as_changerconfirm.Text != "") { sql.Append("as_changerconfirm='" + as_changerconfirm.Text + "',"); } if (as_duty2.Text != "") { sql.Append("as_duty2='" + as_duty2.Text + "',"); } if (as_process.Text != "") { sql.Append("as_process='" + as_process.Text + "',"); } if (as_type.Text != "") { sql.Append("as_type='" + as_type.Text + "',"); } if (as_method.Text != "") { sql.Append("as_method='" + as_method.Text + "',"); } if (as_badpro.Text != "") { sql.Append("as_badpro='" + as_badpro.Text + "',"); } if (as_location.Text != "") { sql.Append("as_location='" + as_location.Text + "',"); } if (as_image1.Text != "") { sql.Append("as_image1='" + as_image1.Text + "',"); } if (as_location1.Text != "") { sql.Append("as_location1='" + as_location1.Text + "',"); } sql.Append(" as_repairman='" + User.UserName + "' where as_id='" + as_id.Text + "'"); dh.ExecuteSql(sql.GetString(), "update"); OperatResult.AppendText(">>序列号【" + GetSNCode.Text + "】保存维修信息成功\n", Color.Green); //dt = (DataTable)dh.ExecuteSql("select max(ms_id) from makeserial where ms_sncode='" + GetSNCode.Text + "'", "select"); //if (dt.Rows.Count > 0) //{ // string ms_id = dt.Rows[0][0].ToString(); // dt = (DataTable)dh.ExecuteSql("select ms_firstsn from makeserial where ms_id='" + ms_id + "'", "select"); // if (dt.Rows.Count > 0) // { // string ms_firstsn = dt.Rows[0][0].ToString(); // dh.ExecuteSql("update craftmaterial set cm_status=-1 where cm_firstsn='" + ms_firstsn + "'", "update"); // OperatResult.AppendText(">>序列号【" + GetSNCode.Text + "】物料拆解成功\n", Color.Green); // } //} GetSNCode.Clear(); AS_DESCRIPTION.Clear(); BaseUtil.CleanForm(this); } private void as_badpro_UserControlTextChanged(object sender, EventArgs e) { switch (as_badpro.Text) { case "NTF": as_duty2.Text = "小度"; break; case "过保": as_duty2.Text = "小度"; break; case "检测无故障": as_duty2.Text = "小度"; break; default: as_duty2.Text = "欧度利方"; break; } Load_as_type(); } private void as_type_UserControlTextChanged(object sender, EventArgs e) { Load_as_image1(); } private void as_recheck_UserControlTextChanged(object sender, EventArgs e) { Load_as_recheck(); } private void Load_as_type() { DataTable dt = (DataTable)dh.ExecuteSql("select asi_code from aftersaleinf where ASI_VALUES='" + as_badpro.Text + "'", "select"); if (dt.Rows.Count > 0) { as_type.Condition = "asi_type='不良类别' and asi_toplevelcode='" + dt.Rows[0][0].ToString() + "'"; } } private void Load_as_image1() { DataTable dt = (DataTable)dh.ExecuteSql("select asi_code from aftersaleinf where ASI_VALUES='" + as_type.Text + "'", "select"); if (dt.Rows.Count > 0) { as_image1.Condition = "asi_type='不良现象' and asi_toplevelcode='" + dt.Rows[0][0].ToString() + "'"; } } private void Load_as_recheck() { DataTable dt = (DataTable)dh.ExecuteSql("select asi_code from aftersaleinf where ASI_VALUES='" + as_type.Text + "'", "select"); if (dt.Rows.Count > 0) { as_method.Condition = "asi_type='原因定位' and asi_toplevelcode='" + dt.Rows[0][0].ToString() + "'"; } } } }