FrmMilDateWaitingDecision.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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.Entity;
  5. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  6. using Core.StlMes.Client.ZGMil.Signature;
  7. using CoreFS.CA06;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Generic;
  12. using System.ComponentModel;
  13. using System.Data;
  14. using System.Drawing;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Windows.Forms;
  18. namespace Core.StlMes.Client.ZGMil.Report
  19. {
  20. public partial class FrmMilDateWaitingDecision : FrmBase
  21. {
  22. private string departm = "";
  23. private string plineCode = "";
  24. public FrmMilDateWaitingDecision()
  25. {
  26. InitializeComponent();
  27. this.IsLoadUserView = true;
  28. }
  29. /// <summary>
  30. /// 重写基类方法
  31. /// </summary>
  32. /// <param name="sender"></param>
  33. /// <param name="ToolbarKey"></param>
  34. public override void ToolBar_Click(object sender, string ToolbarKey)
  35. {
  36. switch (ToolbarKey)
  37. {
  38. case "Query":
  39. doQuery();
  40. break;
  41. case "Save":
  42. doSave();
  43. break;
  44. case "Export":
  45. ExportData();
  46. break;
  47. case "Close":
  48. this.Close();
  49. break;
  50. }
  51. }
  52. private void doSave()
  53. {
  54. ultraGrid1.UpdateData();
  55. ArrayList parm = new ArrayList();
  56. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  57. if (uGrid.Count() == 0)
  58. {
  59. MessageUtil.ShowTips("请选择要保存的数据!");
  60. return;
  61. }
  62. foreach (UltraGridRow uRow in uGrid)
  63. {
  64. ArrayList list = new ArrayList();
  65. list.Add(uRow.Cells["WAITING_DECISION_MEMO"].Value.ToString());
  66. list.Add(uRow.Cells["AGAIN_MEMO"].Value.ToString());
  67. list.Add(uRow.Cells["IS_VISIBLE"].Value.ToString());
  68. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
  69. list.Add(uRow.Cells["PRO_PLAN_ID"].Value.ToString());
  70. list.Add(uRow.Cells["GX_PLAN_NO"].Value.ToString());
  71. parm.Add(list);
  72. }
  73. int count = ServerHelper.SetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.saveMilDateWaitingDecision", new object[] { parm }, this.ob);
  74. MessageUtil.ShowTips("保存成功!");
  75. doQuery();
  76. }
  77. /// <summary>
  78. /// 查询
  79. /// </summary>
  80. private void doQuery()
  81. {
  82. string date = "";
  83. string endDate = "";
  84. string JudgeStoveNo = "";
  85. string LotNo = "";
  86. string ContractNo = "";
  87. string plineCode = "";
  88. string VALIDFLAG = "";
  89. string IsVisible = "";
  90. if (chkDate.Checked)
  91. {
  92. if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
  93. {
  94. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  95. return;
  96. }
  97. else
  98. {
  99. date = cmbDate.Value.ToString();
  100. endDate = cmbEndDate.Value.ToString();
  101. }
  102. }
  103. if (chkJudgeStoveNo.Checked)
  104. {
  105. if (uteJudgeStoveNo.Text.Trim() == "")
  106. {
  107. JudgeStoveNo = "";
  108. }
  109. else
  110. {
  111. JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
  112. }
  113. }
  114. if (chkLotNo.Checked)
  115. {
  116. if (uteLotNo.Text.Trim() == "")
  117. {
  118. LotNo = "";
  119. }
  120. else
  121. {
  122. LotNo = uteLotNo.Value.ToString();
  123. }
  124. }
  125. if (chkContractNo.Checked)
  126. {
  127. if (uteContractNo.Text.Trim() == "")
  128. {
  129. ContractNo = "";
  130. }
  131. else
  132. {
  133. ContractNo = uteContractNo.Value.ToString();
  134. }
  135. }
  136. if (chkPlineCode.Checked)
  137. {
  138. plineCode = cobPlineCode.Value.ToString();
  139. }
  140. if (chkVALIDFLAG.Checked)
  141. {
  142. VALIDFLAG = cobVALIDFLAG.Value.ToString();
  143. }
  144. if (chkIsVisible.Checked)
  145. {
  146. IsVisible = cobIsVisible.Value.ToString();
  147. }
  148. WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
  149. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getFrmMilDateWaitingDecision", new Object[] { date, endDate, JudgeStoveNo, LotNo, ContractNo, plineCode, VALIDFLAG, IsVisible }, this.ob);
  150. GridHelper.CopyDataToDatatable(dt, this.dataTable2, true);
  151. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  152. wf.Close();
  153. }
  154. /// <summary>
  155. /// 查询条件
  156. /// </summary>
  157. /// <param name="sender"></param>
  158. /// <param name="e"></param>
  159. private void chkDate_CheckedChanged(object sender, EventArgs e)
  160. {
  161. if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
  162. if (chkDate.Checked) { cmbEndDate.Enabled = true; } else { cmbEndDate.Enabled = false; }
  163. if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; }
  164. if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
  165. if (chkContractNo.Checked) { uteContractNo.Enabled = true; } else { uteContractNo.Enabled = false; }
  166. if (chkPlineCode.Checked) { cobPlineCode.Enabled = true; } else { cobPlineCode.Enabled = false; }
  167. if (chkVALIDFLAG.Checked) { cobVALIDFLAG.Enabled = true; } else { cobVALIDFLAG.Enabled = false; }
  168. if (chkIsVisible.Checked) { cobIsVisible.Enabled = true; } else { cobIsVisible.Enabled = false; }
  169. }
  170. private void FrmMilDateWaitingDecision_Load(object sender, EventArgs e)
  171. {
  172. cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
  173. NativeMethodNew na = new NativeMethodNew(this.ob);
  174. departm = UserInfo.GetDepartment();
  175. //plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  176. DateTime now = DateTime.Now;
  177. DateTime date = new DateTime(now.Year, now.Month, 1);
  178. cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd"));
  179. cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
  180. //cmbEndDate.Value = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 06:59:59"));
  181. //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 07:00:00"));
  182. //TubeRoll.SetComboItemHeight(uteLotNo);
  183. //TubeRoll.SetComboItemHeight(cmbBz);
  184. }
  185. /// <summary>
  186. /// 导出
  187. /// </summary>
  188. private void ExportData()
  189. {
  190. GridHelper.ulGridToExcel(ultraGrid1, "轧管生产按炉跟踪判定情况");
  191. }
  192. }
  193. }