ComPlanEndZg.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Core.Mes.Client.Comm.Tool;
  10. using Core.StlMes.Client.PlnSaleOrd.炉计划.Entity;
  11. using Core.Mes.Client.Comm.Control;
  12. using Infragistics.Win.UltraWinGrid;
  13. using CoreFS.CA06;
  14. using System.Collections;
  15. using Core.Mes.Client.Comm.Server;
  16. namespace Core.StlMes.Client.PlnSaleOrd.炉计划
  17. {
  18. public partial class ComPlanEndZg : UserControl
  19. {
  20. public string ordLnDlyPk = "";
  21. public string indexSeq = "";
  22. public string carftSeq = "";
  23. public ComPlanEndZg()
  24. {
  25. InitializeComponent();
  26. }
  27. public bool flag = false;
  28. private void ComPlanEndZg_Load(object sender, EventArgs e)
  29. {
  30. EntityHelper.ShowGridCaption<PlnOrderZgSOEntityGp>(ultraGridZgS.DisplayLayout.Bands[0]);
  31. }
  32. /// <summary>
  33. /// 查询轧管订单信息
  34. /// </summary>
  35. public void QueryPlanZg(string materialNo, string gradecode, OpeBase ob)
  36. {
  37. List<PlnOrderZgSOEntityGp> listSource = EntityHelper.GetData<PlnOrderZgSOEntityGp>("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.getPlnOrderZgS",
  38. new object[] { materialNo, gradecode, "D" }, ob);
  39. plnOrderZgSOEntityBindingSource.DataSource = listSource;
  40. GridHelper.RefreshAndAutoSize(ultraGridZgS);
  41. foreach (UltraGridRow ugr in ultraGridZgS.Rows)
  42. {
  43. #region 赋值LJ,装炉,出库
  44. int numLj = 0;
  45. double wtLj = 0;
  46. if (!ugr.Cells["LjNum"].Text.Equals(""))
  47. {
  48. numLj = int.Parse(ugr.Cells["LjNum"].Value.ToString());
  49. wtLj = double.Parse(ugr.Cells["LjWeight"].Value.ToString());
  50. }
  51. int gpNum = 0;
  52. double gpWt = 0;
  53. if (!ugr.Cells["GpreqNum"].Text.Equals(""))
  54. {
  55. gpNum = int.Parse(ugr.Cells["GpreqNum"].Value.ToString());
  56. gpWt = double.Parse(ugr.Cells["GpreqWeight"].Value.ToString());
  57. }
  58. if (gpNum - numLj <= 0)
  59. {
  60. ugr.Cells["ReallNum"].Value = "0";
  61. ugr.Cells["ReallWt"].Value = "0";
  62. }
  63. else
  64. {
  65. ugr.Cells["ReallNum"].Value = (gpNum - numLj).ToString();
  66. ugr.Cells["ReallWt"].Value = (gpWt - wtLj).ToString("f3");
  67. }
  68. #endregion
  69. }
  70. plnOrderZgSOEntityBindingSource.DataSource = listSource.Where(w => w.ReallWt > 0).ToList();
  71. if (listSource.Count == 0)
  72. {
  73. ordLnDlyPk = "";
  74. }
  75. }
  76. /// <summary>
  77. /// 利库
  78. /// </summary>
  79. /// <param name="materialNo"></param>
  80. /// <param name="ob"></param>
  81. public void doAddLibrary(ArrayList list, string userName, OpeBase ob, int countCic, string specCic)
  82. {
  83. UltraGridRow row = ultraGridZgS.ActiveRow;
  84. if (row == null) return;
  85. int count = 0;
  86. string proPlanId = "";
  87. string gxPlanNo = "";
  88. foreach (UltraGridRow ugr in ultraGridZgS.Rows)
  89. {
  90. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  91. {
  92. count++;
  93. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  94. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  95. }
  96. }
  97. if (count == 0 || count > 1)
  98. {
  99. MessageUtil.ShowTips("请选择一个轧管订单!");
  100. return;
  101. }
  102. if (specCic.Equals("")&&countCic == 0)
  103. {
  104. MessageUtil.ShowTips("库存CIC在订单炼钢CIC集合里没有,请指定CIC!");
  105. return;
  106. }
  107. if (MessageUtil.ShowYesNoAndQuestion("是否确认利库?") ==
  108. DialogResult.No)
  109. return;
  110. PlanComm.WaitFromOpen(this.Cursor);
  111. CoreClientParam ccp = new CoreClientParam();
  112. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  113. ccp.MethodName = "doAddLibrary";
  114. ccp.ServerParams = new object[] { list,proPlanId,gxPlanNo,userName };
  115. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  116. PlanComm.WaitFromColse(this.Cursor);
  117. if (ccp.ReturnCode == -1) return;
  118. MessageUtil.ShowTips(ccp.ReturnInfo);
  119. if (ccp.ReturnInfo.Equals("利库成功!"))
  120. {
  121. flag = true;
  122. }
  123. }
  124. /// <summary>
  125. /// 物料改判
  126. /// </summary>
  127. /// <param name="materialNo"></param>
  128. /// <param name="ob"></param>
  129. public void doSentence(ArrayList list, string userName, OpeBase ob)
  130. {
  131. UltraGridRow row = ultraGridZgS.ActiveRow;
  132. if (row == null) return;
  133. int count = 0;
  134. string proPlanId = "";
  135. string gxPlanNo = "";
  136. foreach (UltraGridRow ugr in ultraGridZgS.Rows)
  137. {
  138. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  139. {
  140. count++;
  141. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  142. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  143. }
  144. }
  145. if (count == 0 || count > 1)
  146. {
  147. MessageUtil.ShowTips("请选择一个轧管订单!");
  148. return;
  149. }
  150. if (MessageUtil.ShowYesNoAndQuestion("是否确认改判?") ==
  151. DialogResult.No)
  152. return;
  153. PlanComm.WaitFromOpen(this.Cursor);
  154. CoreClientParam ccp = new CoreClientParam();
  155. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  156. ccp.MethodName = "doSentence";
  157. ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, userName };
  158. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  159. PlanComm.WaitFromColse(this.Cursor);
  160. if (ccp.ReturnCode == -1) return;
  161. MessageUtil.ShowTips(ccp.ReturnInfo);
  162. if (ccp.ReturnInfo.Equals("改判成功!"))
  163. {
  164. flag = true;
  165. }
  166. }
  167. private void ultraGridZgS_AfterRowActivate(object sender, EventArgs e)
  168. {
  169. UltraGridRow row = ultraGridZgS.ActiveRow;
  170. if (row == null) return;
  171. ordLnDlyPk = row.Cells["OrdLnDlyPk"].Value.ToString();
  172. indexSeq = row.Cells["IndexSeq"].Value.ToString();
  173. carftSeq = row.Cells["CraftSeq"].Value.ToString();
  174. //string bom = row.Cells["Bom"].Value.ToString();
  175. }
  176. }
  177. }