| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458 |
- 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
- {
- /// <summary>
- /// LFFLInfo 的摘要说明。
- /// </summary>
- 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;
-
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.Container components = null;
-
- public LFFLInfo()
- {
- //
- // Windows 窗体设计器支持所必需的
- //
- InitializeComponent();
- //
- // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
- //
- }
- /// <summary>
- /// 清理所有正在使用的资源。
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows 窗体设计器生成的代码
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- 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;
- }
- }
-
- /// <summary>
- /// 双击Grid设置辅料信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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();
- }
-
- /// <summary>
- /// 取到物料编码,物料名简称,物料名全称
- /// </summary>
- 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;
- }
- }
- }
|