FrmZKCXXInfo.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Core.Mes.Client.Common;
  10. using Infragistics.Win.UltraWinGrid;
  11. using Infragistics.Win.UltraWinGrid.ExcelExport;
  12. using Infragistics.Win;
  13. using System.Collections;
  14. using CoreFS.CA06;
  15. using System.Diagnostics;
  16. using System.IO;
  17. namespace Core.LgMes.Client.lgIntegrationQuery
  18. {
  19. public partial class FrmZKCXXInfo : frmStyleBase
  20. {
  21. private bool bAddNow, bEditNow, bDelNow;
  22. private UltraGridRow currRow = null;
  23. public FrmZKCXXInfo()
  24. {
  25. InitializeComponent();
  26. }
  27. private void FrmZKCXXInfo_Load(object sender, EventArgs e)
  28. {
  29. ultraDateTimeEditor1.DateTime = DateTime.Today;
  30. ultraDateTimeEditor2.DateTime = DateTime.Today;
  31. proc_SetToolbarButtons();
  32. }
  33. public override void ToolBar_Click(object sender, string ToolbarKey)
  34. {
  35. switch (ToolbarKey)
  36. {
  37. case "Query":
  38. {
  39. if (bAddNow || bEditNow || bDelNow)
  40. return;
  41. proc_Query();
  42. proc_SetToolbarButtons();
  43. break;
  44. }
  45. case "Add":
  46. {
  47. if (bAddNow || bEditNow || bDelNow)
  48. return;
  49. currRow = this.ultraGrid1.DisplayLayout.Bands[0].AddNew();
  50. this.proc_setCellReadOnly(currRow, false);
  51. bAddNow = true;
  52. this.proc_SetToolbarButtons();
  53. break;
  54. }
  55. case "Edit":
  56. {
  57. if (ultraGrid1.ActiveRow == null || (bAddNow || bEditNow || bDelNow))
  58. return;
  59. currRow = ultraGrid1.ActiveRow;
  60. this.proc_setCellReadOnly(currRow, false);
  61. bEditNow = true;
  62. this.proc_SetToolbarButtons();
  63. break;
  64. }
  65. case "Save":
  66. {
  67. if (bAddNow)
  68. {
  69. proc_Add("Add");
  70. }
  71. else if (bEditNow)
  72. {
  73. proc_Add("Edit");
  74. }
  75. proc_Query();
  76. break;
  77. }
  78. case "Delete":
  79. {
  80. if (ultraGrid1.ActiveRow == null || (bAddNow || bEditNow || bDelNow))
  81. return;
  82. bDelNow = true;
  83. this.proc_SetToolbarButtons();
  84. proc_Delete();
  85. bDelNow = false;
  86. proc_Query();
  87. this.proc_SetToolbarButtons();
  88. break;
  89. }
  90. case "Export":
  91. {
  92. try
  93. {
  94. if (ultraGrid1.Rows.Count == 0) return;
  95. string strFileName = "真空槽记录" + DateTime.Now.ToString("yyyyMMdd");
  96. SaveFileDialog dlg = new SaveFileDialog();
  97. dlg.Title = "保存";
  98. dlg.OverwritePrompt = true;
  99. dlg.Filter = "Excel文件(*.xls)|*.xls";
  100. dlg.AddExtension = true;
  101. dlg.FileName = strFileName;
  102. if (dlg.ShowDialog() == DialogResult.OK)
  103. {
  104. strFileName = dlg.FileName;
  105. ultraGridExcelExporter1.Export(ultraGrid1, strFileName);
  106. if (MessageBox.Show("数据导出成功!\r\n需要打开所导出文件吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  107. {
  108. ultraGridExcelExporter1.Export(ultraGrid1, strFileName);
  109. ProcessStartInfo p = new ProcessStartInfo(strFileName);
  110. p.WorkingDirectory = Path.GetDirectoryName(strFileName);
  111. Process.Start(p);
  112. }
  113. }
  114. }
  115. catch (Exception ex)
  116. {
  117. MessageBox.Show(ex.Message);
  118. }
  119. break;
  120. }
  121. case "Cancel":
  122. {
  123. if (!(bAddNow || bEditNow)) return;
  124. string strOpt = " [" + (bAddNow ? "新增" : (bEditNow ? "修改" : "")) + "]";
  125. if (MessageBox.Show("确定要取消" + strOpt + "操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  126. return;
  127. if (bAddNow)
  128. {
  129. currRow.Delete(false);
  130. currRow = null;
  131. if (ultraGrid1.Rows.Count > 0)
  132. {
  133. ultraGrid1.ActiveCell = ultraGrid1.Rows[ultraGrid1.Rows.Count - 1].Cells["STATIONCODE"];
  134. ultraGrid1.Rows[ultraGrid1.Rows.Count - 1].Cells["STATIONCODE"].Selected = false;
  135. }
  136. bAddNow = false;
  137. }
  138. else if (bEditNow)
  139. {
  140. this.proc_setCellReadOnly(currRow, true);
  141. currRow = null;
  142. bEditNow = false;
  143. }
  144. this.proc_SetToolbarButtons();
  145. break;
  146. }
  147. case "Close":
  148. {
  149. this.Close();
  150. break;
  151. }
  152. }
  153. }
  154. public void proc_Query()
  155. {
  156. Cursor oldCursor = this.Cursor;
  157. this.Cursor = Cursors.WaitCursor;
  158. try
  159. {
  160. this.dataTable1.Clear();
  161. string sqlStr = @"SELECT * FROM DEV_ZKC_XX_INFO WHERE
  162. OPTDATE BETWEEN TO_DATE('{0}','YYYY-MM-DD HH24:MI:SS') AND TO_DATE('{1}','YYYY-MM-DD HH24:MI:SS')";
  163. if (ultraDateTimeEditor2.DateTime.Date.Subtract(ultraDateTimeEditor1.DateTime.Date).Days > 90)
  164. {
  165. MessageBox.Show("查询时间不可超过3个月。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  166. return;
  167. }
  168. if (ultraDateTimeEditor1.DateTime.Date > ultraDateTimeEditor2.DateTime.Date)
  169. {
  170. MessageBox.Show("查询开始日期不能大于结束日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  171. return;
  172. }
  173. string strFrom = ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd") + " 00:00:00";
  174. string strTo = ultraDateTimeEditor2.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
  175. sqlStr = string.Format(sqlStr, strFrom, strTo);
  176. //调用服务端方法
  177. CoreClientParam CCP_LgEts = new CoreClientParam();
  178. DataTable dt = new DataTable();
  179. CCP_LgEts.ServerName = "Core.LgMes.Server.Common.ComDBExecute";
  180. CCP_LgEts.MethodName = "doSimpleQuery";
  181. CCP_LgEts.ServerParams = new object[] { sqlStr };
  182. CCP_LgEts.SourceDataTable = dt;
  183. this.ExecuteQueryToDataTable(CCP_LgEts, CoreInvokeType.Internal);
  184. DataSet ds = new DataSet();
  185. if (dt != null && dt.Rows.Count > 0)
  186. {
  187. this.dataTable1.Rows.Clear();
  188. DataRow dr;
  189. for (int iRow = 0; iRow < dt.Rows.Count; iRow++)
  190. {
  191. dr = this.dataTable1.NewRow();
  192. for (int jCol = 0; jCol < dt.Columns.Count; jCol++)
  193. {
  194. if (this.dataTable1.Columns.Contains(dt.Columns[jCol].ColumnName))
  195. {
  196. dr[dt.Columns[jCol].ColumnName] = dt.Rows[iRow][jCol];
  197. }
  198. }
  199. this.dataTable1.Rows.Add(dr);
  200. }
  201. }
  202. ultraGrid1.UpdateData();
  203. if (ultraGrid1.Rows.Count > 0)
  204. {
  205. ultraGrid1.ActiveCell = ultraGrid1.Rows[0].Cells["UUID_"];
  206. ultraGrid1.Rows[0].Cells["UUID_"].Selected = false;
  207. }
  208. this.proc_SetUltraGridReadOnly(ultraGrid1);
  209. }
  210. catch
  211. { }
  212. finally
  213. {
  214. this.Cursor = oldCursor;
  215. }
  216. }
  217. public void proc_Add(string flag)
  218. {
  219. try
  220. {
  221. this.ultraGrid1.UpdateData();
  222. if (dataTable1.Rows.Count > 0)
  223. {
  224. string strErr = "";
  225. string strMess = "";
  226. if (flag == "Add")
  227. {
  228. ArrayList arry = new ArrayList();
  229. arry.Add("frmZKCXXInfo.Insert");
  230. string str1 = ultraGrid1.ActiveRow.Cells["LADLEID"].Text;
  231. string str2 = ultraGrid1.ActiveRow.Cells["FACTORY"].Text;
  232. string str3 = ultraGrid1.ActiveRow.Cells["HLG_DATE"].Text;
  233. string str4 = ultraGrid1.ActiveRow.Cells["HLG_TIME"].Text;
  234. string str5 = ultraGrid1.ActiveRow.Cells["LG_ISCLEAN"].Text;
  235. string str6 = ultraGrid1.ActiveRow.Cells["XX_DATE"].Text;
  236. string str7 = ultraGrid1.ActiveRow.Cells["XX_TIME"].Text;
  237. string str8 = ultraGrid1.ActiveRow.Cells["XXLZ"].Text;
  238. string str9 = ultraGrid1.ActiveRow.Cells["LS_CRG"].Text;
  239. string str10 = ultraGrid1.ActiveRow.Cells["LS_FL"].Text;
  240. string str11 = ultraGrid1.ActiveRow.Cells["LS_XBC"].Text;
  241. string str12 = ultraGrid1.ActiveRow.Cells["LS_ZBC"].Text;
  242. string str13 = ultraGrid1.ActiveRow.Cells["LS_SBC"].Text;
  243. string str14 = ultraGrid1.ActiveRow.Cells["XJ_CDZ"].Text;
  244. string str15 = ultraGrid1.ActiveRow.Cells["XJ_CBZ"].Text;
  245. string str16 = ultraGrid1.ActiveRow.Cells["XJ_HLGZ"].Text;
  246. string str17 = ultraGrid1.ActiveRow.Cells["REPAIR_TYPE"].Text;
  247. string str18 = ultraGrid1.ActiveRow.Cells["XB_CDZ"].Text;
  248. string str19 = ultraGrid1.ActiveRow.Cells["XB_CBZ"].Text;
  249. string str20 = ultraGrid1.ActiveRow.Cells["XB_HLGZ"].Text;
  250. string str21 = ultraGrid1.ActiveRow.Cells["FJ_FL"].Text;
  251. string str22 = ultraGrid1.ActiveRow.Cells["FJ_GRB"].Text;
  252. string str23 = ultraGrid1.ActiveRow.Cells["FJ_FBF"].Text;
  253. string str24 = ultraGrid1.ActiveRow.Cells["FJ_CQXT"].Text;
  254. string str25 = ultraGrid1.ActiveRow.Cells["CHECK_MAN"].Text;
  255. string str26 = ultraGrid1.ActiveRow.Cells["CHECK_DATE"].Text;
  256. string str27 = ultraGrid1.ActiveRow.Cells["CHECK_TIME"].Text;
  257. string str28 = ultraGrid1.ActiveRow.Cells["SX_DATE"].Text;
  258. string str29 = ultraGrid1.ActiveRow.Cells["SX_TIME"].Text;
  259. string str30 = ultraGrid1.ActiveRow.Cells["CTCH"].Text;
  260. string str31 = ultraGrid1.ActiveRow.Cells["SGQG_ISOK"].Text;
  261. string str32 = ultraGrid1.ActiveRow.Cells["TSTQ_ISOK"].Text;
  262. string str33 = ultraGrid1.ActiveRow.Cells["EZQR"].Text;
  263. string str34 = ultraGrid1.ActiveRow.Cells["XKQR"].Text;
  264. string str35 = ultraGrid1.ActiveRow.Cells["FZBQR"].Text;
  265. string str36 = ultraGrid1.ActiveRow.Cells["FIRE_ISOK"].Text;
  266. string str37 = ultraGrid1.ActiveRow.Cells["QR_MAN"].Text;
  267. string str38 = ultraGrid1.ActiveRow.Cells["HKKS_DATE"].Text;
  268. string str39 = ultraGrid1.ActiveRow.Cells["HKKS_TIME"].Text;
  269. string str40 = ultraGrid1.ActiveRow.Cells["HKKS_MQLL"].Text;
  270. string str41 = ultraGrid1.ActiveRow.Cells["HKKS_YQLL"].Text;
  271. string str42 = ultraGrid1.ActiveRow.Cells["HKKS_OPT_MAN"].Text;
  272. string str43 = ultraGrid1.ActiveRow.Cells["TZH_DATE"].Text;
  273. string str44 = ultraGrid1.ActiveRow.Cells["TZH_TIME"].Text;
  274. string str45 = ultraGrid1.ActiveRow.Cells["TZH_MQLL"].Text;
  275. string str46 = ultraGrid1.ActiveRow.Cells["TZH_YQLL"].Text;
  276. string str47 = ultraGrid1.ActiveRow.Cells["TZH_OPT_MAN"].Text;
  277. string str48 = ultraGrid1.ActiveRow.Cells["TDH_DATE"].Text;
  278. string str49 = ultraGrid1.ActiveRow.Cells["TDH_TIME"].Text;
  279. string str50 = ultraGrid1.ActiveRow.Cells["TDH_MQLL"].Text;
  280. string str51 = ultraGrid1.ActiveRow.Cells["TDH_YQLL"].Text;
  281. string str52 = ultraGrid1.ActiveRow.Cells["TDH_OPT_MAN"].Text;
  282. string str53 = ultraGrid1.ActiveRow.Cells["GG_DATE"].Text;
  283. string str54 = ultraGrid1.ActiveRow.Cells["GG_TIME"].Text;
  284. string str55 = ultraGrid1.ActiveRow.Cells["ALL_TIME"].Text;
  285. string str56 = ultraGrid1.ActiveRow.Cells["GG_BZ"].Text;
  286. string str57 = this.UserInfo.GetUserName().Trim();
  287. arry.Add(str1);
  288. arry.Add(str2);
  289. arry.Add(str3);
  290. arry.Add(str4);
  291. arry.Add(str5);
  292. arry.Add(str6);
  293. arry.Add(str7);
  294. arry.Add(str8);
  295. arry.Add(str9);
  296. arry.Add(str10);
  297. arry.Add(str11);
  298. arry.Add(str12);
  299. arry.Add(str13);
  300. arry.Add(str14);
  301. arry.Add(str15);
  302. arry.Add(str16);
  303. arry.Add(str17);
  304. arry.Add(str18);
  305. arry.Add(str19);
  306. arry.Add(str20);
  307. arry.Add(str21);
  308. arry.Add(str22);
  309. arry.Add(str23);
  310. arry.Add(str24);
  311. arry.Add(str25);
  312. arry.Add(str26);
  313. arry.Add(str27);
  314. arry.Add(str28);
  315. arry.Add(str29);
  316. arry.Add(str30);
  317. arry.Add(str31);
  318. arry.Add(str32);
  319. arry.Add(str33);
  320. arry.Add(str34);
  321. arry.Add(str35);
  322. arry.Add(str36);
  323. arry.Add(str37);
  324. arry.Add(str38);
  325. arry.Add(str39);
  326. arry.Add(str40);
  327. arry.Add(str41);
  328. arry.Add(str42);
  329. arry.Add(str43);
  330. arry.Add(str44);
  331. arry.Add(str45);
  332. arry.Add(str46);
  333. arry.Add(str47);
  334. arry.Add(str48);
  335. arry.Add(str49);
  336. arry.Add(str50);
  337. arry.Add(str51);
  338. arry.Add(str52);
  339. arry.Add(str53);
  340. arry.Add(str54);
  341. arry.Add(str55);
  342. arry.Add(str56);
  343. arry.Add(str57);
  344. CommonClientToServer cctos = new CommonClientToServer();
  345. cctos.ob = this.ob;
  346. cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
  347. "doSimpleSave", arry, out strErr);
  348. this.proc_setCellReadOnly(currRow, true);
  349. currRow = null;
  350. bAddNow = false;
  351. }
  352. else if (flag == "Edit")
  353. {
  354. ArrayList arry = new ArrayList();
  355. arry.Add("frmZKCXXInfo.Update");
  356. string str1 = ultraGrid1.ActiveRow.Cells["LADLEID"].Text;
  357. string str2 = ultraGrid1.ActiveRow.Cells["FACTORY"].Text;
  358. string str3 = ultraGrid1.ActiveRow.Cells["HLG_DATE"].Text;
  359. string str4 = ultraGrid1.ActiveRow.Cells["HLG_TIME"].Text;
  360. string str5 = ultraGrid1.ActiveRow.Cells["LG_ISCLEAN"].Text;
  361. string str6 = ultraGrid1.ActiveRow.Cells["XX_DATE"].Text;
  362. string str7 = ultraGrid1.ActiveRow.Cells["XX_TIME"].Text;
  363. string str8 = ultraGrid1.ActiveRow.Cells["XXLZ"].Text;
  364. string str9 = ultraGrid1.ActiveRow.Cells["LS_CRG"].Text;
  365. string str10 = ultraGrid1.ActiveRow.Cells["LS_FL"].Text;
  366. string str11 = ultraGrid1.ActiveRow.Cells["LS_XBC"].Text;
  367. string str12 = ultraGrid1.ActiveRow.Cells["LS_ZBC"].Text;
  368. string str13 = ultraGrid1.ActiveRow.Cells["LS_SBC"].Text;
  369. string str14 = ultraGrid1.ActiveRow.Cells["XJ_CDZ"].Text;
  370. string str15 = ultraGrid1.ActiveRow.Cells["XJ_CBZ"].Text;
  371. string str16 = ultraGrid1.ActiveRow.Cells["XJ_HLGZ"].Text;
  372. string str17 = ultraGrid1.ActiveRow.Cells["REPAIR_TYPE"].Text;
  373. string str18 = ultraGrid1.ActiveRow.Cells["XB_CDZ"].Text;
  374. string str19 = ultraGrid1.ActiveRow.Cells["XB_CBZ"].Text;
  375. string str20 = ultraGrid1.ActiveRow.Cells["XB_HLGZ"].Text;
  376. string str21 = ultraGrid1.ActiveRow.Cells["FJ_FL"].Text;
  377. string str22 = ultraGrid1.ActiveRow.Cells["FJ_GRB"].Text;
  378. string str23 = ultraGrid1.ActiveRow.Cells["FJ_FBF"].Text;
  379. string str24 = ultraGrid1.ActiveRow.Cells["FJ_CQXT"].Text;
  380. string str25 = ultraGrid1.ActiveRow.Cells["CHECK_MAN"].Text;
  381. string str26 = ultraGrid1.ActiveRow.Cells["CHECK_DATE"].Text;
  382. string str27 = ultraGrid1.ActiveRow.Cells["CHECK_TIME"].Text;
  383. string str28 = ultraGrid1.ActiveRow.Cells["SX_DATE"].Text;
  384. string str29 = ultraGrid1.ActiveRow.Cells["SX_TIME"].Text;
  385. string str30 = ultraGrid1.ActiveRow.Cells["CTCH"].Text;
  386. string str31 = ultraGrid1.ActiveRow.Cells["SGQG_ISOK"].Text;
  387. string str32 = ultraGrid1.ActiveRow.Cells["TSTQ_ISOK"].Text;
  388. string str33 = ultraGrid1.ActiveRow.Cells["EZQR"].Text;
  389. string str34 = ultraGrid1.ActiveRow.Cells["XKQR"].Text;
  390. string str35 = ultraGrid1.ActiveRow.Cells["FZBQR"].Text;
  391. string str36 = ultraGrid1.ActiveRow.Cells["FIRE_ISOK"].Text;
  392. string str37 = ultraGrid1.ActiveRow.Cells["QR_MAN"].Text;
  393. string str38 = ultraGrid1.ActiveRow.Cells["HKKS_DATE"].Text;
  394. string str39 = ultraGrid1.ActiveRow.Cells["HKKS_TIME"].Text;
  395. string str40 = ultraGrid1.ActiveRow.Cells["HKKS_MQLL"].Text;
  396. string str41 = ultraGrid1.ActiveRow.Cells["HKKS_YQLL"].Text;
  397. string str42 = ultraGrid1.ActiveRow.Cells["HKKS_OPT_MAN"].Text;
  398. string str43 = ultraGrid1.ActiveRow.Cells["TZH_DATE"].Text;
  399. string str44 = ultraGrid1.ActiveRow.Cells["TZH_TIME"].Text;
  400. string str45 = ultraGrid1.ActiveRow.Cells["TZH_MQLL"].Text;
  401. string str46 = ultraGrid1.ActiveRow.Cells["TZH_YQLL"].Text;
  402. string str47 = ultraGrid1.ActiveRow.Cells["TZH_OPT_MAN"].Text;
  403. string str48 = ultraGrid1.ActiveRow.Cells["TDH_DATE"].Text;
  404. string str49 = ultraGrid1.ActiveRow.Cells["TDH_TIME"].Text;
  405. string str50 = ultraGrid1.ActiveRow.Cells["TDH_MQLL"].Text;
  406. string str51 = ultraGrid1.ActiveRow.Cells["TDH_YQLL"].Text;
  407. string str52 = ultraGrid1.ActiveRow.Cells["TDH_OPT_MAN"].Text;
  408. string str53 = ultraGrid1.ActiveRow.Cells["GG_DATE"].Text;
  409. string str54 = ultraGrid1.ActiveRow.Cells["GG_TIME"].Text;
  410. string str55 = ultraGrid1.ActiveRow.Cells["ALL_TIME"].Text;
  411. string str56 = ultraGrid1.ActiveRow.Cells["GG_BZ"].Text;
  412. string str57 = this.UserInfo.GetUserName().Trim();
  413. string uuid = ultraGrid1.ActiveRow.Cells["UUID_"].Text;
  414. arry.Add(str1);
  415. arry.Add(str2);
  416. arry.Add(str3);
  417. arry.Add(str4);
  418. arry.Add(str5);
  419. arry.Add(str6);
  420. arry.Add(str7);
  421. arry.Add(str8);
  422. arry.Add(str9);
  423. arry.Add(str10);
  424. arry.Add(str11);
  425. arry.Add(str12);
  426. arry.Add(str13);
  427. arry.Add(str14);
  428. arry.Add(str15);
  429. arry.Add(str16);
  430. arry.Add(str17);
  431. arry.Add(str18);
  432. arry.Add(str19);
  433. arry.Add(str20);
  434. arry.Add(str21);
  435. arry.Add(str22);
  436. arry.Add(str23);
  437. arry.Add(str24);
  438. arry.Add(str25);
  439. arry.Add(str26);
  440. arry.Add(str27);
  441. arry.Add(str28);
  442. arry.Add(str29);
  443. arry.Add(str30);
  444. arry.Add(str31);
  445. arry.Add(str32);
  446. arry.Add(str33);
  447. arry.Add(str34);
  448. arry.Add(str35);
  449. arry.Add(str36);
  450. arry.Add(str37);
  451. arry.Add(str38);
  452. arry.Add(str39);
  453. arry.Add(str40);
  454. arry.Add(str41);
  455. arry.Add(str42);
  456. arry.Add(str43);
  457. arry.Add(str44);
  458. arry.Add(str45);
  459. arry.Add(str46);
  460. arry.Add(str47);
  461. arry.Add(str48);
  462. arry.Add(str49);
  463. arry.Add(str50);
  464. arry.Add(str51);
  465. arry.Add(str52);
  466. arry.Add(str53);
  467. arry.Add(str54);
  468. arry.Add(str55);
  469. arry.Add(str56);
  470. arry.Add(str57);
  471. arry.Add(uuid);
  472. CommonClientToServer cctos = new CommonClientToServer();
  473. cctos.ob = this.ob;
  474. cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
  475. "doSimpleSave", arry, out strErr);
  476. this.proc_setCellReadOnly(currRow, true);
  477. currRow = null;
  478. bEditNow = false;
  479. }
  480. if (strErr == "")
  481. {
  482. dataTable1.AcceptChanges();
  483. //JJBStaticFunction.SetRowEdit(ultraGrid1);
  484. if (!string.IsNullOrEmpty(strMess))
  485. MessageBox.Show(strMess, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  486. }
  487. else
  488. {
  489. MessageBox.Show("保存失败!输入信息已经存在或数据无效。", "错误");
  490. }
  491. if (ultraGrid1.ActiveCell != null)
  492. ultraGrid1.ActiveCell.Activated = false;
  493. this.proc_SetToolbarButtons();
  494. }
  495. }
  496. catch (System.Exception ex)
  497. {
  498. Console.WriteLine(ex.ToString());
  499. }
  500. }
  501. public void proc_Delete()
  502. {
  503. try
  504. {
  505. string strErr = "";
  506. ArrayList arry = new ArrayList();
  507. if (this.ultraGrid1.ActiveRow == null) return;
  508. string uuid_ = ultraGrid1.ActiveRow.Cells["UUID_"].Text.Trim();
  509. arry.Add("frmZKCXXInfo.Delete");
  510. arry.Add(uuid_);
  511. CommonClientToServer cctos = new CommonClientToServer();
  512. cctos.ob = this.ob;
  513. cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
  514. "doSimpleSave", arry, out strErr);
  515. if (!string.IsNullOrEmpty(strErr))
  516. {
  517. MessageBox.Show("删除错误:" + strErr);
  518. }
  519. else
  520. {
  521. MessageBox.Show("删除成功:" + strErr);
  522. }
  523. }
  524. catch { }
  525. }
  526. private void proc_SetToolbarButtons()
  527. {
  528. try
  529. {
  530. this.ToolBarItemEnable(this, "Query", !(bAddNow || bEditNow || bDelNow));
  531. this.ToolBarItemEnable(this, "Add", !(bAddNow || bEditNow || bDelNow));
  532. this.ToolBarItemEnable(this, "Edit", (!(bAddNow || bEditNow || bDelNow) && (ultraGrid1.ActiveRow != null)));
  533. this.ToolBarItemEnable(this, "Delete", (!(bAddNow || bEditNow || bDelNow) && (ultraGrid1.ActiveRow != null)));
  534. this.ToolBarItemEnable(this, "Export", (!(bAddNow || bEditNow || bDelNow) && ultraGrid1.Rows.Count > 0));
  535. this.ToolBarItemEnable(this, "Save", (bAddNow || bEditNow));
  536. this.ToolBarItemEnable(this, "Cancel", (bAddNow || bEditNow));
  537. //this.ToolBarVisible(this, "Save");
  538. //this.Toolbars[0].Tools["Save"].SharedProps.Visible = (bAddNow || bEditNow);
  539. //this.Toolbars[0].Tools["Cancel"].SharedProps.Visible = (bAddNow || bEditNow);
  540. }
  541. catch { }
  542. }
  543. private void proc_setCellReadOnly(UltraGridRow row, bool bReadOnly)
  544. {
  545. try
  546. {
  547. if (row == null)
  548. return;
  549. if (bReadOnly)
  550. {
  551. row.Activation = Activation.ActivateOnly;
  552. row.CellAppearance.BackColor = Color.White;
  553. foreach (Infragistics.Win.UltraWinGrid.UltraGridCell cell in row.Cells)
  554. {
  555. cell.CancelUpdate();
  556. }
  557. }
  558. else
  559. {
  560. row.Activation = Activation.AllowEdit;
  561. row.CellAppearance.BackColor = Color.Khaki;
  562. }
  563. }
  564. catch (Exception ex)
  565. {
  566. MessageBox.Show(ex.Message);
  567. }
  568. }
  569. private void proc_SetUltraGridReadOnly(Infragistics.Win.UltraWinGrid.UltraGridBase ultGrid)
  570. {
  571. foreach (UltraGridRow row in ultGrid.Rows)
  572. {
  573. row.Activation = Activation.ActivateOnly;
  574. }
  575. }
  576. }
  577. }