BlankPredictionSelect2.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Windows.Forms;
  6. using Core.Mes.Client.Comm.Format;
  7. using Core.Mes.Client.Comm.Tool;
  8. using Core.StlMes.Client.LgResMgt.Mcms.entity;
  9. using CoreFS.CA06;
  10. using Infragistics.Win.UltraWinEditors;
  11. using Infragistics.Win.UltraWinToolbars;
  12. namespace Core.StlMes.Client.LgResMgt.Mcms
  13. {
  14. public partial class BlankPredictionSelect2 : FrmBase
  15. {
  16. private List<CmmBlankPredictionEntityEdit> totals;
  17. private List<CmmWeightMatEntity> defaultList;
  18. private List<CmmBlankPredictionEntityEdit> currentTotal;
  19. public BlankPredictionSelect2(OpeBase _ob,CmmWeightRecordEntityFull defaultData)
  20. {
  21. InitializeComponent();
  22. ob = _ob;
  23. EntityHelper.ShowGridCaption<CmmBlankPredictionEntityEdit>(CrackDetectGrid.DisplayLayout.Bands[0]);
  24. totals = EntityHelper.GetData<CmmBlankPredictionEntityEdit>(
  25. "com.steering.Mcms.BlankPredictionServer.doQuery",
  26. new object[] { new Dictionary<string, object> { { "validflag", new List<string> { "1" } } } },
  27. ob);
  28. if (totals.Any())
  29. {
  30. totals = totals.OrderBy(p => p.ShippersName).ThenBy(p => p.OrderNo).ThenBy(p => p.JudgeStoveNo).ToList();
  31. }
  32. uceQueryShipperName.DataSource = totals.Select(p => p.ShippersName).Distinct().ToList();
  33. if (defaultData != null)
  34. {
  35. defaultList = defaultData.MatInfos;
  36. uceQueryShipperName.Text = defaultData.ShippersName;
  37. }
  38. }
  39. protected override void OnLoad(EventArgs e)
  40. {
  41. base.OnLoad(e);
  42. }
  43. private void CrackDetectGrid_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  44. {
  45. if (e.Cell.Column.Key != "Chk")
  46. {
  47. e.Cell.Row.Cells["Chk"].Value = true;
  48. e.Cell.Row.Cells["Chk"].Appearance.BackColor = Color.LightGreen;
  49. }
  50. else
  51. {
  52. CrackDetectGrid.UpdateData();
  53. if(!(bool)e.Cell.Row.Cells["Chk"].Value) e.Cell.Row.Cells["Chk"].Appearance.Reset();
  54. }
  55. }
  56. private void uceQueryShipperName_ValueChanged(object sender, System.EventArgs e)
  57. {
  58. cmmBlankPredictionEntityBindingSource.Clear();
  59. txtJudgeStove.Text = "";
  60. if (uceQueryShipperName.Text != "")
  61. {
  62. currentTotal =
  63. totals.Where(p => p.ShippersName == uceQueryShipperName.Text)
  64. .ToList();
  65. if (defaultList != null)
  66. {
  67. currentTotal.Where(p => defaultList.Any(q => q.DocumentNo == p.PredictionId)).ToList().ForEach(p =>
  68. {
  69. p.Chk = true;
  70. p.EditNum = defaultList.FirstOrDefault(q => q.DocumentNo == p.PredictionId).ActCount;
  71. });
  72. defaultList = null;
  73. }
  74. cmmBlankPredictionEntityBindingSource.DataSource = currentTotal;
  75. }
  76. }
  77. public string ShipperName { get;private set; }
  78. public List<CmmBlankPredictionEntityEdit> List { get;private set; }
  79. private void utnOk_Click(object sender, System.EventArgs e)
  80. {
  81. ShipperName = uceQueryShipperName.Text;
  82. CrackDetectGrid.UpdateData();
  83. if (currentTotal != null)
  84. {
  85. List = currentTotal.Where(p => p.Chk).ToList();
  86. }
  87. this.DialogResult = DialogResult.OK;
  88. }
  89. private void BlankPredictionSelect_Shown(object sender, EventArgs e)
  90. {
  91. this.Font = new Font("宋体", 12F);
  92. CrackDetectGrid.DisplayLayout.Override.HeaderAppearance.FontData.SizeInPoints =12;
  93. CrackDetectGrid.Font = Font;
  94. }
  95. private void txtJudgeStove_KeyUp(object sender, KeyEventArgs e)
  96. {
  97. if (currentTotal == null) return;
  98. cmmBlankPredictionEntityBindingSource.DataSource = string.IsNullOrWhiteSpace(txtJudgeStove.Text.Trim()) ? currentTotal :
  99. currentTotal.Where(p => p.JudgeStoveNo.IndexOf(txtJudgeStove.Text.Trim(), StringComparison.Ordinal) >= 0).ToList();
  100. cmmBlankPredictionEntityBindingSource.ResetBindings(false);
  101. }
  102. private void CrackDetectGrid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
  103. {
  104. if ((bool)e.Row.Cells["Chk"].Value) e.Row.Cells["Chk"].Appearance.BackColor = Color.LightGreen;
  105. }
  106. }
  107. }