FrmMatGroupManage_Split.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Server;
  12. using Core.Mes.Client.Comm.Tool;
  13. using Core.StlMes.Client.YdmStuffManage.Entity;
  14. using CoreFS.CA06;
  15. using Core.Mes.Client.Comm.Format;
  16. namespace Core.StlMes.Client.YdmStuffManage
  17. {
  18. public partial class FrmMatGroupManage_Split : FrmBase
  19. {
  20. public FrmMatGroupManage_Split(List<MatGpMEntity> list)
  21. {
  22. InitializeComponent();
  23. matGpMEntitys = list;
  24. }
  25. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  26. {
  27. switch (e.Tool.Key)
  28. {
  29. case "doConfirm":
  30. doConfirm();
  31. break;
  32. case "Close":
  33. this.Close();
  34. break;
  35. }
  36. }
  37. List<MatGpMEntity> matGpMEntitys = new List<MatGpMEntity>();
  38. /// <summary>
  39. /// 增加运费
  40. /// </summary>
  41. public void doConfirm()
  42. {
  43. try
  44. {
  45. this.ultraGrid1.UpdateData();
  46. if (ultraGrid1.Rows.Count == 0)
  47. {
  48. MessageUtil.ShowTips("请输入需要拆分的数据!");
  49. return;
  50. }
  51. double countLen = 0;
  52. double countSplitLen = 0;
  53. foreach (var item in matGpMEntitys)
  54. {
  55. countLen += double.Parse(item.ActLen.ToString());
  56. }
  57. string matGpMEntityStr = JSONFormat.Format(matGpMEntitys[0]);
  58. ArrayList all = new ArrayList();
  59. foreach (var item in this.ultraGrid1.Rows)
  60. {
  61. if (item.Cells["ActCount"].Value.ToString() == "" || item.Cells["ActCount"].Value.ToString() == "0")
  62. {
  63. MessageUtil.ShowTips("请输入需要拆分的支数!");
  64. return;
  65. }
  66. if (item.Cells["ActLen"].Value.ToString() == "" || item.Cells["ActLen"].Value.ToString() == "0")
  67. {
  68. MessageUtil.ShowTips("请输入需要拆分的坯料长度!");
  69. return;
  70. }
  71. ArrayList parm = new ArrayList();
  72. parm.Add(item.Cells["ActLen"].Value.ToString());
  73. parm.Add(item.Cells["ActCount"].Value.ToString());
  74. //parm.Add(item.Cells["ActWeight"].Value.ToString());
  75. all.Add(parm);
  76. countSplitLen += double.Parse(item.Cells["ActLen"].Value.ToString()) * int.Parse(item.Cells["ActCount"].Value.ToString());
  77. }
  78. if (countLen != countSplitLen) {
  79. MessageUtil.ShowTips("拆分后的坯料长度不等于该炉号坯料长度!");
  80. return;
  81. }
  82. if (MessageUtil.ShowYesNoAndQuestion("是否确定添加?") == DialogResult.No)
  83. {
  84. return;
  85. }
  86. CoreClientParam ccp = new CoreClientParam();
  87. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmMatGroupManage";
  88. ccp.MethodName = "doSplit";
  89. ccp.ServerParams = new object[] { matGpMEntityStr, all };
  90. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  91. if (ccp.ReturnCode != -1)
  92. {
  93. if (ccp.ReturnInfo.Equals("拆分成功!"))
  94. {
  95. MessageUtil.ShowTips(ccp.ReturnInfo);
  96. this.Close();
  97. }
  98. else
  99. {
  100. MessageUtil.ShowTips(ccp.ReturnInfo);
  101. }
  102. }
  103. }
  104. catch (System.Exception ex)
  105. {
  106. MessageUtil.ShowTips("操作失败:" + ex.Message);
  107. }
  108. }
  109. }
  110. }