using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win;
using Infragistics.Win.UltraWinEditors;
using CoreFS.CA06;
using System.Data;
namespace Core.LgMes.Client.LgResMgt
{
///
/// LFFLInfo 的摘要说明。
///
public class LFFLInfo : CoreFS.CA06.FrmBase
{
private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1;
private System.Data.DataSet dataSet1;
private System.Data.DataTable dataTable1;
private System.Data.DataColumn dataColumn1;
private System.Data.DataColumn dataColumn2;
private System.Data.DataColumn dataColumn3;
private System.Data.DataColumn dataColumn4;
private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox1;
private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox2;
private Infragistics.Win.Misc.UltraButton ClearBtn;
private Infragistics.Win.Misc.UltraButton ExitBtn;
private Infragistics.Win.Misc.UltraButton OkBtn;
///
/// 必需的设计器变量。
///
private System.ComponentModel.Container components = null;
public LFFLInfo()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
///
/// 清理所有正在使用的资源。
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///
private void InitializeComponent()
{
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinGrid.UltraGridBand ultraGridBand1 = new Infragistics.Win.UltraWinGrid.UltraGridBand("Table1", -1);
Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn1 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("WLBM");
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn2 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("WLLX");
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn3 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("WLMJC");
Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn4 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("WLMQC");
Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance();
this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid();
this.dataSet1 = new System.Data.DataSet();
this.dataTable1 = new System.Data.DataTable();
this.dataColumn1 = new System.Data.DataColumn();
this.dataColumn2 = new System.Data.DataColumn();
this.dataColumn3 = new System.Data.DataColumn();
this.dataColumn4 = new System.Data.DataColumn();
this.ultraGroupBox1 = new Infragistics.Win.Misc.UltraGroupBox();
this.ultraGroupBox2 = new Infragistics.Win.Misc.UltraGroupBox();
this.ClearBtn = new Infragistics.Win.Misc.UltraButton();
this.ExitBtn = new Infragistics.Win.Misc.UltraButton();
this.OkBtn = new Infragistics.Win.Misc.UltraButton();
((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataTable1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).BeginInit();
this.ultraGroupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox2)).BeginInit();
this.ultraGroupBox2.SuspendLayout();
this.SuspendLayout();
//
// ultraGrid1
//
this.ultraGrid1.DataMember = "Table1";
this.ultraGrid1.DataSource = this.dataSet1;
appearance1.BackColor = System.Drawing.Color.LightSteelBlue;
appearance1.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(233)))), ((int)(((byte)(233)))));
appearance1.BackGradientStyle = Infragistics.Win.GradientStyle.BackwardDiagonal;
this.ultraGrid1.DisplayLayout.Appearance = appearance1;
ultraGridColumn1.AutoEdit = false;
ultraGridColumn1.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
appearance2.TextHAlign = Infragistics.Win.HAlign.Center;
ultraGridColumn1.CellAppearance = appearance2;
ultraGridColumn1.Header.VisiblePosition = 0;
ultraGridColumn1.Hidden = true;
ultraGridColumn1.Width = 80;
ultraGridColumn2.AutoEdit = false;
ultraGridColumn2.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
appearance3.TextHAlign = Infragistics.Win.HAlign.Center;
ultraGridColumn2.CellAppearance = appearance3;
ultraGridColumn2.Header.VisiblePosition = 1;
ultraGridColumn2.Width = 60;
ultraGridColumn3.AutoEdit = false;
ultraGridColumn3.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
appearance4.TextHAlign = Infragistics.Win.HAlign.Center;
ultraGridColumn3.CellAppearance = appearance4;
ultraGridColumn3.Header.VisiblePosition = 2;
ultraGridColumn3.Width = 120;
ultraGridColumn4.AutoEdit = false;
ultraGridColumn4.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
ultraGridColumn4.Header.VisiblePosition = 3;
ultraGridColumn4.Width = 180;
ultraGridBand1.Columns.AddRange(new object[] {
ultraGridColumn1,
ultraGridColumn2,
ultraGridColumn3,
ultraGridColumn4});
this.ultraGrid1.DisplayLayout.BandsSerializer.Add(ultraGridBand1);
appearance5.BackColor = System.Drawing.Color.Navy;
appearance5.ForeColor = System.Drawing.Color.White;
this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance = appearance5;
this.ultraGrid1.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.No;
this.ultraGrid1.DisplayLayout.Override.AllowColMoving = Infragistics.Win.UltraWinGrid.AllowColMoving.NotAllowed;
this.ultraGrid1.DisplayLayout.Override.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.None;
this.ultraGrid1.DisplayLayout.Override.AllowColSwapping = Infragistics.Win.UltraWinGrid.AllowColSwapping.NotAllowed;
this.ultraGrid1.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
this.ultraGrid1.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
appearance6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(167)))), ((int)(((byte)(222)))));
this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance6;
this.ultraGrid1.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
this.ultraGrid1.DisplayLayout.Override.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.None;
this.ultraGrid1.DisplayLayout.Override.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.None;
this.ultraGrid1.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.None;
this.ultraGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ultraGrid1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ultraGrid1.Location = new System.Drawing.Point(3, 0);
this.ultraGrid1.Name = "ultraGrid1";
this.ultraGrid1.Size = new System.Drawing.Size(370, 314);
this.ultraGrid1.TabIndex = 27;
this.ultraGrid1.DoubleClick += new System.EventHandler(this.ultraGrid1_DoubleClick);
//
// dataSet1
//
this.dataSet1.DataSetName = "NewDataSet";
this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-CN");
this.dataSet1.Tables.AddRange(new System.Data.DataTable[] {
this.dataTable1});
//
// dataTable1
//
this.dataTable1.Columns.AddRange(new System.Data.DataColumn[] {
this.dataColumn1,
this.dataColumn2,
this.dataColumn3,
this.dataColumn4});
this.dataTable1.TableName = "Table1";
//
// dataColumn1
//
this.dataColumn1.Caption = "物料编码";
this.dataColumn1.ColumnName = "WLBM";
//
// dataColumn2
//
this.dataColumn2.Caption = "物料类型";
this.dataColumn2.ColumnName = "WLLX";
//
// dataColumn3
//
this.dataColumn3.Caption = "物料简称";
this.dataColumn3.ColumnName = "WLMJC";
//
// dataColumn4
//
this.dataColumn4.Caption = "物料全称";
this.dataColumn4.ColumnName = "WLMQC";
//
// ultraGroupBox1
//
this.ultraGroupBox1.Controls.Add(this.ultraGrid1);
this.ultraGroupBox1.Location = new System.Drawing.Point(0, 0);
this.ultraGroupBox1.Name = "ultraGroupBox1";
this.ultraGroupBox1.Size = new System.Drawing.Size(376, 317);
this.ultraGroupBox1.TabIndex = 28;
//
// ultraGroupBox2
//
this.ultraGroupBox2.Appearance.BackColor = System.Drawing.Color.LightSteelBlue;
this.ultraGroupBox2.Controls.Add(this.ClearBtn);
this.ultraGroupBox2.Controls.Add(this.ExitBtn);
this.ultraGroupBox2.Controls.Add(this.OkBtn);
this.ultraGroupBox2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ultraGroupBox2.Location = new System.Drawing.Point(0, 317);
this.ultraGroupBox2.Name = "ultraGroupBox2";
this.ultraGroupBox2.Size = new System.Drawing.Size(376, 48);
this.ultraGroupBox2.TabIndex = 29;
//
// ClearBtn
//
appearance7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(167)))), ((int)(((byte)(222)))));
this.ClearBtn.Appearance = appearance7;
this.ClearBtn.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ClearBtn.Location = new System.Drawing.Point(176, 10);
this.ClearBtn.Name = "ClearBtn";
this.ClearBtn.Size = new System.Drawing.Size(56, 24);
this.ClearBtn.TabIndex = 27;
this.ClearBtn.Text = "置空";
this.ClearBtn.Click += new System.EventHandler(this.ClearBtn_Click);
//
// ExitBtn
//
appearance8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(167)))), ((int)(((byte)(222)))));
this.ExitBtn.Appearance = appearance8;
this.ExitBtn.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ExitBtn.Location = new System.Drawing.Point(304, 10);
this.ExitBtn.Name = "ExitBtn";
this.ExitBtn.Size = new System.Drawing.Size(56, 24);
this.ExitBtn.TabIndex = 26;
this.ExitBtn.Text = "退出";
this.ExitBtn.Click += new System.EventHandler(this.ExitBtn_Click);
//
// OkBtn
//
appearance9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(167)))), ((int)(((byte)(222)))));
this.OkBtn.Appearance = appearance9;
this.OkBtn.BackColor = System.Drawing.SystemColors.Control;
this.OkBtn.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.OkBtn.Location = new System.Drawing.Point(240, 10);
this.OkBtn.Name = "OkBtn";
this.OkBtn.Size = new System.Drawing.Size(56, 24);
this.OkBtn.TabIndex = 25;
this.OkBtn.Text = "确认";
this.OkBtn.Click += new System.EventHandler(this.OkBtn_Click);
//
// LFFLInfo
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(376, 365);
this.Controls.Add(this.ultraGroupBox2);
this.Controls.Add(this.ultraGroupBox1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LFFLInfo";
this.Text = "选择添加料类型";
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
this.Load += new System.EventHandler(this.LFFLInfo_Load);
((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataTable1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).EndInit();
this.ultraGroupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox2)).EndInit();
this.ultraGroupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private int x0 = 0;
public int x1
{
set{x0 = value;}
}
private int y0 = 0;
public int y1
{
set{y0 = value;}
}
private string ClearFlag = "";
public string strClearFlag
{
set{ClearFlag = value;}
}
private string curWLLX = "";
public string strWLLX
{
set{curWLLX = value;}
}
private string curWLBM = "";
public string strWLBM
{
get{return curWLBM;}
}
private string curWLMJC = "";
public string strWLMJC
{
get{return curWLMJC;}
}
private string curWLMQC = "";
public string strWLMQC
{
get{return curWLMQC;}
}
private void LFFLInfo_Load(object sender, System.EventArgs e)
{
this.DesktopLocation = new Point(x0,y0);
if(ClearFlag.Trim() == "0")
{
this.ClearBtn.Enabled = false;
}
GetFLPZInfo();
}
private void OkBtn_Click(object sender, System.EventArgs e)
{
if(this.ultraGrid1.Rows.Count == 0 || this.ultraGrid1.ActiveRow == null)
{
return;
}
HandleDoubleClick();
this.DialogResult = DialogResult.OK;
}
private void ExitBtn_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void ClearBtn_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.No;
}
private void GetFLPZInfo()
{
string strError = "";
try
{
DataSet ds = null;//hengxing (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("lgResMgt", "Core.LgMes.Server.LgResMgt.LfsCollect", "GetFLPZInfo", new object[] { this.curWLLX }, out strError);
if (strError != "")
{
MessageBox.Show(strError, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
this.dataTable1.Clear();
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow drow in ds.Tables[0].Rows)
{
DataRow NewRow = this.dataTable1.NewRow();
foreach (DataColumn dataColumn in this.dataTable1.Columns)
{
if(dataColumn.ColumnName.ToString().Trim() == "WLLX")
{
switch(drow[dataColumn.ColumnName].ToString().Trim())
{
case "HJ":
NewRow[dataColumn.ColumnName] = "合金";
break;
case "FL":
NewRow[dataColumn.ColumnName] = "辅料";
break;
case "WS":
NewRow[dataColumn.ColumnName] = "喂线";
break;
default:
break;
}
}
else
{
NewRow[dataColumn.ColumnName] = drow[dataColumn.ColumnName].ToString();
}
}
this.dataTable1.Rows.Add(NewRow);
}
dataTable1.AcceptChanges();
}
this.ultraGrid1.DataBind();
this.ultraGrid1.ActiveRow = null;
}
}
catch (System.Exception exp)
{
MessageBox.Show(exp.Message, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
///
/// 双击Grid设置辅料信息
///
///
///
private void ultraGrid1_DoubleClick(object sender, System.EventArgs e)
{
UIElement mainElement;
UIElement element;
Point screenPoint;
Point clientPoint;
UltraGridRow row;
mainElement = this.ultraGrid1.DisplayLayout.UIElement;
screenPoint = Control.MousePosition;
clientPoint = this.ultraGrid1.PointToClient(screenPoint);
element = mainElement.ElementFromPoint(clientPoint);
if (element == null)
return;
row = element.GetContext(typeof(UltraGridRow)) as UltraGridRow;
if (row == null)
{
return;
}
if (this.ultraGrid1.ActiveRow == null || this.ultraGrid1.ActiveRow.Index < 0)
{
return;
}
HandleDoubleClick();
}
///
/// 取到物料编码,物料名简称,物料名全称
///
private void HandleDoubleClick()
{
this.curWLBM = this.ultraGrid1.ActiveRow.Cells["WLBM"].Value.ToString().Trim();
this.curWLMJC = this.ultraGrid1.ActiveRow.Cells["WLMJC"].Value.ToString().Trim();
this.curWLMQC = this.ultraGrid1.ActiveRow.Cells["WLMQC"].Value.ToString().Trim();
this.DialogResult = DialogResult.OK;
}
}
}