UIM060021.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Collections;
  9. using System.Windows.Forms;
  10. namespace Core.LZMes.Client.UIM
  11. {
  12. public partial class UIM060021 : Form
  13. {
  14. public string YARD_ADDR = "";//垛位位置
  15. private int areaType = 0;
  16. private int minRow = 1;
  17. private UIM060020 parent = null;
  18. public UIM060021()
  19. {
  20. InitializeComponent();
  21. }
  22. public UIM060021(UIM060020 parent, int areaType)
  23. {
  24. InitializeComponent();
  25. this.parent = parent;
  26. this.areaType = areaType;
  27. }
  28. private void label4_Click(object sender, EventArgs e)
  29. {
  30. YARD_ADDR = this.textBox1.Text.Trim();
  31. if (null == YARD_ADDR || "".Equals(YARD_ADDR))
  32. {
  33. MessageBox.Show("请输入需要入库的垛位!");
  34. this.textBox1.Focus();
  35. return;
  36. }
  37. this.DialogResult = DialogResult.OK;
  38. this.Close();
  39. }
  40. private void UIM060021_Load(object sender, EventArgs e)
  41. {
  42. Infragistics.Win.ValueListItem[] valueListItems = null;
  43. ArrayList list = parent.queryYardAreas(areaType);
  44. if (null != list)
  45. {
  46. int listSize = list.Count;
  47. valueListItems = new Infragistics.Win.ValueListItem[listSize];
  48. for (int i = 0; i < listSize; i++)
  49. {
  50. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  51. Hashtable ht = (Hashtable)list[i];
  52. item.DataValue = ((Hashtable)(ht["AREA_NO"]))["value"].ToString();
  53. item.DisplayText = ht["AREA_NAME"].ToString();
  54. valueListItems[i] = item;
  55. }
  56. this.ultraComboEditor1.Items.AddRange(valueListItems);
  57. }
  58. this.ultraComboEditor1.SelectedIndex = 0;
  59. int areaNo = int.Parse(this.ultraComboEditor1.Value.ToString());
  60. list = parent.queryYardColsByArea(areaNo);
  61. if (null != list)
  62. {
  63. int listSize = list.Count;
  64. valueListItems = new Infragistics.Win.ValueListItem[listSize];
  65. for (int i = 0; i < listSize; i++)
  66. {
  67. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  68. Hashtable ht = (Hashtable)list[i];
  69. item.DataValue = ht["CLF_COL"].ToString();
  70. item.DisplayText = ht["CLF_COL"].ToString();
  71. valueListItems[i] = item;
  72. }
  73. this.ultraComboEditor2.Items.AddRange(valueListItems);
  74. this.ultraComboEditor2.SelectedIndex = 0;
  75. this.DoQuery();
  76. //查询出垛位区域
  77. setYardInfo();
  78. }
  79. }
  80. /// <summary>
  81. /// 查询该行下垛位及钢卷信息
  82. /// </summary>
  83. private void DoQuery()
  84. {
  85. int areaNo = int.Parse(this.ultraComboEditor1.Value.ToString());
  86. string yardCol = this.ultraComboEditor2.Value.ToString();
  87. parent.queryYardRows(areaType, areaNo, yardCol);
  88. parent.queryYardRowCoils(areaType, areaNo, yardCol);
  89. minRow = parent.queryMinYardRow(areaType, areaNo, yardCol);
  90. this.ultraGrid1.DataSource = parent.dataSet3;
  91. this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Hidden = true;
  92. this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].Hidden = true;
  93. }
  94. /// <summary>
  95. /// 将库存中存在的垛位激活
  96. /// </summary>
  97. private void setYardInfo()
  98. {
  99. DataRowCollection drs = parent.dataSet4.Tables[0].Rows;
  100. foreach (Control control in panel5.Controls)
  101. {
  102. if (control.Name.Contains("textBox"))
  103. {
  104. ((TextBox)control).ReadOnly = true;
  105. control.Text = "";
  106. control.DoubleClick += null;
  107. }
  108. else if (control.Name.Contains("pictureBox"))
  109. {
  110. ((PictureBox)control).BackColor = System.Drawing.SystemColors.InactiveBorder;
  111. //control.DoubleClick += null;
  112. }
  113. }
  114. for (int i = 0; i < drs.Count; i++)
  115. {
  116. string row_fl = (int.Parse(drs[i]["CLF_ROW"].ToString().Trim()) - minRow + 1).ToString() + drs[i]["CLF_FL"].ToString().Trim();
  117. Control yardControl1 = null;
  118. for (int j = 0; j < panel5.Controls.Count; j++)
  119. {
  120. if (panel5.Controls[j].Name.Equals("textBox_" + row_fl) || panel5.Controls[j].Name.Equals("pictureBox_" + row_fl))
  121. {
  122. if (null == yardControl1)
  123. {
  124. yardControl1 = panel5.Controls[j];
  125. }
  126. else
  127. {
  128. if (yardControl1.Name.Contains("textBox"))
  129. {
  130. setYardEnabled((PictureBox)panel5.Controls[j], (TextBox)yardControl1, drs[i]["CLF_ROW"].ToString().Trim(), drs[i]["CLF_FL"].ToString().Trim());
  131. }
  132. else
  133. {
  134. setYardEnabled((PictureBox)yardControl1, (TextBox)panel5.Controls[j], drs[i]["CLF_ROW"].ToString().Trim(), drs[i]["CLF_FL"].ToString().Trim());
  135. }
  136. break;
  137. }
  138. }
  139. }
  140. }
  141. }
  142. /// <summary>
  143. /// 激活垛位
  144. /// </summary>
  145. /// <param name="isEnabled"></param>
  146. /// <param name="pictureBox"></param>
  147. /// <param name="textBox"></param>
  148. private void setYardEnabled(PictureBox pictureBox, TextBox textBox, string row, string fl)
  149. {
  150. pictureBox.BackColor = System.Drawing.SystemColors.Window;
  151. textBox.ReadOnly = false;
  152. string clfRow = "";
  153. string clfFl = "";
  154. DataRowCollection drs = parent.dataSet3.Tables[0].Rows;
  155. for (int i = 0; i < drs.Count; i++)
  156. {
  157. clfRow = drs[i]["CLF_ROW"].ToString().Trim();
  158. clfFl = drs[i]["CLF_FL"].ToString().Trim();
  159. if (row.Equals(clfRow) && fl.Equals(clfFl))
  160. {
  161. textBox.Text = drs[i]["COIL_NO"].ToString().Trim();
  162. break;
  163. }
  164. }
  165. //pictureBox.DoubleClick += new EventHandler(pictureBox_doubleClick);
  166. textBox.DoubleClick += new EventHandler(textBox_doubleClick);
  167. }
  168. private void pictureBox_doubleClick(object sender, EventArgs e)
  169. {
  170. PictureBox picBox = (PictureBox)sender;
  171. string row_fl = picBox.Name.Split(new Char[] { '_' })[1];
  172. setYardAddr(row_fl);
  173. }
  174. private void textBox_doubleClick(object sender, EventArgs e)
  175. {
  176. TextBox txtBox = (TextBox)sender;
  177. string row_fl = txtBox.Name.Split(new Char[] { '_' })[1];
  178. setYardAddr(row_fl);
  179. }
  180. private void setYardAddr(string row_fl)
  181. {
  182. string row = (int.Parse(row_fl.Substring(0, row_fl.Length - 1)) + minRow - 1).ToString();
  183. if (row.Length < 2)
  184. {
  185. row = "0" + row;
  186. }
  187. string fl = row_fl.Substring(row_fl.Length - 1);
  188. string flFlag = "";
  189. if (fl.Equals("2"))
  190. {
  191. flFlag = "B";
  192. }
  193. else if (fl.Equals("3"))
  194. {
  195. flFlag = "C";
  196. }
  197. else
  198. {
  199. flFlag = "A";
  200. }
  201. this.textBox1.Text = this.ultraComboEditor2.Value.ToString() + flFlag + "-" + row;// +"-" + fl;
  202. // this.textBox1.Text = this.ultraComboEditor2.Value.ToString() + "-" + row + "-" + fl;
  203. }
  204. private void ultraComboEditor1_ValueChanged(object sender, EventArgs e)
  205. {
  206. int areaNo = int.Parse(this.ultraComboEditor1.Value.ToString());
  207. this.ultraComboEditor2.Items.Clear();
  208. ArrayList list = parent.queryYardColsByArea(areaNo);
  209. if (null != list)
  210. {
  211. int listSize = list.Count;
  212. Infragistics.Win.ValueListItem[] valueListItems = new Infragistics.Win.ValueListItem[listSize];
  213. for (int i = 0; i < listSize; i++)
  214. {
  215. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  216. Hashtable ht = (Hashtable)list[i];
  217. item.DataValue = ht["CLF_COL"].ToString();
  218. item.DisplayText = ht["CLF_COL"].ToString();
  219. valueListItems[i] = item;
  220. }
  221. this.ultraComboEditor2.Items.AddRange(valueListItems);
  222. this.ultraComboEditor2.SelectedIndex = 0;
  223. this.DoQuery();
  224. }
  225. }
  226. private void ultraComboEditor2_ValueChanged(object sender, EventArgs e)
  227. {
  228. this.DoQuery();
  229. setYardInfo();
  230. }
  231. }
  232. }