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; namespace Core.LZMes.Client.UIM { public partial class UIM010071 : Form { private int areaType = 0; private int areaNo = 0; private int minRow = 1; private string yardCol = ""; private UIM010070 parent = null; public UIM010071() { InitializeComponent(); } public UIM010071(UIM010070 parent,int areaType,int areaNo, string yardCol) { InitializeComponent(); this.areaNo = areaNo; this.areaType = areaType; this.yardCol = yardCol; this.parent = parent; } private void UIM010071_Load(object sender, EventArgs e) { this.DoQuery(); this.ultraTextEditor1.Text = yardCol; setYardInfo(); } /// /// 查询该行下垛位及钢卷信息 /// private void DoQuery() { parent.queryYardRows(areaType,areaNo, yardCol); parent.queryYardRowCoils(areaType,areaNo, yardCol); minRow = parent.queryMinYardRow(areaType, areaNo, yardCol); this.ultraGrid1.DataSource = parent.dataSet2; this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].Hidden = true; } /// /// 将库存中存在的垛位激活 /// private void setYardInfo() { DataRowCollection drs = parent.dataSet3.Tables[0].Rows; for (int i = 0; i < drs.Count; i++) { string row_fl = (int.Parse(drs[i]["CLF_ROW"].ToString().Trim()) - minRow + 1).ToString() + drs[i]["CLF_FL"].ToString().Trim(); Control yardControl1 = null; for (int j = 0; j < panel5.Controls.Count; j++) { if (panel5.Controls[j].Name.Equals("textBox_" + row_fl) || panel5.Controls[j].Name.Equals("pictureBox_" + row_fl)) { if (null == yardControl1) { yardControl1 = panel5.Controls[j]; } else { if (yardControl1.Name.Contains("textBox")) { setYardEnabled((PictureBox)panel5.Controls[j], (TextBox)yardControl1, drs[i]["CLF_ROW"].ToString().Trim(), drs[i]["CLF_FL"].ToString().Trim()); } else { setYardEnabled((PictureBox)yardControl1, (TextBox)panel5.Controls[j], drs[i]["CLF_ROW"].ToString().Trim(), drs[i]["CLF_FL"].ToString().Trim()); } break; } } } } } /// /// 激活垛位 /// /// /// /// private void setYardEnabled(PictureBox pictureBox,TextBox textBox,string row,string fl) { pictureBox.BackColor = System.Drawing.SystemColors.Window; textBox.ReadOnly = false; DataRowCollection drs = parent.dataSet2.Tables[0].Rows; for (int i = 0; i < drs.Count; i++) { string clfRow = drs[i]["CLF_ROW"].ToString().Trim(); string clfFl = drs[i]["CLF_FL"].ToString().Trim(); if (row.Equals(clfRow) && fl.Equals(clfFl)) { textBox.Text = drs[i]["COIL_NO"].ToString().Trim(); break; } } } } }