Make_CartonBoxWeigh.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. using LabelManager2;
  2. using Microsoft.Win32;
  3. using System;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.IO.Ports;
  8. using System.Text;
  9. using System.Text.RegularExpressions;
  10. using System.Threading;
  11. using System.Windows.Forms;
  12. using UAS_MES.DataOperate;
  13. using UAS_MES.Entity;
  14. using UAS_MES.PublicForm;
  15. using UAS_MES.PublicMethod;
  16. namespace UAS_MES.Make
  17. {
  18. public partial class Make_CartonBoxWeigh : Form
  19. {
  20. AutoSizeFormClass asc = new AutoSizeFormClass();
  21. DataHelper dh;
  22. DataTable dt;
  23. LogStringBuilder sql = new LogStringBuilder();
  24. ApplicationClass lbl;
  25. Document doc;
  26. Regex re = new Regex("\\d+.\\d+\\w+");
  27. Thread thread;
  28. string PR_CHECKCARTONW = "0";
  29. //创建串口实例
  30. SerialPort serialPort1 = new SerialPort();
  31. //true的时候表示从串口读取数据
  32. bool GetData = true;
  33. //箱内总数
  34. int pa_totalqty;
  35. //称量的标准重量
  36. Double Weight;
  37. //最大重量
  38. Double MaxWeight;
  39. //最小重量
  40. Double MinWeight;
  41. DataTable ListC = new DataTable();
  42. Thread InitPrint;
  43. public Make_CartonBoxWeigh()
  44. {
  45. InitializeComponent();
  46. }
  47. protected override void OnVisibleChanged(EventArgs e)
  48. {
  49. base.OnVisibleChanged(e);
  50. if (!IsHandleCreated)
  51. {
  52. this.Close();
  53. }
  54. }
  55. private void 卡通箱称重_Load(object sender, EventArgs e)
  56. {
  57. CheckForIllegalCrossThreadCalls = false;
  58. asc.controllInitializeSize(this);
  59. ComList.Text = BaseUtil.GetCacheData("PortName").ToString();
  60. BaudRate.Text = BaseUtil.GetCacheData("BaudRate").ToString();
  61. InitPrint = new Thread(InPrint);
  62. SetLoadingWindow stw = new SetLoadingWindow(InitPrint, "初始化打印程序");
  63. BaseUtil.SetFormCenter(stw);
  64. stw.ShowDialog();
  65. StartWeight.PerformClick();
  66. dh = SystemInf.dh;
  67. StepCount.StepCode = User.CurrentStepCode;
  68. StepCount.Source = User.UserSourceCode;
  69. StepCount.LineCode = User.UserLineCode;
  70. StepCount.Dh = dh;
  71. StepCount.Start();
  72. }
  73. private void InPrint()
  74. {
  75. try
  76. {
  77. lbl = new ApplicationClass();
  78. BaseUtil.WriteLbl();
  79. }
  80. catch (Exception)
  81. {
  82. OperateResult.AppendText("未正确安装CodeSoft软件\n", Color.Red);
  83. }
  84. }
  85. private void 卡通箱称重_SizeChanged(object sender, EventArgs e)
  86. {
  87. weight.Location = new Point(weight_label.Location.X + weight_label.Size.Width - 10, weight_label.Location.Y - 20);
  88. asc.controlAutoSize(this);
  89. }
  90. private void sncode_KeyDown(object sender, KeyEventArgs e)
  91. {
  92. if (e.KeyCode == Keys.Enter)
  93. {
  94. //根据箱号查询表单数据
  95. sql.Clear();
  96. sql.Append("select pa_totalqty,ma_code,ma_qty,ma_salecode,PA_STANDARDQTY,PA_CURRENTQTY,pr_detail,pr_cartonunit,pr_code,pr_cartongw,");
  97. sql.Append("pr_cartonmaxw,pr_cartonminw,nvl(PR_CHECKCARTONW,'0') PR_CHECKCARTONW,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype from package left join packagedetail ");
  98. sql.Append("on pa_id=pd_paid left join makeserial on ms_sncode=pd_barcode and ms_makecode=pa_makecode left join product on pr_code=pd_prodcode left join make on ma_code=pd_makecode ");
  99. sql.Append(" where pa_outboxcode='" + outboxcode.Text + "' and pa_nextstep='" + User.CurrentStepCode + "'");
  100. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  101. //填充打印文件选项的DataGridView
  102. if (dt.Rows.Count > 0)
  103. {
  104. BaseUtil.SetFormValue(this.Controls, dt);
  105. string ErrorMessage;
  106. //重量的临时变量
  107. PR_CHECKCARTONW = dt.Rows[0]["PR_CHECKCARTONW"].ToString();
  108. string _weight = dt.Rows[0]["pr_cartongw"].ToString();
  109. string _maxweight = dt.Rows[0]["pr_cartonmaxw"].ToString();
  110. string _minweight = dt.Rows[0]["pr_cartonminw"].ToString();
  111. string pa_pr_cartonunit = dt.Rows[0]["pr_cartonunit"].ToString();
  112. string PA_STANDARDQTY = dt.Rows[0]["PA_STANDARDQTY"].ToString();
  113. string PA_CURRENTQTY = dt.Rows[0]["PA_CURRENTQTY"].ToString();
  114. Weight = double.Parse(_weight == "" ? "0" : _weight);
  115. MaxWeight = double.Parse(_maxweight == "" ? "0" : _maxweight);
  116. MinWeight = double.Parse(_minweight == "" ? "0" : _minweight);
  117. pa_totalqty = int.Parse(dt.Rows[0]["pa_totalqty"].ToString());
  118. if (Weight - MinWeight == MaxWeight - Weight)
  119. pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight) + dt.Rows[0]["pr_cartonunit"].ToString();
  120. else
  121. pr_cartongw.Text = MinWeight + "-" + MaxWeight + dt.Rows[0]["pr_cartonunit"].ToString();
  122. double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text.Replace("kg", "").Trim());
  123. if (sncheck.Checked && sn.Text == "")
  124. {
  125. OperateResult.AppendText(">>SN校验不可为空\n", Color.Red);
  126. sn.Text = "";
  127. outboxcode.Text = "";
  128. sn.Focus();
  129. return;
  130. }
  131. if (sn.Text != "" && !dh.CheckExist("packagedetail", "pd_outboxcode = '" + outboxcode.Text + "' and pd_barcode = '" + sn.Text + "'"))
  132. {
  133. OperateResult.AppendText(">>SN:" + sn.Text + "不存在与箱号:" + outboxcode.Text + "中\n", Color.Red);
  134. sn.Text = "";
  135. outboxcode.Text = "";
  136. sn.Focus();
  137. return;
  138. }
  139. //需要检查称重重量
  140. if (PR_CHECKCARTONW != "0" && PA_STANDARDQTY == PA_CURRENTQTY)
  141. {
  142. //称量合格或不合格都记录重量
  143. if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight && ActualWeight != 0)
  144. {
  145. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱" + outboxcode.Text + "称重", "称量合格:" + weight.Text.Trim(), outboxcode.Text, "");
  146. LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
  147. OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测合格\n", Color.Green);
  148. }
  149. else
  150. {
  151. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱" + outboxcode.Text + "称重", "称量不合格:" + weight.Text.Trim(), outboxcode.Text, "");
  152. LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
  153. OperateResult.AppendText(">>箱号" + outboxcode.Text + "检测未通过\n", Color.Red, outboxcode);
  154. sn.Text = "";
  155. if (sncheck.Checked)
  156. {
  157. sn.Focus();
  158. }
  159. return;
  160. }
  161. }
  162. else
  163. {
  164. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "卡通箱" + outboxcode.Text + "称重", "称量完成:" + weight.Text.Trim(), outboxcode.Text, "");
  165. LogicHandler.RecordProdWeight(outboxcode.Text, "CARTON", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
  166. }
  167. dh.UpdateByCondition("package", "pa_printcount= nvl(pa_printcount,0)+1,pa_weight='" + ActualWeight + "',pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + outboxcode.Text + "'");
  168. if (AutoPrint.Checked)
  169. {
  170. if (PrintLabel.Items.Count > 0)
  171. {
  172. Confirm.PerformClick();
  173. }
  174. else
  175. {
  176. OperateResult.AppendText(">>产品" + pr_code.Text + "未维护卡通标签\n", Color.Red);
  177. }
  178. }
  179. ListViewItem lsi = new ListViewItem();
  180. lsi.SubItems.Add(outboxcode.Text);
  181. lsi.SubItems.Add(ActualWeight.ToString() + pr_cartonunit.Text);
  182. lsi.SubItems.Add(System.DateTime.Now.ToString());
  183. WeighRecord.Items.Add(lsi);
  184. OperateResult.AppendText(">>箱号" + outboxcode.Text + "称重完成\n", Color.Green);
  185. //if (LogicHandler.CartonBoxStepPass(ma_code.Text, User.UserSourceCode, outboxcode.Text, User.UserCode, "卡通箱:" + outboxcode.Text + "整箱过站", out ErrorMessage))
  186. //{
  187. // dh.UpdateByCondition("package", "pa_printcount= nvl(pa_printcount,0)+1,pa_weight='" + ActualWeight + "',pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + outboxcode.Text + "'");
  188. // dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + outboxcode.Text + "'").ToString() + "' ,PA_CURRENTSTEP = '' ", "pa_outboxcode='" + outboxcode.Text + "'");
  189. //}
  190. //else
  191. //{
  192. // OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
  193. //}
  194. DataTable dt1 = (DataTable)dh.ExecuteSql("select wm_concat(ms_sncode) from makeserial where ms_downstatus=-1 and ms_outboxcode='" + outboxcode.Text + "'", "select");
  195. if (dt1.Rows.Count > 0)
  196. {
  197. if (dt1.Rows[0][0].ToString() != "")
  198. {
  199. OperateResult.AppendText(">序列号:" + dt1.Rows[0][0].ToString() + "处于下地状态,箱不允许过站\n", Color.Red);
  200. return;
  201. }
  202. }
  203. if (!LogicHandler.OutBoxStepPass(outboxcode.Text, ma_code.Text, User.UserSourceCode, User.UserCode, "卡通箱:" + outboxcode.Text + "整箱过站", "卡通箱整箱过站", out ErrorMessage))
  204. {
  205. OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, outboxcode);
  206. sn.Text = "";
  207. if (sncheck.Checked)
  208. {
  209. sn.Focus();
  210. }
  211. return;
  212. }
  213. dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + outboxcode.Text + "'").ToString() + "' ,PA_CURRENTSTEP = '' ", "pa_outboxcode='" + outboxcode.Text + "'");
  214. LoadCheckQTY();
  215. outboxcode.Clear();
  216. sn.Text = "";
  217. if (sncheck.Checked)
  218. {
  219. sn.Focus();
  220. }
  221. }
  222. else
  223. {
  224. OperateResult.AppendText(">>箱号" + outboxcode.Text + "当前执行工序不是" + User.CurrentStepCode + "\n", Color.Red, outboxcode);
  225. sn.Text = "";
  226. if (sncheck.Checked)
  227. {
  228. sn.Focus();
  229. }
  230. }
  231. }
  232. }
  233. private void getSerialData()
  234. {
  235. if (serialPort1.IsOpen)
  236. {
  237. if (!SystemInf.OpenPort.Contains(serialPort1.PortName))
  238. {
  239. SystemInf.OpenPort.Add(serialPort1.PortName);
  240. try
  241. {
  242. while (GetData)
  243. {
  244. try
  245. {
  246. weight.Text = re.Match(serialPort1.ReadLine().Trim()).Groups[0].Value;
  247. }
  248. catch (Exception)
  249. {
  250. GetData = false;
  251. }
  252. }
  253. }
  254. catch (IOException ex) { OperateResult.AppendText(">>" + ex.Message + "\n", Color.Red, outboxcode); }
  255. }
  256. else OperateResult.AppendText(">>端口已被占用,请关闭其他窗口\n", Color.Red, outboxcode);
  257. }
  258. }
  259. //确认打印
  260. private void Confirm_Click(object sender, EventArgs e)
  261. {
  262. //doc = lbl.Documents.Open(PrintLabel.Text);
  263. string ErrorMessage = "";
  264. if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
  265. {
  266. OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
  267. }
  268. }
  269. //停止进程,关闭串口
  270. private void StopWeight_Click(object sender, EventArgs e)
  271. {
  272. if (serialPort1.IsOpen)
  273. {
  274. GetData = false;
  275. serialPort1.Close();
  276. SystemInf.OpenPort.Remove(serialPort1.PortName);
  277. thread.Abort();
  278. }
  279. }
  280. //关闭窗口的时候停止进程,不再读取串口数据
  281. private void 卡通箱称重_FormClosing(object sender, FormClosingEventArgs e)
  282. {
  283. BaseUtil.ClosePrint(lbl);
  284. StopWeight.PerformClick();
  285. InitPrint.Abort();
  286. if (serialPort1.IsOpen)
  287. {
  288. GetData = false;
  289. serialPort1.Close();
  290. SystemInf.OpenPort.Remove(serialPort1.PortName);
  291. thread.Interrupt();
  292. }
  293. //thread.Abort();
  294. }
  295. private void StartWeight_Click(object sender, EventArgs e)
  296. {
  297. thread = new Thread(getSerialData);
  298. try
  299. {
  300. GetData = true;
  301. serialPort1.PortName = this.ComList.Text;
  302. serialPort1.BaudRate = int.Parse(BaudRate.Text);
  303. serialPort1.Open();
  304. thread.Start();
  305. }
  306. catch (Exception mes)
  307. {
  308. if (BaudRate.Text == "" || ComList.Text == "")
  309. OperateResult.AppendText(">>请先在电子秤调试界面维护波特率和串口\n", Color.Red);
  310. else
  311. OperateResult.AppendText(">>" + mes.Message + "\n", Color.Red);
  312. }
  313. }
  314. private void pr_code_TextChanged(object sender, EventArgs e)
  315. {
  316. dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='卡通箱标' and la_statuscode='AUDITED' order by la_isdefault", "select");
  317. PrintLabel.DataSource = dt;
  318. PrintLabel.DisplayMember = "la_url";
  319. PrintLabel.ValueMember = "la_id";
  320. }
  321. private void PrintLabel_SelectedValueChanged(object sender, EventArgs e)
  322. {
  323. if (PrintLabel.SelectedValue != null && PrintLabel.SelectedValue.ToString() != "System.Data.DataRowView")
  324. {
  325. string PrintNums = dh.getFieldDataByCondition("label", "la_printnos", "la_id='" + PrintLabel.SelectedValue.ToString() + "'").ToString();
  326. PrintNum.Text = (PrintNums == "" ? "1" : PrintNums);
  327. }
  328. }
  329. private void SendCheck_Click(object sender, EventArgs e)
  330. {
  331. DataTable dt = (DataTable)dh.ExecuteSql("select wm_concat(pa_outboxcode) pa_outboxcode from package where pa_checkno='" + ob_checkno.Text + "' and pa_status=0 ", "select");
  332. if (dt.Rows[0][0].ToString() != "")
  333. {
  334. OperateResult.AppendText(">>批次" + ob_checkno.Text + "存在箱号" + dt.Rows[0][0].ToString() + "未封箱,请先进行封箱\n", Color.Red);
  335. return;
  336. }
  337. sql.Clear();
  338. sql.Append("update oqcbatch set ob_status='UNCHECK',ob_breakingdate=sysdate where ob_checkno ='" + ob_checkno.Text + "'");
  339. dh.ExecuteSql(sql.GetString(), "select");
  340. ob_nowcheckqty.Text = "";
  341. ob_batchqty.Text = "";
  342. ob_nowcheckqty.ForeColor = Color.Black;
  343. SendCheck.Enabled = false;
  344. OperateResult.AppendText(">>批次" + ob_checkno.Text + "送检成功\n", Color.Green);
  345. LogicHandler.InsertMakeProcess("", ma_code.Text, User.UserSourceCode, "手动送检", "手动送检成功", User.UserCode);
  346. //记录操作日志
  347. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "手动送检", "手动送检成功", "", ob_checkno.Text);
  348. ob_checkno.Text = "";
  349. }
  350. bool AutoCut;
  351. private void LoadCheckQTY()
  352. {
  353. sql.Clear();
  354. string condition = "";
  355. int nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
  356. int batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
  357. if (nowcheckqty + 1 == batchqty && AutoCut)
  358. {
  359. condition = "and ob_status='UNCHECK' and ob_checkno='" + ob_checkno.Text + "'";
  360. }
  361. else
  362. {
  363. condition = "and ob_status='ENTERING' ";
  364. }
  365. if (pr_sendchecktype.Text == "SaleCode")
  366. {
  367. condition += " and ob_salecode='" + ma_salecode.Text + "'";
  368. }
  369. else if (pr_sendchecktype.Text == "MakeCode")
  370. {
  371. condition += " and ob_makecode='" + ma_code.Text + "'";
  372. }
  373. sql.Append("select ob_batchqty,ob_nowcheckqty,ob_checkno from oqcbatch where ");
  374. sql.Append("ob_linecode='" + User.UserLineCode + "' and ob_prodcode='" + pr_code.Text + "' and ");
  375. sql.Append("ob_stepcode='" + User.CurrentStepCode + "' " + condition);
  376. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  377. if (dt.Rows.Count > 0)
  378. {
  379. ob_batchqty.Text = dt.Rows[0]["ob_batchqty"].ToString();
  380. ob_nowcheckqty.Text = dt.Rows[0]["ob_nowcheckqty"].ToString();
  381. ob_checkno.Text = dt.Rows[0]["ob_checkno"].ToString();
  382. nowcheckqty = int.Parse(ob_nowcheckqty.Text == "" ? "0" : ob_nowcheckqty.Text);
  383. batchqty = int.Parse(ob_batchqty.Text == "" ? "0" : ob_batchqty.Text);
  384. if (nowcheckqty >= batchqty)
  385. {
  386. ob_nowcheckqty.ForeColor = Color.Red;
  387. OperateResult.AppendText(">>当前采集数量已达到送检数量\n", Color.Red);
  388. if (AutoCut)
  389. {
  390. OperateResult.AppendText(">>批次" + ob_checkno.Text + "自动断批\n", Color.Green);
  391. }
  392. }
  393. }
  394. else
  395. {
  396. ob_batchqty.Text = "";
  397. ob_nowcheckqty.Text = "";
  398. ob_checkno.Text = "";
  399. SendCheck.Enabled = false;
  400. }
  401. if (ob_batchqty.Text != "")
  402. {
  403. SendCheck.Enabled = true;
  404. }
  405. else
  406. {
  407. SendCheck.Enabled = false;
  408. }
  409. }
  410. private void ob_checkno_TextChanged(object sender, EventArgs e)
  411. {
  412. if (ob_checkno.Text != "")
  413. {
  414. string Cut = dh.getFieldDataByCondition("product left join oqcbatch on ob_prodcode=pr_code", "pr_ifautocutcheckno", "ob_checkno='" + ob_checkno.Text + "'").ToString();
  415. if (Cut == "" || Cut == "0")
  416. AutoCut = false;
  417. else
  418. AutoCut = true;
  419. SendCheck.Enabled = true;
  420. }
  421. }
  422. private void RefreshWeigh_Click(object sender, EventArgs e)
  423. {
  424. sql.Clear();
  425. sql.Append("select pr_cartonmaxw,pr_cartonunit,pr_cartonminw,pr_cartongw from product where pr_code='" + pr_code.Text + "'");
  426. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  427. //填充打印文件选项的DataGridView
  428. if (dt.Rows.Count > 0)
  429. {
  430. string _weight = dt.Rows[0]["pr_cartongw"].ToString();
  431. string _maxweight = dt.Rows[0]["pr_cartonmaxw"].ToString();
  432. string _minweight = dt.Rows[0]["pr_cartonminw"].ToString();
  433. Weight = double.Parse(_weight == "" ? "0" : _weight);
  434. MaxWeight = double.Parse(_maxweight == "" ? "0" : _maxweight);
  435. MinWeight = double.Parse(_minweight == "" ? "0" : _minweight);
  436. if (Weight - MinWeight == MaxWeight - Weight)
  437. pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight) + dt.Rows[0]["pr_cartonunit"].ToString();
  438. else
  439. pr_cartongw.Text = MinWeight + "-" + MaxWeight + dt.Rows[0]["pr_cartonunit"].ToString();
  440. }
  441. }
  442. private void sn_KeyDown(object sender, KeyEventArgs e)
  443. {
  444. if (e.KeyCode == Keys.Enter)
  445. {
  446. outboxcode.Focus();
  447. outboxcode.SelectAll();
  448. }
  449. }
  450. }
  451. }