ab8d70669eb6a226913fced850aa7744a965538f.svn-base 16 KB

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