FrmMatNo.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. 
  2. using com.steering.pss.ydm.entity;
  3. using Core.Mes.Client.Comm.Control;
  4. using Core.Mes.Client.Comm.Format;
  5. using Core.Mes.Client.Comm.Tool;
  6. using Core.StlMes.Client.PipeLeaveFactory.YdmObject;
  7. using CoreFS.CA06;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.PipeLeaveFactory
  18. {
  19. public partial class FrmMatNo : FrmBase
  20. {
  21. public FrmMatNo(UltraGridRow uRow,OpeBase ob)
  22. {
  23. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  24. InitializeComponent();
  25. row = uRow;
  26. _ob = ob;
  27. }
  28. public string flag = "";
  29. private UltraGridRow row = null;
  30. private OpeBase _ob;
  31. public string matNo = "";
  32. public string mesNo = "";//喷印管号
  33. public int acount = 0;
  34. public double wgt = 0.0;
  35. public double sumlength = 0.0;
  36. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  37. {
  38. switch (e.Tool.Key)
  39. {
  40. case "DoFrim":
  41. doFrim();
  42. break;
  43. case "Export":
  44. GridHelper.ulGridToExcel(ultraGrid1, "资源信息");
  45. break;
  46. case "DoClose":
  47. closeFrom();
  48. break;
  49. }
  50. }
  51. private void doQuer(UltraGridRow row)
  52. {
  53. MatInfoEntity matZcEntity = (MatInfoEntity)row.ListObject;
  54. string matZcTity = JSONFormat.Format(matZcEntity);
  55. List<MatZcMEntity5> listSource = EntityHelper.GetData<MatZcMEntity5>("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.doQueryDataMat", new object[] { matZcTity }, _ob);
  56. matZcMEntityBindingSource1.DataSource = listSource;
  57. }
  58. //确认
  59. private void doFrim()
  60. {
  61. this.ultraGrid1.UpdateData();
  62. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  63. foreach(UltraGridRow mRow in checkMagRows)
  64. {
  65. MatZcMEntity5 matBTity = (MatZcMEntity5)mRow.ListObject;
  66. matNo = matNo + matBTity.MatNo + ",";
  67. mesNo = mesNo + matBTity.MeasuringSeq + ",";
  68. acount = acount + 1;
  69. wgt = wgt + double.Parse(matBTity.ActWeight.ToString());
  70. sumlength = sumlength + double.Parse(matBTity.ActLen.ToString());
  71. }
  72. flag = "1";
  73. this.Close();
  74. }
  75. private void closeFrom()
  76. {
  77. flag = "0";
  78. this.Close();
  79. }
  80. private void FrmMatNo_Load(object sender, EventArgs e)
  81. {
  82. EntityHelper.ShowGridCaption<MatZcMEntity5>(ultraGrid1.DisplayLayout.Bands[0]);
  83. doQuer(row);
  84. }
  85. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  86. {
  87. this.ultraGrid1.UpdateData();
  88. if (e.Cell.Column.Key == "CHK")
  89. {
  90. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  91. if (checkMagRows.Count() == 0)
  92. {
  93. this.ultraLabel1.Text = "";
  94. return;
  95. }
  96. int acount = 0;
  97. double len = 0.0;
  98. double lenY = 0.0;
  99. double wgt = 0.0;
  100. foreach (UltraGridRow row in checkMagRows)
  101. {
  102. acount = acount + 1;
  103. wgt = wgt + double.Parse(row.Cells["ActWeight"].Text);
  104. len = len + double.Parse(row.Cells["ActLen"].Text);
  105. lenY = lenY + double.Parse(row.Cells["ActLenY"].Text);
  106. }
  107. this.ultraLabel1.Text = "已选信息:" + acount.ToString3() + "支" + " " + wgt.ToString3() + "吨" + " " + len.ToString3() + "米" +" "+ lenY + "英尺";
  108. }
  109. }
  110. }
  111. }