FrmCLRepairBP.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using CoreFS.CA06;
  9. using Core.Mes.Client.Common;
  10. using System.Collections;
  11. namespace Core.LgMes.Client.LgDeviceManager
  12. {
  13. public partial class FrmCLRepairBP : Core.Mes.Client.Common.frmStyleBase
  14. {
  15. bool bOK = false; //是否响应结晶器号选择改变事件
  16. public string strNo = "", strCCM = "";
  17. public FrmCLRepairBP(OpeBase oba)
  18. {
  19. InitializeComponent();
  20. ob = oba;
  21. }
  22. private void FrmCLRepairBP_Load(object sender, EventArgs e)
  23. {
  24. if (strCCM.Length > 0)
  25. {
  26. cmbCCM.Text = strCCM;
  27. this.cbbCCM_SelectedIndexChanged(this, null);
  28. if (strNo.Length > 0)
  29. {
  30. cmbID.Text = strNo;
  31. bOK = true;
  32. this.cbbID_SelectedIndexChanged(this, null);
  33. }
  34. }
  35. else
  36. {
  37. bOK = true;
  38. proc_ResetControl();
  39. btnBegin.Enabled = btnEnd.Enabled = false;
  40. }
  41. }
  42. private void NumberEditor_KeyPress(object sender, KeyPressEventArgs e)
  43. {
  44. if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b'))
  45. {
  46. e.Handled = true;
  47. }
  48. }
  49. /// <summary>
  50. /// 加载结晶器编号
  51. /// </summary>
  52. /// <param name="strCCM"></param>
  53. private void proc_GetID(string strCCM)
  54. {
  55. try
  56. {
  57. if (strCCM.Length == 0)
  58. return;
  59. string strErr = "";
  60. ArrayList arry = new ArrayList();
  61. if (strCCM == "1#连铸机" || strCCM == "2#连铸机")
  62. {
  63. arry.Add("OneandTwoCCM.select");
  64. }
  65. else
  66. {
  67. arry.Add("CRYSTALLIZERID.select");
  68. arry.Add(strCCM);
  69. }
  70. CommonClientToServer ccs = new CommonClientToServer();
  71. ccs.ob = this.ob;
  72. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  73. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  74. {
  75. MessageBox.Show("结晶器号加载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  76. if (MessageBox.Show("是否重新加载结晶器号?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  77. proc_GetID(strCCM);
  78. return;
  79. }
  80. cmbID.DataSource = ds.Tables[0];
  81. cmbID.DisplayMember = "CRYSTALLIZERID";
  82. if (ds.Tables[0].Rows.Count == 0)
  83. {
  84. proc_ResetControl();
  85. btnBegin.Enabled = btnEnd.Enabled = false;
  86. }
  87. }
  88. catch (Exception ex)
  89. {
  90. MessageBox.Show(ex.Message);
  91. }
  92. }
  93. private void proc_ResetControl()
  94. {
  95. try
  96. {
  97. cmbID.Text = "";
  98. cmbType.SelectedIndex = -1;
  99. cmbReason.Text = "";
  100. udteRepair.Text = "";
  101. udteRepairTime.Text = "";
  102. txtCurrID1.Clear();
  103. txtCurrID2.Clear();
  104. txtCurrID3.Clear();
  105. txtCurrID4.Clear();
  106. txtCurrID5.Clear();
  107. txtCurrID6.Clear();
  108. cmbID1.SelectedIndex = -1;
  109. cmbID2.SelectedIndex = -1;
  110. cmbID3.SelectedIndex = -1;
  111. cmbID4.SelectedIndex = -1;
  112. cmbID5.SelectedIndex = -1;
  113. cmbID6.SelectedIndex = -1;
  114. txtCurrCS1.Clear();
  115. txtCurrCS2.Clear();
  116. txtCurrCS3.Clear();
  117. txtCurrCS4.Clear();
  118. txtCurrCS5.Clear();
  119. txtCurrCS6.Clear();
  120. txtCS1.Clear();
  121. txtCS2.Clear();
  122. txtCS3.Clear();
  123. txtCS4.Clear();
  124. txtCS5.Clear();
  125. txtCS6.Clear();
  126. txtMemo.Clear();
  127. }
  128. catch (Exception ex)
  129. {
  130. MessageBox.Show(ex.Message);
  131. }
  132. }
  133. private TextBox proc_GetTextBox(string strComboBoxName)
  134. {
  135. switch (strComboBoxName)
  136. {
  137. case "cbbID1":
  138. {
  139. return txtCS1;
  140. }
  141. case "cbbID2":
  142. {
  143. return txtCS2;
  144. }
  145. case "cbbID3":
  146. {
  147. return txtCS3;
  148. }
  149. case "cbbID4":
  150. {
  151. return txtCS4;
  152. }
  153. case "cbbID5":
  154. {
  155. return txtCS5;
  156. }
  157. case "cbbID6":
  158. {
  159. return txtCS6;
  160. }
  161. }
  162. return null;
  163. }
  164. /// <summary>
  165. /// 维修开始
  166. /// </summary>
  167. private void proc_Begin()
  168. {
  169. try
  170. {
  171. if (cmbID.Items.Count == 0)
  172. return;
  173. string strCcm = cmbCCM.Text.Trim();
  174. string strID = cmbID.Text.Trim();
  175. if (strID.Length == 0)
  176. {
  177. MessageBox.Show("请选择需要维修的结晶器编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  178. cmbID.Focus();
  179. return;
  180. }
  181. string strType = cmbType.Text.Trim();
  182. if (strType.Length == 0)
  183. {
  184. MessageBox.Show("请选择维修类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  185. cmbType.Focus();
  186. return;
  187. }
  188. if (udteRepair.Text.Trim().Length == 0)
  189. udteRepair.DateTime = DateTime.Now;
  190. if (MessageBox.Show("确定要维修[" + strCcm + "]的结晶器[" + strID + "]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  191. {
  192. proc_GetID(strCcm);
  193. return;
  194. }
  195. string strErr = "";
  196. ArrayList arry = new ArrayList();
  197. arry.Add("FrmCLRepairBP.Select_6");
  198. arry.Add(strCcm);
  199. arry.Add(strID);
  200. CommonClientToServer ccs = new CommonClientToServer();
  201. ccs.ob = this.ob;
  202. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  203. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  204. {
  205. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  206. return;
  207. }
  208. int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  209. if (iCnt == 0)
  210. {
  211. MessageBox.Show("[" + strCcm + "]不存在结晶器[" + strID + "]信息,无法维修!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  212. proc_GetID(strCcm);
  213. cmbID.Focus();
  214. return;
  215. }
  216. iCnt = 0;
  217. ds = null;
  218. strErr = "";
  219. arry.Clear();
  220. ccs.ob = this.ob;
  221. arry.Add("FrmCLRepairBP.Select_7");
  222. arry.Add(strCcm);
  223. arry.Add(strID);
  224. ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  225. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  226. {
  227. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  228. return;
  229. }
  230. if (Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim()) != "下线")
  231. {
  232. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]当前状态[" + Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]) + "],只有在[下线]状态才能维修!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  233. cmbID.Focus();
  234. return;
  235. }
  236. #region//水箱信息修改
  237. string strReturn = "";
  238. #endregion
  239. strErr = "";
  240. arry.Clear();
  241. ccs.ob = this.ob;
  242. arry.Add("FrmCLRepairBP.Update_2");
  243. arry.Add(strID);
  244. arry.Add(strCcm);
  245. arry.Add(strType);
  246. arry.Add(udteRepair.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
  247. arry.Add(cmbReason.Text.Trim());
  248. arry.Add(txtMemo.Text.Trim());
  249. arry.Add(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  250. strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  251. if (!(strErr == null || strErr == ""))
  252. {
  253. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  254. return;
  255. }
  256. strErr = "";
  257. strReturn = "";
  258. arry.Clear();
  259. ccs.ob = this.ob;
  260. arry.Add("FrmCLRepairBP.Update_3");
  261. arry.Add("");
  262. arry.Add("");
  263. arry.Add("");
  264. arry.Add("");
  265. arry.Add("");
  266. arry.Add("");
  267. arry.Add(strCcm);
  268. arry.Add(strID);
  269. strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  270. if (!(strErr == null || strErr == ""))
  271. {
  272. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  273. return;
  274. }
  275. FrmCrystallizerManageBP frm = (FrmCrystallizerManageBP)this.Tag;
  276. frm.proc_GetBaseInfo(strCcm, strID);
  277. proc_GetID(strCcm);
  278. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  279. return;
  280. }
  281. catch (Exception ex)
  282. {
  283. MessageBox.Show(ex.Message);
  284. }
  285. }
  286. /// <summary>
  287. /// 维修结束
  288. /// </summary>
  289. private void proc_End()
  290. {
  291. try
  292. {
  293. if (cmbID.Items.Count == 0)
  294. return;
  295. string strCcm = cmbCCM.Text.Trim();
  296. string strID = cmbID.Text.Trim();
  297. if (strID.Length == 0)
  298. {
  299. MessageBox.Show("请选择维修中的结晶器编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  300. cmbID.Focus();
  301. return;
  302. }
  303. string strType = cmbType.Text.Trim();
  304. if (strType.Length == 0)
  305. {
  306. MessageBox.Show("请选择维修类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  307. cmbType.Focus();
  308. return;
  309. }
  310. if (udteRepairTime.Text.Trim().Length == 0)
  311. udteRepairTime.DateTime = DateTime.Now;
  312. if (udteRepair.DateTime > udteRepairTime.DateTime)
  313. {
  314. MessageBox.Show("送修时间不能大于修复时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  315. udteRepairTime.Focus();
  316. return;
  317. }
  318. #region
  319. #endregion
  320. if (MessageBox.Show("确定[" + strCcm + "]结晶器[" + strID + "]维修结束吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  321. {
  322. proc_GetID(strCcm);
  323. return;
  324. }
  325. string strErr = "";
  326. ArrayList arry = new ArrayList();
  327. arry.Add("FrmCLRepairBP.Select_8");
  328. arry.Add(strCcm);
  329. arry.Add(strID);
  330. CommonClientToServer ccs = new CommonClientToServer();
  331. ccs.ob = this.ob;
  332. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  333. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  334. {
  335. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  336. return;
  337. }
  338. int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  339. if (iCnt == 0)
  340. {
  341. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]信息不存在,无法保存维修信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  342. proc_GetID(strCcm);
  343. cmbID.Focus();
  344. return;
  345. }
  346. iCnt = 0;
  347. ds = null;
  348. strErr = "";
  349. arry.Clear();
  350. ccs.ob = this.ob;
  351. arry.Add("FrmCLRepairBP.Select_9");
  352. arry.Add(strCcm);
  353. arry.Add(strID);
  354. ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  355. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  356. {
  357. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  358. return;
  359. }
  360. if (Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim()) != "维修")
  361. {
  362. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]当前状态[" + Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]) + "],只有在[维修]状态才能结束维修!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  363. cmbID.Focus();
  364. return;
  365. }
  366. #region//水箱信息修改
  367. string strReturn = "";
  368. #endregion
  369. strErr = "";
  370. strReturn = "";
  371. arry.Clear();
  372. ccs.ob = this.ob;
  373. arry.Add("FrmCLRepairBP.Update_4");
  374. arry.Add(strType);
  375. arry.Add(udteRepair.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
  376. arry.Add(udteRepairTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
  377. arry.Add(cmbReason.Text.Trim());
  378. arry.Add(txtMemo.Text.Trim());
  379. arry.Add(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  380. arry.Add(strID);
  381. arry.Add(strCcm);
  382. strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  383. if (!(strErr == null || strErr == ""))
  384. {
  385. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  386. return;
  387. }
  388. strErr = "";
  389. strReturn = "";
  390. arry.Clear();
  391. ccs.ob = this.ob;
  392. arry.Add("FrmCLRepairBP.Update_5");
  393. arry.Add("");
  394. arry.Add("");
  395. arry.Add("");
  396. arry.Add("");
  397. arry.Add("");
  398. arry.Add("");
  399. arry.Add(strCcm);
  400. arry.Add(strID);
  401. strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  402. if (!(strErr == null || strErr == ""))
  403. {
  404. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  405. return;
  406. }
  407. FrmCrystallizerManageBP frm = (FrmCrystallizerManageBP)this.Tag;
  408. frm.proc_GetBaseInfo(strCcm, strID);
  409. proc_GetID(strCcm);
  410. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  411. return;
  412. }
  413. catch (Exception ex)
  414. {
  415. MessageBox.Show(ex.Message);
  416. }
  417. }
  418. /// <summary>
  419. /// 维修开始
  420. /// </summary>
  421. /// <param name="sender"></param>
  422. /// <param name="e"></param>
  423. private void btnBegin_Click(object sender, EventArgs e)
  424. {
  425. proc_Begin();
  426. }
  427. /// <summary>
  428. /// 维修结束
  429. /// </summary>
  430. /// <param name="sender"></param>
  431. /// <param name="e"></param>
  432. private void btnEnd_Click(object sender, EventArgs e)
  433. {
  434. proc_End();
  435. }
  436. /// <summary>
  437. /// 加载结晶器信息
  438. /// </summary>
  439. /// <param 铸机好="strCCM"></param>
  440. /// <param 结晶器编号="strID"></param>
  441. private void proc_GetPluginInfo(string strCCM, string strID)
  442. {
  443. try
  444. {
  445. if (strCCM.Length == 0)
  446. return;
  447. string strErr = "";
  448. ArrayList arry = new ArrayList();
  449. arry.Add("FrmCLRepairBP.Select_1");
  450. arry.Add(strCCM);
  451. arry.Add(strCCM);
  452. arry.Add(strID);
  453. arry.Add(strCCM);
  454. arry.Add(strID);
  455. arry.Add(strCCM);
  456. arry.Add(strID);
  457. arry.Add(strCCM);
  458. arry.Add(strID);
  459. arry.Add(strCCM);
  460. arry.Add(strID);
  461. arry.Add(strCCM);
  462. arry.Add(strID);
  463. CommonClientToServer ccs = new CommonClientToServer();
  464. ccs.ob = this.ob;
  465. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  466. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  467. {
  468. MessageBox.Show("结晶器插件信息加载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  469. if (MessageBox.Show("是否重新加载结晶器插件信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  470. proc_GetPluginInfo(strCCM, strID);
  471. return;
  472. }
  473. if (ds.Tables[0].Rows.Count>0)
  474. {
  475. DataRow dr = ds.Tables[0].NewRow();
  476. dr["ID"] = "0";
  477. dr["PLUGINNO"] = "";
  478. dr["TYPE"] = "2";
  479. ds.Tables[0].Rows.InsertAt(dr, 0);
  480. dr = ds.Tables[0].NewRow();
  481. dr["ID"] = "0";
  482. dr["PLUGINNO"] = "";
  483. dr["TYPE"] = "1";
  484. ds.Tables[0].Rows.InsertAt(dr, 0);
  485. dr = ds.Tables[0].NewRow();
  486. dr["ID"] = "0";
  487. dr["PLUGINNO"] = "";
  488. dr["TYPE"] = "0";
  489. ds.Tables[0].Rows.InsertAt(dr, 0);
  490. DataSet ds1 = ds.Copy();
  491. DataView dv1 = ds1.Tables[0].DefaultView;
  492. dv1.RowFilter = "Type = '0'";
  493. DataSet ds2 = ds.Copy();
  494. DataView dv2 = ds2.Tables[0].DefaultView;
  495. dv2.RowFilter = "Type = '0'";
  496. DataSet ds3 = ds.Copy();
  497. DataView dv3 = ds3.Tables[0].DefaultView;
  498. dv3.RowFilter = "Type = '1'";
  499. DataSet ds4 = ds.Copy();
  500. DataView dv4 = ds4.Tables[0].DefaultView;
  501. dv4.RowFilter = "Type = '1'";
  502. DataSet ds5 = ds.Copy();
  503. DataView dv5 = ds5.Tables[0].DefaultView;
  504. dv5.RowFilter = "Type = '2'";
  505. DataSet ds6 = ds.Copy();
  506. DataView dv6 = ds6.Tables[0].DefaultView;
  507. dv6.RowFilter = "Type = '2'";
  508. cmbID1.DataSource = dv1;
  509. cmbID1.ValueMember = "ID";
  510. cmbID1.DisplayMember = "PLUGINNO";
  511. cmbID2.DataSource = dv2;
  512. cmbID2.ValueMember = "ID";
  513. cmbID2.DisplayMember = "PLUGINNO";
  514. cmbID3.DataSource = dv3;
  515. cmbID3.ValueMember = "ID";
  516. cmbID3.DisplayMember = "PLUGINNO";
  517. cmbID4.DataSource = dv4;
  518. cmbID4.ValueMember = "ID";
  519. cmbID4.DisplayMember = "PLUGINNO";
  520. cmbID5.DataSource = dv5;
  521. cmbID5.ValueMember = "ID";
  522. cmbID5.DisplayMember = "PLUGINNO";
  523. cmbID6.DataSource = dv6;
  524. cmbID6.ValueMember = "ID";
  525. cmbID6.DisplayMember = "PLUGINNO";
  526. }
  527. }
  528. catch (Exception ex)
  529. {
  530. MessageBox.Show(ex.Message);
  531. }
  532. }
  533. private void cbbCCM_SelectedIndexChanged(object sender, EventArgs e)
  534. {
  535. if (cmbCCM.Text.Length > 0)
  536. {
  537. proc_GetPluginInfo(cmbCCM.Text, "");
  538. proc_GetID(cmbCCM.Text);
  539. }
  540. }
  541. private void cbbID_SelectedIndexChanged(object sender, EventArgs e)
  542. {
  543. try
  544. {
  545. proc_GetPluginInfo(cmbCCM.Text.Trim(), cmbID.Text.Trim());
  546. if (!bOK)
  547. return;
  548. string strCcm = cmbCCM.Text.Trim();
  549. string strID = cmbID.Text.Trim();
  550. if (strID.Length == 0)
  551. {
  552. cmbType.SelectedIndex = -1;
  553. cmbReason.Text = "";
  554. udteRepair.Text = "";
  555. udteRepairTime.Text = "";
  556. txtCurrID1.Clear();
  557. txtCurrID2.Clear();
  558. txtCurrID3.Clear();
  559. txtCurrID4.Clear();
  560. txtCurrID5.Clear();
  561. txtCurrID6.Clear();
  562. cmbID1.SelectedIndex = -1;
  563. cmbID2.SelectedIndex = -1;
  564. cmbID3.SelectedIndex = -1;
  565. cmbID4.SelectedIndex = -1;
  566. cmbID5.SelectedIndex = -1;
  567. cmbID6.SelectedIndex = -1;
  568. txtCurrCS1.Clear();
  569. txtCurrCS2.Clear();
  570. txtCurrCS3.Clear();
  571. txtCurrCS4.Clear();
  572. txtCurrCS5.Clear();
  573. txtCurrCS6.Clear();
  574. txtCS1.Clear();
  575. txtCS2.Clear();
  576. txtCS3.Clear();
  577. txtCS4.Clear();
  578. txtCS5.Clear();
  579. txtCS6.Clear();
  580. txtMemo.Clear();
  581. btnBegin.Enabled = btnEnd.Enabled = false;
  582. return;
  583. }
  584. string strErr = "";
  585. ArrayList arry = new ArrayList();
  586. arry.Add("FrmCLRepairBP.Select_3");
  587. arry.Add(strID);
  588. arry.Add(strCcm);
  589. CommonClientToServer ccs = new CommonClientToServer();
  590. ccs.ob = this.ob;
  591. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  592. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  593. {
  594. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]维修信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  595. return;
  596. }
  597. if (ds.Tables[0].Rows.Count > 0)
  598. {
  599. cmbType.Text = Convert.ToString(ds.Tables[0].Rows[0]["REPAIRTYPE"]);
  600. udteRepair.DateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["REPAIRTIME"]);
  601. udteRepairTime.Text = "";
  602. cmbReason.Text = Convert.ToString(ds.Tables[0].Rows[0]["REASON"]);
  603. txtMemo.Text = Convert.ToString(ds.Tables[0].Rows[0]["MEMO"]);
  604. btnBegin.Enabled = false;
  605. }
  606. else
  607. {
  608. cmbType.SelectedIndex = -1;
  609. udteRepair.Text = "";
  610. udteRepairTime.Text = "";
  611. cmbReason.Text = "";
  612. txtMemo.Clear();
  613. btnBegin.Enabled = true;
  614. }
  615. btnEnd.Enabled = !btnBegin.Enabled;
  616. ds = null;
  617. strErr = "";
  618. arry.Clear();
  619. arry.Add("FrmCLRepairBP.Select_4");
  620. arry.Add(strID);
  621. arry.Add(strCcm);
  622. ccs.ob = this.ob;
  623. ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  624. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  625. {
  626. MessageBox.Show("[" + strCcm + "]结晶器[" + strID + "]基本信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  627. return;
  628. }
  629. if (ds.Tables[0].Rows.Count == 0) return;
  630. txtCurrID1.Text = Convert.ToString(ds.Tables[0].Rows[0]["NO1"]);
  631. cmbID1.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["ID1"]);
  632. txtCS1.Text = txtCurrCS1.Text = Convert.ToString(ds.Tables[0].Rows[0]["CS1"]);
  633. txtCurrID2.Text = Convert.ToString(ds.Tables[0].Rows[0]["NO2"]);
  634. cmbID2.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["ID2"]);
  635. txtCS2.Text = txtCurrCS2.Text = Convert.ToString(ds.Tables[0].Rows[0]["CS2"]);
  636. txtCurrID3.Text = Convert.ToString(ds.Tables[0].Rows[0]["NO3"]);
  637. cmbID3.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["ID3"]);
  638. txtCS3.Text = txtCurrCS3.Text = Convert.ToString(ds.Tables[0].Rows[0]["CS3"]);
  639. txtCurrID4.Text = Convert.ToString(ds.Tables[0].Rows[0]["NO4"]);
  640. cmbID4.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["ID4"]);
  641. txtCS4.Text = txtCurrCS4.Text = Convert.ToString(ds.Tables[0].Rows[0]["CS4"]);
  642. txtCurrID5.Text = Convert.ToString(ds.Tables[0].Rows[0]["NO5"]);
  643. cmbID5.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["ID5"]);
  644. txtCS5.Text = txtCurrCS5.Text = Convert.ToString(ds.Tables[0].Rows[0]["CS5"]);
  645. txtCurrID6.Text = Convert.ToString(ds.Tables[0].Rows[0]["NO6"]);
  646. cmbID6.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["ID6"]);
  647. txtCS6.Text = txtCurrCS6.Text = Convert.ToString(ds.Tables[0].Rows[0]["CS6"]);
  648. }
  649. catch (Exception ex)
  650. {
  651. MessageBox.Show(ex.Message, "提示");
  652. }
  653. }
  654. private void PlugIn_SelectedIndexChanged(object sender, EventArgs e)
  655. {
  656. try
  657. {
  658. ComboBox cbb = sender as ComboBox;
  659. if (cbb == null) return;
  660. if (!(cbb is ComboBox)) return;
  661. string str = cbb.SelectedValue.ToString();
  662. if (cbb.SelectedItem != null)
  663. {
  664. DataRowView rowView = (DataRowView)cbb.SelectedItem;
  665. str = rowView.Row["ID"].ToString();
  666. }
  667. if (str.Length == 0) return;
  668. string strErr = "";
  669. ArrayList arry = new ArrayList();
  670. arry.Add("FrmCLRepairBP.Select_5");
  671. arry.Add(str);
  672. CommonClientToServer ccs = new CommonClientToServer();
  673. ccs.ob = this.ob;
  674. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  675. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  676. {
  677. return;
  678. }
  679. if (ds.Tables[0].Rows.Count == 0)
  680. {
  681. proc_GetTextBox(cbb.Name).Clear();
  682. return;
  683. }
  684. proc_GetTextBox(cbb.Name).Text = Convert.ToString(ds.Tables[0].Rows[0]["USETIMES"]);
  685. }
  686. catch { }
  687. }
  688. private void ulgrpBaseInfoEdit_Click(object sender, EventArgs e)
  689. {
  690. }
  691. }
  692. }