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 CoreFS.CA03;
using CoreFS.CA04;
using CoreFS.CA06;
using System.Collections;
using Infragistics.Win.UltraWinGrid;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Tool;
namespace Core.StlMes.Client.SaleOrder
{
public partial class dlgPSCSelect : FrmBase
{
public dlgPSCSelect()
{
InitializeComponent();
}
public dlgPSCSelect(OpeBase ob)
{
InitializeComponent();
this.ob = ob;
}
///
/// 模糊查询条件是否可用
///
///
///
private void chkProduct_CheckedChanged(object sender, EventArgs e)
{
if (!chkProduct.Checked)
{
txtProductDesc.Text = "";
}
txtProductDesc.Enabled = chkProduct.Checked;
}
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
if ("doQuery".Equals(e.Tool.Key))
{
//查询
doQuery();
}
else if ("doUpdate".Equals(e.Tool.Key))
{
doUpdate();
}
else
{
this.Close();
}
}
///
/// 委托方法
///
///
public delegate void GetPscSelectHander(DataRow row);
public event GetPscSelectHander GetPscSelect;
///
/// 确认
///
private void doUpdate()
{
string psc = ultraGrid2.ActiveRow.Cells["PSC"].Value.ToString();
string strVal = ultraGrid2.ActiveRow.Cells["VALIDFLAG"].Value.ToString();
string strUnit_Desc = ultraGrid2.ActiveRow.Cells["UNIT_DESC"].Value.ToString();
string strMsc = ultraGrid2.ActiveRow.Cells["MSC"].Value.ToString();
if (strVal.Equals("未生效"))
{
MessageUtil.ShowWarning("所选择的产品码对应的冶金规范码:"+strMsc+"标准未生效,请联系:" + strUnit_Desc+"维护!");
this.Close();
return;
}
foreach (DataRow row in this.dataTable1.Rows)
{
if (psc.Equals(row["PSC"].ToString()))
{
GetPscSelect(row);
this.Close();
return;
}
}
}
///
/// 查询功能
///
private void doQuery()
{
DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CorePscSelect.doQuery", new Object[] { txtProductDesc.Text.Trim() }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
foreach (UltraGridRow ugr in ultraGrid2.Rows)
{
if (ugr.Cells["VALIDFLAG"].Value.ToString() == "无效" || ugr.Cells["VALIDFLAG"].Value.ToString() == "未生效")
{
ugr.Cells["VALIDFLAG"].Appearance.BackColor = Color.MistyRose;
}
}
////列自适应
//GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid2, new UltraGridColumn[] {
//});
}
private void dlgPSCSelect_Load(object sender, EventArgs e)
{
doQuery();
}
///
/// 重写基类load事件,屏蔽平台过滤功能。
///
///
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
ultraGrid2.DisplayLayout.Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.FilterRow;
ultraGrid2.DisplayLayout.Override.FilterOperatorDefaultValue = Infragistics.Win.UltraWinGrid.FilterOperatorDefaultValue.Contains;
//ultraGrid2.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect;
}
private void ultraGrid2_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
{
if (e.Cell.Row.Index == -1)
{
return;
}
Infragistics.Win.UltraWinGrid.UltraGridRow row = ultraGrid2.ActiveRow;
if (row != null)
{
this.doUpdate();
this.Close();
}
}
}
}