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 frmPopItemUon : FrmPmsBase
{
public string QstrWeightName = "";
public string QstrWeightCode = "";
public string QstrUOMCode = "";
public string QstrUOMName = "";
public string QstrItemUomConefficient = "";
private string QstrWeight = "";
public frmPopItemUon(OpeBase ob, string strWeight)
{
InitializeComponent();
this.ob = ob;
QstrWeight = strWeight;
}
///
/// 初始化界面加载数据
///
///
///
private void frmPopItemUon_Load(object sender, EventArgs e)
{
//binUltraGrid("1215");
get_PurUoms();
}
///
/// 刷新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"]
});
}
///
/// 查询采购单位
///
///
public void get_PurUoms()
{
PurUomsEntity UomsEntity = new PurUomsEntity();
if (QstrWeight != "")
{
UomsEntity.WeightUnitCode = QstrWeight;
}
//if (QstrWeight != "")
//{
// foreach (DataRow dr in dt.Rows)
// {
// if (dr["BASECODE"].ToString().Trim() == QstrWeight.Trim())
// {
// dt.Rows.Remove(dr);
// }
// }
//}
UomsEntity.Validflag = "1";
DataTable dt = this.execute("com.hnshituo.pur.configure.service.UomsService", "find", new object[] { UomsEntity, 0, 0 });
//按创建时间降序
if (dt.Rows.Count > 0)
{
dt.DefaultView.Sort = "CREATETIME DESC";
dt = dt.DefaultView.ToTable();
}
GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);//绑定物料分类表
}
///
/// 筛选单位代码
///
///
///
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["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))
{
ugr.Hidden = false; //显示行
}
else
{
ugr.Hidden = true; //隐藏行
}
}
}
}
///
/// 筛选单位名称
///
///
///
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
///
/// 按钮控件
///
///
///
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["WEIGHTUNIT"].Value.ToString();
QstrWeightCode = ultraGrid1.ActiveRow.Cells["WEIGHTUNITCODE"].Value.ToString();
QstrUOMName = ultraGrid1.ActiveRow.Cells["UOMNAME"].Value.ToString();
QstrUOMCode = ultraGrid1.ActiveRow.Cells["UOMCODE"].Value.ToString();
QstrItemUomConefficient = ultraGrid1.ActiveRow.Cells["UOMCONEFFICIENT"].Value.ToString();
this.Close();
}
}
break;
case "ESC":
{
this.Close();
}
break;
}
}
}
}