UIF080001.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. namespace Core.LZMes.Client.UIF
  12. {
  13. /// <summary>
  14. /// 酸轧计划查询
  15. /// </summary>
  16. public partial class UIF080001 : FrmBase
  17. {
  18. public UIF080001()
  19. {
  20. InitializeComponent();
  21. }
  22. #region "TooBar Event"
  23. public override void ToolBar_Click(object sender, string ToolbarKey)
  24. {
  25. switch (ToolbarKey)
  26. {
  27. case "Query":
  28. this.DoQuery("");
  29. break;
  30. case "Exit":
  31. this.Close();
  32. break;
  33. }
  34. }
  35. private void DoQuery(string Condition)
  36. {
  37. try
  38. {
  39. CoreClientParam ccp1 = new CoreClientParam();
  40. Hashtable ht = new Hashtable();
  41. ht.Add("i1" , "1");
  42. ht.Add("o2", "");
  43. ccp1.ServerName = "UIB.COM.ComDBProcedure";
  44. ccp1.MethodName = "doXmlProcedure";
  45. ccp1.ServerParams = new object[] { "UIF080001.RollUpt", ht };
  46. this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
  47. ArrayList al = new ArrayList();
  48. al.Add("UIF080001.Query_RollPlan_Mill");
  49. this.dataSet1.Tables[0].Clear();
  50. CoreClientParam ccp = new CoreClientParam();
  51. ccp.ServerName = "UIB.COM.ComDBQuery";
  52. ccp.MethodName = "doSimpleQuery";
  53. ccp.ServerParams = new object[] { al };
  54. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  55. if (obj.ReturnInfo.Length == 0)
  56. {
  57. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["C_TBF03_SPEC_MILL"]);
  58. tab0.TableName = "C_TBF03_SPEC_MILL";
  59. this.dataSet1.Tables["C_TBF03_SPEC_MILL"].Merge(tab0);
  60. this.dataSet1.AcceptChanges();
  61. };
  62. getRectange();
  63. }
  64. catch (Exception EX)
  65. {
  66. MessageBox.Show(EX.ToString());
  67. }
  68. }
  69. #endregion
  70. #region "Rectange"
  71. //设定基料最大高度
  72. //private int Max_Height = 81;
  73. //基料卷展示的宽度
  74. private int width = 9;
  75. private int locy = 10;
  76. //宽度X坐标(第一个基料卷)
  77. private int locx1 = 0;
  78. //厚度X坐标(第一个基料卷)
  79. private int locx2 = 0;
  80. //轧制单元X坐标(第一个单元)
  81. private int locx_roll = 0;
  82. //轧制单元Y坐标
  83. private int locy_roll = 81;
  84. //轧制单元高度
  85. private int roll_height = 22;
  86. //Coil Tip
  87. System.Windows.Forms.ToolTip Coil_Tip = new ToolTip();
  88. //背景颜色配色
  89. Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance();
  90. private void getRectange()
  91. {
  92. try
  93. {
  94. locx1 = locx2 = locx_roll = 0;
  95. System.Int16 wth;
  96. double thk;
  97. string coilNO;
  98. string rollNO = "";
  99. int rollCoilCnt = 0;
  100. int totalCnt = 0;
  101. this.pal_Rectange.Controls.Clear();
  102. Coil_Tip.RemoveAll();
  103. foreach (DataRow row in this.dataSet1.Tables["C_TBF03_SPEC_MILL"].Rows)
  104. {
  105. wth = Convert.ToInt16(row["ORD_WTH"]);
  106. thk = Convert.ToDouble(row["ORD_THK"]);
  107. coilNO = Convert.ToString(row["COIL_NO"]);
  108. string tempRollNO = Convert.ToString(row["ROLL_MANA_NO"]);
  109. if (rollNO != "" && rollNO != tempRollNO)
  110. {
  111. getRollRectange(totalCnt, rollCoilCnt, rollNO);
  112. rollCoilCnt = 1;
  113. }
  114. else
  115. {
  116. rollCoilCnt = rollCoilCnt + 1;
  117. totalCnt = totalCnt + 1;
  118. }
  119. rollNO = tempRollNO;
  120. getWidthRectange(row);
  121. getThkRectange(row);
  122. }
  123. getRollRectange(totalCnt, rollCoilCnt, rollNO);
  124. }
  125. catch (System.Exception ex)
  126. {
  127. System.Diagnostics.Debug.WriteLine(ex.ToString());
  128. }
  129. }
  130. private void getRollRectange(int totalCnt,int rollCnt,string rollNO)
  131. {
  132. System.Windows.Forms.Label lab_roll = new Label();
  133. lab_roll.AutoSize = false;
  134. lab_roll.TextAlign = ContentAlignment.MiddleCenter;
  135. lab_roll.BackColor = System.Drawing.Color.White;
  136. lab_roll.BorderStyle = BorderStyle.FixedSingle;
  137. this.pal_Rectange.Controls.Add(lab_roll);
  138. lab_roll.Location = new System.Drawing.Point(locx_roll, locy_roll);
  139. lab_roll.Name = rollNO;
  140. lab_roll.Size = new System.Drawing.Size(rollCnt * width, roll_height);
  141. lab_roll.TabIndex = 1;
  142. lab_roll.Text = rollNO;
  143. lab_roll.DoubleClick += new EventHandler(lab_roll_DoubleClick);
  144. this.locx_roll = this.locx_roll + rollCnt * width;
  145. }
  146. private void getWidthRectange(System.Data.DataRow row)
  147. {
  148. try
  149. {
  150. System.Decimal height = Common.FixDBManager.CheckNullDecimal(row["ORD_WTH"]);
  151. string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]);
  152. string Coil_NO = Common.FixDBManager.CheckNullStr(row["COIL_NO"]);
  153. string CUR_LOAD_LOC = Common.FixDBManager.CheckNullStr(row["CUR_LOAD_LOC"]);
  154. string tip_str = getTipStr(row);
  155. int lab_locy = 0;
  156. int lab_height = 0;
  157. if (height <= 900)
  158. {
  159. lab_height = Convert.ToInt16((height / 900) * 26);
  160. lab_locy = 81 - lab_height;
  161. }
  162. else if (height > 900 & height <= 1000)
  163. {
  164. lab_height = Convert.ToInt16(((height - 900) / 100) * 26) + 26;
  165. lab_locy = 81 - lab_height;
  166. }
  167. else if (height > 1000 & height <= 1500)
  168. {
  169. lab_height = Convert.ToInt16(((height - 1000) / 500) * 26) + 26 + 26;
  170. lab_locy = 81 - lab_height;
  171. }
  172. else
  173. {
  174. lab_height = 81;
  175. lab_locy = 0;
  176. }
  177. System.Windows.Forms.Label lab_width = new Label();
  178. lab_width.AutoSize = false;
  179. lab_width.BorderStyle = BorderStyle.FixedSingle;
  180. lab_width.Text = "";
  181. if (Status_CD == "等待" && CUR_LOAD_LOC=="A7T")
  182. {
  183. lab_width.BackColor = this.lab_Standby.BackColor;
  184. }
  185. else if (Status_CD == "进行")
  186. {
  187. lab_width.BackColor = this.lab_P.BackColor;
  188. }
  189. else if (Status_CD == "结束")
  190. {
  191. lab_width.BackColor = this.lab_E.BackColor;
  192. }
  193. else
  194. {
  195. lab_width.BackColor = this.lab_plan.BackColor;
  196. }
  197. this.pal_Rectange.Controls.Add(lab_width);
  198. lab_width.Location = new System.Drawing.Point(locx1, lab_locy);
  199. lab_width.Name = Coil_NO;
  200. lab_width.Tag = Coil_NO;
  201. lab_width.Size = new System.Drawing.Size(width, lab_height);
  202. Coil_Tip.SetToolTip(lab_width, tip_str);
  203. this.locx1 = this.locx1 + this.width;
  204. lab_width.DoubleClick += new EventHandler(lab_width_DoubleClick);
  205. }
  206. catch (System.Exception ex)
  207. {
  208. System.Diagnostics.Debug.WriteLine(ex.ToString());
  209. }
  210. }
  211. private void getThkRectange(System.Data.DataRow row)
  212. {
  213. try
  214. {
  215. int lab_locy = locy_roll + roll_height;
  216. System.Double height = Convert.ToDouble(row["ORD_THK"]);
  217. string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]);
  218. string Coil_NO = Common.FixDBManager.CheckNullStr(row["COIL_NO"]);
  219. string CUR_LOAD_LOC = Common.FixDBManager.CheckNullStr(row["CUR_LOAD_LOC"]);
  220. string tip_str = getTipStr(row);
  221. int lab_height = 0;
  222. if (height <= 5)
  223. {
  224. lab_height = Convert.ToInt16((height / 5) * 26);
  225. }
  226. else if (height > 5 & height <= 10)
  227. {
  228. lab_height = Convert.ToInt16(((height - 5) / 5) * 26) + 26;
  229. }
  230. else if (height > 10 & height <= 16)
  231. {
  232. lab_height = Convert.ToInt16(((height - 10) / 6) * 26) + 26 + 26;
  233. }
  234. else
  235. {
  236. lab_height = 81;
  237. }
  238. System.Windows.Forms.Label Clab_height = new Label();
  239. Clab_height.AutoSize = false;
  240. Clab_height.BorderStyle = BorderStyle.FixedSingle;
  241. Clab_height.Text = "";
  242. if (Status_CD == "等待" && CUR_LOAD_LOC == "A7T")
  243. {
  244. Clab_height.BackColor = this.lab_Standby.BackColor;
  245. }
  246. else if (Status_CD == "进行")
  247. {
  248. Clab_height.BackColor = this.lab_P.BackColor;
  249. }
  250. else if (Status_CD == "结束")
  251. {
  252. Clab_height.BackColor = this.lab_E.BackColor;
  253. }
  254. else
  255. {
  256. Clab_height.BackColor = this.lab_plan.BackColor;
  257. }
  258. this.pal_Rectange.Controls.Add(Clab_height);
  259. Clab_height.Location = new System.Drawing.Point(locx2, lab_locy);
  260. Clab_height.Name = "H" + Coil_NO;
  261. Clab_height.Tag = Coil_NO;
  262. Clab_height.Size = new System.Drawing.Size(width, lab_height);
  263. Coil_Tip.SetToolTip(Clab_height, tip_str);
  264. this.locx2 = this.locx2 + this.width;
  265. Clab_height.DoubleClick += new EventHandler(Clab_height_DoubleClick);
  266. }
  267. catch (System.Exception ex)
  268. {
  269. System.Diagnostics.Debug.WriteLine(ex.ToString());
  270. }
  271. }
  272. private string getTipStr(System.Data.DataRow row)
  273. {
  274. try
  275. {
  276. string tip_str = "板坯号:" + Common.FixDBManager.CheckNullStr(row["SLAB_NO"]) + "\n";
  277. //tip_str = tip_str + "热卷内径:" + Common.FixDBManager.CheckNullStr(row["COIL_INDIA"]) + "\n";
  278. // tip_str = tip_str + "热卷外径:" + Common.FixDBManager.CheckNullStr(row["COIL_OUTDIA"]) + "\n";
  279. tip_str = tip_str + "订单厚度:" + Common.FixDBManager.CheckNullStr(row["ORD_THK"]) + "\n";
  280. tip_str = tip_str + "订单宽度:" + Common.FixDBManager.CheckNullStr(row["ORD_WTH"]) + "\n";
  281. tip_str = tip_str + "轧制单元内顺序:" + Common.FixDBManager.CheckNullStr(row["ROLL_SLAB_SEQ"]);
  282. return tip_str;
  283. }
  284. catch (System.Exception ex)
  285. {
  286. System.Diagnostics.Debug.WriteLine(ex.ToString());
  287. return "";
  288. }
  289. }
  290. #endregion
  291. #region "Label Event"
  292. void lab_roll_DoubleClick(object sender, EventArgs e)
  293. {
  294. try
  295. {
  296. this.ugrd_RollPlan.Selected.Rows.Clear();
  297. string RollNO = (sender as System.Windows.Forms.Label).Name;
  298. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  299. {
  300. if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["ROLL_MANA_NO"].Value) == RollNO)
  301. {
  302. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  303. }
  304. }
  305. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  306. }
  307. catch (System.Exception ex)
  308. {
  309. System.Diagnostics.Debug.WriteLine(ex.ToString());
  310. }
  311. }
  312. void lab_width_DoubleClick(object sender, EventArgs e)
  313. {
  314. try
  315. {
  316. this.ugrd_RollPlan.Selected.Rows.Clear();
  317. string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString();
  318. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  319. {
  320. if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value) == CoilNO)
  321. {
  322. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  323. }
  324. }
  325. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  326. }
  327. catch (System.Exception ex)
  328. {
  329. System.Diagnostics.Debug.WriteLine(ex.ToString());
  330. }
  331. }
  332. void Clab_height_DoubleClick(object sender, EventArgs e)
  333. {
  334. try
  335. {
  336. this.ugrd_RollPlan.Selected.Rows.Clear();
  337. string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString();
  338. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  339. {
  340. if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value) == CoilNO)
  341. {
  342. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  343. }
  344. }
  345. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  346. }
  347. catch (System.Exception ex)
  348. {
  349. System.Diagnostics.Debug.WriteLine(ex.ToString());
  350. }
  351. }
  352. #endregion
  353. #region "Button Event"
  354. private void btn_Add_Click(object sender, EventArgs e)
  355. {
  356. try
  357. {
  358. this.ugrd_RollPlan.Selected.Rows.Clear();
  359. string CoilNO = txt_CoilNO.Text.Trim().ToUpper();
  360. for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
  361. {
  362. if ((Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value).IndexOf(CoilNO) > -1) ||
  363. (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["C_COIL_NO"].Value).IndexOf(CoilNO) > -1))
  364. {
  365. this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
  366. }
  367. }
  368. if (ugrd_RollPlan.Selected.Rows.Count > 0)
  369. this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
  370. }
  371. catch (System.Exception ex)
  372. {
  373. System.Diagnostics.Debug.WriteLine(ex.ToString());
  374. }
  375. }
  376. #endregion
  377. #region "Grid Event"
  378. private void ugrd_RollPlan_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  379. {
  380. e.Cell.SelectAll();
  381. }
  382. private void ugrd_RollPlan_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  383. {
  384. try
  385. {
  386. if (this.ugrd_RollPlan.ActiveRow != null)
  387. {
  388. Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301();
  389. frm.ob = this.ob;
  390. frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_NO"].Value);
  391. frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_SEQ"].Value); ;
  392. frm.ShowDialog();
  393. }
  394. }
  395. catch (System.Exception ex)
  396. {
  397. System.Diagnostics.Debug.WriteLine(ex.ToString());
  398. }
  399. }
  400. #endregion
  401. #region "Init"
  402. private void UIF080001_Load(object sender, EventArgs e)
  403. {
  404. try
  405. {
  406. foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ugrd_RollPlan.DisplayLayout.Bands[0].Columns)
  407. {
  408. Common.FixDBManager.SetCellActivation(col.Key.ToString(), "C_TBF03_SPEC_MILL", this.ugrd_RollPlan, "ACTIVATEONLY");
  409. }
  410. }
  411. catch (System.Exception ex)
  412. {
  413. System.Diagnostics.Debug.WriteLine(ex.ToString());
  414. }
  415. }
  416. #endregion
  417. }
  418. }