FrmUpdatePlan.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. using com.steering.mes.zgmil.entity;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.ZGMil.Entity;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Text.RegularExpressions;
  17. using System.Windows.Forms;
  18. namespace Core.StlMes.Client.ZGMil.Signature
  19. {
  20. public partial class FrmUpdatePlan : FrmBase
  21. {
  22. public FrmUpdatePlan()
  23. {
  24. InitializeComponent();
  25. }
  26. private void FrmUpdatePlan_Load(object sender, EventArgs e)
  27. {
  28. EntityHelper.ShowGridCaption<MilPlanEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  29. }
  30. /// <summary>
  31. /// 重写基类方法
  32. /// </summary>
  33. /// <param name="sender"></param>
  34. /// <param name="ToolbarKey"></param>
  35. public override void ToolBar_Click(object sender, string ToolbarKey)
  36. {
  37. switch (ToolbarKey)
  38. {
  39. case "Query":
  40. queryMilPlan();
  41. break;
  42. case "updateStatus":
  43. updateSawNum();
  44. break;
  45. case "Close":
  46. this.Close();
  47. break;
  48. }
  49. }
  50. /// <summary>
  51. /// 查询炉计划
  52. /// </summary>
  53. private void queryMilPlan()
  54. {
  55. string jugeNo = "";
  56. string lotNo = "";
  57. NativeMethodNew na = new NativeMethodNew(this.ob);
  58. string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
  59. if (this.txtJugeNo.Text.Trim() == "")
  60. {
  61. MessageUtil.ShowTips("请输入炉号查询!");
  62. return;
  63. }
  64. else
  65. {
  66. jugeNo = this.txtJugeNo.Text.Trim();
  67. }
  68. if (this.chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
  69. {
  70. lotNo = this.txtLotNo.Text.Trim();
  71. }
  72. ArrayList list = new ArrayList();
  73. list.Add(jugeNo);
  74. list.Add(lotNo);
  75. list.Add(plinCode);
  76. List<MilPlanEntity> listSource = EntityHelper.GetData<MilPlanEntity>(
  77. "com.steering.mes.signature.FrmUpdatePlan.queryMilPlan", new object[] { list }, this.ob);
  78. MilPlanEntitybindingSource.DataSource = listSource;
  79. }
  80. /// <summary>
  81. /// 修改倍尺数
  82. /// </summary>
  83. private void updateSawNum()
  84. {
  85. this.ultraGrid1.UpdateData();
  86. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  87. if (uRow == null)
  88. {
  89. MessageUtil.ShowTips("请选择需要修改的炉信息!");
  90. return;
  91. }
  92. MilPlanEntity milPlanEntity = (MilPlanEntity)uRow.ListObject;
  93. if(!StringUtil.IsInt(milPlanEntity.SawNum.ToString2()))
  94. {
  95. MessageUtil.ShowTips("分切数必须为整数!");
  96. return;
  97. }
  98. if (int.Parse(milPlanEntity.SawNum.ToString2()) == 0)
  99. {
  100. MessageUtil.ShowTips("分切数必须大于零!");
  101. return;
  102. }
  103. DataTable ds = ServerHelper.GetData("com.steering.mes.signature.FrmUpdatePlan.doQuerySawResult", new object[] { milPlanEntity.Id.ToString(), milPlanEntity.JudgeStoveNo }, ob);
  104. if (int.Parse(ds.Rows[0][0].ToString()) > 0)
  105. {
  106. MessageUtil.ShowTips("已产生分切实绩,不允许进行分切数的修改!");
  107. return;
  108. }
  109. DataTable dp = ServerHelper.GetData("com.steering.mes.signature.FrmUpdatePlan.doQuerySamplePipe", new object[] { milPlanEntity.Id.ToString(), milPlanEntity.JudgeStoveNo }, ob);
  110. if (int.Parse(dp.Rows[0][0].ToString()) > 0)
  111. {
  112. MessageUtil.ShowTips("已分批取样,不允许进行分切数的修改!");
  113. return;
  114. }
  115. string milPlanTity = JSONFormat.Format(milPlanEntity);
  116. CoreClientParam ccp = new CoreClientParam();
  117. ccp.ServerName = "com.steering.mes.signature.FrmUpdatePlan";
  118. ccp.MethodName = "updateSawNum";
  119. ccp.ServerParams = new object[] { milPlanTity };
  120. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  121. if (ccp.ReturnCode != -1)
  122. {
  123. if (ccp.ReturnInfo.Equals("修改成功!"))
  124. {
  125. AddRackJZ(milPlanEntity.JudgeStoveNo.ToString(), milPlanEntity.ProPlanId.ToString(), milPlanEntity.GxPlanNo.ToString());
  126. queryMilPlan();
  127. MessageUtil.ShowTips(ccp.ReturnInfo);
  128. }
  129. else
  130. {
  131. MessageUtil.ShowTips(ccp.ReturnInfo);
  132. }
  133. }
  134. }
  135. /// <summary>
  136. /// 修改了分切数,删除原来的精整跟踪记录,再新增精整跟踪记录
  137. /// </summary>
  138. /// <param name="jugeNo"></param>
  139. private void AddRackJZ(String jugeNo, String proPlanId, String gxPlanNo)
  140. {
  141. NativeMethodNew na = new NativeMethodNew(this.ob);
  142. string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
  143. ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.AddRackJZ", new object[] { jugeNo, plinCode, proPlanId, gxPlanNo }, this.ob);
  144. }
  145. }
  146. }