FrmPopItemWeight.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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.Windows.Forms;
  9. using Pur.Entity.configureEntity;
  10. using Core.Mes.Client.Comm.Control;
  11. using CoreFS.CA06;using Pur.Entity;using Pur.Entity;
  12. using Core.Mes.Client.Comm.Tool;
  13. using Core.Mes.Client.Comm.Server;
  14. using Infragistics.Win.UltraWinGrid;
  15. namespace Pur.Pop_upWindow
  16. {
  17. public partial class FrmPopItemWeight : FrmPmsBase
  18. {
  19. public string QstrWeightName = "";
  20. public string QstrWeightCode = "";
  21. public FrmPopItemWeight(OpeBase ob)
  22. {
  23. InitializeComponent();
  24. this.ob = ob;
  25. }
  26. /// <summary>
  27. /// 初始化界面加载数据
  28. /// </summary>
  29. /// <param name="sender"></param>
  30. /// <param name="e"></param>
  31. private void FrmPopItemWeight_Load(object sender, EventArgs e)
  32. {
  33. binUltraGrid("1215");
  34. }
  35. /// <summary>
  36. /// 刷新Grid数据源
  37. /// </summary>
  38. /// <param name="basecode"></param>
  39. private void binUltraGrid(string basecode)
  40. {
  41. this.dataTable1.Clear();
  42. DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { basecode }, this.ob);
  43. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  44. //不同颜色区分是否有效数据
  45. Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
  46. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  47. {
  48. row = ultraGrid1.Rows[i];
  49. if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
  50. {
  51. //row.Appearance.ForeColor = Color.Red;
  52. row.Hidden = true;
  53. }
  54. else
  55. {
  56. //row.Appearance.ForeColor = Color.Black;
  57. }
  58. }
  59. //内容自适应
  60. GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1, new UltraGridColumn[] {
  61. ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"]
  62. });
  63. }
  64. /// <summary>
  65. /// 筛选单位代码
  66. /// </summary>
  67. /// <param name="sender"></param>
  68. /// <param name="e"></param>
  69. private void txt_ITEM_UOM_CONEFFICIENT_TextChanged(object sender, EventArgs e)
  70. {
  71. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  72. {
  73. if (ugr.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
  74. {
  75. if (ugr.Cells["BASECODE"].Value.ToString().Contains(txt_UOM_CODE_QUERY.Text) && ugr.Cells["BASENAME"].Value.ToString().Contains(txt_UOM_NAME_QUERY.Text))
  76. {
  77. ugr.Hidden = false; //显示行
  78. }
  79. else
  80. {
  81. ugr.Hidden = true; //隐藏行
  82. }
  83. }
  84. }
  85. }
  86. /// <summary>
  87. /// 按钮控件
  88. /// </summary>
  89. /// <param name="sender"></param>
  90. /// <param name="e"></param>
  91. private void barsManagerButon_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  92. {
  93. switch (e.Tool.Key.ToString())
  94. {
  95. case "conFirmation":
  96. {
  97. if (ultraGrid1.ActiveRow != null)
  98. {
  99. if (ultraGrid1.ActiveRow == null || ultraGrid1.ActiveRow.Hidden == true)
  100. {
  101. MessageUtil.ShowTips("请选择一条数据");
  102. return;
  103. }
  104. QstrWeightName = ultraGrid1.ActiveRow.Cells["BASENAME"].Value.ToString();
  105. QstrWeightCode = ultraGrid1.ActiveRow.Cells["BASECODE"].Value.ToString();
  106. this.Close();
  107. }
  108. }
  109. break;
  110. case "ESC":
  111. {
  112. this.Close();
  113. }
  114. break;
  115. }
  116. }
  117. }
  118. }