using System; using System.Collections; 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.PublicMethod; namespace UAS_MES_NEW.Make { public partial class Make_SeqProgramTransform : Form { AutoSizeFormClass asc = new AutoSizeFormClass(); LogStringBuilder sql = new LogStringBuilder(); DataHelper dh; //原序列号 string TSN = ""; //转换后序列号 string SN = ""; //错误信息 string errorMessage; //存放productsnrelation表中的数据 DataTable ListA; //存放工单信息 DataTable dt; //存放序列号防呆规则 DataTable rules; //step 记录检验规则的进度 int step = 0; //存放关联信息类型 string type; //存放包含IMEI的规则的值,方便拼接 StringBuilder imei = new StringBuilder(); LogStringBuilder logsql = new LogStringBuilder(); //存放工单中数量 int ma_qty; //存放所有关联信息的类型和录入的值 Hashtable hs; string oMakecode = ""; string oMsid = ""; string siid = "";//存储TSN对应的sninfo记录id DataTable macRange;//记录macBT范围 string macOrBt = "";//存储去掉":"或者"-"的mac和bt bool onlyPass = false;//自己转自己 string imeif = ""; bool hasSnList = false;//记录是否有转换后SN清单 bool hasMakeRule = false;//记录是否有工单防呆规则 public Make_SeqProgramTransform() { InitializeComponent(); } private void Make_SeqProgramTransform_Load(object sender, EventArgs e) { asc.controllInitializeSize(this); code.Focus(); //提示用户“>>请输入TSN号” OperateResult.AppendText(">>请输入TSN号\n", Color.Black); dh = SystemInf.dh; StepCount.StepCode = User.CurrentStepCode; StepCount.Source = User.UserSourceCode; StepCount.LineCode = User.UserLineCode; StepCount.Dh = dh; StepCount.Start(); Seq_Remark_PreFix.Text = BaseUtil.GetCacheData("Seq_Remark_PreFix").ToString(); } private void code_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (code.Text != "") { if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out errorMessage)) { //为0,输入TSN if (step == 0) { OperateResult.AppendText(">>TSN号" + code.Text + "\n", Color.Black); if (!ChangeResult.Checked)//不勾选 { //核对工序 if (!LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, code.Text, User.UserCode, out oMakecode, out oMsid, out errorMessage)) { OperateResult.AppendText(">>" + errorMessage + "\n", Color.Red, code); return; } } else//勾选 { oMsid = dh.getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode in (select '" + code.Text + "' from dual union select sn from makesnrelation where beforesn='" + code.Text + "' and sn<>' ' union select beforesn from makesnrelation where sn='" + code.Text + "' and beforesn<>' ')").ToString(); if (oMsid == "") { OperateResult.AppendText("< 0) { if (dt.Rows[0]["ms_downstatus"].ToString() != "0") { OperateResult.AppendText("<<当前TSN号处于下地状态不允许操作\n", Color.Red, code); return; } if (dt.Rows[0]["ms_stepcode"].ToString() == User.CurrentStepCode) { step = 1; TSN = code.Text; //显示序列号 show_sncode.Text = TSN; ChangeResult.Enabled = false; } else { OperateResult.AppendText("<<当前工序不允许重新转号\n", Color.Red, code); return; } } else { OperateResult.AppendText("< 0) { //记录数量 ma_qty = int.Parse(dt.Rows[0]["ma_qty"].ToString()); BaseUtil.SetFormValue(this.Controls, dt); } else { OperateResult.AppendText("<>请输入TSN\n", Color.Black); if (ChangeResult.Checked) { clearInfo(); } return; } if (ChangeResult.Checked) { OperateResult.AppendText(">>请输入SN\n", Color.Green, code); } //判断重新转换未勾选 if (!ChangeResult.Checked) { //没有勾选,只能修改一次 //核对TSN是否正确 //string beforesn = dh.getFieldDataByCondition("makeserial", "ms_beforesn", "ms_sncode='" + code.Text + "'").ToString().Trim(); if (dh.CheckExist("makeserial", "ms_id='" + oMsid + "' and ms_sncode='" + code.Text + "' and ms_beforesn is null")) { step = 1; //记录转换前的序列号 TSN = code.Text; //显示之前的序列号 show_sncode.Text = TSN; OperateResult.AppendText(">>请输入SN\n", Color.Green, code); ChangeResult.Enabled = false; } else //不为空,进行过转换。不勾选修改结果,就不能再修改 { //修改转换结果时,输入两次SN直接过站 if (dh.CheckExist("MakeSerial", "ms_id='" + oMsid + "' and ms_sncode='" + code.Text + "' and ms_beforesn is not null")) { string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsid + "'").ToString(); if (nextstepcode == User.CurrentStepCode) { step = 1; TSN = code.Text; //显示序列号 show_sncode.Text = TSN; OperateResult.AppendText(">>请输入SN\n", Color.Green, code); ChangeResult.Enabled = false; onlyPass = true; } else { OperateResult.AppendText("<<序列号:" + code.Text + "下一工序是" + nextstepcode + ",不是当前岗位的工序\n", Color.Red, code); OperateResult.AppendText(">>请重新输入TSN\n", Color.Black); } } else { OperateResult.AppendText("<<序列号:" + code.Text + "已转换过\n", Color.Red, code); OperateResult.AppendText(">>请重新输入TSN\n", Color.Black); } } } } else if (step == 1) { OperateResult.AppendText(">>" + code.Text + "\n", Color.Black); //判断工单是否导入了序列号清单 if (hasSnList) { if (!dh.CheckExist("makesnlist", "msl_sncode='" + code.Text + "' and msl_makecode='" + ms_macode.Text + "' and msl_type='after'")) { //有序列号清单,输入的序列号却不在范围内 OperateResult.AppendText("<'" + oMsid + "' and nvl(ms_nextmacode,' ') =' '") && !onlyPass || onlyPass && TSN == code.Text)) || (ChangeResult.Checked && !dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "' and ms_id <>'" + oMsid + "' and nvl(ms_nextmacode,' ') =' '"))) { onlyPass = false; //SN校验成功,合法,记录下SN SN = code.Text; code.Text = ""; //开始进行校验规则 if (ListA.Rows.Count > 0) { OperateResult.AppendText(">>请输入" + ListA.Rows[0]["psr_type"] + "\n", Color.Green); //实例化hashTable的值 hs = new Hashtable(); } //step+1 step = 2; } else { if (onlyPass) { OperateResult.AppendText("<>请输入SN\n", Color.Black, code); } } else if (step < ListA.Rows.Count + 2) { OperateResult.AppendText(">>" + code.Text + "\n", Color.Black); //开始进行校验规则 if (checkRules(step)) { step += 1; code.Text = ""; } } } else { OperateResult.AppendText(">>" + errorMessage + "\n", Color.Red, code); } } else { OperateResult.AppendText("<<输入不能为空\n", Color.Red); } } } /// /// 检验长度或者前缀是否合法 /// /// /// /// private bool checkLengthOrPre(CheckBox checkbox, TextBox textbox, string type, string TSNorSN) { if (checkbox.Checked == true) { //如果勾选没有填值 if (textbox.Text == "") { OperateResult.AppendText("<<勾选长度或者前缀需要填写内容\n", Color.Red); return false; } if (type == "长度") { //则判断输入转换前的序列号长度是否合法,不合法则提示 if (code.Text.Trim().Length != int.Parse(textbox.Text)) { //序列号校验错误,长度错误 OperateResult.AppendText("<<" + TSNorSN + ":" + code.Text + "校验错误,长度错误\n", Color.Red, code); OperateResult.AppendText(">>请重新输入" + TSNorSN + "\n", Color.Black); return false; } } else if (type == "前缀") { string[] pres = textbox.Text.Split('|'); bool f = false; for (int i = 0; i < pres.Length; i++) { if (pres[i] == "" ? true : code.Text.StartsWith(pres[i])) { //满足其中一条即可 f = true; break; } } //则判断输入转换前的序列号前缀是否合法,不合法则提示 if (!f) { //序列号校验错误,前缀错误 OperateResult.AppendText("<<" + TSNorSN + ":" + code.Text + "校验错误,前缀错误\n", Color.Red, code); OperateResult.AppendText(">>请重新输入" + TSNorSN + "\n", Color.Black); return false; } } return true; } return true; } /// /// 关联采集的校验 /// /// private bool checkRules(int step) { type = ListA.Rows[step - 2]["psr_type"].ToString(); //将type中的mac和bt中的"-"和":"号去掉 if (type == "MAC" || type == "BT") { if (code.Text.Length > 40) { macOrBt = code.Text.Substring(0, 40).Replace(":", "").Replace("-", ""); } else { macOrBt = code.Text.Replace(":", "").Replace("-", ""); } } else { if (code.Text.Length > 40) { imeif = code.Text.Substring(0, 40); } else { imeif = code.Text; } } if (code.Text.Length > 40) { //如果前缀和长度都满足的话 if ((ListA.Rows[step - 2]["psr_length"].ToString() == "0" ? false : code.Text.Substring(0, 40).Length != int.Parse(ListA.Rows[step - 2]["psr_length"].ToString()))) { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"] + "长度需为" + ListA.Rows[step - 2]["psr_length"].ToString() + "校验不通过,请重新输入\n", Color.Red); OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black, code); return false; } } else { //如果前缀和长度都满足的话 if ((ListA.Rows[step - 2]["psr_length"].ToString() == "0" ? false : code.Text.Length != int.Parse(ListA.Rows[step - 2]["psr_length"].ToString()))) { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"] + "长度需为" + ListA.Rows[step - 2]["psr_length"].ToString() + "校验不通过,请重新输入\n", Color.Red); OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black, code); return false; } } //以|符号分割前缀 string[] preFixs = ListA.Rows[step - 2]["psr_prefix"].ToString().Split('|'); //只要满足其中一个前缀条件即可 bool isfit = false; for (int i = 0; i < preFixs.Length; i++) { if (preFixs[i] == "" ? true : code.Text.StartsWith(preFixs[i])) { //满足其中一条即可 isfit = true; break; } } if (!isfit) { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"] + "前缀校验不通过,请重新输入\n", Color.Red); OperateResult.AppendText(">>请重新输入" + ListA.Rows[step - 2]["psr_type"] + "\n", Color.Black, code); return false; } switch (type) { case "IMEI1": case "IMEI2": case "IMEI3": string tempSn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "(ms_imei1='" + imeif + "' or ms_imei2 = '" + imeif + "' or ms_imei3 = '" + imeif + "') and ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "' and nvl(ms_nextmacode,' ')=' '").ToString(); if (tempSn != "") { OperateResult.AppendText("<<" + type + ":" + imeif + "错误,已被序列号" + tempSn + "使用\n", Color.Red); OperateResult.AppendText(">>请输入" + type + "\n", Color.Black, code); return false; } else { //校验sninfo中是否已经存在这个 tempSn = dh.getFieldDataByCondition("sninfo", "si_sn", "(si_imei1='" + imeif + "' or si_imei2 = '" + imeif + "' or si_imei3 = '" + imeif + "') and si_id <>'" + siid + "'").ToString(); if (tempSn != "") { OperateResult.AppendText("<<" + type + ":" + imeif + "错误,已被序列号" + tempSn + "使用\n", Color.Red); OperateResult.AppendText(">>请输入" + type + "\n", Color.Black, code); return false; } //判断IMEI1,IMEI2,IMEI3中是否已经有这个号了 if (imei.ToString().Contains(imeif)) { OperateResult.AppendText("<<" + type + ":" + imeif + "已录,请重新输入\n", Color.Red); OperateResult.AppendText(">>请输入" + type + "\n", Color.Black, code); return false; } } //通过校验,将包含IMEI的值拼接 imei.Append("'" + imeif + "',"); break; case "BT": case "MAC": //验证是否符合合同防呆 if (!LogicHandler.checkMacOrBtRange(oMsid, macOrBt, type)) { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,不在合同防呆范围内\n", Color.Red); OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code); return false; } //验证是否MAC和BT重复 if (hs.ContainsValue(macOrBt)) { foreach (DictionaryEntry de in hs) { //拿到重复的项 if (de.Value.ToString() == macOrBt) { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误," + de.Key + "已录\n", Color.Red); OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code); return false; } } } //验证是否已被使用 string temSn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "(MS_mac='" + macOrBt + "'or ms_bt='" + macOrBt + "') and ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "' and nvl(ms_nextmacode,' ')=' '").ToString(); if (temSn != "") { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,已被序列号" + temSn + "使用\n", Color.Red); OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code); return false; } else { //校验在sninfo表中是否存在 temSn = dh.getFieldDataByCondition("sninfo", "si_sn", "(si_mac='" + macOrBt + "' or si_bt='" + macOrBt + "') and si_id <>'" + siid + "'").ToString(); if (temSn != "") { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + code.Text + "错误,已被序列号" + temSn + "使用\n", Color.Red); OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code); return false; } } break; case "NETCODE": //验证是否MAC和BT重复 if (hs.ContainsValue(imeif)) { foreach (DictionaryEntry de in hs) { //拿到重复的项 if (de.Value.ToString() == imeif) { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + imeif + "错误," + de.Key + "已录\n", Color.Red); OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code); return false; } } } //校验网标是否存在 string teSn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "MS_" + type + "='" + imeif + "' and ms_status in (0,1,2,3) and ms_id <> '" + oMsid + "' and nvl(ms_nextmacode,' ')=' '").ToString(); if (teSn != "") { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + imeif + "错误,已被序列号" + teSn + "使用\n", Color.Red); OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code); return false; } else { //校验在sninfo表中是否存在 teSn = dh.getFieldDataByCondition("sninfo", "si_sn", "si_" + type + "='" + imeif + "' and si_id <>'" + siid + "'").ToString(); if (teSn != "") { OperateResult.AppendText("<<" + ListA.Rows[step - 2]["psr_type"].ToString() + ":" + imeif + "错误,已被序列号" + teSn + "使用\n", Color.Red); OperateResult.AppendText(">>请输入" + ListA.Rows[step - 2]["psr_type"].ToString() + "\n", Color.Black, code); return false; } } break; } if (step == ListA.Rows.Count + 1) { if (CollectRemark.Checked || SameReamrk.Checked) { if (Remark.Text == "") { OperateResult.AppendText(">>备注栏信息为空,录入备注信息\n", Color.Black); Remark.SelectAll(); Remark.Focus(); imei.Replace(code.Text, ""); return false; } if (IFONLY.Checked) { if (!CheckPre()) { imei.Replace(code.Text, ""); return false; } string UsedSncode = dh.getFieldDataByCondition("SNRELATIONINFORECORD", "SIR_SNCODE", "sir_remark = '" + Remark.Text + "'").ToString(); if (UsedSncode != "") { OperateResult.AppendText(">>备注信息" + Remark.Text + "已被" + UsedSncode + "采集,不可重复采集\n", Color.Red); Remark.SelectAll(); Remark.Focus(); imei.Replace(code.Text, ""); return false; } LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", ms_macode.Text, ma_prodcode.Text, Remark.Text); OperateResult.AppendText(">>备注:" + Remark.Text + "\n", Color.Black); if (CollectRemark.Checked) { Remark.Text = ""; } } else { if (!CheckPre()) { imei.Replace(code.Text, ""); return false; } LogicHandler.CollectRemarkInf(show_sncode.Text, "", "", ms_macode.Text, ma_prodcode.Text, Remark.Text); OperateResult.AppendText(">>备注:" + Remark.Text + "\n", Color.Black); if (CollectRemark.Checked) { Remark.Text = ""; } } } } //满足规则,则采集 if (type == "MAC" || type == "BT") { hs.Add(ListA.Rows[step - 2]["psr_type"].ToString(), macOrBt); } else { hs.Add(ListA.Rows[step - 2]["psr_type"].ToString(), imeif); } //说明已经是最后一个校验规则 if (step == ListA.Rows.Count + 1) { return SetStepResult(); } else { OperateResult.AppendText(">>请输入" + ListA.Rows[step - 1]["psr_type"] + "\n", Color.Green, code); return true; } } //校验备注前缀 private Boolean CheckPre() { try { if (Remark.Text.Substring(0, Seq_Remark_PreFix.Text.Length) != Seq_Remark_PreFix.Text) { OperateResult.AppendText(">>备注前缀不匹配,请重新输入备注信息\n", Color.Red); Remark.SelectAll(); Remark.Focus(); return false; } } catch (Exception) { OperateResult.AppendText(">>备注前缀不匹配,请重新输入备注信息\n", Color.Red); Remark.SelectAll(); Remark.Focus(); return false; } return true; } //通过存储过程二次校验 private Boolean SetStepResult() { if (LogicHandler.snChangeAndBurn(TSN, SN, User.UserSourceCode, User.UserCode, ms_macode.Text, ChangeResult.Checked ? 1 : 0, (hs.ContainsKey("IMEI1") ? hs["IMEI1"].ToString() : ""), (hs.ContainsKey("IMEI2") ? hs["IMEI2"].ToString() : ""), (hs.ContainsKey("IMEI3") ? hs["IMEI3"].ToString() : ""), "", (hs.ContainsKey("NETCODE") ? hs["NETCODE"].ToString() : ""), "", "", "", "", (hs.ContainsKey("MAC") ? hs["MAC"].ToString() : ""), (hs.ContainsKey("BT") ? hs["BT"].ToString() : ""), "", "", "", out errorMessage)) { OperateResult.AppendText("<<序列号" + TSN + "成功转换为" + SN + "\n<<关联采集成功\n", Color.Green); //写入日志 LogManager.DoLog("修改序列号:" + TSN + "为" + SN + "成功!" + "操作人:" + User.UserCode); //记录日志 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_macode.Text, User.UserLineCode, User.UserSourceCode, "序列烧录转换", TSN + "转换为" + SN, SN, ""); //获取剩余数,刷新页面 sql.Clear(); sql.Append("select mcd_inqty from makecraftdetail where mcd_macode='" + ms_macode.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'"); dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select"); if (dt.Rows.Count > 0) { remain_qty.Text = ma_qty - int.Parse(dt.Rows[0]["mcd_inqty"].ToString()) + ""; } //更新页面计数+1 count.Text = int.Parse(count.Text) + 1 + ""; //完成之后,清除信息 clearInfo(); OperateResult.AppendText(">>请输入TSN号\n", Color.Black); } else { OperateResult.AppendText(">>" + errorMessage + "\n", Color.Red, code); OperateResult.AppendText(">>请重新输入TSN\n", Color.Black, code); // //清空信息 clearInfo(); } code.Text = ""; return false; } /// /// 工单号变化时,带出校验规则 /// /// /// private void ms_macode_TextChanged(object sender, EventArgs e) { hasSnList = false; hasMakeRule = false; //清空 TSNPre.Text = ""; TSNLength.Text = ""; SNPre.Text = ""; SNLength.Text = ""; //取消勾选 TSNPre_checkBox.Checked = false; TSNLength_checkBox.Checked = false; SNPre_checkBox.Checked = false; SNLength_checkBox.Checked = false; //设置可编辑 TSNLength.Enabled = true; TSNPre.Enabled = true; SNLength.Enabled = true; SNPre.Enabled = true; TSNPre_checkBox.Enabled = true; TSNLength_checkBox.Enabled = true; SNPre_checkBox.Enabled = true; SNLength_checkBox.Enabled = true; //判断工单是否导入了序列号清单 if (dh.CheckExist("makesnlist", "msl_makecode='" + ms_macode.Text + "' and msl_type='after'")) { hasSnList = true; return; } //查询表工单序列号防呆规则表 rules = (DataTable)dh.ExecuteSql("select msr_startno from makesnrule where msr_makecode='" + ms_macode.Text + "' and msr_type='after'", "select"); if (rules.Rows.Count > 0) { hasMakeRule = true; } else { /* 如果转换前没有值,则取 select productsnrule where psr_prodcode=? 产品编号, * 有值则赋值到 转换前,并且自动勾选不可编辑。*/ rules = (DataTable)dh.ExecuteSql("select psr_prefix,psr_length from productsnrule where psr_prodcode ='" + dt.Rows[0]["ma_prodcode"].ToString() + "' and psr_type='after'", "select"); if (rules.Rows.Count > 0) { //将产品序列号防呆规则查出的数据填充 if (rules.Rows[0]["psr_prefix"].ToString() != "") { SNPre.Text = rules.Rows[0]["psr_prefix"].ToString(); SNPre.Enabled = false; SNPre_checkBox.Checked = true; SNPre_checkBox.Enabled = false; } if (rules.Rows[0]["psr_length"].ToString() != "") { SNLength.Text = rules.Rows[0]["psr_length"].ToString(); SNLength.Enabled = false; SNLength_checkBox.Checked = true; SNLength_checkBox.Enabled = false; } } } } private bool checkExist(string fields) { //不存在 if (!dh.CheckExist("makeserial", fields)) { //则记录 return false; } else { return true; } } private void clearInfo() { //步骤重置为0 step = 0; //关联采集信息清空 if (hs != null) { hs.Clear(); } imei.Clear(); logsql.Clear(); show_sncode.Text = ""; ChangeResult.Enabled = true; onlyPass = false; } private void cancel_Click(object sender, EventArgs e) { //清除已经采集的所有信息 clearInfo(); //提示用户输入TSN OperateResult.AppendText(">>请输入TSN\n", Color.Green); } private void ChangeResult_CheckedChanged(object sender, EventArgs e) { if (ChangeResult.Checked) { //勾选的时候提示输入TSN OperateResult.AppendText(">>请输入TSN号\n", Color.Black); } } private void Make_SeqProgramTransform_SizeChanged(object sender, EventArgs e) { asc.controlAutoSize(this); } private void Seq_Remark_PreFix_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { BaseUtil.SetCacheData("Seq_Remark_PreFix", Seq_Remark_PreFix.Text); if (CollectRemark.Checked || SameReamrk.Checked) { Remark.SelectAll(); Remark.Focus(); } } } private void Remark_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { if (step == ListA.Rows.Count + 1 && (CollectRemark.Checked || SameReamrk.Checked) && Remark.Text != "") { code.Enabled = true; code.Focus(); code_KeyDown(this, new KeyEventArgs(Keys.Enter)); } else { code.Enabled = true; code.Focus(); } } catch { code.Enabled = true; code.Focus(); } } } private void IFONLY_CheckedChanged(object sender, EventArgs e) { if (IFONLY.Checked) { SameReamrk.Checked = false; CollectRemark.Checked = true; } } private void SameReamrk_CheckedChanged(object sender, EventArgs e) { if (SameReamrk.Checked) { IFONLY.Checked = false; CollectRemark.Checked = false; } } private void CollectRemark_CheckedChanged(object sender, EventArgs e) { if (CollectRemark.Checked) { SameReamrk.Checked = false; } } private void Remark_Enter(object sender, EventArgs e) { code.Enabled = false; } private void Remark_Leave(object sender, EventArgs e) { code.Enabled = true; } } }