FrmSplit.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using Core.Mes.Client.Comm.Format;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.YdmBcPipeManage.Entity;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. namespace Core.StlMes.Client.YdmBcPipeManage
  16. {
  17. public partial class FrmSplit : FrmBase
  18. {
  19. OpeBase _ob;
  20. public string disOk = "";
  21. MatBcMEntity2 matBcEntity = null;
  22. private string _userName = "";
  23. public FrmSplit(OpeBase ob,MatBcMEntity2 matBctity,string userName)
  24. {
  25. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  26. InitializeComponent();
  27. _ob = ob;
  28. _userName = userName;
  29. matBcEntity = matBctity;
  30. }
  31. /// <summary>
  32. /// 重写基类方法
  33. /// </summary>
  34. /// <param name="sender"></param>
  35. /// <param name="To
  36. /// olbarKey"></param>
  37. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  38. {
  39. switch (e.Tool.Key)
  40. {
  41. case "ComFrim":
  42. doFrim();
  43. break;
  44. case "Close":
  45. this.Close();
  46. break;
  47. }
  48. }
  49. private void doFrim()
  50. {
  51. this.ultraGrid1.UpdateData();
  52. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  53. if (checkMagRows.Count() == 0)
  54. {
  55. return;
  56. }
  57. string matBcEntityZ = JSONFormat.Format(matBcEntity);
  58. ArrayList parmList = new ArrayList();
  59. foreach (UltraGridRow row in checkMagRows)
  60. {
  61. MatBcMEntity matBc = (MatBcMEntity)row.ListObject;
  62. if (!StringUtil.IsInt(matBc.ActCount.ToString3()) || int.Parse(matBc.ActCount.ToString3()) <= 0)
  63. {
  64. MessageUtil.ShowTips("分切支数需为整数并且分切支数需大于0!");
  65. return;
  66. }
  67. if (!StringUtil.IsDouble(matBc.ActLen.ToString3()) || double.Parse(matBc.ActLen.ToString3()) <= 0)
  68. {
  69. MessageUtil.ShowTips("分切后长度需为数字型并且分切后长度需大于0!");
  70. return;
  71. }
  72. string matBcEntityS = JSONFormat.Format(matBc);
  73. parmList.Add(matBcEntityS);
  74. }
  75. CoreClientParam ccp = new CoreClientParam();
  76. ccp.ServerName = "com.steering.ydm.bc.FrmSplittingManage";
  77. ccp.MethodName = "doSpliting";
  78. ccp.ServerParams = new object[] {matBcEntityZ,parmList,_userName };
  79. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  80. if (ccp.ReturnCode != -1)
  81. {
  82. if (ccp.ReturnInfo.Equals("分切成功!"))
  83. {
  84. disOk = "1";
  85. this.Close();
  86. MessageUtil.ShowTips(ccp.ReturnInfo);
  87. }
  88. else
  89. {
  90. MessageUtil.ShowTips(ccp.ReturnInfo);
  91. }
  92. }
  93. }
  94. private void FrmSplit_Load(object sender, EventArgs e)
  95. {
  96. EntityHelper.ShowGridCaption<MatBcMEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  97. }
  98. }
  99. }