锐腾搅拌上料功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

728 lines
29 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using ICSSoft.Base.Config.DBHelper;
  10. using ICSSoft.Base.Config.AppConfig;
  11. using ICSSoft.Frame.Data.Entity;
  12. using System.Collections;
  13. using System.IO;
  14. using ICSSoft.Frame.Data.BLL;
  15. using ICSSoft.Frame.DataConnect.Action;
  16. using ICSSoft.Frame.DataConnect;
  17. using ICSSoft.Frame.DataCollect;
  18. namespace ICSSoft.Frame.APP
  19. {
  20. public delegate void LotCodeChangeEventHandler(string ItemCode, string RouteCode, string OpCode);
  21. public partial class UserControlCollectBeginTop : UserControl
  22. {
  23. public event LotCodeChangeEventHandler LotCodeChange;
  24. private const string PAUSE = "暂停";
  25. private const string CANCELPAUSE = "取消暂停";
  26. private const string START = "开工";
  27. private const string END = "完工";
  28. private string Status;
  29. private string routeCode;
  30. private string EQPType;
  31. private string partCode = "";
  32. private string partSpec = "";
  33. #region 采集
  34. public UserControlCollectBeginTop()
  35. {
  36. InitializeComponent();
  37. txtUserCode.Focus();
  38. }
  39. #region 员工条码
  40. private void txtUserCode_KeyPress(object sender, KeyPressEventArgs e)
  41. {
  42. try
  43. {
  44. if (e.KeyChar == (char)Keys.Enter)
  45. {
  46. string UserCode = txtUserCode.Text.Trim();
  47. string sql = "select distinct ID, UserCode,UserName from dbo.Sys_User with(nolock) where UserCode='{0}'";
  48. sql = string.Format(sql, UserCode);
  49. DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  50. if (data.Rows.Count > 0)
  51. {
  52. foreach (DataRow dr in data.Rows)
  53. {
  54. txtUserCode.Text = dr["UserCode"].ToString();
  55. txtUserName.Text = dr["UserName"].ToString();
  56. }
  57. txtLotNo.Focus();
  58. SetMsg(Color.Blue, "");
  59. }
  60. else
  61. {
  62. txtUserName.Text = "";
  63. txtUserCode.SelectAll();
  64. txtUserCode.Focus();
  65. SetMsg(Color.Red, "员工条码不存在!");
  66. }
  67. }
  68. }
  69. catch (Exception ex)
  70. {
  71. SetMsg(Color.Red, ex.Message);
  72. }
  73. }
  74. #endregion
  75. #region 产品跟踪单号
  76. private void txtLotNo_KeyPress(object sender, KeyPressEventArgs e)
  77. {
  78. try
  79. {
  80. if (e.KeyChar == (char)Keys.Enter)
  81. {
  82. #region 20200820新增防呆
  83. string chksql = @"select ISNULL(EATTRIBUTE6,'') AS EATTRIBUTE6 from ICSITEMLot
  84. where LotNO='{0}' AND WorkPoint='{1}'";
  85. chksql = string.Format(chksql, txtLotNo.Text.Trim(), AppConfig.WorkPointCode);
  86. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, chksql).Tables[0];
  87. if (dt.Rows.Count == 0)
  88. {
  89. ICSBaseSimpleCode.AppshowMessageBox("产品跟踪单号不存在!!");
  90. return;
  91. }
  92. else
  93. {
  94. if (dt.Rows[0]["EATTRIBUTE6"].ToString() == "")
  95. {
  96. ICSBaseSimpleCode.AppshowMessageBox("产品跟踪单号未绑定零件号,请先绑定再发料!!");
  97. return;
  98. }
  99. }
  100. #endregion
  101. btnStart.Text = START;
  102. btnPauseBegin.Text = PAUSE;
  103. string LotNo = txtLotNo.Text.Trim();
  104. string sql = @"SELECT DISTINCT
  105. a.ID,
  106. a.LOTNO,
  107. a.LOTQTY,
  108. b.MOCODE,
  109. b.ITEMCODE,
  110. a.VenderLotNO,
  111. c.INVNAME AS ItemName,
  112. d.LOTStatus,
  113. CASE d.CollectStatus WHEN 'COLLECT_BEGIN' THEN 'WG' ELSE 'KG' END AS Status
  114. FROM
  115. ICSITEMLot a WITH (nolock)
  116. LEFT JOIN ICSMO b WITH (nolock) ON a.TransNO = b.MOCODE AND a.TransLine=b.MOSEQ
  117. LEFT JOIN ICSINVENTORY c WITH (nolock) ON b.ITEMCODE = c.INVCODE
  118. LEFT JOIN ICSLOTSIMULATION d WITH(nolock) ON a.LOTNO = d.LOTNO
  119. WHERE
  120. a.LOTNO = '{0}'";
  121. sql = string.Format(sql, LotNo);
  122. DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  123. if (data.Rows.Count > 0)
  124. {
  125. foreach (DataRow dr in data.Rows)
  126. {
  127. txtLotNo.Text = dr["LOTNO"].ToString();
  128. //txtLotNo.Tag = dr["LOTSEQ"].ToString();
  129. //txtLotQty.Text = dr["LOTQTY"].ToString();
  130. txtItemCode.Text = dr["ITEMCODE"].ToString();
  131. txtItemName.Text = dr["ItemName"].ToString();
  132. txtMoCode.Text = dr["MOCODE"].ToString();
  133. txtVenderLotNO.Text = dr["VenderLotNO"].ToString();
  134. Status = dr["Status"].ToString();
  135. if (dr["Status"].ToString().Equals("WG"))
  136. btnStart.Text = END;
  137. if (dr["LOTStatus"].ToString().Equals(PAUSE))
  138. btnPauseBegin.Text = CANCELPAUSE;
  139. if (LotCodeChange != null)
  140. {
  141. LotCodeChange(txtItemCode.Text.Trim(), routeCode, txtOpCode.Text.Trim());
  142. }
  143. }
  144. txtOpCode.Focus();
  145. SetMsg(Color.Blue, "");
  146. }
  147. else
  148. {
  149. //txtLotNo.Tag = "";
  150. //txtLotQty.Text = "";
  151. txtItemCode.Text = "";
  152. txtItemName.Text = "";
  153. txtMoCode.Text = "";
  154. txtLotNo.SelectAll();
  155. txtLotNo.Focus();
  156. txtInvLotFurnace.Text = "";
  157. SetMsg(Color.Red, "产品跟踪单号不存在!");
  158. }
  159. }
  160. }
  161. catch (Exception ex)
  162. {
  163. SetMsg(Color.Red, ex.Message);
  164. }
  165. }
  166. #endregion
  167. #region 工序条码
  168. private void txtOpCode_KeyPress(object sender, KeyPressEventArgs e)
  169. {
  170. try
  171. {
  172. if (e.KeyChar == (char)Keys.Enter)
  173. {
  174. btnStart.Text = START;
  175. btnPauseBegin.Text = PAUSE;
  176. string OpCode = txtOpCode.Text.Trim();
  177. string LOTNO = txtLotNo.Text.Trim();
  178. string sql = @"SELECT DISTINCT
  179. a.ID,
  180. a.OPCODE,
  181. a.OPDESC,
  182. b.RouteCode,
  183. b.EQPCode,
  184. b.EQPName,d.LOTStatus,
  185. CASE d.CollectStatus WHEN 'COLLECT_BEGIN' THEN 'WG' ELSE 'KG' END AS Status,
  186. Type,ISNULL(b.EATTRIBUTE1,0) AS EATTRIBUTE1
  187. FROM
  188. ICSOP a WITH (nolock)
  189. LEFT JOIN ICSMO2User b WITH(nolock) ON a.OPCODE = b.OPCODE
  190. LEFT JOIN ICSLOTSIMULATION d WITH(nolock) ON b.LOTNO = d.LOTNO and b.OPCODE=d.OPCODE
  191. LEFT JOIN ICSEquipment e WITH(nolock) ON b.EQPCode=e.EQPCode
  192. WHERE
  193. b.OPCODE = '{0}' AND b.LOTNO = '{1}'";
  194. sql = string.Format(sql, OpCode, LOTNO);
  195. DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  196. if (data.Rows.Count > 0)
  197. {
  198. SetMsg(Color.Blue, "");
  199. foreach (DataRow dr in data.Rows)
  200. {
  201. //if (dr["EATTRIBUTE1"].ToString()=="1")
  202. //{
  203. // txtOpName.Text = "";
  204. // txtEQPCode.Text = "";
  205. // txtEQPName.Text = "";
  206. // Status = "";
  207. // routeCode = "";
  208. // EQPType = "";
  209. // txtOpCode.SelectAll();
  210. // txtOpCode.Focus();
  211. // SetMsg(Color.Red, "委外工序不能在此界面报工!");
  212. // return;
  213. //}
  214. txtOpCode.Text = dr["OPCODE"].ToString();
  215. txtOpName.Text = dr["OPDESC"].ToString();
  216. txtEQPCode.Text = dr["EQPCode"].ToString();
  217. txtEQPName.Text = dr["EQPName"].ToString();
  218. Status = dr["Status"].ToString();
  219. routeCode = dr["RouteCode"].ToString();
  220. EQPType = dr["Type"].ToString();
  221. if (dr["Status"].ToString().Equals("WG"))
  222. btnStart.Text = END;
  223. if (dr["LOTStatus"].ToString().Equals(PAUSE))
  224. btnPauseBegin.Text = CANCELPAUSE;
  225. }
  226. if (LotCodeChange != null)
  227. {
  228. LotCodeChange(txtItemCode.Text.Trim(), routeCode, txtOpCode.Text.Trim());
  229. }
  230. this.txtRealEQP.SelectAll();
  231. this.txtRealEQP.Focus();
  232. }
  233. else
  234. {
  235. txtOpName.Text = "";
  236. txtEQPCode.Text = "";
  237. txtEQPName.Text = "";
  238. Status = "";
  239. routeCode = "";
  240. EQPType = "";
  241. txtOpCode.SelectAll();
  242. txtOpCode.Focus();
  243. SetMsg(Color.Red, "该批次工序对应的派工信息不存在!");
  244. }
  245. }
  246. }
  247. catch (Exception ex)
  248. {
  249. SetMsg(Color.Red, ex.Message);
  250. }
  251. }
  252. #endregion
  253. #region 设备条码
  254. private void txtEQPCode_KeyPress(object sender, KeyPressEventArgs e)
  255. {
  256. try
  257. {
  258. if (e.KeyChar == (char)Keys.Enter)
  259. {
  260. #region 20200820新增防呆 20210430去掉
  261. // string chksql = @"select ISNULL(MTStatus,'') AS MTStatus from ICSEquipment
  262. // where EQPCode='{0}' And WorkPoint='{1}'";
  263. // chksql = string.Format(chksql, txtRealEQP.Text.Trim(), AppConfig.WorkPointCode);
  264. // DataTable chkdt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, chksql).Tables[0];
  265. // if (chkdt.Rows.Count != 0)
  266. // {
  267. // if (chkdt.Rows[0]["MTStatus"].ToString() == "是")
  268. // {
  269. // chksql = @"select * from ICSItemOPPrice
  270. // where ITEMCODE='{0}' AND OPCODE='{1}'
  271. // AND WorkPoint='{2}'";
  272. // chksql = string.Format(chksql, txtItemCode.Text.Trim(), txtOpCode.Text.Trim(), AppConfig.WorkPointCode);
  273. // chkdt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, chksql).Tables[0];
  274. // if (chkdt.Rows.Count == 0)
  275. // {
  276. // SetMsg(Color.Red, "开工设备类型为泛威时,必须维护工序价格!");
  277. // return;
  278. // }
  279. // }
  280. // }
  281. #endregion
  282. string EQPCode = txtRealEQP.Text.Trim();
  283. string sql = @"SELECT DISTINCT
  284. a.EQPID,
  285. a.EQPCode,
  286. a.EQPName,Type
  287. FROM
  288. ICSEquipment a WITH (nolock)
  289. WHERE
  290. a.EQPCode = '{0}'";
  291. sql = string.Format(sql, EQPCode);
  292. DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  293. if (data.Rows.Count > 0)
  294. {
  295. foreach (DataRow dr in data.Rows)
  296. {
  297. txtRealEQP.Text = dr["EQPCode"].ToString();
  298. txtRealEQPName.Text = dr["EQPName"].ToString();
  299. EQPType = dr["Type"].ToString();
  300. }
  301. SetMsg(Color.Blue, "");
  302. //if (Status.Equals("KG"))
  303. // save();
  304. }
  305. else
  306. {
  307. txtRealEQPName.Text = "";
  308. txtRealEQP.SelectAll();
  309. txtRealEQP.Focus();
  310. EQPType = "";
  311. SetMsg(Color.Red, "设备条码不存在!");
  312. }
  313. }
  314. }
  315. catch (Exception ex)
  316. {
  317. SetMsg(Color.Red, ex.Message);
  318. }
  319. }
  320. #endregion
  321. #region 检查输入数据
  322. public string check()
  323. {
  324. string msg = "";
  325. if (txtUserName.Text.Trim() == "")
  326. {
  327. msg += "请重新扫描员工条码!\n";
  328. }
  329. if (txtMoCode.Text.Trim() == "")
  330. {
  331. msg += "请重新扫描产品跟踪单号!\n";
  332. }
  333. if (txtOpName.Text.Trim() == "")
  334. {
  335. msg += "请重新扫描工序条码!\n";
  336. }
  337. if (txtRealEQPName.Text.Trim() == "")
  338. {
  339. msg += "请重新扫描设备条码!\n";
  340. }
  341. return msg;
  342. }
  343. #endregion
  344. //消息提示
  345. private void SetMsg(Color color, string Msg)
  346. {
  347. txtMessages.Text = Msg;
  348. txtMessages.ForeColor = color;
  349. }
  350. #endregion
  351. #region 暂停开始
  352. private void btnPauseBegin_Click(object sender, EventArgs e)
  353. {
  354. if (btnPauseBegin.Text.Trim().Equals(PAUSE))
  355. {
  356. Pause();
  357. }
  358. else
  359. {
  360. CancelPause();
  361. }
  362. }
  363. private void Pause()
  364. {
  365. try
  366. {
  367. if (txtLotNo.Text.Trim() == "" || txtOpCode.Text.Trim() == "" || txtUserCode.Text.Trim() == "" || txtRealEQP.Text.Trim() == "")
  368. {
  369. SetMsg(Color.Red, "请先扫描批次信息!");
  370. return;
  371. }
  372. #region simulation
  373. ICSLOTSIMULATION simulationNew = new ICSLOTSIMULATION();
  374. simulationNew.MUSER = txtUserCode.Text.Trim();
  375. simulationNew.LOTNO = txtLotNo.Text.Trim();
  376. simulationNew.OPCODE = txtOpCode.Text.Trim();
  377. simulationNew.EQPCODE = txtRealEQP.Text.Trim();
  378. #endregion
  379. ICSCollectBLL.Pause(AppConfig.AppConnectString, simulationNew);
  380. SetMsg(Color.Blue, "暂停成功!");
  381. btnPauseBegin.Text = CANCELPAUSE;
  382. }
  383. catch (Exception ex)
  384. {
  385. SetMsg(Color.Red, ex.Message);
  386. }
  387. }
  388. #endregion
  389. private void clear()
  390. {
  391. try
  392. {
  393. txtUserCode.Text = "";
  394. txtUserName.Text = "";
  395. txtItemCode.Text = "";
  396. txtVenderLotNO.Text = "";
  397. txtLotNo.Text = "";
  398. txtMoCode.Text = "";
  399. txtItemName.Text = "";
  400. txtOpCode.Text = "";
  401. txtOpName.Text = "";
  402. txtKeyPart.Text = "";
  403. txtEQPCode.Text = "";
  404. txtEQPName.Text = "";
  405. txtInvLotFurnace.Text = "";
  406. txtRealEQP.Text = "";
  407. txtRealEQPName.Text = "";
  408. txtMemo.Text = "";
  409. }
  410. catch (Exception ex)
  411. {
  412. SetMsg(Color.Red, ex.Message);
  413. }
  414. }
  415. #region 取消暂停
  416. private void CancelPause()
  417. {
  418. try
  419. {
  420. if (txtLotNo.Text.Trim() == "" || txtOpCode.Text.Trim() == "" || txtUserCode.Text.Trim() == "" || txtRealEQP.Text.Trim() == "")
  421. {
  422. SetMsg(Color.Red, "请先扫描批次信息!");
  423. return;
  424. }
  425. #region simulation
  426. ICSLOTSIMULATION simulationNew = new ICSLOTSIMULATION();
  427. simulationNew.MUSER = txtUserCode.Text.Trim();
  428. simulationNew.LOTNO = txtLotNo.Text.Trim();
  429. simulationNew.OPCODE = txtOpCode.Text.Trim();
  430. simulationNew.EQPCODE = txtRealEQP.Text.Trim();
  431. #endregion
  432. ICSCollectBLL.CancelPause(AppConfig.AppConnectString, simulationNew);
  433. SetMsg(Color.Blue, "取消暂停成功!");
  434. btnPauseBegin.Text = PAUSE;
  435. clear();
  436. }
  437. catch (Exception ex)
  438. {
  439. SetMsg(Color.Red, ex.Message);
  440. }
  441. }
  442. #endregion
  443. #region 开工、完工
  444. private void btnTransfer_Click(object sender, EventArgs e)
  445. {
  446. SetMsg(Color.Blue, "");
  447. string msg = check();
  448. if (msg != "")
  449. {
  450. SetMsg(Color.Red, msg);
  451. return;
  452. }
  453. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在处理...请稍等...");
  454. try
  455. {
  456. _wait.Show();
  457. string OpCode = txtOpCode.Text.Trim();
  458. string LOTNO = txtLotNo.Text.Trim();
  459. string sql = @"SELECT DISTINCT
  460. a.ID,
  461. a.OPCODE,
  462. a.OPDESC,
  463. b.RouteCode,
  464. b.EQPCode,
  465. b.EQPName,d.LOTStatus,
  466. CASE d.CollectStatus WHEN 'COLLECT_BEGIN' THEN 'WG' ELSE 'KG' END AS Status,
  467. Type,ISNULL(b.EATTRIBUTE1,0) AS EATTRIBUTE1
  468. FROM
  469. ICSOP a WITH (nolock)
  470. LEFT JOIN ICSMO2User b WITH(nolock) ON a.OPCODE = b.OPCODE
  471. LEFT JOIN ICSLOTSIMULATION d WITH(nolock) ON b.LOTNO = d.LOTNO and b.OPCODE=d.OPCODE
  472. LEFT JOIN ICSEquipment e WITH(nolock) ON b.EQPCode=e.EQPCode
  473. WHERE
  474. b.OPCODE = '{0}' AND b.LOTNO = '{1}'";
  475. sql = string.Format(sql, OpCode, LOTNO);
  476. DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  477. if (data.Rows.Count > 0)
  478. {
  479. foreach (DataRow dr in data.Rows)
  480. {
  481. if (dr["EATTRIBUTE1"].ToString() == "1")
  482. {
  483. txtOpName.Text = "";
  484. txtEQPCode.Text = "";
  485. txtEQPName.Text = "";
  486. Status = "";
  487. routeCode = "";
  488. EQPType = "";
  489. txtOpCode.SelectAll();
  490. txtOpCode.Focus();
  491. _wait.Close();
  492. SetMsg(Color.Red, "所扫描的工序为委外工序,无法开工,请确认!");
  493. return;
  494. }
  495. }
  496. }
  497. #region simulation
  498. ICSLOTSIMULATION simulationNew = new ICSLOTSIMULATION();
  499. simulationNew.MUSER = txtUserCode.Text.Trim();
  500. simulationNew.LOTNO = txtLotNo.Text.Trim();
  501. simulationNew.OPCODE = txtOpCode.Text.Trim();
  502. simulationNew.EQPCODE = txtRealEQP.Text.Trim();
  503. simulationNew.RESCODE = txtInvLotFurnace.Text.Trim();//试样号
  504. simulationNew.CHECKLOTNO = txtMemo.Text.Trim(); //备注
  505. //simulationNew.MOCODE = simulation.MOCODE;
  506. //simulationNew.LOTSEQ = simulation.LOTSEQ;
  507. //simulationNew.LOTQTY = Convert.ToInt32(simulation.LOTQTY);
  508. //simulationNew.GOODQTY = simulation.GOODQTY;
  509. //simulationNew.NGQTY = simulation.NGQTY;
  510. //simulationNew.LOTStatus = simulation.LOTStatus;
  511. //simulationNew.MODELCODE = simulation.MODELCODE;
  512. //simulationNew.ITEMCODE = simulation.ITEMCODE;
  513. //simulationNew.FROMROUTE = simulation.FROMROUTE;
  514. //simulationNew.FROMOP = simulation.FROMOP;
  515. //simulationNew.ROUTECODE = simulation.ROUTECODE;
  516. //simulationNew.RESCODE = simulation.RESCODE;
  517. //simulationNew.CHECKLOTNO = simulation.CHECKLOTNO;
  518. //simulationNew.CARTONCODE = simulation.CARTONCODE;
  519. //simulationNew.PALLETCODE = simulation.PALLETCODE;
  520. //simulationNew.PRODUCTSTATUS = simulation.PRODUCTSTATUS;
  521. //simulationNew.LACTION = simulation.LACTION;
  522. //simulationNew.ACTIONLIST = simulation.ACTIONLIST;
  523. //simulationNew.NGTIMES = simulation.NGTIMES;
  524. //simulationNew.ISCOM = simulation.ISCOM;
  525. //simulationNew.ISHOLD = simulation.ISHOLD;
  526. //simulationNew.SHELFNO = simulation.SHELFNO;
  527. //simulationNew.MOSEQ = simulation.MOSEQ;
  528. //simulationNew.CollectStatus = simulation.CollectStatus;
  529. //simulationNew.BeginTime = simulation.BeginTime;
  530. //simulationNew.SEQ = simulation.SEQ + 1;
  531. //simulationNew.EndTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString("HHmmss"));
  532. //simulationNew.MUSERName = AppConfig.UserName;
  533. //simulationNew.MTIME = DateTime.Now;
  534. //simulationNew.WorkPoint = AppConfig.WorkPointCode;
  535. //simulationNew.EATTRIBUTE1 = simulation.EATTRIBUTE1;
  536. #endregion
  537. if (btnStart.Text.Trim().Equals(START))
  538. {
  539. simulationNew.EATTRIBUTE1 = "COLLECT_BEGIN";
  540. }
  541. else
  542. {
  543. simulationNew.EATTRIBUTE1 = "COLLECT_END";
  544. }
  545. ICSCollectBLL.Save(AppConfig.AppConnectString, simulationNew);
  546. SetMsg(Color.Blue, btnStart.Text.Trim() + "成功!");
  547. if (btnStart.Text.Trim().Equals(START))
  548. {
  549. btnStart.Text = END;
  550. }
  551. else
  552. {
  553. btnStart.Text = START;
  554. }
  555. _wait.Close();
  556. }
  557. catch (Exception ex)
  558. {
  559. _wait.Close();
  560. SetMsg(Color.Red, ex.Message);
  561. }
  562. }
  563. #endregion
  564. private void txtLotNo_Click(object sender, EventArgs e)
  565. {
  566. txtLotNo.Focus();
  567. txtLotNo.SelectAll();
  568. }
  569. private void txtOpCode_Click(object sender, EventArgs e)
  570. {
  571. txtOpCode.Focus();
  572. txtOpCode.SelectAll();
  573. }
  574. private void btnTransfer_Click_1(object sender, EventArgs e)
  575. {
  576. SetMsg(Color.Blue, "");
  577. string msg = check();
  578. if (msg != "")
  579. {
  580. SetMsg(Color.Red, msg);
  581. return;
  582. }
  583. try
  584. {
  585. #region simulation
  586. ICSLOTSIMULATION simulationNew = new ICSLOTSIMULATION();
  587. simulationNew.MUSER = txtUserCode.Text.Trim();
  588. simulationNew.LOTNO = txtLotNo.Text.Trim();
  589. simulationNew.OPCODE = txtOpCode.Text.Trim();
  590. simulationNew.EQPCODE = txtRealEQP.Text.Trim();
  591. simulationNew.RESCODE = txtInvLotFurnace.Text.Trim();//试样号
  592. simulationNew.CHECKLOTNO = txtMemo.Text.Trim(); //备注
  593. //simulationNew.MOCODE = simulation.MOCODE;
  594. //simulationNew.LOTSEQ = simulation.LOTSEQ;
  595. //simulationNew.LOTQTY = Convert.ToInt32(simulation.LOTQTY);
  596. //simulationNew.GOODQTY = simulation.GOODQTY;
  597. //simulationNew.NGQTY = simulation.NGQTY;
  598. //simulationNew.LOTStatus = simulation.LOTStatus;
  599. //simulationNew.MODELCODE = simulation.MODELCODE;
  600. //simulationNew.ITEMCODE = simulation.ITEMCODE;
  601. //simulationNew.FROMROUTE = simulation.FROMROUTE;
  602. //simulationNew.FROMOP = simulation.FROMOP;
  603. //simulationNew.ROUTECODE = simulation.ROUTECODE;
  604. //simulationNew.RESCODE = simulation.RESCODE;
  605. //simulationNew.CHECKLOTNO = simulation.CHECKLOTNO;
  606. //simulationNew.CARTONCODE = simulation.CARTONCODE;
  607. //simulationNew.PALLETCODE = simulation.PALLETCODE;
  608. //simulationNew.PRODUCTSTATUS = simulation.PRODUCTSTATUS;
  609. //simulationNew.LACTION = simulation.LACTION;
  610. //simulationNew.ACTIONLIST = simulation.ACTIONLIST;
  611. //simulationNew.NGTIMES = simulation.NGTIMES;
  612. //simulationNew.ISCOM = simulation.ISCOM;
  613. //simulationNew.ISHOLD = simulation.ISHOLD;
  614. //simulationNew.SHELFNO = simulation.SHELFNO;
  615. //simulationNew.MOSEQ = simulation.MOSEQ;
  616. //simulationNew.CollectStatus = simulation.CollectStatus;
  617. //simulationNew.BeginTime = simulation.BeginTime;
  618. //simulationNew.SEQ = simulation.SEQ + 1;
  619. //simulationNew.EndTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString("HHmmss"));
  620. //simulationNew.MUSERName = AppConfig.UserName;
  621. //simulationNew.MTIME = DateTime.Now;
  622. //simulationNew.WorkPoint = AppConfig.WorkPointCode;
  623. //simulationNew.EATTRIBUTE1 = simulation.EATTRIBUTE1;
  624. #endregion
  625. ICSCollectBLL.Transfer(AppConfig.AppConnectString, simulationNew);
  626. SetMsg(Color.Blue, btnTransfer.Text.Trim() + "成功!");
  627. }
  628. catch (Exception ex)
  629. {
  630. SetMsg(Color.Red, ex.Message);
  631. }
  632. }
  633. //上料采集
  634. private void txtKeyPart_KeyPress(object sender, KeyPressEventArgs e)
  635. {
  636. if (e.KeyChar != (char)Keys.Enter)
  637. {
  638. return;
  639. }
  640. //检查数据输入
  641. SetMsg(Color.Blue, "");
  642. string msg = check();
  643. if (msg != "")
  644. {
  645. SetMsg(Color.Red, msg);
  646. return;
  647. }
  648. try
  649. {
  650. #region simulation
  651. ICSLOTONWIPITEM simulationNew = new ICSLOTONWIPITEM();
  652. simulationNew.MUSER = txtUserCode.Text.Trim();
  653. simulationNew.LOTNO = txtLotNo.Text.Trim();
  654. simulationNew.OPCODE = txtOpCode.Text.Trim();
  655. simulationNew.INVLOTNO = txtKeyPart.Text.Trim();
  656. #endregion
  657. ICSCollectBLL.SaveItem(AppConfig.AppConnectString, simulationNew);
  658. SetMsg(Color.Blue, txtKeyPart.Text.Trim() + " 上料成功!");
  659. }
  660. catch (Exception ex)
  661. {
  662. SetMsg(Color.Red, ex.Message);
  663. }
  664. }
  665. private void UserControlCollectBeginTop_Load(object sender, EventArgs e)
  666. {
  667. txtUserCode.Focus();
  668. }
  669. }
  670. }