frmDemandSplit.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Text.RegularExpressions;
  9. using System.Windows.Forms;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Format;
  12. using Core.Mes.Client.Comm.Tool;
  13. using Core.StlMes.Client.YdmBcPipeManage.Entity;
  14. using CoreFS.CA06;
  15. namespace Core.StlMes.Client.YdmBcPipeManage.Demand
  16. {
  17. public partial class frmDemandSplit : FrmBase
  18. {
  19. private readonly TmsDemandM tmsDemandMs;
  20. private string startnode = "";
  21. private string endnode = "";
  22. public frmDemandSplit(OpeBase _ob, TmsDemandM tmsDemand,List<MatBcMatS> data )
  23. {
  24. InitializeComponent();
  25. lblUnplnQty.Text = tmsDemand.UnPlanQtyVal.ToString3();
  26. lblUnplnWt.Text = tmsDemand.UnPlanWtVal.ToString3();
  27. this.ob = _ob;
  28. tmsDemandMs = tmsDemand;
  29. uneNumber.Value = tmsDemand.UnPlanQtyVal;
  30. EntityHelper.ShowGridCaption<MatBcMatS>(ultraGrid1.DisplayLayout.Bands[0]);
  31. data.ForEach(p=>p.chk= p.PlineName!= tmsDemand.DemandOrgDesc && p.QcmStaus =="合格" &&
  32. ( tmsDemand.TranClassCode!="TL" || p.StorageName!= tmsDemandMs.EndAreaDesc)
  33. );
  34. matBcMatSBindingSource.DataSource = data;
  35. ultraGrid1_CellChange(null, null);
  36. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "Memo");
  37. }
  38. private void ubtSave_Click(object sender, EventArgs e)
  39. {
  40. int splitNum = 0;
  41. if (uneNumber.Value == null || !int.TryParse(uneNumber.Value.ToString3(), out splitNum) || splitNum<=0)
  42. {
  43. MessageBox.Show("请输入正确的拆分支数");
  44. return;
  45. }
  46. var ccp = new CoreClientParam();
  47. ccp.ServerName = "com.steering.Demand.sever.TmsDemandServer";
  48. ccp.MethodName = "splitDemand";
  49. ccp.ServerParams = new object[]
  50. {
  51. tmsDemandMs.DemandNo,
  52. splitNum,
  53. UserInfo.GetUserName()
  54. };
  55. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  56. if (ccp.ReturnCode != -1)
  57. {
  58. MessageUtil.ShowTips(ccp.ReturnInfo);
  59. if (ccp.ReturnInfo.Equals("拆分成功!"))
  60. this.DialogResult = DialogResult.OK;
  61. else
  62. {
  63. uneNumber.Focus();
  64. uneNumber.SelectAll();
  65. }
  66. }
  67. }
  68. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  69. {
  70. ultraGrid1.UpdateData();
  71. try
  72. {
  73. uneNumber.Value =
  74. (matBcMatSBindingSource.DataSource as List<MatBcMatS>).Where(p => p.chk).Sum(p => p.ActCount);
  75. }
  76. catch (Exception)
  77. {
  78. }
  79. }
  80. }
  81. }