using System; using System.Data; 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_CancelImei : Form { DataHelper dh; LogStringBuilder sql = new LogStringBuilder(); public Special_CancelImei() { InitializeComponent(); } private void Special_BoxSplit_Load(object sender, EventArgs e) { dh = SystemInf.dh; } private void Split_Click(object sender, EventArgs e) { } private void SaveRepairInf_Click(object sender, EventArgs e) { if (Reason.Text == "") { MessageBox.Show("必须填写原因"); return; } DataTable dt = (DataTable)dh.ExecuteSql("select si_sn,si_imei1 from sninfo where si_imei1 ='" + IMEI.Text + "'", "select"); if (dt.Rows.Count > 0) { dt = (DataTable)dh.ExecuteSql("select ms_sncode,substr(pr_detail,0,15)pr_detail from makeserial left join product on pr_code=ms_prodcode where ms_imei1='" + IMEI.Text + "'", "select"); if (dt.Rows.Count > 0) { string sn = dt.Rows[0]["ms_sncode"].ToString(); string pr_detail = dt.Rows[0]["pr_detail"].ToString(); dh.ExecuteSql("update makeserial set ms_imei1='" + Reason.Text + "' where ms_imei1='" + IMEI.Text + "'", "update"); dh.ExecuteSql("update sninfo set ms_imei1='' where sn_imei1='" + IMEI.Text + "'", "update"); LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, Reason.Text, "取消成功", IMEI.Text, ""); OperateResult.AppendText("SN:" + sn + ",IMEI:" + IMEI.Text + ",机型:" + pr_detail + "取消成功\n", System.Drawing.Color.Black); } } else { dt = (DataTable)dh.ExecuteSql("select si_sn,si_imei2 from sninfo where si_imei2 ='" + IMEI.Text + "'", "select"); if (dt.Rows.Count > 0) { dt = (DataTable)dh.ExecuteSql("select ms_sncode,substr(pr_detail,0,15)pr_detail from makeserial left join product on pr_code=ms_prodcode where ms_imei2='" + IMEI.Text + "'", "select"); if (dt.Rows.Count > 0) { string sn = dt.Rows[0]["ms_sncode"].ToString(); string pr_detail = dt.Rows[0]["pr_detail"].ToString(); dh.ExecuteSql("update makeserial set ms_imei2=='" + Reason.Text + "' where ms_imei2='" + IMEI.Text + "'", "update"); dh.ExecuteSql("update sninfo set si_imei2='' where sn_imei2='" + IMEI.Text + "'", "update"); LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, Reason.Text, "取消成功", IMEI.Text, ""); LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, Reason.Text, "取消成功", IMEI.Text, ""); OperateResult.AppendText("SN:" + sn + ",IMEI:" + IMEI.Text + ",机型:" + pr_detail + "取消成功\n", System.Drawing.Color.Black); } } else { OperateResult.AppendText(IMEI.Text + "未录入系统\n", System.Drawing.Color.Black); } } } } }