FrmMilScrapStatistics.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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.ZGMil.Common;
  5. using Core.StlMes.Client.ZGMil.Entity;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace Core.StlMes.Client.ZGMil.Report
  17. {
  18. public partial class FrmMilScrapStatistics : FrmBase
  19. {
  20. private string departm = "";
  21. private string plineCode = "";
  22. private string[] plineCodes = { };
  23. public FrmMilScrapStatistics()
  24. {
  25. InitializeComponent();
  26. this.IsLoadUserView = true;
  27. }
  28. /// <summary>
  29. /// 重写基类方法
  30. /// </summary>
  31. /// <param name="sender"></param>
  32. /// <param name="ToolbarKey"></param>
  33. public override void ToolBar_Click(object sender, string ToolbarKey)
  34. {
  35. switch (ToolbarKey)
  36. {
  37. case "Query":
  38. doQuery();
  39. break;
  40. case "Export":
  41. ExportData();
  42. break;
  43. case "Close":
  44. this.Close();
  45. break;
  46. }
  47. }
  48. /// <summary>
  49. /// 查询
  50. /// </summary>
  51. private void doQuery()
  52. {
  53. string date = "";
  54. string endDate = "";
  55. string JudgeStoveNo = "";
  56. string LotNo = "";
  57. string ContractNo = "";
  58. if (chkDate.Checked)
  59. {
  60. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  61. {
  62. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  63. return;
  64. }
  65. else
  66. {
  67. date = cmbDate.Value.ToString();
  68. endDate = cmbEndDate.Value.ToString();
  69. }
  70. }
  71. if (chkJudgeStoveNo.Checked)
  72. {
  73. if (uteJudgeStoveNo.Text.Trim() == "")
  74. {
  75. JudgeStoveNo = "";
  76. }
  77. else
  78. {
  79. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  80. }
  81. }
  82. if (chkLotNo.Checked)
  83. {
  84. if (uteLotNo.Text.Trim() == "")
  85. {
  86. LotNo = "";
  87. }
  88. else
  89. {
  90. LotNo = uteLotNo.Value.ToString();
  91. }
  92. }
  93. if (chkContractNo.Checked)
  94. {
  95. if (uteContractNo.Text.Trim() == "")
  96. {
  97. ContractNo = "";
  98. }
  99. else
  100. {
  101. ContractNo = uteContractNo.Value.ToString();
  102. }
  103. }
  104. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getMilScrapStatistics", new Object[] { date, endDate, JudgeStoveNo, LotNo, plineCodes }, this.ob);
  105. GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
  106. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  107. //ChangeGridColor();
  108. }
  109. /// <summary>
  110. /// 数据不平的颜色红
  111. /// </summary>
  112. public void ChangeGridColor()
  113. { int a = 0;
  114. foreach(UltraGridRow ugr in ultraGrid1.Rows)
  115. {
  116. a = int.Parse(ugr.Cells["YJ"].Value.ToString()) - int.Parse(ugr.Cells["CC"].Value.ToString()) -int.Parse(ugr.Cells["FEI"].Value.ToString()) ;
  117. if (ugr.Cells["NODE_STATUS1"].Value.ToString() == "入库" && a >0)
  118. {
  119. ugr.Appearance.BackColor = Color.Red;
  120. }
  121. }
  122. }
  123. /// <summary>
  124. /// 查询条件
  125. /// </summary>
  126. /// <param name="sender"></param>
  127. /// <param name="e"></param>
  128. private void chkDate_CheckedChanged(object sender, EventArgs e)
  129. {
  130. if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
  131. if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; }
  132. if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
  133. if (chkContractNo.Checked) { uteContractNo.Enabled = true; } else { uteContractNo.Enabled = false; }
  134. }
  135. private void FrmMilOutputStatistics_Load(object sender, EventArgs e)
  136. {
  137. cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
  138. NativeMethodNew na = new NativeMethodNew(this.ob);
  139. departm = UserInfo.GetDepartment();
  140. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  141. plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob);
  142. DateTime now = DateTime.Now;
  143. DateTime date = new DateTime(now.Year, now.Month, 1);
  144. cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd"));
  145. cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
  146. //cmbEndDate.Value = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 06:59:59"));
  147. //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 07:00:00"));
  148. //TubeRoll.SetComboItemHeight(uteLotNo);
  149. //TubeRoll.SetComboItemHeight(cmbBz);
  150. }
  151. /// <summary>
  152. /// 导出
  153. /// </summary>
  154. private void ExportData()
  155. {
  156. GridHelper.ulGridToExcel(ultraGrid1, "轧管废品统计");
  157. }
  158. /// <summary>
  159. /// 非250、258、168、460的产线代码都为空
  160. /// </summary>
  161. /// <returns></returns>
  162. private string getPlineCode()
  163. {
  164. if (plineCode.Equals("C008") || plineCode.Equals("C009") || plineCode.Equals("C010") || plineCode.Equals("C017"))
  165. {
  166. return plineCode;
  167. }
  168. else
  169. {
  170. return "";
  171. }
  172. }
  173. }
  174. }