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_UpdateSn : Form { DataHelper dh = SystemInf.dh; LogStringBuilder sql = new LogStringBuilder(); public Special_UpdateSn() { InitializeComponent(); } private void Confirm_Click(object sender, EventArgs e) { if (!dh.CheckExist("smtbind", "sb_barcode = '" + sncode.Text + "'")) { OperateResult.AppendText(">>序列号" + sncode.Text + "不存在绑定记录,无法操作\n", Color.Red, sncode); sncode.Focus(); return; } if (dh.CheckExist("smtbind", "sb_barcode = '" + newsncode.Text + "'") || dh.CheckExist("makeserial", "ms_sncode = '" + newsncode.Text + "'")) { OperateResult.AppendText(">>序列号" + newsncode.Text + "存在绑定以及采集记录,无法操作\n", Color.Red, newsncode); newsncode.Focus(); return; } //更新记录 dh.ExecuteSql("update MES_SMTLOCATION_TABLE set smt_ms_sncode = '"+ newsncode.Text + "' where smt_ms_sncode = '"+ sncode.Text + "'", "update"); dh.ExecuteSql("update smtbind set sb_barcode = '" + newsncode.Text + "' where sb_barcode = '" + sncode.Text + "'", "update"); dh.ExecuteSql("update steppassed set sp_sncode = '" + newsncode.Text + "' where sp_sncode = '" + sncode.Text + "'", "update"); dh.ExecuteSql("update makeserial set ms_code = '" + newsncode.Text + "',ms_sncode = '" + newsncode.Text + "',ms_firstsn = '" + newsncode.Text + "' where ms_sncode = '" + sncode.Text + "'", "update"); dh.ExecuteSql("update CRAFTMATERIAL set cm_mscode = '" + newsncode.Text + "',cm_sncode = '" + newsncode.Text + "' where cm_sncode = '" + sncode.Text + "'", "update"); dh.ExecuteSql("update REDUCESTEPRECORD set rsd_sncode = '" + newsncode.Text + "' where rsd_sncode = '" + sncode.Text + "'", "update"); dh.ExecuteSql("update makeprocess set mp_sncode = '" + newsncode.Text + "',mp_mscode = '" + newsncode.Text + "' where mp_sncode = '" + sncode.Text + "'", "update"); dh.ExecuteSql("update commandlog set cl_sncode = '" + newsncode.Text + "' where cl_sncode = '" + sncode.Text + "'", "update"); dh.ExecuteSql("update makebad set mb_mscode = '" + newsncode.Text + "',mb_sncode = '" + newsncode.Text + "' where mb_sncode = '" + sncode.Text + "'", "update"); dh.ExecuteSql("update MAKEBADREASON set mbr_sncode = '" + newsncode.Text + "' where mbr_sncode = '" + sncode.Text + "'", "update"); LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode,"", User.UserLineCode, User.UserSourceCode, "SN更新", "旧SN:"+ sncode.Text + "更新为:"+ newsncode.Text + "", newsncode.Text, ""); OperateResult.AppendText(">>旧SN:" + sncode.Text + "更新为:" + newsncode.Text + "\n", Color.Green); newsncode.Text = ""; sncode.Text = ""; sncode.Focus(); // OperateResult.AppendText(">>序列号" + sncode.Text + "不存在\n", Color.Red, sncode); } private void Clean_Click(object sender, EventArgs e) { OperateResult.Clear(); } private void sn_code_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (!dh.CheckExist("smtbind", "sb_barcode = '" + sncode.Text + "'")) { OperateResult.AppendText(">>序列号" + sncode.Text + "不存在绑定记录,无法操作\n", Color.Red, sncode); return; } else { newsncode.Focus(); newsncode.SelectAll(); } } } private void enterTextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (dh.CheckExist("smtbind", "sb_barcode = '" + newsncode.Text + "'") || dh.CheckExist("makeserial", "ms_sncode = '" + newsncode.Text + "'")) { OperateResult.AppendText(">>序列号" + newsncode.Text + "存在绑定以及采集记录,无法操作\n", Color.Red, newsncode); return; } else { Confirm_Click(sender, e); } } } } }