ucHj.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.LgClassModel;
  6. using Core.StlMes.Client.LgCommon;
  7. using Core.StlMes.Client.PnCost.Models;
  8. using Infragistics.Win.UltraWinGrid;
  9. using Infragistics.Win;
  10. using System.Data;
  11. using Core.Mes.Client.Comm.Server;
  12. using CoreFS.CA06;
  13. using System.Windows.Forms;
  14. namespace Core.StlMes.Client.PnCost
  15. {
  16. public partial class ucHj : ucNewResBase
  17. {
  18. public ucHj()
  19. {
  20. InitializeComponent();
  21. ClsControlPack.SetUltraGridStyle(ugData, 1);
  22. }
  23. protected OpeBase Ob;
  24. public void SetBase(OpeBase ob)
  25. {
  26. Ob = ob;
  27. }
  28. protected override void OnLoad(EventArgs e)
  29. {
  30. base.OnLoad(e);
  31. EntityHelper.ShowGridCaption<TqnqD01Entity>(ugData.DisplayLayout.Bands[0]);
  32. ugData.DisplayLayout.Bands[0].Override.HeaderClickAction = HeaderClickAction.Select;
  33. SetData(new List<object> { new TqnqD01Entity() });
  34. SetControlDelegate();
  35. }
  36. protected virtual void SetControlDelegate()
  37. {
  38. //ugData.AfterCellUpdate += new CellEventHandler(ugData_AfterCellUpdate);
  39. //ugData.KeyDown += new KeyEventHandler(ugData_KeyDown);
  40. //ugData.KeyPress += ugData_KeyPress;
  41. ugData.ClickCellButton += new CellEventHandler(ugData_ClickCellButton);
  42. }
  43. protected virtual void ugData_ClickCellButton(object sender, CellEventArgs e)
  44. {
  45. try
  46. {
  47. if (e.Cell.Column.DataType == typeof(Decimal) || e.Cell.Column.DataType == typeof(Decimal?))
  48. {
  49. frmInputDecimal frm = new frmInputDecimal(Convert.ToString(e.Cell.Text));
  50. frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size);
  51. if (frm.ShowDialog() == DialogResult.OK)
  52. {
  53. if (!frm.ValueChanged) return;
  54. e.Cell.Value = frm.Value;
  55. ugData.UpdateData();
  56. }
  57. }
  58. }
  59. catch { }
  60. }
  61. public TqnqD01Entity TqnqD01Entity()
  62. {
  63. UltraGridRow row = ugData.Rows[0];
  64. return (TqnqD01Entity)row.ListObject;
  65. }
  66. public void setHj(TqnqD01Entity entity)
  67. {
  68. if (entity.SmeltCode.Equals("") || entity.SmeltCode == null) return;
  69. if (entity.SgSign.Equals("") || entity.SgSign == null) return;
  70. if (entity.SgStd.Equals("") || entity.SgStd == null) return;
  71. if (entity.Cic.Equals("") || entity.Cic == null) return;
  72. if (entity.InSteelTypeCode.Equals("") || entity.InSteelTypeCode == null) return;
  73. List<TqnqD01Entity> data = EntityHelper.GetData<TqnqD01Entity>(
  74. "com.steering.mes.cost.FrmTqnqd01.QueryDexh", new object[] { entity.Cic, entity.SgSign }, Ob);
  75. if (data != null && data.Count > 0)
  76. {
  77. ugData.DataSource = data;
  78. }
  79. for (int i = 0; i < ugData.Rows.Count; i++)
  80. {
  81. ugData.Rows[i].Cells["OutSmeltCode"].Value = entity.SmeltCode;
  82. ugData.Rows[i].Cells["OutSgSign"].Value = entity.SgSign;
  83. ugData.Rows[i].Cells["OutSgStd"].Value = entity.SgStd;
  84. ugData.Rows[i].Cells["OutSteelTypeCode"].Value = entity.InSteelTypeCode;
  85. }
  86. }
  87. }
  88. }