FrmMilQcmZgJugdeApply.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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 FrmMilQcmZgJugdeApply : FrmBase
  19. {
  20. private string departm = "";
  21. private string plineCode = "";
  22. private string[] plineCodes = { };
  23. public FrmMilQcmZgJugdeApply()
  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 ApplyCode = "";
  58. string State = "";
  59. string barYearMonth = "";
  60. if (chkDate.Checked)
  61. {
  62. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  63. {
  64. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  65. return;
  66. }
  67. else
  68. {
  69. date = cmbDate.Value.ToString();
  70. endDate = cmbEndDate.Value.ToString();
  71. }
  72. }
  73. if (chkJudgeStoveNo.Checked)
  74. {
  75. if (uteJudgeStoveNo.Text.Trim() == "")
  76. {
  77. JudgeStoveNo = "";
  78. }
  79. else
  80. {
  81. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  82. }
  83. }
  84. if (chkLotNo.Checked)
  85. {
  86. if (uteLotNo.Text.Trim() == "")
  87. {
  88. LotNo = "";
  89. }
  90. else
  91. {
  92. LotNo = uteLotNo.Value.ToString();
  93. }
  94. }
  95. if (chkApplyCode.Checked)
  96. {
  97. if (uteApplyCode.Text.Trim() == "")
  98. {
  99. ApplyCode = "";
  100. }
  101. else
  102. {
  103. ApplyCode = uteApplyCode.Value.ToString();
  104. }
  105. }
  106. if (uckState.Checked)
  107. {
  108. if (cobState.Text.Trim() == "")
  109. {
  110. State = "";
  111. }
  112. else
  113. {
  114. State = cobState.Value.ToString();
  115. }
  116. }
  117. if (chkBalYearMonth.Checked)
  118. {
  119. if (BAL_YEAR_MONTH.Text.Trim() == "")
  120. {
  121. barYearMonth = "";
  122. }
  123. else
  124. {
  125. barYearMonth = BAL_YEAR_MONTH.Value.ToString("yyyyMM");
  126. }
  127. }
  128. WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
  129. if (this.ultraTabControl1.Tabs[0].Active)
  130. {
  131. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getQcmZgJugdeApply", new Object[] { date, endDate, JudgeStoveNo, LotNo, ApplyCode, State, plineCodes }, this.ob);
  132. GridHelper.CopyDataToDatatable(dt, this.dataTable2, true);
  133. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  134. }
  135. else if(this.ultraTabControl1.Tabs[1].Active)
  136. {
  137. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getQcmZgJugdeApplyAll", new Object[] { barYearMonth, plineCodes }, this.ob);
  138. GridHelper.CopyDataToDatatable(dt, this.dataTable3, true);
  139. GridHelper.RefreshAndAutoSize(this.ultraGrid2);
  140. //数据处理
  141. //foreach (UltraGridRow ugr in ultraGrid2.Rows)
  142. //{
  143. // if (Int32.Parse(ugr.Cells["wspd"].Value.ToString3()) < 0)
  144. // {
  145. // ugr.Cells["wspd"].Value = "0.000";
  146. // }
  147. //}
  148. }
  149. wf.Close();
  150. }
  151. /// <summary>
  152. /// 数据不平的颜色红
  153. /// </summary>
  154. public void ChangeGridColor()
  155. { int a = 0;
  156. foreach(UltraGridRow ugr in ultraGrid1.Rows)
  157. {
  158. a = int.Parse(ugr.Cells["YJ"].Value.ToString()) - int.Parse(ugr.Cells["CC"].Value.ToString()) -int.Parse(ugr.Cells["FEI"].Value.ToString()) ;
  159. if (ugr.Cells["NODE_STATUS1"].Value.ToString() == "入库" && a >0)
  160. {
  161. ugr.Appearance.BackColor = Color.Red;
  162. }
  163. }
  164. }
  165. /// <summary>
  166. /// 查询条件
  167. /// </summary>
  168. /// <param name="sender"></param>
  169. /// <param name="e"></param>
  170. private void chkDate_CheckedChanged(object sender, EventArgs e)
  171. {
  172. if (chkDate.Checked) { cmbDate.Enabled = true;
  173. cmbEndDate.Enabled = true;}else { cmbDate.Enabled = false; cmbEndDate.Enabled = false;}
  174. if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; }
  175. if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
  176. if (chkApplyCode.Checked) { uteApplyCode.Enabled = true; } else { uteApplyCode.Enabled = false; }
  177. if (uckState.Checked) { cobState.Enabled = true; } else { cobState.Enabled = false; }
  178. if (chkBalYearMonth.Checked) { BAL_YEAR_MONTH.Enabled = true; } else { BAL_YEAR_MONTH.Enabled = false; }
  179. }
  180. private void FrmMilOutputStatistics_Load(object sender, EventArgs e)
  181. {
  182. cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
  183. NativeMethodNew na = new NativeMethodNew(this.ob);
  184. departm = UserInfo.GetDepartment();
  185. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  186. plineCodes = BaseMethod.GetPlineCode(ValidDataPurviewIds, ob);
  187. DateTime now = DateTime.Now;
  188. DateTime date = new DateTime(now.Year, now.Month, 1);
  189. //string a = DateTime.Now.ToString("yyyyMM");
  190. //BAL_YEAR_MONTH.Value = DateTime.Parse(DateTime.Now.ToString("yyyyMM"));
  191. //cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
  192. cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd HH:mm:ss"));
  193. cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  194. }
  195. /// <summary>
  196. /// 导出
  197. /// </summary>
  198. private void ExportData()
  199. {
  200. if (this.ultraTabControl1.Tabs[0].Active)
  201. {
  202. GridHelper.ulGridToExcel(ultraGrid1, "送判信息");
  203. }
  204. else if (this.ultraTabControl1.Tabs[1].Active)
  205. {
  206. GridHelper.ulGridToExcel(ultraGrid2, "下线→待送判→已送判");
  207. }
  208. }
  209. private string getPlineCode()
  210. /// <summary>
  211. /// 非250、258、168、460的产线代码都为空
  212. /// </summary>
  213. /// <returns></returns>
  214. {
  215. if (plineCode.Equals("C008") || plineCode.Equals("C009") || plineCode.Equals("C010") || plineCode.Equals("C017"))
  216. {
  217. return plineCode;
  218. }
  219. else
  220. {
  221. return "";
  222. }
  223. }
  224. private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
  225. {
  226. }
  227. }
  228. }