using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Xml; using CoreFS.CA06; namespace Core.LZMes.Client.UIM { public partial class UIM010070 : FrmBase { private int areaType = 1;//原料库 public UIM010070() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Exit": this.Close(); break; } } private void DoQuery() { CoreClientParam ccp1 = new CoreClientParam(); ccp1.ServerName = "UIM.UIM010070"; ccp1.MethodName = "queryCoilCount"; ccp1.ServerParams = new object[] { areaType }; ccp1 = this.ExecuteQuery(ccp1, CoreInvokeType.Internal); if (null != ccp1.ReturnObject && !"".Equals(ccp1.ReturnObject)) { Hashtable ht = (Hashtable)(((ArrayList)ccp1.ReturnObject)[0]); this.textBox1.Text = ((Hashtable)ht["COIL_COUNT"])["value"].ToString(); this.textBox2.Text = ((Hashtable)ht["TOT_COUNT"])["value"].ToString(); } this.dataSet1.Tables[0].Clear(); CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIM.UIM010070"; ccp2.MethodName = "queryColCoils"; ccp2.ServerParams = new object[] { areaType }; ccp2.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); DataRowCollection drs = this.dataSet1.Tables[0].Rows; for (int i = panel5.Controls.Count - 1; i >= 0 ; i--) { if (null != panel5.Controls[i]) { for (int j = panel5.Controls[i].Controls.Count - 1; j >= 0; j--) { if (null != panel5.Controls[i].Controls[j]) { for (int l = 0; l < drs.Count; l++) { if (panel5.Controls[i].Controls[j].Controls[1].Name.Contains(drs[l]["col_name"].ToString().Trim())) { panel5.Controls[i].Controls[j].Controls[1].Text = drs[l]["col_count"].ToString().Trim(); break ; } } } } } } } private void UIM010070_Load(object sender, EventArgs e) { //query string xmlStr = queryAreaInfo(); if (null != xmlStr) { Infragistics.Win.Misc.UltraGroupBox ultraGroupBox = null; //parse xmls XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(xmlStr); XmlNodeList nodeList = xmldoc.SelectSingleNode("areas").ChildNodes; for (int i = nodeList.Count - 1; i >= 0; i--) { XmlNode node = nodeList[i]; //create ultraGroupBox ultraGroupBox = new Infragistics.Win.Misc.UltraGroupBox(); ultraGroupBox.Text = node.Attributes["name"].Value.Trim(); ultraGroupBox.Name = node.Attributes["id"].Value.Trim(); ultraGroupBox.Height = 70; ultraGroupBox.ViewStyle = Infragistics.Win.Misc.GroupBoxViewStyle.Office2003; ultraGroupBox.Dock = DockStyle.Top; XmlNodeList colList = node.ChildNodes; //create panel Panel panel = null; for (int j = colList.Count - 1; j >= 0; j--) { XmlNode colNode = colList[j]; panel = new Panel(); panel.Dock = DockStyle.Left; panel.Width = 58; Label lbl1 = new Label(); lbl1.Text = colNode.Attributes["name"].Value.Trim().Split(new Char[] { '_' })[0]; lbl1.Height = 26; lbl1.Width = 55; lbl1.Location = new Point(0, 0); lbl1.Cursor = System.Windows.Forms.Cursors.Hand; lbl1.Name = "lbl1_" + colNode.Attributes["name"].Value.Trim(); lbl1.BackColor = System.Drawing.Color.FromArgb(220, 229, 236); lbl1.BorderStyle = BorderStyle.FixedSingle; lbl1.DoubleClick += new EventHandler(lbl_Click); Label lbl2 = new Label(); lbl2.Height = 26; lbl2.Width = 55; lbl2.Location = new Point(0,26); lbl2.Name = "lbl2_" + colNode.Attributes["name"].Value.Trim(); lbl2.Cursor = System.Windows.Forms.Cursors.Hand; lbl2.BackColor = Color.White; lbl2.BorderStyle = BorderStyle.FixedSingle; lbl2.DoubleClick += new EventHandler(lbl_Click); panel.Controls.Add(lbl1); panel.Controls.Add(lbl2); ultraGroupBox.Controls.Add(panel); } panel5.Controls.Add(ultraGroupBox); } } } /// /// 查询区域信息 /// private string queryAreaInfo() { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010070"; ccp.MethodName = "queryYardArea"; ccp.ServerParams = new object[] { areaType }; ccp = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); string xmlStr = null != ccp.ReturnObject ? ccp.ReturnObject.ToString() : null; return xmlStr; } private void lbl_Click(object sender, EventArgs e) { Label lbl = (Label)sender; string str = lbl.Name; string yardCol = str.Split(new char[]{'_'})[1].Trim(); int areaNo = int.Parse(lbl.Parent.Parent.Name); //MessageBox.Show(lbl.Name); UIM010071 dlg = new UIM010071(this, areaType, areaNo, yardCol); dlg.ShowDialog(this); } /// /// 查询区域中一行的垛位信息 /// /// /// /// internal void queryYardRows(int areaType,int areaNo, string yardCol) { this.dataSet3.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010070"; ccp.MethodName = "queryYardRows"; ccp.ServerParams = new object[] { areaType,areaNo, yardCol }; ccp.SourceDataTable = this.dataSet3.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } /// /// 查询区域中一行的垛位中钢卷信息 /// /// /// /// internal void queryYardRowCoils(int areaType,int areaNo, string yardCol) { this.dataSet2.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010070"; ccp.MethodName = "queryYardRowCoils"; ccp.ServerParams = new object[] { areaType,areaNo, yardCol }; ccp.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } internal int queryMinYardRow(int areaType, int areaNo, string yardCol) { int minRow = 1; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010070"; ccp.MethodName = "queryMinYardRow"; ccp.ServerParams = new object[] { areaType, areaNo, yardCol }; ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnObject != null) { minRow = int.Parse(ccp.ReturnObject.ToString()); } return minRow; } } }