FrmApplyInputUpdate.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using com.steering.mes.zgmil.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Format;
  4. using Core.Mes.Client.Comm.Server;
  5. using Core.Mes.Client.Comm.Tool;
  6. using Core.StlMes.Client.ZGMil.Entity;
  7. using Core.StlMes.Client.ZGMil.NodeResultQuery;
  8. using Core.StlMes.Client.ZGMil.Popup;
  9. using Core.StlMes.Client.ZGMil.Report;
  10. using Core.StlMes.Client.ZGMil.ResultConrtrol;
  11. using CoreFS.CA06;
  12. using Infragistics.Win.UltraWinGrid;
  13. using System;
  14. using System.Collections;
  15. using System.Collections.Generic;
  16. using System.ComponentModel;
  17. using System.Data;
  18. using System.Drawing;
  19. using System.Linq;
  20. using System.Text;
  21. using System.Windows.Forms;
  22. namespace Core.StlMes.Client.ZGMil.Signature
  23. {
  24. public partial class FrmApplyInputUpdate : FrmBase
  25. {
  26. private string Process = "";//参数
  27. private string[] arrId;//数据权限
  28. private DataTable _dtPline = null;
  29. public FrmApplyInputUpdate()
  30. {
  31. InitializeComponent();
  32. }
  33. private void FrmApplyInputUpdate_Load(object sender, EventArgs e)
  34. {
  35. DateTime now = DateTime.Now;
  36. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  37. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  38. this.StartTime2.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  39. this.EndTime2.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  40. EntityHelper.ShowGridCaption<QcmZgJugdeApplyEntity2>(ultraGrid1.DisplayLayout.Bands[0]);
  41. EntityHelper.ShowGridCaption<QcmZgJudgeInputRecordEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  42. Process = this.CustomInfo.ToString();//参数
  43. _dtPline = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.JudgeBaseInfo", new object[] { Process }, ob);
  44. //_dtPline.AcceptChanges();
  45. string strPlineNames = string.Join(",", _dtPline.Rows.Cast<DataRow>().Select(a => a["plineName"].ToString()).ToArray());
  46. string strPineCodes = string.Join(",", _dtPline.Rows.Cast<DataRow>().Select(a => a["plineCode"].ToString()).ToArray());
  47. ultraTextEditor1.Text = strPlineNames;
  48. ultraTextEditor1.Tag = strPineCodes;
  49. InitBindColumn();
  50. }
  51. private void InitBindColumn()
  52. {
  53. }
  54. public override void ToolBar_Click(object sender, string ToolbarKey)
  55. {
  56. switch (ToolbarKey)
  57. {
  58. case "DoQuery":
  59. QueryZgJugdeApply();
  60. break;
  61. case "updateInputWt":
  62. updateInputWt();
  63. break;
  64. case "Close":
  65. this.Close();
  66. break;
  67. }
  68. }
  69. /// <summary>
  70. /// 调整设料量
  71. /// </summary>
  72. private void updateInputWt()
  73. {
  74. this.ultraGrid1.UpdateData();
  75. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  76. //string departMentid = PipeManageClass.GetDepartIdBySectionId(UserInfo.GetDeptid(), ob);
  77. string departMentid = UserInfo.GetDeptid();
  78. if (uRow == null)
  79. {
  80. MessageUtil.ShowTips("请选择需要调整的炉信息!");
  81. return;
  82. }
  83. if (Double.Parse(uRow.Cells["InputCount"].Value.ToString3()) < 0)
  84. {
  85. MessageUtil.ShowTips("请输入正确的数字!");
  86. return;
  87. }
  88. if (Double.Parse(uRow.Cells["InputWeight"].Value.ToString3()) < 0)
  89. {
  90. MessageUtil.ShowTips("请输入正确的数字 !");
  91. return;
  92. }
  93. ArrayList list = new ArrayList();
  94. list.Add(uRow.Cells["JugdeApplyCode"].Value.ToString());
  95. list.Add(uRow.Cells["JugdeApplySequeno"].Value.ToString());
  96. list.Add(uRow.Cells["JudgeStoveNo"].Value.ToString());
  97. list.Add(uRow.Cells["BatchNo"].Value.ToString());
  98. list.Add(uRow.Cells["BatchGroudNo"].Value.ToString());
  99. list.Add(uRow.Cells["InputCount"].Text.ToString3());
  100. list.Add(uRow.Cells["InputWeight"].Text.ToString3());
  101. list.Add(UserInfo.GetUserName());
  102. CoreClientParam ccp = new CoreClientParam();
  103. ccp.ServerName = "com.steering.mes.signature.FrmInOnlineStore";
  104. ccp.MethodName = "updateInputWt";
  105. ccp.ServerParams = new object[] { list };
  106. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  107. if (ccp.ReturnCode != -1)
  108. {
  109. if (ccp.ReturnInfo.Equals("调整成功!"))
  110. {
  111. QueryZgJugdeApply();
  112. MessageUtil.ShowTips(ccp.ReturnInfo);
  113. }
  114. else
  115. {
  116. MessageUtil.ShowTips(ccp.ReturnInfo);
  117. }
  118. }
  119. }
  120. /// <summary>
  121. /// 查询送判数据
  122. /// </summary>
  123. private void QueryZgJugdeApply()
  124. {
  125. string plinCode = "";
  126. string jugeNo = "";
  127. string startTim = "";
  128. string endTim = "";
  129. string departMentid = UserInfo.GetDeptid();
  130. if (this.chkHeatNo2.Checked && this.txtHeatNo2.Text.Trim() != "")
  131. {
  132. jugeNo = this.txtHeatNo2.Text.Trim();
  133. }
  134. if (chkTim2.Checked)
  135. {
  136. if (DateTime.Parse(StartTime2.Value.ToString()) > DateTime.Parse(EndTime2.Value.ToString()))
  137. {
  138. MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
  139. return;
  140. }
  141. else
  142. {
  143. startTim = this.StartTime2.Value.ToString("yyyy-MM-dd HH:mm:ss");
  144. endTim = this.EndTime2.Value.ToString("yyyy-MM-dd HH:mm:ss");
  145. }
  146. }
  147. if (chkPlineCode.Checked)
  148. {
  149. plinCode = ultraTextEditor1.Tag.ToString().Replace(",", "', '");
  150. }
  151. List<QcmZgJugdeApplyEntity2> listSource = EntityHelper.GetData<QcmZgJugdeApplyEntity2>(
  152. "com.steering.mes.signature.FrmInOnlineStore.QueryZgJugdeApply", new object[] { jugeNo, startTim, endTim, plinCode }, this.ob);
  153. qcmZgJugdeApplyEntityBindingSource.DataSource = listSource;
  154. GridHelper.RefreshAndAutoSize(ultraGrid1);
  155. }
  156. private void chkTim2_CheckedChanged(object sender, EventArgs e)
  157. {
  158. this.StartTime2.Enabled = this.EndTime2.Enabled = this.chkTim2.Checked;
  159. }
  160. private void chkHeatNo2_CheckedChanged(object sender, EventArgs e)
  161. {
  162. this.txtHeatNo2.Enabled = this.chkHeatNo2.Checked;
  163. }
  164. private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  165. {
  166. ChoicePlineFrm frm = new ChoicePlineFrm(_dtPline, ultraTextEditor1.Tag.ToString2(), this.ob);
  167. if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  168. {
  169. ultraTextEditor1.Text = frm.ChoicePlineName;
  170. ultraTextEditor1.Tag = frm.ChoicePlineCode;
  171. }
  172. }
  173. private void chkPlineCode_CheckedChanged(object sender, EventArgs e)
  174. {
  175. this.ultraTextEditor1.Enabled = this.chkPlineCode.Checked;
  176. }
  177. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  178. {
  179. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  180. List<QcmZgJudgeInputRecordEntity> listSource = EntityHelper.GetData<QcmZgJudgeInputRecordEntity>(
  181. "com.steering.mes.signature.FrmInOnlineStore.QueryZgApplyInputRecord", new object[] { uRow.Cells["JugdeApplyCode"].Value.ToString(), uRow.Cells["JugdeApplySequeno"].Value.ToString(), uRow.Cells["JudgeStoveNo"].Value.ToString(), uRow.Cells["BatchNo"].Value.ToString(), uRow.Cells["BatchGroudNo"].Value.ToString() }, this.ob);
  182. bindingSource1.DataSource = listSource;
  183. }
  184. }
  185. }