baf0fab8498ecccc6cad5c1a37e0d113a3535408.svn-base 16 KB

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