Frmjz.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.PnCost.Models;
  5. using CoreFS.CA06;
  6. using Infragistics.Win.UltraWinGrid;
  7. using System;
  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.PnCost.NewCost.弹窗
  16. {
  17. public partial class Frmjz : FrmBase
  18. {
  19. public Frmjz(OpeBase ob)
  20. {
  21. InitializeComponent();
  22. this.ob = ob;
  23. EntityHelper.ShowGridCaption<Tqnqc17Entity>(ultraGrid2.DisplayLayout.Bands[0]);
  24. //ultraGrid2.
  25. }
  26. public string bh = "", gx = "";
  27. private string _subBackLog = "";
  28. public string SubBackLog
  29. {
  30. get { return _subBackLog; }
  31. set { _subBackLog = value; }
  32. }
  33. private decimal? _Chencailv = null;
  34. public decimal? Chencailv
  35. {
  36. get { return _Chencailv; }
  37. set { _Chencailv = value; }
  38. }
  39. private decimal? _unitPrice = null;
  40. public decimal? UnitPrice
  41. {
  42. get { return _unitPrice; }
  43. set { _unitPrice = value; }
  44. }
  45. private void Query()
  46. {
  47. if(this.gxtext.Text != null && !this.gxtext.Text.Equals(""))
  48. {
  49. gx = this.gxtext.Text;
  50. }
  51. DataTable dtPsc = ServerHelper.GetData("com.steering.mes.cost.FrmTqnqd05.Query", new Object[] { bh, gx }, this.ob);
  52. if (dtPsc != null && dtPsc.Rows.Count > 0)
  53. {
  54. GridHelper.CopyDataToDatatable(ref dtPsc, ref dataTable1, true);
  55. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1);
  56. }
  57. else
  58. {
  59. dataTable1.Rows.Clear();
  60. }
  61. }
  62. private void Submit()
  63. {
  64. var rows = ultraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
  65. if (rows.Count() == 0)
  66. {
  67. MessageUtil.ShowWarning("请选择一行记录!");
  68. return;
  69. }
  70. _subBackLog = string.Join(";", rows.Select(a => a.GetValue("SUB_BACKLOG") + @"*" + a.GetValue("TIME_NUM")).ToArray());
  71. UnitPrice = new decimal(0);
  72. foreach (var unit in rows)
  73. {
  74. UnitPrice += decimal.Parse(unit.Cells["UNIT_PRICE"].Value.ToString()) * decimal.Parse(unit.Cells["TIME_NUM"].Value.ToString());//decimal.Parse(unit.GetValue("UNIT_PRICE")) * decimal.Parse(unit.GetValue("TIME_NUM"));
  75. }
  76. //_choicePlineName = string.Join(",", rows.Select(a => a.GetValue("plineName")).ToArray());
  77. var rowChenCailv = ultraGrid2.Rows.Where(a => a.GetValue("chk") == "True");
  78. if (rowChenCailv.Count() > 1)
  79. {
  80. MessageUtil.ShowWarning("成材率选项有误,只能进行单选");
  81. return;
  82. }
  83. foreach (var chencailv in rowChenCailv)
  84. {
  85. _Chencailv = decimal.Parse(chencailv.Cells["Chencailv"].Value.ToString());
  86. }
  87. // string str = row.Select(a => a.GetValue("Chencailv")).ToArray().ToString();
  88. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  89. }
  90. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  91. {
  92. //UltraGridRow row = e.Cell.Row;
  93. UltraGridRow row = this.ultraGrid1.ActiveRow;
  94. string unitcode = row.Cells["WHOLE_BACKLOG"].Value.ToString();
  95. List<Tqnqc17Entity> listSource = EntityHelper.GetData<Tqnqc17Entity>(
  96. "com.steering.mes.cost.FrmTqnqd05.QueryChencl", new object[] { unitcode }, this.ob);
  97. tqnqc17EntityBindingSource.DataSource = listSource;
  98. GridHelper.RefreshAndAutoSize(ultraGrid2);
  99. }
  100. private void ultraToolbarsManager1_ToolClick_1(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  101. {
  102. switch (e.Tool.Key)
  103. {
  104. case "查询":
  105. Query();
  106. break;
  107. case "确认":
  108. Submit();
  109. break;
  110. case "关闭":
  111. this.Close();
  112. break;
  113. }
  114. }
  115. }
  116. }