UIC020140.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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 CoreFS.CA06;
  10. using System.Diagnostics;
  11. using System.Collections;
  12. using Infragistics.Win.UltraWinGrid;
  13. namespace Core.LZMes.Client.UIC
  14. {
  15. public partial class UIC020140 : FrmBase
  16. {
  17. public UIC020140()
  18. {
  19. InitializeComponent();
  20. }
  21. public override void ToolBar_Click(object sender, string ToolbarKey)
  22. {
  23. switch (ToolbarKey)
  24. {
  25. case "Query":
  26. this.DoQuery();
  27. break;
  28. case "Export":
  29. this.DoExport();
  30. break;
  31. case "Save":
  32. this.DoSave();
  33. break;
  34. case "Update":
  35. this.DoUpdate();
  36. break;
  37. case "Exit":
  38. this.Close();
  39. break;
  40. }
  41. }
  42. private void DoExport()
  43. {
  44. try
  45. {
  46. if (this.ultraGrid1.Rows.Count == 0)
  47. {
  48. MessageBox.Show("没有可以导出的数据", "提示");
  49. return;
  50. }
  51. saveFileDialog1.FileName = "热轧停扎时间" + DateTime.Today.ToShortDateString() + "_01";
  52. saveFileDialog1.Filter = "表格(*.xls)|*.xls";
  53. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  54. {
  55. string fName = this.saveFileDialog1.FileName;
  56. this.ultraGridExcelExporter1.Export(ultraGrid1, fName);
  57. Process.Start(fName);
  58. }
  59. }
  60. catch (Exception ex)
  61. {
  62. System.Diagnostics.Debug.WriteLine(ex.ToString());
  63. }
  64. }
  65. private void JZExport()
  66. {
  67. try
  68. {
  69. if (this.ultraGrid4.Rows.Count == 0)
  70. {
  71. MessageBox.Show("没有可以导出的数据", "提示");
  72. return;
  73. }
  74. saveFileDialog1.FileName = "热轧班组节奏" + DateTime.Today.ToShortDateString() + "_01";
  75. saveFileDialog1.Filter = "表格(*.xls)|*.xls";
  76. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  77. {
  78. string fName1 = this.saveFileDialog1.FileName;
  79. this.ultraGridExcelExporter1.Export(ultraGrid4, fName1);
  80. Process.Start(fName1);
  81. }
  82. }
  83. catch (Exception ex)
  84. {
  85. System.Diagnostics.Debug.WriteLine(ex.ToString());
  86. }
  87. }
  88. public void DoQuery()
  89. {
  90. try
  91. {
  92. ArrayList al = new ArrayList();
  93. al.Add("UIC020140_01.SELECT");
  94. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss").Trim());
  95. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd").Trim()+"999999");
  96. //查询详细停轧时间
  97. this.dataSet1.Tables[0].Clear();
  98. CoreClientParam ccp = new CoreClientParam();
  99. ccp.ServerName = "UIB.COM.ComDBQuery";
  100. ccp.MethodName = "doSimpleQuery";
  101. ccp.ServerParams = new object[] { al };
  102. ccp.SourceDataTable = this.dataSet1.Tables[0];
  103. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  104. Color color = Color.FromArgb(255, 255, 255);
  105. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  106. {
  107. string status = ugr.Cells["CHKFLAG"].Value.ToString().Trim();
  108. if ("1".Equals(status))
  109. {
  110. ugr.Cells["CHKTIME"].Appearance.BackColor = Color.Pink;
  111. }
  112. }
  113. this.ultraGrid1.Update();
  114. //停扎时间按班次统计
  115. this.dataSet1.Tables[1].Clear();
  116. string queryDate = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss").Trim();
  117. string queryDate1 = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd").Trim() + "999999";
  118. if (queryDate.Substring(0, 6) != queryDate1.Substring(0, 6))
  119. {
  120. MessageBox.Show("请确保两个查询日期在同一月份", "错误");
  121. return;
  122. }
  123. string queryDate2 = "";//月累统计截止日期
  124. if (queryDate1.Substring(0, 6) == DateTime.Today.ToString("yyyyMM"))//查询日期为当月
  125. queryDate2 = DateTime.Today.ToString("yyyyMMdd");
  126. else
  127. {
  128. DateTime date = ultraDateTimeEditor2.DateTime;
  129. queryDate2 = date.AddDays(1 - date.Day).AddMonths(1).AddDays(-1).ToString("yyyyMMdd");
  130. }
  131. CoreClientParam ccp1 = new CoreClientParam();
  132. ccp1.ServerName = "UIC.UIC02.UIC020120";
  133. ccp1.MethodName = "queryhot";
  134. ccp1.ServerParams = new object[] { queryDate, queryDate1, queryDate2 };
  135. ccp1.SourceDataTable = this.dataSet1.Tables[1];
  136. this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  137. this.dataSet2.Tables[0].Clear();
  138. CoreClientParam ccp2 = new CoreClientParam();
  139. ccp2.ServerName = "UIC.UIC02.UIC020120";
  140. ccp2.MethodName = "queryTeam";
  141. ccp2.ServerParams = new object[] { queryDate, queryDate1, queryDate2 };
  142. ccp2.SourceDataTable = this.dataSet2.Tables[0];
  143. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  144. }
  145. catch (Exception ex)
  146. {
  147. System.Diagnostics.Debug.WriteLine(ex.ToString());
  148. }
  149. }
  150. private void label2_Click(object sender, EventArgs e)
  151. {
  152. }
  153. private void DoSave()
  154. {
  155. try
  156. {
  157. if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  158. return;
  159. ArrayList al = new ArrayList();
  160. ArrayList list = null;
  161. string num1 = "";//日历时间
  162. string num2 = "";//停轧时间
  163. string strBC = "";//班次
  164. string strTime = "";
  165. string strProdLine = "";
  166. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  167. {
  168. if (ugr.Cells["CHK"].Text == "True")
  169. {
  170. list = new ArrayList();
  171. list.Add("UIC020140_01.UPDATE");
  172. list.Add(ugr.Cells["CHKRESON"].Text.Trim());
  173. list.Add(ugr.Cells["CHKNAME"].Text.Trim());
  174. list.Add(ugr.Cells["BUGLOCAION"].Text.Trim());
  175. list.Add(ugr.Cells["PRDSMOD"].Text.Trim());
  176. list.Add(ugr.Cells["TIMESTART"].Text.Trim());
  177. al.Add(list);
  178. }
  179. }
  180. if (al.Count == 0)
  181. {
  182. MessageBox.Show("没有修改的数据(红色行),保存无效", "提示");
  183. return;
  184. }
  185. CoreClientParam ccp = new CoreClientParam();
  186. ccp.ServerName = "UIB.COM.ComDBSave";
  187. ccp.MethodName = "doXmlSave";
  188. ccp.ServerParams = new object[] { al };
  189. ccp.IfShowErrMsg = false;
  190. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  191. this.DoQuery();
  192. }
  193. catch (Exception ex)
  194. {
  195. System.Diagnostics.Debug.WriteLine(ex.ToString());
  196. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  197. }
  198. }
  199. private void DoUpdate()
  200. {
  201. try
  202. {
  203. if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  204. return;
  205. ArrayList al = new ArrayList();
  206. ArrayList list = null;
  207. string num1 = "";//日历时间
  208. string num2 = "";//停轧时间
  209. string strBC = "";//班次
  210. string strTime = "";
  211. string strProdLine = "";
  212. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  213. {
  214. if (ugr.Cells["CHK"].Text == "True")
  215. {
  216. list = new ArrayList();
  217. list.Add("UIC020140_02.UPDATE");
  218. list.Add(ugr.Cells["CHKRESON"].Text.Trim());
  219. list.Add(ugr.Cells["CHKNAME"].Text.Trim());
  220. list.Add(ugr.Cells["BUGLOCAION"].Text.Trim());
  221. list.Add(ugr.Cells["PRDSMOD"].Text.Trim());
  222. list.Add(ugr.Cells["TIMESTART"].Text.Trim());
  223. al.Add(list);
  224. }
  225. }
  226. if (al.Count == 0)
  227. {
  228. MessageBox.Show("没有修改的数据(红色行),保存无效", "提示");
  229. return;
  230. }
  231. CoreClientParam ccp = new CoreClientParam();
  232. ccp.ServerName = "UIB.COM.ComDBSave";
  233. ccp.MethodName = "doXmlSave";
  234. ccp.ServerParams = new object[] { al };
  235. ccp.IfShowErrMsg = false;
  236. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  237. this.DoQuery();
  238. }
  239. catch (Exception ex)
  240. {
  241. System.Diagnostics.Debug.WriteLine(ex.ToString());
  242. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  243. }
  244. }
  245. private void UIC020140_Load(object sender, EventArgs e)
  246. {
  247. }
  248. private void ultraButton1_Click(object sender, EventArgs e)
  249. {
  250. this.JZExport();
  251. }
  252. }
  253. }