frmPlanQuery.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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.Comm.Control;
  10. using Core.Mes.Client.Comm.Server;
  11. using Core.Mes.Client.Comm.Tool;
  12. using Core.StlMes.Client.LgCommon;
  13. using CoreFS.CA06;
  14. using Infragistics.Win.UltraWinGrid;
  15. namespace Core.StlMes.Client.LgResMgt
  16. {
  17. public partial class frmPlanQuery : FrmBase
  18. {
  19. public frmPlanQuery()
  20. {
  21. InitializeComponent();
  22. }
  23. private DataTable dtData;
  24. protected override void OnLoad(EventArgs e)
  25. {
  26. base.OnLoad(e);
  27. var vlistGradeCode = ClsBusinessPack.GetValuelistSteel(ob);
  28. uceGrade.ValueList = vlistGradeCode;
  29. ClsBusinessPack.InitDropPlinePower("A", uceEafLine, this.ob);
  30. dateBegintime.Value = DateTime.Now;
  31. dateEndtime.Value = DateTime.Now;
  32. if (uceEafLine.Items.Count > 0) uceEafLine.SelectedIndex = 0;
  33. }
  34. public override void ToolBar_Click(object sender, string toolbarKey)
  35. {
  36. switch (toolbarKey)
  37. {
  38. case "Query": //查询
  39. RefreshData();
  40. break;
  41. case "Export":
  42. DoExport();
  43. break;
  44. case "Print":
  45. DoPrint();
  46. break;
  47. case "Close": //关闭
  48. Close();
  49. break;
  50. }
  51. }
  52. private void DoExport()
  53. {
  54. GridHelper.ulGridToExcel(ugPlan, "炼钢生产计划");
  55. }
  56. private void DoPrint()
  57. {
  58. try
  59. {
  60. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLgPlan.cpt&op=view&EF_PLINE_CODE={2}&GRADECODE={4}&JUDGE_STOVE_NO={3}&ORDER_NO={5}&PRO_MONTH1={0}&PRO_MONTH2={1}";
  61. strurl = string.Format(strurl,
  62. ((DateTime) dateBegintime.Value).ToString("yyyyMMdd"),
  63. ((DateTime) dateEndtime.Value).ToString("yyyyMMdd"),
  64. ucEafLine.Checked && uceEafLine.SelectedIndex >= 0
  65. ? uceEafLine.SelectedItem.DataValue.ToString()
  66. : "",
  67. ucJudgeStove.Checked ? txtStoveNo.Text : "",
  68. chcGrade.Checked && uceGrade.SelectedIndex >= 0 ? uceGrade.SelectedItem.DataValue.ToString() : "",
  69. uceOrder.Checked ? txtOrder.Text : ""
  70. );
  71. FrmRepExcel fBug = new FrmRepExcel(ob, strurl)
  72. {
  73. AutoSize = true,
  74. MaximumSize =
  75. new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height),
  76. Text = "炼钢生产计划打印"
  77. };
  78. fBug.ShowDialog();
  79. }
  80. catch (Exception ex)
  81. {
  82. MessageBox.Show("打印出错:" + ex.Message);
  83. }
  84. }
  85. private void RefreshData()
  86. {
  87. dtData = ServerHelper.GetData("Core.LgMes.Server.LgDeviceManager.PlanQuery.GetPlan",
  88. new object[]
  89. {
  90. ((DateTime)dateBegintime.Value).ToString("yyyyMMdd"),
  91. ((DateTime)dateEndtime.Value).ToString("yyyyMMdd"),
  92. ucEafLine.Checked && uceEafLine.SelectedIndex>=0 ? uceEafLine.SelectedItem.DataValue.ToString():"",
  93. ucJudgeStove.Checked ? txtStoveNo.Text :"",
  94. chcGrade.Checked && uceGrade.SelectedIndex>=0 ? uceGrade.SelectedItem.DataValue.ToString():"",
  95. uceOrder.Checked ? txtOrder.Text :""
  96. }, ob);
  97. bindingSource1.DataSource = dtData;
  98. ugPlan.UpdateData();
  99. ugPlan.Refresh();
  100. foreach (UltraGridColumn ugc in ugPlan.DisplayLayout.Bands[0].Columns)
  101. {
  102. ugc.SortIndicator = SortIndicator.Disabled;
  103. ugc.CellActivation = Activation.ActivateOnly;
  104. ugc.PerformAutoResize(PerformAutoSizeType.AllRowsInBand);
  105. }
  106. //GridHelper.CopyDataToDatatable(dt, dtData, true);
  107. //ugPlan.DataSource = dt;
  108. }
  109. private void ugPlan_InitializeRow(object sender, InitializeRowEventArgs e)
  110. {
  111. if (dtData.Rows[e.Row.Index]["分切"].ToString() != "1")
  112. {
  113. e.Row.Appearance.BackColor = Color.LightBlue;
  114. }
  115. }
  116. }
  117. }