frmPopItemUon.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 frmPopItemUon : FrmPmsBase
  18. {
  19. public string QstrWeightName = "";
  20. public string QstrWeightCode = "";
  21. public string QstrUOMCode = "";
  22. public string QstrUOMName = "";
  23. public string QstrItemUomConefficient = "";
  24. private string QstrWeight = "";
  25. public frmPopItemUon(OpeBase ob, string strWeight)
  26. {
  27. InitializeComponent();
  28. this.ob = ob;
  29. QstrWeight = strWeight;
  30. }
  31. /// <summary>
  32. /// 初始化界面加载数据
  33. /// </summary>
  34. /// <param name="sender"></param>
  35. /// <param name="e"></param>
  36. private void frmPopItemUon_Load(object sender, EventArgs e)
  37. {
  38. //binUltraGrid("1215");
  39. get_PurUoms();
  40. }
  41. /// <summary>
  42. /// 刷新Grid数据源
  43. /// </summary>
  44. /// <param name="basecode"></param>
  45. private void binUltraGrid(string basecode)
  46. {
  47. this.dataTable1.Clear();
  48. DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { basecode }, this.ob);
  49. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  50. //不同颜色区分是否有效数据
  51. Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
  52. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  53. {
  54. row = ultraGrid1.Rows[i];
  55. if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
  56. {
  57. //row.Appearance.ForeColor = Color.Red;
  58. row.Hidden = true;
  59. }
  60. else
  61. {
  62. //row.Appearance.ForeColor = Color.Black;
  63. }
  64. }
  65. //内容自适应
  66. GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1, new UltraGridColumn[] {
  67. ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"]
  68. });
  69. }
  70. /// <summary>
  71. /// 查询采购单位
  72. /// </summary>
  73. /// <param name="PurPlanMEntity"></param>
  74. public void get_PurUoms()
  75. {
  76. PurUomsEntity UomsEntity = new PurUomsEntity();
  77. if (QstrWeight != "")
  78. {
  79. UomsEntity.WeightUnitCode = QstrWeight;
  80. }
  81. //if (QstrWeight != "")
  82. //{
  83. // foreach (DataRow dr in dt.Rows)
  84. // {
  85. // if (dr["BASECODE"].ToString().Trim() == QstrWeight.Trim())
  86. // {
  87. // dt.Rows.Remove(dr);
  88. // }
  89. // }
  90. //}
  91. UomsEntity.Validflag = "1";
  92. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.UomsService", "find", new object[] { UomsEntity, 0, 0 });
  93. //按创建时间降序
  94. if (dt.Rows.Count > 0)
  95. {
  96. dt.DefaultView.Sort = "CREATETIME DESC";
  97. dt = dt.DefaultView.ToTable();
  98. }
  99. GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);//绑定物料分类表
  100. }
  101. /// <summary>
  102. /// 筛选单位代码
  103. /// </summary>
  104. /// <param name="sender"></param>
  105. /// <param name="e"></param>
  106. private void txt_ITEM_UOM_CONEFFICIENT_TextChanged(object sender, EventArgs e)
  107. {
  108. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  109. {
  110. if (ugr.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
  111. {
  112. if (ugr.Cells["UOMCODE"].Value.ToString().Contains(txt_UOM_CODE_QUERY.Text) && ugr.Cells["UOMNAME"].Value.ToString().Contains(txt_UOM_NAME_QUERY.Text) && ugr.Cells["WEIGHTUNIT"].Value.ToString().Contains(txt_WEIGHT_UNIT_QUERY.Text) && ugr.Cells["WEIGHTUNITCODE"].Value.ToString().Contains(txt_WEIGHT_UNIT_CODE_QUERY.Text))
  113. {
  114. ugr.Hidden = false; //显示行
  115. }
  116. else
  117. {
  118. ugr.Hidden = true; //隐藏行
  119. }
  120. }
  121. }
  122. }
  123. /// <summary>
  124. /// 筛选单位名称
  125. /// </summary>
  126. /// <param name="sender"></param>
  127. /// <param name="e"></param>
  128. private void textBox1_TextChanged(object sender, EventArgs e)
  129. {
  130. }
  131. /// <summary>
  132. /// 按钮控件
  133. /// </summary>
  134. /// <param name="sender"></param>
  135. /// <param name="e"></param>
  136. private void barsManagerButon_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  137. {
  138. switch (e.Tool.Key.ToString())
  139. {
  140. case "conFirmation":
  141. {
  142. if (ultraGrid1.ActiveRow != null)
  143. {
  144. if (ultraGrid1.ActiveRow == null || ultraGrid1.ActiveRow.Hidden==true)
  145. {
  146. MessageUtil.ShowTips("请选择一条数据");
  147. return;
  148. }
  149. QstrWeightName = ultraGrid1.ActiveRow.Cells["WEIGHTUNIT"].Value.ToString();
  150. QstrWeightCode = ultraGrid1.ActiveRow.Cells["WEIGHTUNITCODE"].Value.ToString();
  151. QstrUOMName = ultraGrid1.ActiveRow.Cells["UOMNAME"].Value.ToString();
  152. QstrUOMCode = ultraGrid1.ActiveRow.Cells["UOMCODE"].Value.ToString();
  153. QstrItemUomConefficient = ultraGrid1.ActiveRow.Cells["UOMCONEFFICIENT"].Value.ToString();
  154. this.Close();
  155. }
  156. }
  157. break;
  158. case "ESC":
  159. {
  160. this.Close();
  161. }
  162. break;
  163. }
  164. }
  165. }
  166. }