FrmjGPerformance.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.Report
  16. {
  17. public partial class FrmJGPerformance : FrmBase
  18. {
  19. private string plineCode = "";
  20. private string manageNmae = ""; //科室名称
  21. private string stationCode = "700301";//工序点代码
  22. private string[] plineCodes = new string[] { };
  23. public FrmJGPerformance()
  24. {
  25. InitializeComponent();
  26. this.IsLoadUserView = true;
  27. }
  28. private void FrmJGPerformance_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("H", 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. if (!CheckQuery()) return;
  72. string staTime = "";
  73. string endTime = "";
  74. if (chkTim.Checked)
  75. {
  76. staTime = StartTime.Value.ToString();
  77. endTime = EndTime.Value.ToString();
  78. }
  79. ArrayList list = new ArrayList();
  80. list.Add(staTime);
  81. list.Add(endTime);
  82. list.Add(this.txtJugeNo.Text.Trim());
  83. list.Add(this.txtLotNo.Text.Trim());
  84. list.Add(this.txtOrder.Text.Trim());
  85. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.doQueryPerformance", new object[] { list, plineCode == "" ? plineCodes : new string[] { plineCode }, stationCode }, ob);
  86. GridHelper.CopyDataToDatatable(ref dt1, ref dataTable1, true);
  87. }
  88. /// <summary>
  89. /// 数据验证
  90. /// </summary>
  91. /// <returns></returns>
  92. private bool CheckQuery()
  93. {
  94. if (DataTimeUtil.JudgeTime(DateTime.Parse(StartTime.Value.ToString()), DateTime.Parse(EndTime.Value.ToString())) == 0)
  95. {
  96. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  97. return false;
  98. }
  99. if (this.chkJugeHeatNo.Checked && string.IsNullOrEmpty(this.txtJugeNo.Text.Trim()))
  100. {
  101. MessageUtil.ShowWarning("请输入炉号!");
  102. return false;
  103. }
  104. if (this.chkLotNo.Checked && string.IsNullOrEmpty(this.txtLotNo.Text.Trim()))
  105. {
  106. MessageUtil.ShowWarning("请输入批号!");
  107. return false;
  108. }
  109. if (this.chkOrder.Checked && string.IsNullOrEmpty(this.txtOrder.Text.Trim()))
  110. {
  111. MessageUtil.ShowWarning("请输入合同号!");
  112. return false;
  113. }
  114. return true;
  115. }
  116. private void txt_PlinCode_TextChanged(object sender, EventArgs e)
  117. {
  118. plineCode = txt_PlinCode.SelectedItem.DataValue.ToString();
  119. }
  120. }
  121. }