FrmSGRepair.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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 FrmSGRepair : Core.Mes.Client.Common.frmStyleBase//frmModelFormStyle
  14. {
  15. bool bOK = false; //是否响应扇形段号选择改变事件
  16. public string strNo = "", strCCM = "";
  17. public FrmSGRepair(OpeBase oba)
  18. {
  19. InitializeComponent();
  20. ob = oba;
  21. }
  22. private void FrmSGRepair_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. /// <summary>
  43. /// 扇形段号加载
  44. /// </summary>
  45. /// <param name="strCCM"></param>
  46. private void proc_GetID(string strCCM)
  47. {
  48. try
  49. {
  50. if (strCCM.Length == 0)
  51. return;
  52. string strErr = "";
  53. ArrayList arry = new ArrayList();
  54. arry.Add("FrmSGRepair_Query1");
  55. arry.Add(strCCM);
  56. CommonClientToServer ccs = new CommonClientToServer();
  57. ccs.ob = this.ob;
  58. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  59. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  60. {
  61. MessageBox.Show("扇形段号加载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  62. if (MessageBox.Show("是否重新加载扇形段号?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  63. proc_GetID(strCCM);
  64. return;
  65. }
  66. cmbID.DataSource = ds.Tables[0];
  67. cmbID.DisplayMember = "SEGMENTID";
  68. if (ds.Tables[0].Rows.Count == 0)
  69. {
  70. proc_ResetControl();
  71. btnBegin.Enabled = btnEnd.Enabled = false;
  72. }
  73. }
  74. catch (Exception ex)
  75. {
  76. MessageBox.Show(ex.Message);
  77. }
  78. }
  79. private void proc_ResetControl()
  80. {
  81. try
  82. {
  83. cmbID.Text = "";
  84. cmbType.SelectedIndex = -1;
  85. udteRepairTime.Text = "";
  86. udteRepairT.Text = "";
  87. cmbReason.Text = "";
  88. txtCS.Clear();
  89. txtMemo.Clear();
  90. }
  91. catch (Exception ex)
  92. {
  93. MessageBox.Show(ex.Message);
  94. }
  95. }
  96. /// <summary>
  97. /// 维修开始
  98. /// </summary>
  99. private void proc_Begin()
  100. {
  101. try
  102. {
  103. if (cmbID.Items.Count == 0)
  104. return;
  105. string strCcm = cmbCCM.Text.Trim();
  106. string strID = cmbID.Text.Trim();
  107. if (strID.Length == 0)
  108. {
  109. MessageBox.Show("请选择需要维修的扇形段编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  110. cmbID.Focus();
  111. return;
  112. }
  113. string strType = cmbType.Text.Trim();
  114. if (strType.Length == 0)
  115. {
  116. MessageBox.Show("请选择维修类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  117. cmbType.Focus();
  118. return;
  119. }
  120. if (udteRepairTime.Text.Trim().Length == 0)
  121. udteRepairTime.DateTime = DateTime.Now;
  122. if (MessageBox.Show("确定要维修[" + strCcm + "]的扇形段[" + strID + "]吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  123. {
  124. proc_GetID(strCcm);
  125. return;
  126. }
  127. //string strErr = "";
  128. //string strSql = "select count(1) from DEV_SXD_BASE_INFO where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
  129. //CallingMessage par = new CallingMessage();
  130. //par.ServerName = "LgDeviceManager";
  131. //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
  132. //par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager";
  133. //par.MethodName = "ExecuteCommand_Return";
  134. //par.args = new object[] { strSql };
  135. //DataSet ds = null; // ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as DataSet;
  136. string strErr = "";
  137. ArrayList arry = new ArrayList();
  138. arry.Add("FrmSGRepair_Query4");
  139. arry.Add(strCCM);
  140. arry.Add(strID);
  141. CommonClientToServer ccs = new CommonClientToServer();
  142. ccs.ob = this.ob;
  143. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  144. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  145. {
  146. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  147. return;
  148. }
  149. int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  150. if (iCnt == 0)
  151. {
  152. MessageBox.Show("[" + strCcm + "]不存在扇形段[" + strID + "]信息,无法维修!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  153. proc_GetID(strCcm);
  154. cmbID.Focus();
  155. return;
  156. }
  157. iCnt = 0;
  158. ds = null;
  159. strErr = "";
  160. arry.Clear();
  161. //strSql = "select case NOWSTATUS when '0' then '下线' when '1' then '上线' when '2' then '维修' when '3' then '备用' end NOWSTATUS from DEV_SXD_BASE_INFO where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
  162. //par.args = new object[] { strSql };
  163. //ds = null; //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as DataSet;
  164. ccs.ob = ob;
  165. arry.Add("FrmSGRepair_Query5");
  166. arry.Add(strCcm);
  167. arry.Add(strID);
  168. ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  169. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  170. {
  171. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  172. return;
  173. }
  174. if (Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim()) != "下线")
  175. {
  176. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]当前状态[" + Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]) + "],只有在[下线]状态才能维修!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  177. cmbID.Focus();
  178. return;
  179. }
  180. string strReturn = "";
  181. strErr = "";
  182. arry.Clear();
  183. arry.Add("FrmSGRepair_Add1");
  184. arry.Add(strID);
  185. arry.Add(strCcm);
  186. arry.Add(strType);
  187. arry.Add(udteRepairTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
  188. arry.Add(cmbReason.Text.Trim());
  189. arry.Add(txtMemo.Text.Trim());
  190. arry.Add(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  191. //strSql = "insert into DEV_TOOL_REPAIR (REPAIRID, TOOLTYPEID, REPAIRTOOLID, REPAIRTYPE, REPAIRTIME, REASON, MEMO, RECORDER) "
  192. //+ "values "
  193. //+ "("
  194. //+ "(select nvl(max(REPAIRID),100000001) + 1 from DEV_TOOL_REPAIR),"
  195. //+ "'3',"
  196. //+ "(select ID from DEV_SXD_BASE_INFO where SEGMENTID = '" + strID + "' and CCM_ID = '" + strCcm + "'),"
  197. //+ "'" + strType + "',"
  198. //+ "to_date('" + ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd HH24:mi:ss'),"
  199. //+ "'" + cbbReason.Text.Trim() + "',"
  200. //+ "'" + tbMemo.Text.Trim() + "',"
  201. //+ "'" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' "
  202. //+ ")";
  203. //par.MethodName = "ExecuteCommand_NonReturn";
  204. //par.args = new object[] { strSql };
  205. //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  206. ccs.ob = ob;
  207. strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  208. if (!(strErr == null || strErr == ""))
  209. {
  210. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  211. return;
  212. }
  213. strReturn = "";
  214. strErr = "";
  215. arry.Clear();
  216. ccs.ob = ob;
  217. arry.Add("FrmSGRepair_Update1");
  218. arry.Add(txtCS.Text.Trim());
  219. arry.Add(strCcm);
  220. arry.Add(strID);
  221. //strSql = "update DEV_SXD_BASE_INFO set NOWSTATUS = '2', POSITION = null, USETIMES = nvl('" + tbCS.Text.Trim() + "',0) where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
  222. //par.args = new object[] { strSql };
  223. //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  224. strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  225. if (!(strErr == null || strErr == ""))
  226. {
  227. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  228. return;
  229. }
  230. FrmSegMentManage frm = (FrmSegMentManage)this.Tag;
  231. frm.proc_GetBaseInfo(strCcm, strID);
  232. proc_GetID(strCcm);
  233. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  234. return;
  235. }
  236. catch (Exception ex)
  237. {
  238. MessageBox.Show(ex.Message);
  239. }
  240. }
  241. private void proc_End()
  242. {
  243. try
  244. {
  245. if (cmbID.Items.Count == 0)
  246. return;
  247. string strCcm = cmbCCM.Text.Trim();
  248. string strID = cmbID.Text.Trim();
  249. if (strID.Length == 0)
  250. {
  251. MessageBox.Show("请选择维修中的扇形段编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  252. cmbID.Focus();
  253. return;
  254. }
  255. string strType = cmbType.Text.Trim();
  256. if (strType.Length == 0)
  257. {
  258. MessageBox.Show("请选择维修类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  259. cmbType.Focus();
  260. return;
  261. }
  262. if (udteRepairT.Text.Trim().Length == 0)
  263. udteRepairT.DateTime = DateTime.Now;
  264. if (udteRepairTime.DateTime > udteRepairT.DateTime)
  265. {
  266. MessageBox.Show("送修时间不能大于修复时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  267. udteRepairT.Focus();
  268. return;
  269. }
  270. if (txtCS.Text.Trim().Length == 0)
  271. {
  272. MessageBox.Show("使用炉数不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  273. txtCS.Focus();
  274. return;
  275. }
  276. if (MessageBox.Show("确定[" + strCcm + "]扇形段[" + strID + "]维修结束吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  277. {
  278. proc_GetID(strCcm);
  279. return;
  280. }
  281. string strErr = "";
  282. ArrayList arry = new ArrayList();
  283. arry.Add("FrmSGRepair_Query6");
  284. arry.Add(strCcm);
  285. arry.Add(strID);
  286. CommonClientToServer ccs = new CommonClientToServer();
  287. ccs.ob = this.ob;
  288. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  289. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  290. {
  291. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  292. return;
  293. }
  294. int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  295. if (iCnt == 0)
  296. {
  297. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]信息不存在,无法保存维修信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  298. proc_GetID(strCcm);
  299. cmbID.Focus();
  300. return;
  301. }
  302. iCnt = 0;
  303. ds = null;
  304. strErr = "";
  305. arry.Clear();
  306. ccs.ob = ob;
  307. arry.Add("FrmSGRepair_Query7");
  308. arry.Add(strCcm);
  309. arry.Add(strID);
  310. //strSql = "select case NOWSTATUS when '0' then '下线' when '1' then '上线' when '2' then '维修' when '3' then '备用' end NOWSTATUS from DEV_SXD_BASE_INFO where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
  311. //par.args = new object[] { strSql };
  312. //ds = null; //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as DataSet;
  313. ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  314. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  315. {
  316. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  317. return;
  318. }
  319. if (Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"].ToString().Trim()) != "维修")
  320. {
  321. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]当前状态[" + Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]) + "],只有在[维修]状态才能结束维修!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  322. cmbID.Focus();
  323. return;
  324. }
  325. string strReturn = "";
  326. strErr = "";
  327. arry.Clear();
  328. //strSql = "update DEV_TOOL_REPAIR set "
  329. //+ "REPAIRTYPE = '" + strType + "',"
  330. //+ "REPAIRTIME = to_date('" + ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd HH24:mi:ss'),"
  331. //+ "REPAIREDTIME = to_date('" + ultraDateTimeEditor2.DateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd HH24:mi:ss'),"
  332. //+ "REASON = '" + cbbReason.Text.Trim() + "',"
  333. //+ "MEMO = '" + tbMemo.Text.Trim() + "',"
  334. //+ "RECORDER = '" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' "
  335. //+ "where TOOLTYPEID = '3' and REPAIREDTIME is null and REPAIRTOOLID = "
  336. //+ "(select ID from DEV_SXD_BASE_INFO where SEGMENTID = '" + strID + "' and CCM_ID = '" + strCcm + "')";
  337. //par.MethodName = "ExecuteCommand_NonReturn";
  338. //par.args = new object[] { strSql };
  339. //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  340. ccs.ob = ob;
  341. arry.Add("FrmSGRepair_Update2");
  342. arry.Add(strType);
  343. arry.Add(udteRepairTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
  344. arry.Add(udteRepairT.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
  345. arry.Add(cmbReason.Text.Trim());
  346. arry.Add(txtMemo.Text.Trim());
  347. arry.Add(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  348. arry.Add(strID);
  349. arry.Add(strCcm);
  350. strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  351. if (!(strErr == null || strErr == ""))
  352. {
  353. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  354. return;
  355. }
  356. strReturn = "";
  357. strErr = "";
  358. arry.Clear();
  359. ccs.ob = ob;
  360. arry.Add("FrmSGRepair_Update3");
  361. arry.Add(txtCS.Text.Trim());
  362. arry.Add(strCcm);
  363. arry.Add(strID);
  364. strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  365. //strSql = "update DEV_SXD_BASE_INFO set NOWSTATUS = '3', POSITION = null, USETIMES = nvl('" + tbCS.Text.Trim() + "',0) where CCM_ID = '" + strCcm + "' and SEGMENTID = '" + strID + "'";
  366. //par.args = new object[] { strSql };
  367. //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  368. if (!(strErr == null || strErr == ""))
  369. {
  370. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  371. return;
  372. }
  373. FrmSegMentManage frm = (FrmSegMentManage)this.Tag;
  374. frm.proc_GetBaseInfo(strCcm, strID);
  375. proc_GetID(strCcm);
  376. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  377. return;
  378. }
  379. catch (Exception ex)
  380. {
  381. MessageBox.Show(ex.Message);
  382. }
  383. }
  384. private void btnBegin_Click(object sender, EventArgs e)
  385. {
  386. proc_Begin();
  387. }
  388. private void btnEnd_Click(object sender, EventArgs e)
  389. {
  390. proc_End();
  391. }
  392. private void cbbCCM_SelectedIndexChanged(object sender, EventArgs e)
  393. {
  394. if (cmbCCM.Text.Length > 0)
  395. proc_GetID(cmbCCM.Text);
  396. }
  397. /// <summary>
  398. /// 扇形段基础信息加载
  399. /// </summary>
  400. /// <param name="sender"></param>
  401. /// <param name="e"></param>
  402. private void cbbID_SelectedIndexChanged(object sender, EventArgs e)
  403. {
  404. try
  405. {
  406. if (!bOK)
  407. return;
  408. string strCcm = cmbCCM.Text.Trim();
  409. string strID = cmbID.Text.Trim();
  410. if (strID.Length == 0)
  411. {
  412. cmbType.SelectedIndex = -1;
  413. udteRepairTime.Text = "";
  414. udteRepairT.Text = "";
  415. cmbReason.Text = "";
  416. txtCS.Clear();
  417. txtMemo.Clear();
  418. btnBegin.Enabled = btnEnd.Enabled = false;
  419. return;
  420. }
  421. string strErr = "";
  422. ArrayList arry = new ArrayList();
  423. arry.Add("FrmSGRepair_Query2");
  424. arry.Add(strID);
  425. arry.Add(strCcm);
  426. CommonClientToServer ccs = new CommonClientToServer();
  427. ccs.ob = this.ob;
  428. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  429. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  430. {
  431. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]维修信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  432. return;
  433. }
  434. if (ds.Tables[0].Rows.Count > 0)
  435. {
  436. cmbType.Text = Convert.ToString(ds.Tables[0].Rows[0]["REPAIRTYPE"]);
  437. udteRepairTime.DateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["REPAIRTIME"]);
  438. udteRepairT.Text = "";
  439. cmbReason.Text = Convert.ToString(ds.Tables[0].Rows[0]["REASON"]);
  440. txtMemo.Text = Convert.ToString(ds.Tables[0].Rows[0]["MEMO"]);
  441. btnBegin.Enabled = false;
  442. }
  443. else
  444. {
  445. cmbType.SelectedIndex = -1;
  446. udteRepairTime.Text = "";
  447. udteRepairT.Text = "";
  448. cmbReason.Text = "";
  449. txtMemo.Clear();
  450. btnBegin.Enabled = true;
  451. }
  452. btnEnd.Enabled = !btnBegin.Enabled;
  453. ds = null;
  454. strErr = "";
  455. arry.Clear();
  456. arry.Add("FrmSGRepair_Query3");
  457. arry.Add(strID);
  458. arry.Add(strCcm);
  459. ccs.ob = ob;
  460. ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  461. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  462. {
  463. MessageBox.Show("[" + strCcm + "]扇形段[" + strID + "]基本信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  464. return;
  465. }
  466. if (ds.Tables[0].Rows.Count > 0)
  467. {
  468. txtCS.Text = Convert.ToString(ds.Tables[0].Rows[0]["USETIMES"]);
  469. }
  470. }
  471. catch (Exception ex)
  472. {
  473. MessageBox.Show(ex.Message, "提示");
  474. }
  475. }
  476. private void NumberEditor_KeyPress(object sender, KeyPressEventArgs e)
  477. {
  478. if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b'))
  479. {
  480. e.Handled = true;
  481. }
  482. }
  483. }
  484. }