FrmHlReport.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Collections;
  5. using System.ComponentModel;
  6. using System.Windows.Forms;
  7. using CoreFS.CA06;
  8. using System.Threading;
  9. using System.Diagnostics;
  10. using Infragistics.Win.UltraWinMaskedEdit;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Infragistics.Win;
  13. using System.IO;
  14. using Core.Mes.Client.Common;
  15. using Core.LgMes.Client.Report;
  16. using Core.LgMes.Client.lgBll.lgReport;
  17. using Infragistics.Win.UltraWinMaskedEdit;
  18. namespace Core.LgMes.Client.LgIntegrationQuery
  19. {
  20. /// <summary>
  21. /// FrmIronEleQry 的摘要说明。
  22. /// </summary>
  23. public class FrmHlReport : Core.Mes.Client.Common.frmStyleBase
  24. {
  25. private System.Windows.Forms.Label label2;
  26. private Infragistics.Win.UltraWinDataSource.UltraDataSource ultraDataSource1;
  27. private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1;
  28. private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox1;
  29. private Infragistics.Win.UltraWinEditors.UltraDateTimeEditor uldtEndTime;
  30. private CheckBox chkTime;
  31. private Infragistics.Win.UltraWinEditors.UltraDateTimeEditor uldtBeginTime;
  32. private Label label4;
  33. private IContainer components;
  34. string strStartTime = "";
  35. private TextBox textBox1;
  36. private Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter GridExcelExporter;
  37. string strEndTime = "";
  38. private Infragistics.Win.UltraWinEditors.UltraCheckEditor uCkEditorForFilter;
  39. private Core.LgMes.Client.lgBll.lgResMgt.CommonAtomStlCcmMgt lgCcmReprt = null;
  40. public FrmHlReport()
  41. {
  42. if (lgCcmReprt == null)
  43. {
  44. lgCcmReprt = new Core.LgMes.Client.lgBll.lgResMgt.CommonAtomStlCcmMgt();
  45. }
  46. //
  47. // Windows 窗体设计器支持所必需的
  48. //
  49. InitializeComponent();
  50. //
  51. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  52. //
  53. }
  54. /// <summary>
  55. /// 清理所有正在使用的资源。
  56. /// </summary>
  57. protected override void Dispose( bool disposing )
  58. {
  59. try
  60. {
  61. }
  62. catch { }
  63. if( disposing )
  64. {
  65. if(components != null)
  66. {
  67. components.Dispose();
  68. }
  69. }
  70. base.Dispose( disposing );
  71. }
  72. #region Windows 窗体设计器生成的代码
  73. /// <summary>
  74. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  75. /// 此方法的内容。
  76. /// </summary>
  77. private void InitializeComponent()
  78. {
  79. this.components = new System.ComponentModel.Container();
  80. Infragistics.Win.Appearance appearance70 = new Infragistics.Win.Appearance();
  81. Infragistics.Win.Appearance appearance71 = new Infragistics.Win.Appearance();
  82. Infragistics.Win.Appearance appearance72 = new Infragistics.Win.Appearance();
  83. Infragistics.Win.Appearance appearance73 = new Infragistics.Win.Appearance();
  84. Infragistics.Win.Appearance appearance74 = new Infragistics.Win.Appearance();
  85. Infragistics.Win.Appearance appearance75 = new Infragistics.Win.Appearance();
  86. Infragistics.Win.Appearance appearance76 = new Infragistics.Win.Appearance();
  87. Infragistics.Win.Appearance appearance77 = new Infragistics.Win.Appearance();
  88. Infragistics.Win.Appearance appearance78 = new Infragistics.Win.Appearance();
  89. Infragistics.Win.Appearance appearance79 = new Infragistics.Win.Appearance();
  90. Infragistics.Win.Appearance appearance80 = new Infragistics.Win.Appearance();
  91. Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
  92. Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
  93. this.label2 = new System.Windows.Forms.Label();
  94. this.ultraDataSource1 = new Infragistics.Win.UltraWinDataSource.UltraDataSource(this.components);
  95. this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid();
  96. this.ultraGroupBox1 = new Infragistics.Win.Misc.UltraGroupBox();
  97. this.textBox1 = new System.Windows.Forms.TextBox();
  98. this.label4 = new System.Windows.Forms.Label();
  99. this.chkTime = new System.Windows.Forms.CheckBox();
  100. this.uldtBeginTime = new Infragistics.Win.UltraWinEditors.UltraDateTimeEditor();
  101. this.uldtEndTime = new Infragistics.Win.UltraWinEditors.UltraDateTimeEditor();
  102. this.GridExcelExporter = new Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter(this.components);
  103. this.uCkEditorForFilter = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
  104. ((System.ComponentModel.ISupportInitialize)(this.ultraDataSource1)).BeginInit();
  105. ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit();
  106. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).BeginInit();
  107. this.ultraGroupBox1.SuspendLayout();
  108. ((System.ComponentModel.ISupportInitialize)(this.uldtBeginTime)).BeginInit();
  109. ((System.ComponentModel.ISupportInitialize)(this.uldtEndTime)).BeginInit();
  110. ((System.ComponentModel.ISupportInitialize)(this.uCkEditorForFilter)).BeginInit();
  111. this.SuspendLayout();
  112. //
  113. // label2
  114. //
  115. this.label2.AutoSize = true;
  116. this.label2.Location = new System.Drawing.Point(413, 18);
  117. this.label2.Name = "label2";
  118. this.label2.Size = new System.Drawing.Size(29, 12);
  119. this.label2.TabIndex = 51;
  120. this.label2.Text = "炉号";
  121. //
  122. // ultraGrid1
  123. //
  124. appearance70.TextHAlignAsString = "Left";
  125. this.ultraGrid1.DisplayLayout.CaptionAppearance = appearance70;
  126. appearance71.BackColor = System.Drawing.SystemColors.ActiveBorder;
  127. appearance71.BackColor2 = System.Drawing.SystemColors.ControlDark;
  128. appearance71.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
  129. appearance71.BorderColor = System.Drawing.SystemColors.Window;
  130. this.ultraGrid1.DisplayLayout.GroupByBox.Appearance = appearance71;
  131. appearance72.ForeColor = System.Drawing.SystemColors.GrayText;
  132. this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance = appearance72;
  133. this.ultraGrid1.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
  134. this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true;
  135. appearance73.BackColor = System.Drawing.SystemColors.ControlLightLight;
  136. appearance73.BackColor2 = System.Drawing.SystemColors.Control;
  137. appearance73.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
  138. appearance73.ForeColor = System.Drawing.SystemColors.GrayText;
  139. this.ultraGrid1.DisplayLayout.GroupByBox.PromptAppearance = appearance73;
  140. this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1;
  141. this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1;
  142. appearance74.BackColor = System.Drawing.SystemColors.Window;
  143. appearance74.ForeColor = System.Drawing.SystemColors.ControlText;
  144. this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance = appearance74;
  145. appearance75.BackColor = System.Drawing.SystemColors.Highlight;
  146. appearance75.ForeColor = System.Drawing.SystemColors.HighlightText;
  147. this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance = appearance75;
  148. this.ultraGrid1.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.RaisedSoft;
  149. this.ultraGrid1.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.None;
  150. appearance76.BackColor = System.Drawing.SystemColors.Window;
  151. this.ultraGrid1.DisplayLayout.Override.CardAreaAppearance = appearance76;
  152. appearance77.FontData.SizeInPoints = 10F;
  153. appearance77.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
  154. this.ultraGrid1.DisplayLayout.Override.CellAppearance = appearance77;
  155. this.ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
  156. this.ultraGrid1.DisplayLayout.Override.CellPadding = 0;
  157. this.ultraGrid1.DisplayLayout.Override.DefaultRowHeight = 25;
  158. appearance78.BackColor = System.Drawing.SystemColors.Control;
  159. appearance78.BackColor2 = System.Drawing.SystemColors.ControlDark;
  160. appearance78.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;
  161. appearance78.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
  162. appearance78.BorderColor = System.Drawing.SystemColors.Window;
  163. this.ultraGrid1.DisplayLayout.Override.GroupByRowAppearance = appearance78;
  164. appearance79.TextHAlignAsString = "Left";
  165. this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance79;
  166. this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
  167. this.ultraGrid1.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.Standard;
  168. this.ultraGrid1.DisplayLayout.Override.RowSelectorNumberStyle = Infragistics.Win.UltraWinGrid.RowSelectorNumberStyle.RowIndex;
  169. this.ultraGrid1.DisplayLayout.Override.RowSelectorWidth = 25;
  170. appearance80.BackColor = System.Drawing.SystemColors.ControlLight;
  171. this.ultraGrid1.DisplayLayout.Override.TemplateAddRowAppearance = appearance80;
  172. this.ultraGrid1.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
  173. this.ultraGrid1.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
  174. this.ultraGrid1.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
  175. this.ultraGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
  176. this.ultraGrid1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  177. this.ultraGrid1.Location = new System.Drawing.Point(0, 47);
  178. this.ultraGrid1.Name = "ultraGrid1";
  179. this.ultraGrid1.Size = new System.Drawing.Size(975, 446);
  180. this.ultraGrid1.TabIndex = 19;
  181. //
  182. // ultraGroupBox1
  183. //
  184. this.ultraGroupBox1.Controls.Add(this.uCkEditorForFilter);
  185. this.ultraGroupBox1.Controls.Add(this.textBox1);
  186. this.ultraGroupBox1.Controls.Add(this.label4);
  187. this.ultraGroupBox1.Controls.Add(this.chkTime);
  188. this.ultraGroupBox1.Controls.Add(this.uldtBeginTime);
  189. this.ultraGroupBox1.Controls.Add(this.uldtEndTime);
  190. this.ultraGroupBox1.Controls.Add(this.label2);
  191. this.ultraGroupBox1.Dock = System.Windows.Forms.DockStyle.Top;
  192. this.ultraGroupBox1.Location = new System.Drawing.Point(0, 0);
  193. this.ultraGroupBox1.Name = "ultraGroupBox1";
  194. this.ultraGroupBox1.Size = new System.Drawing.Size(975, 47);
  195. this.ultraGroupBox1.TabIndex = 21;
  196. //
  197. // textBox1
  198. //
  199. this.textBox1.Location = new System.Drawing.Point(448, 11);
  200. this.textBox1.Name = "textBox1";
  201. this.textBox1.Size = new System.Drawing.Size(100, 21);
  202. this.textBox1.TabIndex = 285;
  203. //
  204. // label4
  205. //
  206. this.label4.AutoSize = true;
  207. this.label4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  208. this.label4.Location = new System.Drawing.Point(243, 16);
  209. this.label4.Name = "label4";
  210. this.label4.Size = new System.Drawing.Size(21, 14);
  211. this.label4.TabIndex = 284;
  212. this.label4.Text = "到";
  213. //
  214. // chkTime
  215. //
  216. this.chkTime.AutoSize = true;
  217. this.chkTime.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  218. this.chkTime.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  219. this.chkTime.Location = new System.Drawing.Point(21, 14);
  220. this.chkTime.Name = "chkTime";
  221. this.chkTime.Size = new System.Drawing.Size(79, 18);
  222. this.chkTime.TabIndex = 283;
  223. this.chkTime.Text = "时间 从";
  224. this.chkTime.UseVisualStyleBackColor = true;
  225. this.chkTime.CheckedChanged += new System.EventHandler(this.chkTime_CheckedChanged);
  226. //
  227. // uldtBeginTime
  228. //
  229. appearance5.BorderAlpha = Infragistics.Win.Alpha.UseAlphaLevel;
  230. appearance5.BorderColor = System.Drawing.Color.Black;
  231. this.uldtBeginTime.ButtonAppearance = appearance5;
  232. this.uldtBeginTime.DateTime = new System.DateTime(2008, 1, 12, 0, 0, 0, 0);
  233. this.uldtBeginTime.Enabled = false;
  234. this.uldtBeginTime.FormatProvider = new System.Globalization.CultureInfo("en-US");
  235. this.uldtBeginTime.FormatString = "yyyy-MM-dd HH:mm";
  236. this.uldtBeginTime.Location = new System.Drawing.Point(104, 14);
  237. this.uldtBeginTime.MaskInput = "yyyy-mm-dd hh:mm";
  238. this.uldtBeginTime.Name = "uldtBeginTime";
  239. this.uldtBeginTime.Size = new System.Drawing.Size(133, 19);
  240. this.uldtBeginTime.TabIndex = 282;
  241. this.uldtBeginTime.UseFlatMode = Infragistics.Win.DefaultableBoolean.True;
  242. this.uldtBeginTime.Value = new System.DateTime(2008, 1, 12, 0, 0, 0, 0);
  243. this.uldtBeginTime.ValueChanged += new System.EventHandler(this.uldtBeginTime_ValueChanged);
  244. //
  245. // uldtEndTime
  246. //
  247. this.uldtEndTime.DateTime = new System.DateTime(2008, 11, 24, 0, 0, 0, 0);
  248. this.uldtEndTime.FormatProvider = new System.Globalization.CultureInfo("en-US");
  249. this.uldtEndTime.FormatString = "yyyy-MM-dd HH:mm";
  250. this.uldtEndTime.Location = new System.Drawing.Point(271, 12);
  251. this.uldtEndTime.MaskInput = "yyyy-mm-dd hh:mm";
  252. this.uldtEndTime.Name = "uldtEndTime";
  253. this.uldtEndTime.Size = new System.Drawing.Size(136, 21);
  254. this.uldtEndTime.TabIndex = 281;
  255. this.uldtEndTime.Value = new System.DateTime(2008, 11, 24, 0, 0, 0, 0);
  256. //
  257. // uCkEditorForFilter
  258. //
  259. appearance3.BackColor = System.Drawing.Color.LimeGreen;
  260. appearance3.TextVAlignAsString = "Middle";
  261. this.uCkEditorForFilter.Appearance = appearance3;
  262. this.uCkEditorForFilter.BackColor = System.Drawing.Color.LimeGreen;
  263. this.uCkEditorForFilter.BackColorInternal = System.Drawing.Color.Transparent;
  264. this.uCkEditorForFilter.Location = new System.Drawing.Point(578, 11);
  265. this.uCkEditorForFilter.Name = "uCkEditorForFilter";
  266. this.uCkEditorForFilter.Size = new System.Drawing.Size(46, 20);
  267. this.uCkEditorForFilter.TabIndex = 291;
  268. this.uCkEditorForFilter.Text = "过滤";
  269. this.uCkEditorForFilter.CheckedChanged += new System.EventHandler(this.uCkEditorForFilter_CheckedChanged);
  270. //
  271. // FrmHlReport
  272. //
  273. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  274. this.ClientSize = new System.Drawing.Size(975, 493);
  275. this.Controls.Add(this.ultraGrid1);
  276. this.Controls.Add(this.ultraGroupBox1);
  277. this.Name = "FrmHlReport";
  278. this.StatusCustomInfo = "F1:用户视图 F2:表格拖选统计";
  279. this.Text = "恒拉统计表";
  280. this.Load += new System.EventHandler(this.FrmIronEleQry_Load);
  281. ((System.ComponentModel.ISupportInitialize)(this.ultraDataSource1)).EndInit();
  282. ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
  283. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).EndInit();
  284. this.ultraGroupBox1.ResumeLayout(false);
  285. this.ultraGroupBox1.PerformLayout();
  286. ((System.ComponentModel.ISupportInitialize)(this.uldtBeginTime)).EndInit();
  287. ((System.ComponentModel.ISupportInitialize)(this.uldtEndTime)).EndInit();
  288. ((System.ComponentModel.ISupportInitialize)(this.uCkEditorForFilter)).EndInit();
  289. this.ResumeLayout(false);
  290. }
  291. #endregion
  292. private void FrmIronEleQry_Load(object sender, System.EventArgs e)
  293. {
  294. this.uldtBeginTime.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 00:00";
  295. this.uldtEndTime.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 23:59";
  296. this.chkTime.Checked = true;
  297. }
  298. /// <summary>
  299. /// ds需要的字段
  300. /// </summary>
  301. /// <returns></returns>
  302. private string[] returnColumnName()
  303. {
  304. return new string[] { "OPTDATE", "HEATNO", "STATIONCODE", "INFO2", "INFO3", "INFO4", "INFO1", "CASTFLOW", "BC", "BB", "TOTALTIME", "LMLTEMPT", "LMLTEMPTRESULT", "MWRAPTEMPT05", "BJFYL", "BJZHL", "FRONTLINE", "ISSTARTCCM", "HITMWRAPTEMPT", "HLTIME", "PRODUCTCPTCODE" };
  305. }
  306. /// <summary>
  307. ///
  308. /// </summary>
  309. /// <returns></returns>
  310. private string[] returnColumnHeaderName()
  311. {
  312. return new string[] { "操作时间", "炉号", "连铸机号", "钢种", "断面1", "断面2", "断面", "铸机流", "班次", "班别", "浇铸时间", "钢种液相线", "成品液相线", "中包温度", "成品包晶反应率", "成品包晶转化率", "上道工序", "开浇炉", "中包温度命中", "恒拉时间", "非恒拉原因" };
  313. }
  314. public override void ToolBar_Click(object sender, string ToolbarKey)
  315. {
  316. switch (ToolbarKey)
  317. {
  318. case "Query":
  319. this.doQuery();
  320. break;
  321. case "Close":
  322. this.Close();
  323. break;
  324. case "Export":
  325. this.ExportExcel();
  326. break;
  327. default:
  328. break;
  329. }
  330. }
  331. private void chkTime_CheckedChanged(object sender, EventArgs e)
  332. {
  333. uldtBeginTime.Enabled = chkTime.Checked;
  334. uldtEndTime.Enabled = chkTime.Checked;
  335. }
  336. private void uldtBeginTime_ValueChanged(object sender, EventArgs e)
  337. {
  338. }
  339. #region "Auto Refresh"
  340. /// <summary>
  341. /// 返回ccm拉速信息
  342. /// </summary>
  343. /// <returns></returns>
  344. private DataSet getAllCcmData()
  345. {
  346. return LgCcmReportCollection.returnDsOfCcmCastSpeedReport(new ClientParamWithSqlConditionAndOpenBase(this.getSqlCondition(),this.ob));
  347. }
  348. /// <summary>
  349. /// 获取查询条件
  350. /// </summary>
  351. /// <returns></returns>
  352. private string getSqlCondition()
  353. {
  354. string strStartTime = this.uldtBeginTime.DateTime.ToString("yyyy-MM-dd");
  355. string strEndTime = this.uldtEndTime.DateTime.ToString("yyyy-MM-dd");
  356. string sqlCondition = string.Format(string.Format(" and a.optdate >= trunc({0}) and a.optdate <= trunc({1} + 1)", "to_date('{0}','yyyy-mm-dd')", "to_date('{1}','yyyy-mm-dd')"), strStartTime, strEndTime);
  357. if (this.textBox1.Text.Trim().Length > 0)
  358. {
  359. sqlCondition = sqlCondition + string.Format(" and a.heatno like '%{0}%'", this.textBox1.Text.Trim());
  360. }
  361. //sqlCondition += sqlCondition + " and round((nvl(a.endtime,null ) - a.starttime )*86400 / 60, 2)<60";
  362. return sqlCondition;
  363. }
  364. /// <summary>
  365. /// 通过炉号返回ccm信息
  366. /// </summary>
  367. /// <param name="v_heatno"></param>
  368. /// <returns></returns>
  369. private DataSet getCcminfoByHeatNo(string heatNo)
  370. {
  371. return lgCcmReprt.returnDsOfCcmChemInfo(new ClientParamWithSqlConditionAndOpenBase(string.Format(" and HEATNO = '{0}'", heatNo), this.ob));
  372. }
  373. // 获取炉号计划牌号和断面
  374. private Hashtable getPlsteelAndFaceSecetion(string vheatno)
  375. {
  376. DataSet ds = getCcminfoByHeatNo(vheatno);
  377. Hashtable hs = new Hashtable();
  378. string[] temp = null;
  379. if (ds.Tables[0].Rows.Count > 0)
  380. {
  381. DataRow dr = ds.Tables[0].Rows[0];
  382. string v1 = dr["SHIFTCODE"].ToString().Substring(0, 1);
  383. string v2 = dr["SHIFTCODE"].ToString().Substring(1, 1);
  384. string v3 = dr["LMLTEMPT"].ToString();
  385. string v4 = dr["MWRAPTEMPT05"].ToString();
  386. string v5 = dr["FRONTLINE"].ToString();
  387. string v6 = dr["ISSTARTCCM"].ToString();
  388. string v7 = dr["HITMWRAPTEMPT"].ToString();
  389. string v8 = dr["LMLTEMPTRESULT"].ToString();
  390. string v9 = dr["BILLETSECTION2"].ToString();
  391. string v10 = dr["HLSTANDARDTIME1"].ToString();
  392. string v11 = dr["HLSTANDARDTIME2"].ToString();
  393. string v12 = dr["PRODUCTCPTCODE"].ToString();
  394. string v13 = dr["BJFYL"].ToString();
  395. string v14 = dr["BJZHL"].ToString();
  396. if (v4 == "")
  397. {
  398. v4 = dr["MWRAPTEMPT20"].ToString();
  399. }
  400. if (v9 == "")
  401. {
  402. v9 = dr["BILLETSECTION"].ToString();
  403. }
  404. string vBc = (v1 == "1") ? "白" : (v1 == "2") ? "中" : "夜";
  405. string vBb = (v2 == "1") ? "甲" : (v2 == "2") ? "乙" : (v2 == "3")? "丙":"丁";
  406. temp = new string[] { dr["PLANSTEEL"].ToString(), dr["BILLETSECTION"].ToString(), dr["STATIONCODE"].ToString(), vBc, vBb, v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14};
  407. if (!hs.Contains(dr["HEATNO"].ToString()))
  408. {
  409. hs.Add(dr["HEATNO"].ToString(), temp);
  410. }
  411. }
  412. return hs;
  413. }
  414. /// <summary>
  415. /// 获取所有拉速
  416. /// </summary>
  417. /// <param name="ds"></param>
  418. /// <param name="columnName"></param>
  419. /// <returns></returns>
  420. private ArrayList getAllFixedSpeed(DataSet ds, string columnName)
  421. {
  422. ArrayList list = new ArrayList();
  423. if(ds == null || ds.Tables.Count == 0)
  424. return list;
  425. if (ds.Tables[0].Rows.Count > 0)
  426. {
  427. foreach (DataRow dr in ds.Tables[0].Rows)
  428. {
  429. if (!list.Contains(dr[columnName].ToString()))
  430. {
  431. list.Add(dr[columnName].ToString());
  432. }
  433. }
  434. }
  435. list.Sort();
  436. return list;
  437. }
  438. private ArrayList getAllHeatNo(DataSet ds)
  439. {
  440. ArrayList list = new ArrayList();
  441. list = getAllFixedSpeed(ds,"HEATNO");
  442. return list;
  443. }
  444. private DataSet initDataSet(DataSet dsAllColumn, DataSet dsData, ArrayList listHeatNo, ArrayList listallFixedSpeedLis, string[] arrayCastFlow)
  445. {
  446. DataSet ds = dsAllColumn.Clone();
  447. DataRow drtemp = null;
  448. Hashtable hs = null;
  449. string[] planSteel = null;
  450. DataTable dt = ds.Tables[0];
  451. DataView dvtemp = null;
  452. DataTable temp = null;
  453. DataView dv1 = null;
  454. dvtemp = new DataView(dsData.Tables[0]);
  455. foreach (string s in listHeatNo)
  456. {
  457. dvtemp.RowFilter = string.Format("HEATNO = '{0}'", s);
  458. dv1 = new DataView(dvtemp.ToTable());
  459. double totalTime = 0;
  460. hs = getPlsteelAndFaceSecetion(s);
  461. try
  462. {
  463. for (int i = 0; i < arrayCastFlow.Length; i++)
  464. {
  465. dv1.RowFilter = string.Format("CASTFLOW = '{0}'", arrayCastFlow[i]);
  466. temp = dv1.ToTable();
  467. totalTime = 0;
  468. drtemp = dt.NewRow();
  469. planSteel = hs[temp.Rows[0]["HEATNO"].ToString()] as string[];
  470. drtemp["OPTDATE"] = temp.Rows[0]["OPTDATE"];
  471. drtemp["HEATNO"] = temp.Rows[0]["HEATNO"];
  472. //drtemp["CASTFLOW"] = arrayCastFlow[i];
  473. string[] faceResult = planSteel[1].Split('X');
  474. string[] faceResult2 = planSteel[11].Split('X');
  475. try
  476. {
  477. drtemp["INFO2"] = planSteel[0];
  478. drtemp["STATIONCODE"] = planSteel[2];
  479. if (i == 0)
  480. {
  481. drtemp["INFO3"] = faceResult[0];
  482. drtemp["INFO4"] = faceResult[1];
  483. drtemp["INFO1"] = planSteel[1];
  484. drtemp["HLTIME"] = planSteel[12].ToString() == "0" ? "" : planSteel[12];
  485. }
  486. else
  487. {
  488. drtemp["INFO3"] = faceResult2[0];
  489. drtemp["INFO4"] = faceResult2[1];
  490. drtemp["INFO1"] = planSteel[11];
  491. drtemp["HLTIME"] = planSteel[13].ToString() == "0" ? "" : planSteel[13];
  492. }
  493. drtemp["BC"] = planSteel[3];
  494. drtemp["BB"] = planSteel[4];
  495. drtemp["LMLTEMPT"] = planSteel[5];
  496. drtemp["MWRAPTEMPT05"] = planSteel[6];
  497. drtemp["FRONTLINE"] = planSteel[7];
  498. drtemp["ISSTARTCCM"] = planSteel[8];
  499. drtemp["HITMWRAPTEMPT"] = planSteel[9];
  500. drtemp["LMLTEMPTRESULT"] = planSteel[10];
  501. drtemp["PRODUCTCPTCODE"] = planSteel[14];
  502. drtemp["BJFYL"] = planSteel[15];
  503. drtemp["BJZHL"] = planSteel[16];
  504. if (planSteel[2]=="01")
  505. {
  506. drtemp["CASTFLOW"] = arrayCastFlow[i];
  507. }
  508. else if (planSteel[2]=="02")
  509. {
  510. if (i == 0)
  511. {
  512. drtemp["CASTFLOW"] = "S3";
  513. }
  514. else
  515. {
  516. drtemp["CASTFLOW"] = "S4";
  517. }
  518. }
  519. else
  520. {
  521. drtemp["CASTFLOW"] = "S5";
  522. }
  523. }
  524. catch
  525. { }
  526. foreach (DataRow dr in temp.Rows)
  527. {
  528. if (listallFixedSpeedLis.Contains(dr["FIXEDSPEED"].ToString()))
  529. {
  530. drtemp[dr["FIXEDSPEED"].ToString()] = Convert.ToDouble((drtemp[dr["FIXEDSPEED"].ToString()].ToString().Length == 0) ? "0" : drtemp[dr["FIXEDSPEED"].ToString()].ToString())
  531. + ((dr["FIXEDTIME"].ToString().Length == 0) ? 0 : Convert.ToDouble(dr["FIXEDTIME"]));
  532. totalTime += (dr["FIXEDTIME"].ToString().Length == 0) ? 0 : Convert.ToDouble(dr["FIXEDTIME"]);
  533. // try{
  534. // if( Convert.ToDouble(dr["FIXEDTIME"]) >totalTime)
  535. // totalTime = Convert.ToDouble(dr["FIXEDTIME"]);
  536. //}catch{}
  537. }
  538. }
  539. drtemp["TOTALTIME"] = totalTime;
  540. dt.Rows.Add(drtemp);
  541. }
  542. }
  543. catch
  544. {
  545. }
  546. }
  547. return ds;
  548. }
  549. private void doQueryReport()
  550. {
  551. if (uldtEndTime.DateTime.Date.Subtract(uldtBeginTime.DateTime.Date).Days > 180)
  552. {
  553. MessageBox.Show("查询时间不可超过6个月。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  554. return;
  555. }
  556. if (uldtBeginTime.DateTime.Date > uldtEndTime.DateTime.Date)
  557. {
  558. MessageBox.Show("查询开始日期不能大于结束日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  559. return;
  560. }
  561. DataSet ds = getAllColumn();
  562. DataSet dsData = getAllCcmData();
  563. //ds.Tables[0].Columns.Add("LMLTEMPT", typeof(System.String));
  564. //dsData.Tables[0].Columns.Add("LMLTEMPT",typeof(System.String));
  565. DataTable dt = ds.Tables[0];
  566. ArrayList allFixedSpeedList = getAllFixedSpeed(dsData, "FIXEDSPEED");
  567. ArrayList listHeatNo = getAllHeatNo(dsData);
  568. DataSet dsRealData = initDataSet(ds, dsData, listHeatNo, allFixedSpeedList, new string[] { "S1","S2"});
  569. ds.Clear();
  570. ds.Merge(dsRealData);
  571. ds.Tables[0].TableName = "TABLE1";
  572. DataView dv = new DataView(ds.Tables[0]);
  573. dv.Sort = "OPTDATE";
  574. try
  575. {
  576. this.ultraGrid1.Refresh();
  577. ((this.ultraGrid1.DataSource) as DataTable).Clear();
  578. }
  579. catch
  580. {
  581. }
  582. this.ultraGrid1.DataSource = dv.ToTable();
  583. initUltraGrid();
  584. }
  585. /// <summary>
  586. /// 构造新的dataset,包含需要显示的字段
  587. /// </summary>
  588. /// <returns></returns>
  589. private DataSet getAllColumn()
  590. {
  591. DataSet ds = new DataSet();
  592. DataTable dt = new DataTable();
  593. string[] columnName = returnColumnName();
  594. foreach(string s in columnName)
  595. {
  596. dt.Columns.Add(new DataColumn(s, Type.GetType("System.String"))); // 时间
  597. }
  598. foreach (string s in this.getAllFixedSpeed(getAllCcmData(), "FIXEDSPEED"))
  599. {
  600. dt.Columns.Add(new DataColumn(s, Type.GetType("System.String"))); // 各拉速
  601. }
  602. ds.Tables.Add(dt);
  603. return ds;
  604. }
  605. /// <summary>
  606. /// 设置需要显示的列宽
  607. /// </summary>
  608. /// <returns></returns>
  609. private Hashtable returnColumnWidth()
  610. {
  611. Hashtable hs = new Hashtable();
  612. hs.Add("HEATNO",90);
  613. hs.Add("OPTDATE", 100);
  614. hs.Add("BJFYL", 90);
  615. hs.Add("BJZHL", 90);
  616. return hs;
  617. }
  618. /// <summary>
  619. /// 初始化grid
  620. /// </summary>
  621. private void initUltraGrid()
  622. {
  623. try
  624. {
  625. string[] columnName = returnColumnName();
  626. string[] columnHeaderName = returnColumnHeaderName();
  627. Hashtable hs = returnColumnWidth();
  628. int columnWidht = 50;
  629. int otherColumnWidth = 40; // 拉速宽度
  630. for(int i = 0; i < columnName.Length;i++)
  631. {
  632. try
  633. {
  634. this.ultraGrid1.DisplayLayout.Bands[0].Columns[columnName[i]].Header.Caption = columnHeaderName[i];
  635. if (hs.Contains(columnName[i]))
  636. this.ultraGrid1.DisplayLayout.Bands[0].Columns[columnName[i]].Width = Convert.ToInt16(hs[columnName[i]]);
  637. else
  638. this.ultraGrid1.DisplayLayout.Bands[0].Columns[columnName[i]].Width = columnWidht;
  639. }
  640. catch
  641. {
  642. }
  643. }
  644. for (int i = 0; i < this.ultraGrid1.DisplayLayout.Bands[0].Columns.Count; i++)
  645. {
  646. if (i > 21)
  647. {
  648. this.ultraGrid1.DisplayLayout.Bands[0].Columns[i].Width = otherColumnWidth;
  649. }
  650. }
  651. //设置列只读
  652. Core.Mes.Client.Common.UltraGridMgt.SetUltraGridColumnsReadOnly(ref this.ultraGrid1);
  653. }
  654. catch
  655. {
  656. }
  657. }
  658. private void doQuery()
  659. {
  660. doQueryReport();
  661. }
  662. private void ExportExcel()
  663. {
  664. try
  665. {
  666. string StrfileName = "连铸恒拉明细表.xls";
  667. this.GridExcelExporter.Export(this.ultraGrid1, StrfileName);
  668. ProcessStartInfo p = new ProcessStartInfo(StrfileName);
  669. p.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
  670. p.WorkingDirectory = Path.GetDirectoryName(StrfileName);
  671. Process.Start(p);
  672. }
  673. catch (Exception ex)
  674. {
  675. }
  676. }
  677. #endregion
  678. private void uCkEditorForFilter_CheckedChanged(object sender, EventArgs e)
  679. {
  680. try
  681. {
  682. if (uCkEditorForFilter.Checked)
  683. {
  684. ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
  685. }
  686. else
  687. {
  688. ultraGrid1.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters();
  689. ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  690. }
  691. }
  692. catch { }
  693. }
  694. }
  695. }