ColNoChanges.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. using Core.Mes.Client.Comm.Server;
  2. using CoreFS.CA06;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. namespace Core.StlMes.Client.ZGMil.NodeResultQuery
  12. {
  13. public partial class ColNoChanges : FrmBase
  14. {
  15. private OpeBase ob;
  16. public OpeBase Ob
  17. {
  18. get { return ob; }
  19. set { ob = value; }
  20. }
  21. private string node = "";
  22. private string colno = "";
  23. private string HeatNo = "";//炉号
  24. private string proPlanId = null;//轧管订单编号
  25. private string gxPlanNo = null;//工序排产序号
  26. private string PlineCode = "";//产线
  27. private string StrColNofrom = "";
  28. private string StrColNoto = "";
  29. private int Num = 0;//调整支数
  30. private int Num1 = 0;//可调整支数
  31. private int Num2 = 0;
  32. private int Num3 = 0;
  33. private int TsNum = 0;
  34. public ColNoChanges()
  35. {
  36. //InitializeComponent();
  37. }
  38. public ColNoChanges(OpeBase ob, string Node, string heatno, string plinecode, string ProPlanId, string GxPlanNo)
  39. {
  40. InitializeComponent();
  41. this.Ob = ob;
  42. this.HeatNo = heatno;
  43. this.PlineCode = plinecode;
  44. this.proPlanId = ProPlanId;
  45. this.gxPlanNo = GxPlanNo;
  46. this.node = Node.Substring(0, 1);
  47. this.colno = Node.Substring(1, 1);
  48. this.ColNofrom.Items.Add("1#");
  49. this.ColNofrom.Items.Add("2#");
  50. this.ColNoTo.Items.Add("1#");
  51. this.ColNoTo.Items.Add("2#");
  52. if (this.PlineCode.Equals("C010"))
  53. {
  54. this.ColNofrom.Items.Add("3#");
  55. this.ColNoTo.Items.Add("3#");
  56. }
  57. this.ColNofrom.Text = "1#";
  58. this.ColNoTo.Text = "2#";
  59. RefreshAll();
  60. }
  61. /// <summary>
  62. /// 刷新界面或初始化
  63. /// </summary>
  64. public void RefreshAll()
  65. {
  66. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetCount", new object[] { HeatNo, node, "1","1" }, this.ob);
  67. if (dt1.Rows.Count > 0)
  68. {
  69. //ScrapNumBefore = int.Parse(dt.Rows[0]["counts"].ToString()) - ScrapNumBefore;
  70. if (!string.IsNullOrEmpty(dt1.Rows[0]["counts"].ToString()))
  71. {
  72. this.Num1 = int.Parse(dt1.Rows[0]["counts"].ToString());
  73. }
  74. }
  75. else
  76. {
  77. this.Num1 = 0;
  78. }
  79. DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetCount", new object[] { HeatNo, node, "2", "2" }, this.ob);
  80. if (dt2.Rows.Count > 0)
  81. {
  82. //ScrapNumBefore = int.Parse(dt.Rows[0]["counts"].ToString()) - ScrapNumBefore;
  83. this.Num2 = int.Parse(dt2.Rows[0]["counts"].ToString());
  84. }
  85. else
  86. {
  87. this.Num2 = 0;
  88. }
  89. if (PlineCode.Equals("C010"))//168机组三个台子
  90. {
  91. DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetCount", new object[] { HeatNo, node, "3","3" }, this.ob);
  92. if (dt3.Rows.Count > 0)
  93. {
  94. //ScrapNumBefore = int.Parse(dt.Rows[0]["counts"].ToString()) - ScrapNumBefore;
  95. this.Num3 = int.Parse(dt3.Rows[0]["counts"].ToString());
  96. }
  97. else
  98. {
  99. this.Num3 = 0;
  100. }
  101. }
  102. this.TxtNum1.Value = Num1.ToString();
  103. this.TxtNum1.Enabled = false;
  104. this.TxtNum2.Value = Num2.ToString();
  105. this.TxtNum2.Enabled = false;
  106. this.TxtNum3.Value = Num3.ToString();
  107. this.TxtNum3.Enabled = false;
  108. }
  109. /// <summary>
  110. /// 是否要插入下线实绩表
  111. /// </summary>
  112. /// <returns></returns>
  113. public bool isInsert()
  114. {
  115. bool result = true;
  116. string pro = "";
  117. if (node.Equals("0"))
  118. {
  119. pro = "JZ";
  120. }
  121. if (node.Equals("1"))
  122. {
  123. pro = "TS";
  124. }
  125. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.isInsertOfflineResult", new object[] { HeatNo, pro, proPlanId, gxPlanNo }, this.ob);
  126. if (dt.Rows.Count > 0)
  127. {
  128. result = false;
  129. }
  130. return result;
  131. }
  132. /// <summary>
  133. /// 确认
  134. /// </summary>
  135. /// <param name="sender"></param>
  136. /// <param name="e"></param>
  137. private void BtnOk_Click(object sender, EventArgs e)
  138. {
  139. if (!isInsert())
  140. {
  141. //MessageBox.Show("炉号:【" + HeatNo + "】已进行下线操作,不允许进行子管分配调整", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  142. //return;
  143. }
  144. if (ColNofrom.Text.Equals("1#"))
  145. {
  146. Num = int.Parse(this.TxtNumFrom.Value.ToString());
  147. if (Num > Num1)
  148. {
  149. MessageBox.Show("您输入的支数过大,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  150. return;
  151. }
  152. //做个判断 探伤工序是否有那么多可调整支数
  153. //DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetTsNum", new object[] { HeatNo, "1" }, this.ob);
  154. //if (dt1.Rows.Count > 0)
  155. //{
  156. // TsNum = int.Parse(dt1.Rows[0]["counts"].ToString());
  157. //}
  158. //else
  159. //{
  160. // TsNum = 0;
  161. //}
  162. //if (Num > TsNum)
  163. //{
  164. // MessageBox.Show("您输入的支数过大,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  165. // return;
  166. //}
  167. }
  168. if (ColNofrom.Text.Equals("2#"))
  169. {
  170. Num = int.Parse(this.TxtNumFrom.Value.ToString());
  171. if (Num > Num2)
  172. {
  173. MessageBox.Show("您输入的支数过大,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  174. return;
  175. }
  176. }
  177. if (ColNofrom.Text.Equals("3#"))
  178. {
  179. Num = int.Parse(this.TxtNumFrom.Value.ToString());
  180. if (Num > Num3)
  181. {
  182. MessageBox.Show("您输入的支数过大,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  183. return;
  184. }
  185. }
  186. StrColNofrom = this.ColNofrom.Text.ToString().Substring(0, 1);
  187. StrColNoto = this.ColNoTo.Text.ToString().Substring(0, 1);
  188. //if (node.Equals("0"))//2016-03-23注释
  189. //{
  190. // int testnum = 0;
  191. // DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetTestingChangeNum", new object[] { HeatNo, StrColNofrom }, this.ob);
  192. // if (dt1.Rows.Count > 0)
  193. // {
  194. // testnum = Convert.ToInt16(dt1.Rows[0]["counts"].ToString());
  195. // }
  196. // if (testnum < Num)
  197. // {
  198. // MessageBox.Show("探伤工序" + StrColNofrom + "#台只有" + testnum + "支子管可调整,请确认后重新进行子管分台操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  199. // return;
  200. // }
  201. //}
  202. if (StrColNofrom.Equals(StrColNoto))
  203. {
  204. MessageBox.Show("调整的子管来源台号和去向台号一致,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  205. return;
  206. }
  207. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmOffLine.ColNoChanges", new object[] { HeatNo,this.node ,Num, StrColNofrom, StrColNoto }, this.ob);
  208. if (count > 0)
  209. {
  210. //MessageBox.Show("子管换台调整成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Information);
  211. }
  212. RefreshAll();
  213. }
  214. private void ColNoChanges_FormClosed(object sender, FormClosedEventArgs e)
  215. {
  216. this.DialogResult = DialogResult.OK;
  217. }
  218. }
  219. }