using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pur.Entity.configureEntity;
using Core.Mes.Client.Comm.Control;
using CoreFS.CA06;using Pur.Entity;using Pur.Entity;
using Core.Mes.Client.Comm.Tool;
using Core.Mes.Client.Comm.Server;
using Infragistics.Win.UltraWinGrid;
namespace Pur.Pop_upWindow
{
public partial class FrmPopItemWeight : FrmPmsBase
{
public string QstrWeightName = "";
public string QstrWeightCode = "";
public FrmPopItemWeight(OpeBase ob)
{
InitializeComponent();
this.ob = ob;
}
///
/// 初始化界面加载数据
///
///
///
private void FrmPopItemWeight_Load(object sender, EventArgs e)
{
binUltraGrid("1215");
}
///
/// 刷新Grid数据源
///
///
private void binUltraGrid(string basecode)
{
this.dataTable1.Clear();
DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { basecode }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
//不同颜色区分是否有效数据
Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
for (int i = 0; i < ultraGrid1.Rows.Count; i++)
{
row = ultraGrid1.Rows[i];
if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
{
//row.Appearance.ForeColor = Color.Red;
row.Hidden = true;
}
else
{
//row.Appearance.ForeColor = Color.Black;
}
}
//内容自适应
GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1, new UltraGridColumn[] {
ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"]
});
}
///
/// 筛选单位代码
///
///
///
private void txt_ITEM_UOM_CONEFFICIENT_TextChanged(object sender, EventArgs e)
{
foreach (UltraGridRow ugr in ultraGrid1.Rows)
{
if (ugr.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
{
if (ugr.Cells["BASECODE"].Value.ToString().Contains(txt_UOM_CODE_QUERY.Text) && ugr.Cells["BASENAME"].Value.ToString().Contains(txt_UOM_NAME_QUERY.Text))
{
ugr.Hidden = false; //显示行
}
else
{
ugr.Hidden = true; //隐藏行
}
}
}
}
///
/// 按钮控件
///
///
///
private void barsManagerButon_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key.ToString())
{
case "conFirmation":
{
if (ultraGrid1.ActiveRow != null)
{
if (ultraGrid1.ActiveRow == null || ultraGrid1.ActiveRow.Hidden == true)
{
MessageUtil.ShowTips("请选择一条数据");
return;
}
QstrWeightName = ultraGrid1.ActiveRow.Cells["BASENAME"].Value.ToString();
QstrWeightCode = ultraGrid1.ActiveRow.Cells["BASECODE"].Value.ToString();
this.Close();
}
}
break;
case "ESC":
{
this.Close();
}
break;
}
}
}
}