FrmMaterialInout.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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. using Core.LgMes.Client.Report;
  18. namespace Core.LgMes.Client.lgIntegrationQuery
  19. {
  20. public partial class FrmMaterialInout : frmStyleBase
  21. {
  22. private bool bAddNow, bEditNow, bDelNow;
  23. private UltraGridRow currRow = null;
  24. public FrmMaterialInout()
  25. {
  26. InitializeComponent();
  27. }
  28. private void FrmMaterialInout_Load(object sender, EventArgs e)
  29. {
  30. ultraDateTimeEditor1.DateTime = DateTime.Today;
  31. ultraDateTimeEditor2.DateTime = DateTime.Today;
  32. ValueList vl = new ValueList();
  33. vl.ValueListItems.Add("4#LF", "4#LF");
  34. vl.ValueListItems.Add("5#LF", "5#LF");
  35. vl.ValueListItems.Add("RH", "RH");
  36. vl.ValueListItems.Add("VD", "VD");
  37. vl.ValueListItems.Add("中包班", "中包班");
  38. vl.ValueListItems.Add("钢包班", "钢包班");
  39. this.ultraGrid1.DisplayLayout.Bands[0].Columns["STATIONCODE"].ValueList = vl;
  40. proc_SetToolbarButtons();
  41. }
  42. public override void ToolBar_Click(object sender, string ToolbarKey)
  43. {
  44. switch (ToolbarKey)
  45. {
  46. case "Query":
  47. {
  48. if (bAddNow || bEditNow || bDelNow)
  49. return;
  50. proc_Query();
  51. proc_SetToolbarButtons();
  52. break;
  53. }
  54. case "Add":
  55. {
  56. if (bAddNow || bEditNow || bDelNow)
  57. return;
  58. currRow = this.ultraGrid1.DisplayLayout.Bands[0].AddNew();
  59. this.proc_setCellReadOnly(currRow, false);
  60. bAddNow = true;
  61. this.proc_SetToolbarButtons();
  62. break;
  63. }
  64. case "Edit":
  65. {
  66. if (ultraGrid1.ActiveRow == null || (bAddNow || bEditNow || bDelNow))
  67. return;
  68. currRow = ultraGrid1.ActiveRow;
  69. this.proc_setCellReadOnly(currRow, false);
  70. bEditNow = true;
  71. this.proc_SetToolbarButtons();
  72. break;
  73. }
  74. case "Save":
  75. {
  76. if (bAddNow)
  77. {
  78. proc_Add("Add");
  79. }
  80. else if (bEditNow)
  81. {
  82. proc_Add("Edit");
  83. }
  84. proc_Query();
  85. break;
  86. }
  87. case "Delete":
  88. {
  89. if (ultraGrid1.ActiveRow == null || (bAddNow || bEditNow || bDelNow))
  90. return;
  91. bDelNow = true;
  92. this.proc_SetToolbarButtons();
  93. proc_Delete();
  94. bDelNow = false;
  95. proc_Query();
  96. this.proc_SetToolbarButtons();
  97. break;
  98. }
  99. case "Export":
  100. {
  101. try
  102. {
  103. if (ultraGrid1.Rows.Count == 0) return;
  104. string strFileName = "精二作业区物料申报记录"+DateTime.Now.ToString("yyyyMMdd");
  105. SaveFileDialog dlg = new SaveFileDialog();
  106. dlg.Title = "保存";
  107. dlg.OverwritePrompt = true;
  108. dlg.Filter = "Excel文件(*.xls)|*.xls";
  109. dlg.AddExtension = true;
  110. dlg.FileName = strFileName;
  111. if (dlg.ShowDialog() == DialogResult.OK)
  112. {
  113. strFileName = dlg.FileName;
  114. ultraGridExcelExporter1.Export(ultraGrid1, strFileName);
  115. if (MessageBox.Show("数据导出成功!\r\n需要打开所导出文件吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  116. {
  117. ultraGridExcelExporter1.Export(ultraGrid1, strFileName);
  118. ProcessStartInfo p = new ProcessStartInfo(strFileName);
  119. p.WorkingDirectory = Path.GetDirectoryName(strFileName);
  120. Process.Start(p);
  121. }
  122. }
  123. }
  124. catch (Exception ex)
  125. {
  126. MessageBox.Show(ex.Message);
  127. }
  128. break;
  129. }
  130. case "Cancel":
  131. {
  132. if (!(bAddNow || bEditNow)) return;
  133. string strOpt = " [" + (bAddNow ? "新增" : (bEditNow ? "修改" : "")) + "]";
  134. if (MessageBox.Show("确定要取消" + strOpt + "操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  135. return;
  136. if (bAddNow)
  137. {
  138. currRow.Delete(false);
  139. currRow = null;
  140. if (ultraGrid1.Rows.Count > 0)
  141. {
  142. ultraGrid1.ActiveCell = ultraGrid1.Rows[ultraGrid1.Rows.Count - 1].Cells["STATIONCODE"];
  143. ultraGrid1.Rows[ultraGrid1.Rows.Count - 1].Cells["STATIONCODE"].Selected = false;
  144. }
  145. bAddNow = false;
  146. }
  147. else if (bEditNow)
  148. {
  149. this.proc_setCellReadOnly(currRow, true);
  150. currRow = null;
  151. bEditNow = false;
  152. }
  153. this.proc_SetToolbarButtons();
  154. break;
  155. }
  156. case "Close":
  157. {
  158. this.Close();
  159. break;
  160. }
  161. }
  162. }
  163. public void proc_Query()
  164. {
  165. Cursor oldCursor = this.Cursor;
  166. this.Cursor = Cursors.WaitCursor;
  167. try
  168. {
  169. this.dataTable1.Clear();
  170. string sqlStr = @"SELECT * FROM DEV_MATERIAL_REPORT WHERE
  171. OPTDATE BETWEEN TO_DATE('{0}','YYYY-MM-DD HH24:MI:SS') AND TO_DATE('{1}','YYYY-MM-DD HH24:MI:SS')";
  172. if (ultraDateTimeEditor2.DateTime.Date.Subtract(ultraDateTimeEditor1.DateTime.Date).Days > 90)
  173. {
  174. MessageBox.Show("查询时间不可超过3个月。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  175. return;
  176. }
  177. if (ultraDateTimeEditor1.DateTime.Date > ultraDateTimeEditor2.DateTime.Date)
  178. {
  179. MessageBox.Show("查询开始日期不能大于结束日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  180. return;
  181. }
  182. string strFrom = ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd") + " 00:00:00";
  183. string strTo = ultraDateTimeEditor2.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
  184. sqlStr = string.Format(sqlStr, strFrom, strTo);
  185. //调用服务端方法
  186. CoreClientParam CCP_LgEts = new CoreClientParam();
  187. DataTable dt = new DataTable();
  188. CCP_LgEts.ServerName = "Core.LgMes.Server.Common.ComDBExecute";
  189. CCP_LgEts.MethodName = "doSimpleQuery";
  190. CCP_LgEts.ServerParams = new object[] { sqlStr };
  191. CCP_LgEts.SourceDataTable = dt;
  192. this.ExecuteQueryToDataTable(CCP_LgEts, CoreInvokeType.Internal);
  193. DataSet ds = new DataSet();
  194. if (dt != null && dt.Rows.Count > 0)
  195. {
  196. this.dataTable1.Rows.Clear();
  197. DataRow dr;
  198. for (int iRow = 0; iRow < dt.Rows.Count; iRow++)
  199. {
  200. dr = this.dataTable1.NewRow();
  201. for (int jCol = 0; jCol < dt.Columns.Count; jCol++)
  202. {
  203. if (this.dataTable1.Columns.Contains(dt.Columns[jCol].ColumnName))
  204. {
  205. dr[dt.Columns[jCol].ColumnName] = dt.Rows[iRow][jCol];
  206. }
  207. }
  208. this.dataTable1.Rows.Add(dr);
  209. }
  210. }
  211. ultraGrid1.UpdateData();
  212. if (ultraGrid1.Rows.Count > 0)
  213. {
  214. ultraGrid1.ActiveCell = ultraGrid1.Rows[0].Cells["STATIONCODE"];
  215. ultraGrid1.Rows[0].Cells["STATIONCODE"].Selected = false;
  216. }
  217. this.proc_SetUltraGridReadOnly(ultraGrid1);
  218. ArrayList alistColumns = new ArrayList();
  219. for (int i = 0; i < this.dataTable1.Columns.Count; i++)
  220. {
  221. if (this.dataTable1.Columns[i].ColumnName != "OPTDATE" && this.dataTable1.Columns[i].ColumnName != "OPTMAN" &&
  222. this.dataTable1.Columns[i].ColumnName != "UUID_" && this.dataTable1.Columns[i].ColumnName != "STATIONCODE")
  223. alistColumns.Add(this.dataTable1.Columns[i].ColumnName);
  224. }
  225. proc_Statics(ref ultraGrid1, alistColumns, true, " {0:############0.0}");
  226. }
  227. catch
  228. { }
  229. finally
  230. {
  231. this.Cursor = oldCursor;
  232. }
  233. }
  234. public void proc_Add(string flag)
  235. {
  236. try
  237. {
  238. this.ultraGrid1.UpdateData();
  239. if (dataTable1.Rows.Count > 0)
  240. {
  241. string strErr = "";
  242. string strMess = "";
  243. if (flag == "Add")
  244. {
  245. ArrayList arry = new ArrayList();
  246. arry.Add("frmMaterial.Insert");
  247. string str1 = ultraGrid1.ActiveRow.Cells["STATIONCODE"].Text;
  248. string str2 = ultraGrid1.ActiveRow.Cells["ZTJ"].Text;
  249. string str3 = ultraGrid1.ActiveRow.Cells["RHGZJ"].Text;
  250. string str4 = ultraGrid1.ActiveRow.Cells["LG"].Text;
  251. string str5 = ultraGrid1.ActiveRow.Cells["LX"].Text;
  252. string str6 = ultraGrid1.ActiveRow.Cells["WFCGX"].Text;
  253. string str7 = ultraGrid1.ActiveRow.Cells["CGX"].Text;
  254. string str8 = ultraGrid1.ActiveRow.Cells["LT"].Text;
  255. string str9 = ultraGrid1.ActiveRow.Cells["XL"].Text;
  256. string str10 = ultraGrid1.ActiveRow.Cells["NT"].Text;
  257. string str11 = ultraGrid1.ActiveRow.Cells["FT"].Text;
  258. string str12 = ultraGrid1.ActiveRow.Cells["NB"].Text;
  259. string str13 = ultraGrid1.ActiveRow.Cells["TB"].Text;
  260. string str14 = ultraGrid1.ActiveRow.Cells["TT"].Text;
  261. string str15 = ultraGrid1.ActiveRow.Cells["GT"].Text;
  262. string str16 = ultraGrid1.ActiveRow.Cells["PT"].Text;
  263. string str17 = ultraGrid1.ActiveRow.Cells["XT"].Text;
  264. string str18 = ultraGrid1.ActiveRow.Cells["LHT"].Text;
  265. string str19 = ultraGrid1.ActiveRow.Cells["FDHJ"].Text;
  266. string str20 = ultraGrid1.ActiveRow.Cells["JSM"].Text;
  267. string str21 = ultraGrid1.ActiveRow.Cells["DJ"].Text;
  268. string str22 = ultraGrid1.ActiveRow.Cells["DJT"].Text;
  269. string str23 = ultraGrid1.ActiveRow.Cells["DJDJ"].Text;
  270. string str24 = ultraGrid1.ActiveRow.Cells["DJX"].Text;
  271. string str25 = ultraGrid1.ActiveRow.Cells["XBLLZ"].Text;
  272. string str26 = ultraGrid1.ActiveRow.Cells["GBZZ"].Text;
  273. string str27 = ultraGrid1.ActiveRow.Cells["TQZ"].Text;
  274. string str28 = ultraGrid1.ActiveRow.Cells["FJG"].Text;
  275. //string str29 = ultraGrid1.ActiveRow.Cells["ZBZZ"].Text;
  276. //string str30 = ultraGrid1.ActiveRow.Cells["ZBSK"].Text;
  277. //string str31 = ultraGrid1.ActiveRow.Cells["SB"].Text;
  278. //string str32 = ultraGrid1.ActiveRow.Cells["MFD"].Text;
  279. //string str33 = ultraGrid1.ActiveRow.Cells["GLQ"].Text;
  280. string str34 = this.UserInfo.GetUserName();
  281. string str35 = ultraGrid1.ActiveRow.Cells["BM_LX"].Text;
  282. string str36 = ultraGrid1.ActiveRow.Cells["BM_WFCGX"].Text;
  283. string str37 = ultraGrid1.ActiveRow.Cells["BM_CGX"].Text;
  284. string str38 = ultraGrid1.ActiveRow.Cells["PTTQZ"].Text;
  285. string str39 = ultraGrid1.ActiveRow.Cells["JLLG"].Text;
  286. //string str39 = ultraGrid1.ActiveRow.Cells["ZBZZ1"].Text;
  287. //string str40 = ultraGrid1.ActiveRow.Cells["PTZBSK"].Text;
  288. //string str41 = ultraGrid1.ActiveRow.Cells["CDTZBSK"].Text;
  289. //string str42 = ultraGrid1.ActiveRow.Cells["PTSB"].Text;
  290. //string str43 = ultraGrid1.ActiveRow.Cells["CDTSB"].Text;
  291. arry.Add(str1);
  292. arry.Add(str2);
  293. arry.Add(str3);
  294. arry.Add(str4);
  295. arry.Add(str5);
  296. arry.Add(str6);
  297. arry.Add(str7);
  298. arry.Add(str8);
  299. arry.Add(str9);
  300. arry.Add(str10);
  301. arry.Add(str11);
  302. arry.Add(str12);
  303. arry.Add(str13);
  304. arry.Add(str14);
  305. arry.Add(str15);
  306. arry.Add(str16);
  307. arry.Add(str17);
  308. arry.Add(str18);
  309. arry.Add(str19);
  310. arry.Add(str20);
  311. arry.Add(str21);
  312. arry.Add(str22);
  313. arry.Add(str23);
  314. arry.Add(str24);
  315. arry.Add(str25);
  316. arry.Add(str26);
  317. arry.Add(str27);
  318. arry.Add(str28);
  319. /*arry.Add(str29);
  320. arry.Add(str30);
  321. arry.Add(str31);
  322. arry.Add(str32);
  323. arry.Add(str33);*/
  324. arry.Add(str34);
  325. arry.Add(str35);
  326. arry.Add(str36);
  327. arry.Add(str37);
  328. arry.Add(str38);
  329. arry.Add(str39);
  330. /*arry.Add(str40);
  331. arry.Add(str41);
  332. arry.Add(str42);
  333. arry.Add(str43);*/
  334. CommonClientToServer cctos = new CommonClientToServer();
  335. cctos.ob = this.ob;
  336. cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
  337. "doSimpleSave", arry, out strErr);
  338. this.proc_setCellReadOnly(currRow, true);
  339. currRow = null;
  340. bAddNow = false;
  341. }
  342. else if (flag == "Edit")
  343. {
  344. ArrayList arry = new ArrayList();
  345. arry.Add("frmMaterial.Update");
  346. string str1 = ultraGrid1.ActiveRow.Cells["STATIONCODE"].Text;
  347. string str2 = ultraGrid1.ActiveRow.Cells["ZTJ"].Text;
  348. string str3 = ultraGrid1.ActiveRow.Cells["RHGZJ"].Text;
  349. string str4 = ultraGrid1.ActiveRow.Cells["LG"].Text;
  350. string str5 = ultraGrid1.ActiveRow.Cells["LX"].Text;
  351. string str6 = ultraGrid1.ActiveRow.Cells["WFCGX"].Text;
  352. string str7 = ultraGrid1.ActiveRow.Cells["CGX"].Text;
  353. string str8 = ultraGrid1.ActiveRow.Cells["LT"].Text;
  354. string str9 = ultraGrid1.ActiveRow.Cells["XL"].Text;
  355. string str10 = ultraGrid1.ActiveRow.Cells["NT"].Text;
  356. string str11 = ultraGrid1.ActiveRow.Cells["FT"].Text;
  357. string str12 = ultraGrid1.ActiveRow.Cells["NB"].Text;
  358. string str13 = ultraGrid1.ActiveRow.Cells["TB"].Text;
  359. string str14 = ultraGrid1.ActiveRow.Cells["TT"].Text;
  360. string str15 = ultraGrid1.ActiveRow.Cells["GT"].Text;
  361. string str16 = ultraGrid1.ActiveRow.Cells["PT"].Text;
  362. string str17 = ultraGrid1.ActiveRow.Cells["XT"].Text;
  363. string str18 = ultraGrid1.ActiveRow.Cells["LHT"].Text;
  364. string str19 = ultraGrid1.ActiveRow.Cells["FDHJ"].Text;
  365. string str20 = ultraGrid1.ActiveRow.Cells["JSM"].Text;
  366. string str21 = ultraGrid1.ActiveRow.Cells["DJ"].Text;
  367. string str22 = ultraGrid1.ActiveRow.Cells["DJT"].Text;
  368. string str23 = ultraGrid1.ActiveRow.Cells["DJDJ"].Text;
  369. string str24 = ultraGrid1.ActiveRow.Cells["DJX"].Text;
  370. string str25 = ultraGrid1.ActiveRow.Cells["XBLLZ"].Text;
  371. string str26 = ultraGrid1.ActiveRow.Cells["GBZZ"].Text;
  372. string str27 = ultraGrid1.ActiveRow.Cells["TQZ"].Text;
  373. string str28 = ultraGrid1.ActiveRow.Cells["FJG"].Text;
  374. //string str29 = ultraGrid1.ActiveRow.Cells["ZBZZ"].Text;
  375. //string str30 = ultraGrid1.ActiveRow.Cells["ZBSK"].Text;
  376. //string str31 = ultraGrid1.ActiveRow.Cells["SB"].Text;
  377. //string str32 = ultraGrid1.ActiveRow.Cells["MFD"].Text;
  378. //string str33 = ultraGrid1.ActiveRow.Cells["GLQ"].Text;
  379. string str34 = this.UserInfo.GetUserName();
  380. string uuid = ultraGrid1.ActiveRow.Cells["UUID_"].Text;
  381. string str35 = ultraGrid1.ActiveRow.Cells["BM_LX"].Text;
  382. string str36 = ultraGrid1.ActiveRow.Cells["BM_WFCGX"].Text;
  383. string str37 = ultraGrid1.ActiveRow.Cells["BM_CGX"].Text;
  384. string str38 = ultraGrid1.ActiveRow.Cells["PTTQZ"].Text;
  385. string str39 = ultraGrid1.ActiveRow.Cells["JLLG"].Text;
  386. //string str39 = ultraGrid1.ActiveRow.Cells["ZBZZ1"].Text;
  387. //string str40 = ultraGrid1.ActiveRow.Cells["PTZBSK"].Text;
  388. //string str41 = ultraGrid1.ActiveRow.Cells["CDTZBSK"].Text;
  389. //string str42 = ultraGrid1.ActiveRow.Cells["PTSB"].Text;
  390. //string str43 = ultraGrid1.ActiveRow.Cells["CDTSB"].Text;
  391. arry.Add(str1);
  392. arry.Add(str2);
  393. arry.Add(str3);
  394. arry.Add(str4);
  395. arry.Add(str5);
  396. arry.Add(str6);
  397. arry.Add(str7);
  398. arry.Add(str8);
  399. arry.Add(str9);
  400. arry.Add(str10);
  401. arry.Add(str11);
  402. arry.Add(str12);
  403. arry.Add(str13);
  404. arry.Add(str14);
  405. arry.Add(str15);
  406. arry.Add(str16);
  407. arry.Add(str17);
  408. arry.Add(str18);
  409. arry.Add(str19);
  410. arry.Add(str20);
  411. arry.Add(str21);
  412. arry.Add(str22);
  413. arry.Add(str23);
  414. arry.Add(str24);
  415. arry.Add(str25);
  416. arry.Add(str26);
  417. arry.Add(str27);
  418. arry.Add(str28);
  419. /*arry.Add(str29);
  420. arry.Add(str30);
  421. arry.Add(str31);
  422. arry.Add(str32);
  423. arry.Add(str33);*/
  424. arry.Add(str34);
  425. arry.Add(str35);
  426. arry.Add(str36);
  427. arry.Add(str37);
  428. arry.Add(str38);
  429. arry.Add(str39);
  430. /*arry.Add(str40);
  431. arry.Add(str41);
  432. arry.Add(str42);
  433. arry.Add(str43);*/
  434. arry.Add(uuid);
  435. CommonClientToServer cctos = new CommonClientToServer();
  436. cctos.ob = this.ob;
  437. cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
  438. "doSimpleSave", arry, out strErr);
  439. this.proc_setCellReadOnly(currRow, true);
  440. currRow = null;
  441. bEditNow = false;
  442. }
  443. if (strErr == "")
  444. {
  445. dataTable1.AcceptChanges();
  446. //JJBStaticFunction.SetRowEdit(ultraGrid1);
  447. if (!string.IsNullOrEmpty(strMess))
  448. MessageBox.Show(strMess, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  449. }
  450. else
  451. {
  452. MessageBox.Show("保存失败!输入信息已经存在或数据无效。", "错误");
  453. }
  454. if (ultraGrid1.ActiveCell != null)
  455. ultraGrid1.ActiveCell.Activated = false;
  456. this.proc_SetToolbarButtons();
  457. }
  458. }
  459. catch (System.Exception ex)
  460. {
  461. Console.WriteLine(ex.ToString());
  462. }
  463. }
  464. public void proc_Delete()
  465. {
  466. try
  467. {
  468. string strErr = "";
  469. ArrayList arry = new ArrayList();
  470. if (this.ultraGrid1.ActiveRow == null) return;
  471. string uuid_ = ultraGrid1.ActiveRow.Cells["UUID_"].Text.Trim();
  472. arry.Add("frmMaterial.Delete");
  473. arry.Add(uuid_);
  474. CommonClientToServer cctos = new CommonClientToServer();
  475. cctos.ob = this.ob;
  476. cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBSave",
  477. "doSimpleSave", arry, out strErr);
  478. if (!string.IsNullOrEmpty(strErr))
  479. {
  480. MessageBox.Show("删除错误:" + strErr);
  481. }
  482. else
  483. {
  484. MessageBox.Show("删除成功:" + strErr);
  485. }
  486. }
  487. catch { }
  488. }
  489. private void proc_SetToolbarButtons()
  490. {
  491. try
  492. {
  493. this.ToolBarItemEnable(this, "Query",!(bAddNow || bEditNow || bDelNow));
  494. this.ToolBarItemEnable(this, "Add", !(bAddNow || bEditNow || bDelNow));
  495. this.ToolBarItemEnable(this, "Edit", (!(bAddNow || bEditNow || bDelNow) && (ultraGrid1.ActiveRow != null)));
  496. this.ToolBarItemEnable(this, "Delete", (!(bAddNow || bEditNow || bDelNow) && (ultraGrid1.ActiveRow != null)));
  497. this.ToolBarItemEnable(this, "Export", (!(bAddNow || bEditNow || bDelNow) && ultraGrid1.Rows.Count > 0));
  498. this.ToolBarItemEnable(this, "Save", (bAddNow || bEditNow));
  499. this.ToolBarItemEnable(this, "Cancel", (bAddNow || bEditNow));
  500. //this.ToolBarVisible(this, "Save");
  501. //this.Toolbars[0].Tools["Save"].SharedProps.Visible = (bAddNow || bEditNow);
  502. //this.Toolbars[0].Tools["Cancel"].SharedProps.Visible = (bAddNow || bEditNow);
  503. }
  504. catch { }
  505. }
  506. private void proc_setCellReadOnly(UltraGridRow row, bool bReadOnly)
  507. {
  508. try
  509. {
  510. if (row == null)
  511. return;
  512. if (bReadOnly)
  513. {
  514. row.Activation = Activation.ActivateOnly;
  515. row.CellAppearance.BackColor = Color.White;
  516. foreach (Infragistics.Win.UltraWinGrid.UltraGridCell cell in row.Cells)
  517. {
  518. cell.CancelUpdate();
  519. }
  520. }
  521. else
  522. {
  523. row.Activation = Activation.AllowEdit;
  524. row.CellAppearance.BackColor = Color.Khaki;
  525. }
  526. }
  527. catch (Exception ex)
  528. {
  529. MessageBox.Show(ex.Message);
  530. }
  531. }
  532. private void proc_SetUltraGridReadOnly(Infragistics.Win.UltraWinGrid.UltraGridBase ultGrid)
  533. {
  534. foreach (UltraGridRow row in ultGrid.Rows)
  535. {
  536. row.Activation = Activation.ActivateOnly;
  537. }
  538. }
  539. public void proc_Statics(ref UltraGrid ultraGrid, ArrayList alistColumns, bool clearExists, string strFormat)
  540. {
  541. try
  542. {
  543. if (alistColumns == null)
  544. {
  545. return;
  546. }
  547. UltraGridBand band = ultraGrid.DisplayLayout.Bands[0];
  548. if (clearExists)
  549. band.Summaries.Clear();
  550. SummarySettings summary = null;
  551. UltraGridColumn cl = null;
  552. foreach (UltraGridColumn column in ultraGrid.DisplayLayout.Bands[0].Columns)
  553. {
  554. if (column.RowLayoutColumnInfo.OriginX == 0)
  555. {
  556. cl = column;
  557. break;
  558. }
  559. }
  560. summary = band.Summaries.Add(SummaryType.Count, cl);
  561. summary.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed;
  562. summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
  563. summary.DisplayFormat = "合计:";
  564. summary.Appearance.TextHAlign = Infragistics.Win.HAlign.Center;
  565. summary.Appearance.TextVAlign = Infragistics.Win.VAlign.Middle;
  566. summary.Appearance.FontData.Bold = DefaultableBoolean.True;
  567. if (string.IsNullOrEmpty(strFormat.Trim()))
  568. {
  569. strFormat = " {0:############0.00}";
  570. }
  571. for (int i = 0; i < alistColumns.Count; i++)
  572. {
  573. try
  574. {
  575. summary = band.Summaries.Add(SummaryType.Sum, band.Columns[alistColumns[i].ToString()]);
  576. summary.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed;
  577. summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
  578. summary.DisplayFormat = strFormat;
  579. summary.Appearance.TextHAlign = Infragistics.Win.HAlign.Right;
  580. summary.Appearance.TextVAlign = Infragistics.Win.VAlign.Middle;
  581. summary.Appearance.FontData.Bold = DefaultableBoolean.True;
  582. summary.Appearance.ForeColor = Color.DarkBlue;
  583. summary.Appearance.BackColor = Color.White;
  584. }
  585. catch { }
  586. }
  587. band.Override.SummaryFooterCaptionVisible = Infragistics.Win.DefaultableBoolean.False;
  588. }
  589. catch { }
  590. }
  591. }
  592. }