FrmOffLineReport.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Drawing;
  5. using System.Linq;
  6. using System.Management;
  7. using System.Windows.Forms;
  8. using Core.Mes.Client.Comm.Control;
  9. using Core.Mes.Client.Comm.Tool;
  10. using Core.StlMes.Client.Mcp.Mch.Entity;
  11. using CoreFS.CA06;
  12. namespace Core.StlMes.Client.Mcp.Mch.Report
  13. {
  14. public partial class FrmOffLineReport : FrmBase
  15. {
  16. private string plineCode = "";
  17. private string[] plineCodes = {};
  18. public FrmOffLineReport()
  19. {
  20. InitializeComponent();
  21. IsLoadUserView = true;
  22. }
  23. public override void ToolBar_Click(object sender, string ToolbarKey)
  24. {
  25. switch (ToolbarKey)
  26. {
  27. case "DoQuery":
  28. QuerySinglePlan();
  29. break;
  30. case "DoClose":
  31. Close();
  32. break;
  33. case "Export":
  34. GridHelper.ulGridToExcel(ultraGrid1, "热处理离线台账");
  35. break;
  36. }
  37. }
  38. /// <summary>
  39. /// 台账查询
  40. /// </summary>
  41. private void QuerySinglePlan()
  42. {
  43. var startTime = "";
  44. var endTime = "";
  45. var judgeNo = "";
  46. var batchNo = "";
  47. var gx = "";
  48. if (chkTim.Checked)
  49. if (DateTime.Parse(RegStartTime.Value.ToString()) > DateTime.Parse(RegEndTime.Value.ToString()))
  50. {
  51. MessageUtil.ShowTips("选择时间区间错误,请重新选择!");
  52. return;
  53. }
  54. else
  55. {
  56. startTime = RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  57. endTime = RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  58. }
  59. else if (!chkJugeHeatNo.Checked)
  60. if (MessageUtil.ShowYesNoAndQuestion("未加时间条件,查询时间可能比较长,请确定是否继续查询?") == DialogResult.No) return;
  61. if (chkJugeHeatNo.Checked)
  62. judgeNo = txtJugeNo.Text.Trim();
  63. if (chkBatch.Checked)
  64. batchNo = txtBatch.Text.Trim();
  65. var list = new ArrayList();
  66. list.Add(startTime);
  67. list.Add(endTime);
  68. list.Add(judgeNo);
  69. list.Add(batchNo);
  70. list.Add(gx);
  71. list.Add(uceType.SelectedItem.DataValue.ToString());
  72. List<MchOfflineResultAndGroupEntity> listSource = EntityHelper.GetData<MchOfflineResultAndGroupEntity>(
  73. "com.steering.mes.mcp.Mch.FrmJgxReport.doQueryOffLine", new object[] { list, new string[]{ultraCheckEditor1.Checked?"1":"0", ultraCheckEditor2.Checked?"1":"0",ultraCheckEditor3.Checked?"1":"0",ultraCheckEditor4.Checked?"1":"0"}
  74. ,plineCode == "" ? plineCodes : new string[] { plineCode } }, ob);
  75. List<MchGroupResultEntity> listGroup = EntityHelper.GetData<MchGroupResultEntity>(
  76. "com.steering.mes.mcp.Mch.FrmMchDownLineManage.doQueryOffGroupDetail",
  77. new object[] {listSource.Select(p => p.GroupId).Distinct().ToArray()}, ob);
  78. listSource.ForEach(
  79. p => p.MchGroupResultEntitys = listGroup.Where(q => q.GroupId == p.GroupId).OrderBy(q => q.GroupXh).ToList());
  80. HttOfflineResultEntitybindingSource.DataSource = listSource;
  81. comm.RefreshAndAutoSize(ultraGrid1,new string[]{"StdName"});
  82. }
  83. private void FrmWatergageReport_Load(object sender, EventArgs e)
  84. {
  85. plineCodes = comm.InitDropPlineCodePower("G", txt_PlinCode, ValidDataPurviewIds, ob);
  86. if (plineCodes.Length > 1 && (plineCodes[1] == "C038" || plineCodes[1] == "C039" || plineCodes[1] == "C049" || plineCodes[1] == "C050" ||
  87. plineCodes[1] == "C051" || plineCodes[1] == "C057"))
  88. {
  89. RegStartTime.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 20:00"));
  90. RegEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 19:59"));
  91. }
  92. else
  93. {
  94. RegStartTime.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 21:00"));
  95. RegEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 20:59"));
  96. }
  97. txt_PlinCode.SelectedIndex = 0;
  98. EntityHelper.ShowGridCaption<MchOfflineResultAndGroupEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  99. EntityHelper.ShowGridCaption<MchGroupResultEntity>(ultraGrid1.DisplayLayout.Bands[1]);
  100. uceType.SelectedIndex = 0;
  101. QuerySinglePlan();
  102. }
  103. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  104. {
  105. if (chkTim.Checked)
  106. {
  107. RegStartTime.Enabled = true;
  108. RegEndTime.Enabled = true;
  109. }
  110. else
  111. {
  112. RegStartTime.Enabled = false;
  113. RegEndTime.Enabled = false;
  114. }
  115. if (chkJugeHeatNo.Checked) txtJugeNo.Enabled = true;
  116. else txtJugeNo.Enabled = false;
  117. if (chkBatch.Checked) txtBatch.Enabled = true;
  118. else txtBatch.Enabled = false;
  119. }
  120. private void txt_PlinCode_TextChanged(object sender, EventArgs e)
  121. {
  122. plineCode = txt_PlinCode.SelectedItem.DataValue.ToString();
  123. }
  124. private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
  125. {
  126. MchOfflineResultAndGroupEntity list = e.Row.ListObject as MchOfflineResultAndGroupEntity;
  127. if(list==null) return;
  128. if (list.GroupLog == "1")
  129. {
  130. e.Row.Cells["GroupLog"].Appearance.BackColor = Color.LightGreen;
  131. }
  132. if ((list.OfflineNum ?? 0) - (list.GroupNum ?? 0) - (list.ReNum ?? 0) - (list.SubcontractNum ?? 0) + (list.SubcontractcompleteNum ?? 0) <= 0)
  133. {
  134. if ((list.SubcontractNum ?? 0) > 0 && (list.SubcontractcompleteNum ?? 0) == 0 &&
  135. (list.HbFpNum ?? 0) == 0)
  136. {
  137. e.Row.Cells["JudgeStoveNo"].Appearance.BackColor = Color.Khaki;
  138. }
  139. else if((list.GroupNum??0)>0)
  140. {
  141. e.Row.Cells["JudgeStoveNo"].Appearance.BackColor = Color.DarkGray;
  142. }
  143. else
  144. {
  145. e.Row.Cells["JudgeStoveNo"].Appearance.BackColor = Color.LightGray;
  146. }
  147. }
  148. }
  149. }
  150. }