锐腾搅拌上料功能
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.

718 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新增防呆
  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. try
  454. {
  455. string OpCode = txtOpCode.Text.Trim();
  456. string LOTNO = txtLotNo.Text.Trim();
  457. string sql = @"SELECT DISTINCT
  458. a.ID,
  459. a.OPCODE,
  460. a.OPDESC,
  461. b.RouteCode,
  462. b.EQPCode,
  463. b.EQPName,d.LOTStatus,
  464. CASE d.CollectStatus WHEN 'COLLECT_BEGIN' THEN 'WG' ELSE 'KG' END AS Status,
  465. Type,ISNULL(b.EATTRIBUTE1,0) AS EATTRIBUTE1
  466. FROM
  467. ICSOP a WITH (nolock)
  468. LEFT JOIN ICSMO2User b WITH(nolock) ON a.OPCODE = b.OPCODE
  469. LEFT JOIN ICSLOTSIMULATION d WITH(nolock) ON b.LOTNO = d.LOTNO and b.OPCODE=d.OPCODE
  470. LEFT JOIN ICSEquipment e WITH(nolock) ON b.EQPCode=e.EQPCode
  471. WHERE
  472. b.OPCODE = '{0}' AND b.LOTNO = '{1}'";
  473. sql = string.Format(sql, OpCode, LOTNO);
  474. DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  475. if (data.Rows.Count > 0)
  476. {
  477. foreach (DataRow dr in data.Rows)
  478. {
  479. if (dr["EATTRIBUTE1"].ToString() == "1")
  480. {
  481. txtOpName.Text = "";
  482. txtEQPCode.Text = "";
  483. txtEQPName.Text = "";
  484. Status = "";
  485. routeCode = "";
  486. EQPType = "";
  487. txtOpCode.SelectAll();
  488. txtOpCode.Focus();
  489. SetMsg(Color.Red, "所扫描的工序为委外工序,无法开工,请确认!");
  490. return;
  491. }
  492. }
  493. }
  494. #region simulation
  495. ICSLOTSIMULATION simulationNew = new ICSLOTSIMULATION();
  496. simulationNew.MUSER = txtUserCode.Text.Trim();
  497. simulationNew.LOTNO = txtLotNo.Text.Trim();
  498. simulationNew.OPCODE = txtOpCode.Text.Trim();
  499. simulationNew.EQPCODE = txtRealEQP.Text.Trim();
  500. simulationNew.RESCODE = txtInvLotFurnace.Text.Trim();//试样号
  501. simulationNew.CHECKLOTNO = txtMemo.Text.Trim(); //备注
  502. //simulationNew.MOCODE = simulation.MOCODE;
  503. //simulationNew.LOTSEQ = simulation.LOTSEQ;
  504. //simulationNew.LOTQTY = Convert.ToInt32(simulation.LOTQTY);
  505. //simulationNew.GOODQTY = simulation.GOODQTY;
  506. //simulationNew.NGQTY = simulation.NGQTY;
  507. //simulationNew.LOTStatus = simulation.LOTStatus;
  508. //simulationNew.MODELCODE = simulation.MODELCODE;
  509. //simulationNew.ITEMCODE = simulation.ITEMCODE;
  510. //simulationNew.FROMROUTE = simulation.FROMROUTE;
  511. //simulationNew.FROMOP = simulation.FROMOP;
  512. //simulationNew.ROUTECODE = simulation.ROUTECODE;
  513. //simulationNew.RESCODE = simulation.RESCODE;
  514. //simulationNew.CHECKLOTNO = simulation.CHECKLOTNO;
  515. //simulationNew.CARTONCODE = simulation.CARTONCODE;
  516. //simulationNew.PALLETCODE = simulation.PALLETCODE;
  517. //simulationNew.PRODUCTSTATUS = simulation.PRODUCTSTATUS;
  518. //simulationNew.LACTION = simulation.LACTION;
  519. //simulationNew.ACTIONLIST = simulation.ACTIONLIST;
  520. //simulationNew.NGTIMES = simulation.NGTIMES;
  521. //simulationNew.ISCOM = simulation.ISCOM;
  522. //simulationNew.ISHOLD = simulation.ISHOLD;
  523. //simulationNew.SHELFNO = simulation.SHELFNO;
  524. //simulationNew.MOSEQ = simulation.MOSEQ;
  525. //simulationNew.CollectStatus = simulation.CollectStatus;
  526. //simulationNew.BeginTime = simulation.BeginTime;
  527. //simulationNew.SEQ = simulation.SEQ + 1;
  528. //simulationNew.EndTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString("HHmmss"));
  529. //simulationNew.MUSERName = AppConfig.UserName;
  530. //simulationNew.MTIME = DateTime.Now;
  531. //simulationNew.WorkPoint = AppConfig.WorkPointCode;
  532. //simulationNew.EATTRIBUTE1 = simulation.EATTRIBUTE1;
  533. #endregion
  534. if (btnStart.Text.Trim().Equals(START))
  535. {
  536. simulationNew.EATTRIBUTE1 = "COLLECT_BEGIN";
  537. }
  538. else
  539. {
  540. simulationNew.EATTRIBUTE1 = "COLLECT_END";
  541. }
  542. ICSCollectBLL.Save(AppConfig.AppConnectString, simulationNew);
  543. SetMsg(Color.Blue, btnStart.Text.Trim() + "成功!");
  544. if (btnStart.Text.Trim().Equals(START))
  545. {
  546. btnStart.Text = END;
  547. }
  548. else
  549. {
  550. btnStart.Text = START;
  551. }
  552. }
  553. catch (Exception ex)
  554. {
  555. SetMsg(Color.Red, ex.Message);
  556. }
  557. }
  558. #endregion
  559. private void txtLotNo_Click(object sender, EventArgs e)
  560. {
  561. txtLotNo.Focus();
  562. txtLotNo.SelectAll();
  563. }
  564. private void txtOpCode_Click(object sender, EventArgs e)
  565. {
  566. txtOpCode.Focus();
  567. txtOpCode.SelectAll();
  568. }
  569. private void btnTransfer_Click_1(object sender, EventArgs e)
  570. {
  571. SetMsg(Color.Blue, "");
  572. string msg = check();
  573. if (msg != "")
  574. {
  575. SetMsg(Color.Red, msg);
  576. return;
  577. }
  578. try
  579. {
  580. #region simulation
  581. ICSLOTSIMULATION simulationNew = new ICSLOTSIMULATION();
  582. simulationNew.MUSER = txtUserCode.Text.Trim();
  583. simulationNew.LOTNO = txtLotNo.Text.Trim();
  584. simulationNew.OPCODE = txtOpCode.Text.Trim();
  585. simulationNew.EQPCODE = txtRealEQP.Text.Trim();
  586. simulationNew.RESCODE = txtInvLotFurnace.Text.Trim();//试样号
  587. simulationNew.CHECKLOTNO = txtMemo.Text.Trim(); //备注
  588. //simulationNew.MOCODE = simulation.MOCODE;
  589. //simulationNew.LOTSEQ = simulation.LOTSEQ;
  590. //simulationNew.LOTQTY = Convert.ToInt32(simulation.LOTQTY);
  591. //simulationNew.GOODQTY = simulation.GOODQTY;
  592. //simulationNew.NGQTY = simulation.NGQTY;
  593. //simulationNew.LOTStatus = simulation.LOTStatus;
  594. //simulationNew.MODELCODE = simulation.MODELCODE;
  595. //simulationNew.ITEMCODE = simulation.ITEMCODE;
  596. //simulationNew.FROMROUTE = simulation.FROMROUTE;
  597. //simulationNew.FROMOP = simulation.FROMOP;
  598. //simulationNew.ROUTECODE = simulation.ROUTECODE;
  599. //simulationNew.RESCODE = simulation.RESCODE;
  600. //simulationNew.CHECKLOTNO = simulation.CHECKLOTNO;
  601. //simulationNew.CARTONCODE = simulation.CARTONCODE;
  602. //simulationNew.PALLETCODE = simulation.PALLETCODE;
  603. //simulationNew.PRODUCTSTATUS = simulation.PRODUCTSTATUS;
  604. //simulationNew.LACTION = simulation.LACTION;
  605. //simulationNew.ACTIONLIST = simulation.ACTIONLIST;
  606. //simulationNew.NGTIMES = simulation.NGTIMES;
  607. //simulationNew.ISCOM = simulation.ISCOM;
  608. //simulationNew.ISHOLD = simulation.ISHOLD;
  609. //simulationNew.SHELFNO = simulation.SHELFNO;
  610. //simulationNew.MOSEQ = simulation.MOSEQ;
  611. //simulationNew.CollectStatus = simulation.CollectStatus;
  612. //simulationNew.BeginTime = simulation.BeginTime;
  613. //simulationNew.SEQ = simulation.SEQ + 1;
  614. //simulationNew.EndTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString("HHmmss"));
  615. //simulationNew.MUSERName = AppConfig.UserName;
  616. //simulationNew.MTIME = DateTime.Now;
  617. //simulationNew.WorkPoint = AppConfig.WorkPointCode;
  618. //simulationNew.EATTRIBUTE1 = simulation.EATTRIBUTE1;
  619. #endregion
  620. ICSCollectBLL.Transfer(AppConfig.AppConnectString, simulationNew);
  621. SetMsg(Color.Blue, btnTransfer.Text.Trim() + "成功!");
  622. }
  623. catch (Exception ex)
  624. {
  625. SetMsg(Color.Red, ex.Message);
  626. }
  627. }
  628. //上料采集
  629. private void txtKeyPart_KeyPress(object sender, KeyPressEventArgs e)
  630. {
  631. if (e.KeyChar != (char)Keys.Enter)
  632. {
  633. return;
  634. }
  635. //检查数据输入
  636. SetMsg(Color.Blue, "");
  637. string msg = check();
  638. if (msg != "")
  639. {
  640. SetMsg(Color.Red, msg);
  641. return;
  642. }
  643. try
  644. {
  645. #region simulation
  646. ICSLOTONWIPITEM simulationNew = new ICSLOTONWIPITEM();
  647. simulationNew.MUSER = txtUserCode.Text.Trim();
  648. simulationNew.LOTNO = txtLotNo.Text.Trim();
  649. simulationNew.OPCODE = txtOpCode.Text.Trim();
  650. simulationNew.INVLOTNO = txtKeyPart.Text.Trim();
  651. #endregion
  652. ICSCollectBLL.SaveItem(AppConfig.AppConnectString, simulationNew);
  653. SetMsg(Color.Blue, txtKeyPart.Text.Trim() + " 上料成功!");
  654. }
  655. catch (Exception ex)
  656. {
  657. SetMsg(Color.Red, ex.Message);
  658. }
  659. }
  660. }
  661. }