FrmCcmBilletWgtsamplingReport.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  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.lgBll.lgReport;
  16. using Infragistics.Win.UltraWinMaskedEdit;
  17. namespace Core.LgMes.Client.LgIntegrationQuery
  18. {
  19. /// <summary>
  20. /// FrmIronEleQry 的摘要说明。
  21. /// </summary>
  22. public class FrmCcmBilletWgtsamplingReport : Core.Mes.Client.Common.frmStyleBase
  23. {
  24. private Infragistics.Win.UltraWinDataSource.UltraDataSource ultraDataSource1;
  25. private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1;
  26. private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox1;
  27. private Infragistics.Win.UltraWinEditors.UltraDateTimeEditor uldtEndTime;
  28. private CheckBox chkTime;
  29. private Infragistics.Win.UltraWinEditors.UltraDateTimeEditor uldtBeginTime;
  30. private Label label4;
  31. private IContainer components;
  32. string strStartTime = "";
  33. private Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter GridExcelExporter;
  34. string strEndTime = "";
  35. public FrmCcmBilletWgtsamplingReport()
  36. {
  37. //
  38. // Windows 窗体设计器支持所必需的
  39. //
  40. InitializeComponent();
  41. //
  42. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  43. //
  44. }
  45. /// <summary>
  46. /// 清理所有正在使用的资源。
  47. /// </summary>
  48. protected override void Dispose( bool disposing )
  49. {
  50. try
  51. {
  52. }
  53. catch { }
  54. if( disposing )
  55. {
  56. if(components != null)
  57. {
  58. components.Dispose();
  59. }
  60. }
  61. base.Dispose( disposing );
  62. }
  63. #region Windows 窗体设计器生成的代码
  64. /// <summary>
  65. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  66. /// 此方法的内容。
  67. /// </summary>
  68. private void InitializeComponent()
  69. {
  70. this.components = new System.ComponentModel.Container();
  71. Infragistics.Win.Appearance appearance70 = new Infragistics.Win.Appearance();
  72. Infragistics.Win.Appearance appearance71 = new Infragistics.Win.Appearance();
  73. Infragistics.Win.Appearance appearance72 = new Infragistics.Win.Appearance();
  74. Infragistics.Win.Appearance appearance73 = new Infragistics.Win.Appearance();
  75. Infragistics.Win.Appearance appearance74 = new Infragistics.Win.Appearance();
  76. Infragistics.Win.Appearance appearance75 = new Infragistics.Win.Appearance();
  77. Infragistics.Win.Appearance appearance76 = new Infragistics.Win.Appearance();
  78. Infragistics.Win.Appearance appearance77 = new Infragistics.Win.Appearance();
  79. Infragistics.Win.Appearance appearance78 = new Infragistics.Win.Appearance();
  80. Infragistics.Win.Appearance appearance79 = new Infragistics.Win.Appearance();
  81. Infragistics.Win.Appearance appearance80 = new Infragistics.Win.Appearance();
  82. Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
  83. this.ultraDataSource1 = new Infragistics.Win.UltraWinDataSource.UltraDataSource(this.components);
  84. this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid();
  85. this.ultraGroupBox1 = new Infragistics.Win.Misc.UltraGroupBox();
  86. this.label4 = new System.Windows.Forms.Label();
  87. this.chkTime = new System.Windows.Forms.CheckBox();
  88. this.uldtBeginTime = new Infragistics.Win.UltraWinEditors.UltraDateTimeEditor();
  89. this.uldtEndTime = new Infragistics.Win.UltraWinEditors.UltraDateTimeEditor();
  90. this.GridExcelExporter = new Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter(this.components);
  91. ((System.ComponentModel.ISupportInitialize)(this.ultraDataSource1)).BeginInit();
  92. ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit();
  93. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).BeginInit();
  94. this.ultraGroupBox1.SuspendLayout();
  95. ((System.ComponentModel.ISupportInitialize)(this.uldtBeginTime)).BeginInit();
  96. ((System.ComponentModel.ISupportInitialize)(this.uldtEndTime)).BeginInit();
  97. this.SuspendLayout();
  98. //
  99. // ultraGrid1
  100. //
  101. appearance70.TextHAlignAsString = "Left";
  102. this.ultraGrid1.DisplayLayout.CaptionAppearance = appearance70;
  103. appearance71.BackColor = System.Drawing.SystemColors.ActiveBorder;
  104. appearance71.BackColor2 = System.Drawing.SystemColors.ControlDark;
  105. appearance71.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
  106. appearance71.BorderColor = System.Drawing.SystemColors.Window;
  107. this.ultraGrid1.DisplayLayout.GroupByBox.Appearance = appearance71;
  108. appearance72.ForeColor = System.Drawing.SystemColors.GrayText;
  109. this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance = appearance72;
  110. this.ultraGrid1.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
  111. this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true;
  112. appearance73.BackColor = System.Drawing.SystemColors.ControlLightLight;
  113. appearance73.BackColor2 = System.Drawing.SystemColors.Control;
  114. appearance73.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
  115. appearance73.ForeColor = System.Drawing.SystemColors.GrayText;
  116. this.ultraGrid1.DisplayLayout.GroupByBox.PromptAppearance = appearance73;
  117. this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1;
  118. this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1;
  119. appearance74.BackColor = System.Drawing.SystemColors.Window;
  120. appearance74.ForeColor = System.Drawing.SystemColors.ControlText;
  121. this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance = appearance74;
  122. appearance75.BackColor = System.Drawing.SystemColors.Highlight;
  123. appearance75.ForeColor = System.Drawing.SystemColors.HighlightText;
  124. this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance = appearance75;
  125. this.ultraGrid1.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.RaisedSoft;
  126. this.ultraGrid1.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.None;
  127. appearance76.BackColor = System.Drawing.SystemColors.Window;
  128. this.ultraGrid1.DisplayLayout.Override.CardAreaAppearance = appearance76;
  129. appearance77.FontData.SizeInPoints = 10F;
  130. appearance77.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
  131. this.ultraGrid1.DisplayLayout.Override.CellAppearance = appearance77;
  132. this.ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
  133. this.ultraGrid1.DisplayLayout.Override.CellPadding = 0;
  134. this.ultraGrid1.DisplayLayout.Override.DefaultRowHeight = 25;
  135. appearance78.BackColor = System.Drawing.SystemColors.Control;
  136. appearance78.BackColor2 = System.Drawing.SystemColors.ControlDark;
  137. appearance78.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;
  138. appearance78.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
  139. appearance78.BorderColor = System.Drawing.SystemColors.Window;
  140. this.ultraGrid1.DisplayLayout.Override.GroupByRowAppearance = appearance78;
  141. appearance79.TextHAlignAsString = "Left";
  142. this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance79;
  143. this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
  144. this.ultraGrid1.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.Standard;
  145. this.ultraGrid1.DisplayLayout.Override.RowSelectorNumberStyle = Infragistics.Win.UltraWinGrid.RowSelectorNumberStyle.RowIndex;
  146. this.ultraGrid1.DisplayLayout.Override.RowSelectorWidth = 25;
  147. appearance80.BackColor = System.Drawing.SystemColors.ControlLight;
  148. this.ultraGrid1.DisplayLayout.Override.TemplateAddRowAppearance = appearance80;
  149. this.ultraGrid1.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
  150. this.ultraGrid1.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
  151. this.ultraGrid1.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
  152. this.ultraGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
  153. this.ultraGrid1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  154. this.ultraGrid1.Location = new System.Drawing.Point(0, 47);
  155. this.ultraGrid1.Name = "ultraGrid1";
  156. this.ultraGrid1.Size = new System.Drawing.Size(975, 446);
  157. this.ultraGrid1.TabIndex = 19;
  158. //
  159. // ultraGroupBox1
  160. //
  161. this.ultraGroupBox1.Controls.Add(this.label4);
  162. this.ultraGroupBox1.Controls.Add(this.chkTime);
  163. this.ultraGroupBox1.Controls.Add(this.uldtBeginTime);
  164. this.ultraGroupBox1.Controls.Add(this.uldtEndTime);
  165. this.ultraGroupBox1.Dock = System.Windows.Forms.DockStyle.Top;
  166. this.ultraGroupBox1.Location = new System.Drawing.Point(0, 0);
  167. this.ultraGroupBox1.Name = "ultraGroupBox1";
  168. this.ultraGroupBox1.Size = new System.Drawing.Size(975, 47);
  169. this.ultraGroupBox1.TabIndex = 21;
  170. //
  171. // label4
  172. //
  173. this.label4.AutoSize = true;
  174. this.label4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  175. this.label4.Location = new System.Drawing.Point(243, 16);
  176. this.label4.Name = "label4";
  177. this.label4.Size = new System.Drawing.Size(21, 14);
  178. this.label4.TabIndex = 284;
  179. this.label4.Text = "到";
  180. //
  181. // chkTime
  182. //
  183. this.chkTime.AutoSize = true;
  184. this.chkTime.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  185. this.chkTime.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  186. this.chkTime.Location = new System.Drawing.Point(21, 14);
  187. this.chkTime.Name = "chkTime";
  188. this.chkTime.Size = new System.Drawing.Size(79, 18);
  189. this.chkTime.TabIndex = 283;
  190. this.chkTime.Text = "时间 从";
  191. this.chkTime.UseVisualStyleBackColor = true;
  192. this.chkTime.CheckedChanged += new System.EventHandler(this.chkTime_CheckedChanged);
  193. //
  194. // uldtBeginTime
  195. //
  196. appearance5.BorderAlpha = Infragistics.Win.Alpha.UseAlphaLevel;
  197. appearance5.BorderColor = System.Drawing.Color.Black;
  198. this.uldtBeginTime.ButtonAppearance = appearance5;
  199. this.uldtBeginTime.DateTime = new System.DateTime(2008, 1, 12, 0, 0, 0, 0);
  200. this.uldtBeginTime.Enabled = false;
  201. this.uldtBeginTime.FormatProvider = new System.Globalization.CultureInfo("en-US");
  202. this.uldtBeginTime.FormatString = "yyyy-MM-dd HH:mm";
  203. this.uldtBeginTime.Location = new System.Drawing.Point(104, 14);
  204. this.uldtBeginTime.MaskInput = "yyyy-mm-dd hh:mm";
  205. this.uldtBeginTime.Name = "uldtBeginTime";
  206. this.uldtBeginTime.Size = new System.Drawing.Size(133, 19);
  207. this.uldtBeginTime.TabIndex = 282;
  208. this.uldtBeginTime.UseFlatMode = Infragistics.Win.DefaultableBoolean.True;
  209. this.uldtBeginTime.Value = new System.DateTime(2008, 1, 12, 0, 0, 0, 0);
  210. this.uldtBeginTime.ValueChanged += new System.EventHandler(this.uldtBeginTime_ValueChanged);
  211. //
  212. // uldtEndTime
  213. //
  214. this.uldtEndTime.DateTime = new System.DateTime(2008, 11, 24, 0, 0, 0, 0);
  215. this.uldtEndTime.FormatProvider = new System.Globalization.CultureInfo("en-US");
  216. this.uldtEndTime.FormatString = "yyyy-MM-dd HH:mm";
  217. this.uldtEndTime.Location = new System.Drawing.Point(271, 12);
  218. this.uldtEndTime.MaskInput = "yyyy-mm-dd hh:mm";
  219. this.uldtEndTime.Name = "uldtEndTime";
  220. this.uldtEndTime.Size = new System.Drawing.Size(136, 21);
  221. this.uldtEndTime.TabIndex = 281;
  222. this.uldtEndTime.Value = new System.DateTime(2008, 11, 24, 0, 0, 0, 0);
  223. //
  224. // FrmCcmBilletWgtsamplingReport
  225. //
  226. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  227. this.ClientSize = new System.Drawing.Size(975, 493);
  228. this.Controls.Add(this.ultraGrid1);
  229. this.Controls.Add(this.ultraGroupBox1);
  230. this.Name = "FrmCcmBilletWgtsamplingReport";
  231. this.Text = "板坯重量记录表";
  232. this.Load += new System.EventHandler(this.FrmIronEleQry_Load);
  233. ((System.ComponentModel.ISupportInitialize)(this.ultraDataSource1)).EndInit();
  234. ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
  235. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).EndInit();
  236. this.ultraGroupBox1.ResumeLayout(false);
  237. this.ultraGroupBox1.PerformLayout();
  238. ((System.ComponentModel.ISupportInitialize)(this.uldtBeginTime)).EndInit();
  239. ((System.ComponentModel.ISupportInitialize)(this.uldtEndTime)).EndInit();
  240. this.ResumeLayout(false);
  241. }
  242. #endregion
  243. private void FrmIronEleQry_Load(object sender, System.EventArgs e)
  244. {
  245. this.uldtBeginTime.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 00:00";
  246. this.uldtEndTime.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 23:59";
  247. this.chkTime.Checked = true;
  248. }
  249. /// <summary>
  250. /// ds需要的字段
  251. /// </summary>
  252. /// <returns></returns>
  253. private string[] returnColumnName()
  254. {
  255. return new string[] { "SAMPLINGID", "CCMID", "FLOWNO","WEIGHT", "SAMPLINGTIME", "MSG_EXP" };
  256. }
  257. /// <summary>
  258. ///
  259. /// </summary>
  260. /// <returns></returns>
  261. private string[] returnColumnHeaderName()
  262. {
  263. return new string[] { "采样ID", "铸机号", "铸流号","重量", "称重时间", "称重序号" };
  264. }
  265. private string[] returnColumnDataType()
  266. {
  267. return new string[] { "System.String", "System.String", "System.String", "System.Double" , "System.DateTime", "System.String" };
  268. }
  269. private Hashtable GetColumnAndType()
  270. {
  271. Hashtable hs = new Hashtable();
  272. for (int i = 0; i < returnColumnName().Length; i++)
  273. {
  274. hs.Add(returnColumnName()[i], returnColumnDataType()[i]);
  275. }
  276. return hs;
  277. }
  278. public override void ToolBar_Click(object sender, string ToolbarKey)
  279. {
  280. switch (ToolbarKey)
  281. {
  282. case "Query":
  283. this.doQuery();
  284. break;
  285. case "Close":
  286. this.Close();
  287. break;
  288. case "Export":
  289. this.ExportExcel();
  290. break;
  291. default:
  292. break;
  293. }
  294. }
  295. private void chkTime_CheckedChanged(object sender, EventArgs e)
  296. {
  297. uldtBeginTime.Enabled = chkTime.Checked;
  298. uldtEndTime.Enabled = chkTime.Checked;
  299. }
  300. private void uldtBeginTime_ValueChanged(object sender, EventArgs e)
  301. {
  302. }
  303. #region "Auto Refresh"
  304. /// <summary>
  305. /// 获取查询条件
  306. /// </summary>
  307. /// <returns></returns>
  308. private string getSqlCondition()
  309. {
  310. string strStartTime = this.uldtBeginTime.DateTime.ToString("yyyy-MM-dd");
  311. string strEndTime = this.uldtEndTime.DateTime.ToString("yyyy-MM-dd");
  312. string sqlCondition = string.Format(string.Format(" and samplingtime >= trunc({0}) and samplingtime <= trunc({1} + 1)", "to_date('{0}','yyyy-mm-dd')", "to_date('{1}','yyyy-mm-dd')"), strStartTime, strEndTime);
  313. return sqlCondition;
  314. }
  315. /// <summary>
  316. /// 将原dataset 中的铸机号和流号进行转换
  317. /// </summary>
  318. /// <param name="ds"></param>
  319. /// <returns></returns>
  320. private DataSet ChgDataSetByChangeCcmidAndFlow(ref DataSet ds)
  321. {
  322. DataSet dsTemp = this.getAllColumn();
  323. DataRow drs = null;
  324. foreach (DataRow dr in ds.Tables[0].Rows)
  325. {
  326. drs = dsTemp.Tables[0].NewRow();
  327. foreach (DataColumn dc in ds.Tables[0].Columns)
  328. {
  329. if (!dsTemp.Tables[0].Columns.Contains(dc.ColumnName))
  330. continue;
  331. if (dc.ColumnName == "CCMID" || dc.ColumnName == "FLOWNO" || dc.ColumnName == "SAMPLINGTIME" || dc.ColumnName == "WEIGHT")
  332. {
  333. drs["CCMID"] = dr["CCMID"] + "#";
  334. drs["FLOWNO"] = dr["FLOWNO"] + "流";
  335. drs["SAMPLINGTIME"] = Convert.ToDateTime(dr["SAMPLINGTIME"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
  336. drs["WEIGHT"] = dr["WEIGHT"] + "";
  337. }
  338. else
  339. {
  340. drs[dc.ColumnName] = dr[dc.ColumnName];
  341. }
  342. }
  343. dsTemp.Tables[0].Rows.Add(drs);
  344. }
  345. return dsTemp;
  346. }
  347. private void SetTotalInfo()
  348. {
  349. ArrayList alistColumns = new ArrayList();
  350. ArrayList alistFormat = new ArrayList();
  351. alistColumns.Add("WEIGHT");
  352. alistFormat.Add(" {0:############0.0}");
  353. Core.Mes.Client.Common.UltraGridMgt.proc_Statics(ref this.ultraGrid1, alistColumns, true, " {0:############0.0}");
  354. }
  355. private void doQueryReport()
  356. {
  357. if (uldtEndTime.DateTime.Date.Subtract(uldtBeginTime.DateTime.Date).Days > 180)
  358. {
  359. MessageBox.Show("查询时间不可超过6个月。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  360. return;
  361. }
  362. if (uldtBeginTime.DateTime.Date > uldtEndTime.DateTime.Date)
  363. {
  364. MessageBox.Show("查询开始日期不能大于结束日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  365. return;
  366. }
  367. DataSet ds = new DataSet();
  368. ClientParamWithSqlConditionAndOpenBase param = new ClientParamWithSqlConditionAndOpenBase(getSqlCondition(),this.ob);
  369. try
  370. {
  371. ds = Core.LgMes.Client.lgBll.lgResMgt.LgStlCcmBilletWgtSamplingMgt.GetStlCcmBilletWgtSamping(param);
  372. DataSet dsTemp = ChgDataSetByChangeCcmidAndFlow(ref ds);
  373. if (lgCommon.isNullOrEmptyDataSetCheck(dsTemp))
  374. {
  375. DataView dv = new DataView(dsTemp.Tables[0]);
  376. dv.Sort = "SAMPLINGTIME desc";
  377. this.ultraGrid1.DataSource = dv.ToTable();
  378. }
  379. }
  380. catch(Exception ex)
  381. {
  382. }
  383. initUltraGrid();
  384. SetTotalInfo();
  385. }
  386. /// <summary>
  387. /// 初始化grid
  388. /// </summary>
  389. private void initUltraGrid()
  390. {
  391. try
  392. {
  393. string[] columnName = returnColumnName();
  394. string[] columnHeaderName = returnColumnHeaderName();
  395. int columnWidht = 150;
  396. int otherColumnWidth = 100; // 拉速宽度
  397. for(int i = 0; i < columnName.Length;i++)
  398. {
  399. try
  400. {
  401. this.ultraGrid1.DisplayLayout.Bands[0].Columns[columnName[i]].Header.Caption = columnHeaderName[i];
  402. this.ultraGrid1.DisplayLayout.Bands[0].Columns[columnName[i]].Width = columnWidht;
  403. }
  404. catch
  405. {
  406. }
  407. }
  408. for (int i = 0; i < this.ultraGrid1.DisplayLayout.Bands[0].Columns.Count; i++)
  409. {
  410. if (i > 8)
  411. {
  412. this.ultraGrid1.DisplayLayout.Bands[0].Columns[i].Width = otherColumnWidth;
  413. }
  414. }
  415. //设置列只读
  416. Core.Mes.Client.Common.UltraGridMgt.SetUltraGridColumnsReadOnly(ref this.ultraGrid1);
  417. }
  418. catch
  419. {
  420. }
  421. }
  422. /// <summary>
  423. /// 构造新的dataset,包含需要显示的字段
  424. /// </summary>
  425. /// <returns></returns>
  426. private DataSet getAllColumn()
  427. {
  428. DataSet ds = new DataSet();
  429. DataTable dt = new DataTable();
  430. string[] columnName = returnColumnName();
  431. Hashtable hs = GetColumnAndType();
  432. foreach (string s in columnName)
  433. {
  434. string dbtype = hs[s].ToString();
  435. dt.Columns.Add(new DataColumn(s, Type.GetType("System.String"))); // 时间
  436. }
  437. ds.Tables.Add(dt);
  438. return ds;
  439. }
  440. private void doQuery()
  441. {
  442. doQueryReport();
  443. }
  444. private void ExportExcel()
  445. {
  446. try
  447. {
  448. string StrfileName = "板坯重量记录表【" + this.uldtBeginTime.DateTime.ToString("yyyy-MM-dd") +"~"+this.uldtEndTime.DateTime.ToString("yyyy-MM-dd")+"】"+ ".xls";
  449. this.GridExcelExporter.Export(this.ultraGrid1, StrfileName);
  450. ProcessStartInfo p = new ProcessStartInfo(StrfileName);
  451. p.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
  452. p.WorkingDirectory = Path.GetDirectoryName(StrfileName);
  453. Process.Start(p);
  454. }
  455. catch (Exception ex)
  456. {
  457. }
  458. }
  459. #endregion
  460. }
  461. }