FrmMchBale.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.Mcp.Mch.Entity;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  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.Mch.MchResult
  16. {
  17. public partial class FrmMchBale : FrmBase
  18. {
  19. private string[] plineCode = null;
  20. public FrmMchBale()
  21. {
  22. InitializeComponent();
  23. }
  24. private void chkHeatNo2_CheckedChanged(object sender, EventArgs e)
  25. {
  26. this.txtHeatNo2.Enabled = this.chkHeatNo2.Checked;
  27. }
  28. private void chkOrderNo_CheckedChanged(object sender, EventArgs e)
  29. {
  30. this.txtOrderNo.Enabled = this.chkOrderNo.Checked;
  31. }
  32. private void FrmMchBale_Load(object sender, EventArgs e)
  33. {
  34. //DateTime now = DateTime.Now;
  35. //DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  36. //DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  37. //this.StartTime2.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  38. //this.EndTime2.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  39. EntityHelper.ShowGridCaption<RtdMeasurePosdataEntityJG>(ultraGrid1.DisplayLayout.Bands[0]);
  40. EntityHelper.ShowGridCaption<RtdMeasurePosdataEntityJG>(ultraGrid2.DisplayLayout.Bands[0]);
  41. plineCode = comm.GetPlineCode(this.ValidDataPurviewIds, "G", this.CustomInfo, ob);
  42. }
  43. public override void ToolBar_Click(object sender, string ToolbarKey)
  44. {
  45. switch (ToolbarKey)
  46. {
  47. case "DoQuery":
  48. QueryRtdMeasurePosdata();
  49. break;
  50. case "updateBale":
  51. updateBale();
  52. break;
  53. case "DoPrint":
  54. PrintResult();
  55. break;
  56. case "Close":
  57. this.Close();
  58. break;
  59. }
  60. }
  61. /// <summary>
  62. /// 查询
  63. /// </summary>
  64. private void QueryRtdMeasurePosdata()
  65. {
  66. string orderNo = "";
  67. string jugeNo = "";
  68. string startTim = "";
  69. string endTim = "";
  70. if (this.chkHeatNo2.Checked && this.txtHeatNo2.Text.Trim() != "")
  71. {
  72. jugeNo = this.txtHeatNo2.Text.Trim();
  73. }
  74. if (this.chkOrderNo.Checked && this.txtOrderNo.Text.Trim() != "")
  75. {
  76. orderNo = this.txtOrderNo.Text.Trim();
  77. }
  78. if (chkTim2.Checked)
  79. {
  80. if (DateTime.Parse(StartTime2.Value.ToString()) > DateTime.Parse(EndTime2.Value.ToString()))
  81. {
  82. MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
  83. return;
  84. }
  85. else
  86. {
  87. startTim = this.StartTime2.Value.ToString("yyyy-MM-dd HH:mm:ss");
  88. endTim = this.EndTime2.Value.ToString("yyyy-MM-dd HH:mm:ss");
  89. }
  90. }
  91. List<RtdMeasurePosdataEntityJG> listSource = EntityHelper.GetData<RtdMeasurePosdataEntityJG>(
  92. "com.steering.mes.mcp.Mch.FrmMeasureResult.QueryZgJugdeApply", new object[] { jugeNo, startTim, endTim, orderNo, plineCode }, this.ob);
  93. bindingSource1.DataSource = listSource;
  94. GridHelper.RefreshAndAutoSize(ultraGrid1);
  95. }
  96. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  97. {
  98. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  99. List<RtdMeasurePosdataEntityJG> listSource = EntityHelper.GetData<RtdMeasurePosdataEntityJG>(
  100. "com.steering.mes.mcp.Mch.FrmMeasureResult.QueryBaleRecord", new object[] { uRow.Cells["JudgeStoveNo"].Value.ToString(), uRow.Cells["BatchNo"].Value.ToString(), uRow.Cells["PlineCode"].Value.ToString(), uRow.Cells["ProOrderNo"].Value.ToString() }, this.ob);
  101. bindingSource2.DataSource = listSource;
  102. }
  103. /// <summary>
  104. /// 打捆
  105. /// </summary>
  106. private void updateBale()
  107. {
  108. this.ultraGrid1.UpdateData();
  109. this.ultraGrid2.UpdateData();
  110. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  111. if (uRow == null)
  112. {
  113. MessageUtil.ShowTips("请选择需要调整的炉信息!");
  114. return;
  115. }
  116. ArrayList listAll = new ArrayList();
  117. if (ultraGrid2.Rows.Count > 0)
  118. {
  119. foreach (UltraGridRow ugr in ultraGrid2.Rows)
  120. {
  121. if (Double.Parse(ugr.Cells["BaleNo"].Value.ToString3()) < 0)
  122. {
  123. MessageUtil.ShowTips("请输入正确的数字!");
  124. return;
  125. }
  126. ArrayList list = new ArrayList();
  127. list.Add(ugr.Cells["BaleNo"].Value.ToString());
  128. list.Add(ugr.Cells["KeyId"].Value.ToString());
  129. listAll.Add(list);
  130. }
  131. }
  132. CoreClientParam ccp = new CoreClientParam();
  133. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMeasureResult";
  134. ccp.MethodName = "updateBale";
  135. ccp.ServerParams = new object[] { listAll };
  136. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  137. if (ccp.ReturnCode != -1)
  138. {
  139. if (ccp.ReturnInfo.Equals("打捆成功!"))
  140. {
  141. QueryRtdMeasurePosdata();
  142. MessageUtil.ShowTips(ccp.ReturnInfo);
  143. }
  144. else
  145. {
  146. MessageUtil.ShowTips(ccp.ReturnInfo);
  147. }
  148. }
  149. }
  150. /// <summary>
  151. /// 打捆标签
  152. /// </summary>
  153. private void PrintResult()
  154. {
  155. this.ultraGrid2.UpdateData();
  156. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  157. String JudgeStoveNo = uRow.Cells["JudgeStoveNo"].Value.ToString();
  158. String BatchNo = uRow.Cells["BatchNo"].Value.ToString();
  159. String PlineCode = uRow.Cells["PlineCode"].Value.ToString();
  160. String ProOrderNo = uRow.Cells["ProOrderNo"].Value.ToString();
  161. String BaleNo = uRow.Cells["BaleNo"].Value.ToString();
  162. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMchBale.cpt&JUDGE_STOVE_NO=" + JudgeStoveNo + "&BATCH_NO=" + BatchNo + "&PLINE_CODE=" + PlineCode + "&PRO_ORDER_NO=" + ProOrderNo + "&BALE_NO=" + BaleNo;
  163. FrmRepExcel fre = new FrmRepExcel(ob, strurl);
  164. fre.AutoSize = true;
  165. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  166. fre.WindowState = FormWindowState.Maximized;
  167. fre.Show();
  168. }
  169. }
  170. }