FrmMilControlLogStop.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using com.steering.mes.zgmil.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.ZGMil.Common;
  6. using Core.StlMes.Client.ZGMil.Entity;
  7. using CoreFS.CA06;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.ZGMil.Report
  18. {
  19. public partial class FrmMilControlLogStop : FrmBase
  20. {
  21. private string departm = "";
  22. private string plineCode = "";
  23. private string[] plineCodes = { };
  24. public FrmMilControlLogStop()
  25. {
  26. InitializeComponent();
  27. this.IsLoadUserView = true;
  28. }
  29. private void FrmMilControlLogStop_Load(object sender, EventArgs e)
  30. {
  31. cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
  32. NativeMethodNew na = new NativeMethodNew(this.ob);
  33. departm = UserInfo.GetDepartment();
  34. //plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  35. plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob);
  36. EntityHelper.ShowGridCaption<MilControlLogEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  37. DateTime now = DateTime.Now;
  38. DateTime date = new DateTime(now.Year, now.Month, 1);
  39. cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd"));
  40. cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
  41. //cmbEndDate.Value = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 06:59:59"));
  42. //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 07:00:00"));
  43. //TubeRoll.SetComboItemHeight(uteLotNo);
  44. //TubeRoll.SetComboItemHeight(cmbBz);
  45. //加载产线
  46. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getPlineNameZG", new object[] { plineCodes }, ob);
  47. if (dt != null && dt.Rows.Count > 0)
  48. {
  49. txt_PlinCode.DataSource = dt;
  50. txt_PlinCode.ValueMember = "PLINE_CODE";
  51. txt_PlinCode.DisplayMember = "PLINE_NAME";
  52. }
  53. }
  54. /// <summary>
  55. /// 重写基类方法
  56. /// </summary>
  57. /// <param name="sender"></param>
  58. /// <param name="ToolbarKey"></param>
  59. public override void ToolBar_Click(object sender, string ToolbarKey)
  60. {
  61. switch (ToolbarKey)
  62. {
  63. case "Query":
  64. doQuery();
  65. break;
  66. case "Export":
  67. ExportData();
  68. break;
  69. case "Close":
  70. this.Close();
  71. break;
  72. }
  73. }
  74. /// <summary>
  75. /// 查询
  76. /// </summary>
  77. private void doQuery()
  78. {
  79. string date = "";
  80. string endDate = "";
  81. string JudgeStoveNo = "";
  82. string LotNo = "";
  83. string ContractNo = "";
  84. if (chkDate.Checked)
  85. {
  86. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  87. {
  88. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  89. return;
  90. }
  91. else
  92. {
  93. date = cmbDate.Value.ToString("yyyyMMdd0000");
  94. endDate = cmbEndDate.Value.ToString("yyyyMMdd2359");
  95. }
  96. }
  97. List<MilControlLogEntity> listSource = EntityHelper.GetData<MilControlLogEntity>(
  98. "com.steering.mes.zgmil.report.FrmMilDateStatistics.getMilControlLogStop", new object[] { date, endDate, plineCode, plineCodes }, this.ob);
  99. bindingSource1.DataSource = listSource;
  100. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  101. }
  102. /// <summary>
  103. /// 查询条件
  104. /// </summary>
  105. /// <param name="sender"></param>
  106. /// <param name="e"></param>
  107. private void chkDate_CheckedChanged(object sender, EventArgs e)
  108. {
  109. if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
  110. if (ultra_PlinCode.Checked) { txt_PlinCode.Enabled = true; } else { txt_PlinCode.Enabled = false; }
  111. }
  112. /// <summary>
  113. /// 导出
  114. /// </summary>
  115. private void ExportData()
  116. {
  117. GridHelper.ulGridToExcel(ultraGrid1, "调度停机统计");
  118. }
  119. private void txt_PlinCode_TextChanged(object sender, EventArgs e)
  120. {
  121. plineCode = txt_PlinCode.SelectedItem.DataValue.ToString();
  122. }
  123. }
  124. }