FrmHttPerformance.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Mcp.Control;
  5. using CoreFS.CA06;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. namespace Core.StlMes.Client.Mcp.Treatment.Report
  16. {
  17. public partial class FrmHttPerformance : FrmBase
  18. {
  19. private string plineCode = "";
  20. private string manageNmae = ""; //科室名称
  21. private string stationCode = "";//工序代码
  22. private string[] plineCodes = new string[] { };
  23. public FrmHttPerformance()
  24. {
  25. InitializeComponent();
  26. this.IsLoadUserView = true;
  27. }
  28. private void FrmPerformance_Load(object sender, EventArgs e)
  29. {
  30. //DateTime now = DateTime.Now;
  31. //DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  32. //DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  33. //StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  34. //EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  35. StartTime.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 21:00"));
  36. EndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 20:59"));
  37. manageNmae = UserInfo.GetDepartment();
  38. //plineCode = YdmBaseClass.GetPCode(manageNmae, this.ob);//获取 用户 对应的产线
  39. plineCodes = comm.InitDropPlineCodePower("F", txt_PlinCode, this.ValidDataPurviewIds, this.ob);
  40. txt_PlinCode.SelectedIndex = 0;
  41. }
  42. public override void ToolBar_Click(object sender, string ToolbarKey)
  43. {
  44. //base.ToolBar_Click(sender, ToolbarKey);
  45. switch (ToolbarKey)
  46. {
  47. case "Query":
  48. DoQuery();
  49. break;
  50. case "Export":
  51. GridHelper.ulGridToExcel(ultraGrid1, "热处理实绩数据统计");
  52. break;
  53. case "Close":
  54. this.Close();
  55. break;
  56. }
  57. }
  58. private void chkTim_CheckedChanged(object sender, EventArgs e)
  59. {
  60. if (chkTim.Checked) { StartTime.Enabled = true; EndTime.Enabled = true; } else { StartTime.Enabled = false; EndTime.Enabled = false; }
  61. if (chkJugeHeatNo.Checked) { txtJugeNo.Enabled = true; } else { txtJugeNo.Enabled = false; }
  62. if (chkLotNo.Checked) { txtLotNo.Enabled = true; } else { txtLotNo.Enabled = false; }
  63. if (chkOrder.Checked) { txtOrder.Enabled = true; }
  64. else
  65. {
  66. txtOrder.Enabled = false;
  67. }
  68. }
  69. private void DoQuery()
  70. {
  71. string judgeNo = "";
  72. string batchNo = "";
  73. string orderNo = "";
  74. if (!CheckQuery()) return;
  75. string staTime = "";
  76. string endTime = "";
  77. if (chkTim.Checked)
  78. {
  79. staTime = StartTime.Value.ToString();
  80. endTime = EndTime.Value.ToString();
  81. }
  82. if (chkLotNo.Checked)
  83. {
  84. batchNo = this.txtLotNo.Text.Trim();
  85. }
  86. if (chkJugeHeatNo.Checked)
  87. {
  88. judgeNo = this.txtJugeNo.Text.Trim();
  89. }
  90. if (chkOrder.Checked)
  91. {
  92. orderNo = this.txtOrder.Text.Trim();
  93. }
  94. ArrayList list = new ArrayList();
  95. list.Add(staTime);
  96. list.Add(endTime);
  97. list.Add(judgeNo);
  98. list.Add(batchNo);
  99. list.Add(orderNo);
  100. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmRCLPerformance.doQuery", new object[] { list, plineCode == "" ? plineCodes : new string[] { plineCode }, stationCode }, ob);
  101. GridHelper.CopyDataToDatatable(ref dt1, ref dataTable1, true);
  102. }
  103. /// <summary>
  104. /// 数据验证
  105. /// </summary>
  106. /// <returns></returns>
  107. private bool CheckQuery()
  108. {
  109. if (DataTimeUtil.JudgeTime(DateTime.Parse(StartTime.Value.ToString()), DateTime.Parse(EndTime.Value.ToString())) == 0)
  110. {
  111. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  112. return false;
  113. }
  114. if (this.chkJugeHeatNo.Checked && string.IsNullOrEmpty(this.txtJugeNo.Text.Trim()))
  115. {
  116. MessageUtil.ShowWarning("请输入炉号!");
  117. return false;
  118. }
  119. if (this.chkLotNo.Checked && string.IsNullOrEmpty(this.txtLotNo.Text.Trim()))
  120. {
  121. MessageUtil.ShowWarning("请输入批号!");
  122. return false;
  123. }
  124. if (this.chkOrder.Checked && string.IsNullOrEmpty(this.txtOrder.Text.Trim()))
  125. {
  126. MessageUtil.ShowWarning("请输入合同号!");
  127. return false;
  128. }
  129. return true;
  130. }
  131. private void txt_PlinCode_TextChanged(object sender, EventArgs e)
  132. {
  133. plineCode = txt_PlinCode.SelectedItem.DataValue.ToString();
  134. }
  135. private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
  136. {
  137. /* if (int.Parse(e.Row.Cells["FLAG"].Value.ToString3()) >0)
  138. {
  139. e.Row.Appearance.BackColor = Color.Yellow;
  140. }*/
  141. }
  142. }
  143. }