UIM050010.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.LZMes.Client.UIM.comm;
  11. namespace Core.LZMes.Client.UIM.UIM05
  12. {
  13. public partial class UIM050010 : FrmBase
  14. {
  15. private PictureBox _PicBoxPLTCM;
  16. private PictureBox _PicBoxCAL;
  17. private PictureBox _PicBoxRCL;
  18. public UIM050010()
  19. {
  20. InitializeComponent();
  21. }
  22. private void UIM050010_Load(object sender, EventArgs e)
  23. {
  24. _PicBoxPLTCM = new CustomPictureBox(Scenes.PLTCM, new EventHandler(pictureBoxDoubleClick));
  25. panel1.Controls.Add(_PicBoxPLTCM);
  26. _PicBoxCAL = new CustomPictureBox(Scenes.CAL, new EventHandler(pictureBoxDoubleClick));
  27. panel1.Controls.Add(_PicBoxCAL);
  28. _PicBoxRCL = new CustomPictureBox(Scenes.RCL, new EventHandler(pictureBoxDoubleClick));
  29. panel1.Controls.Add(_PicBoxRCL);
  30. panel1.Controls.Add(new CustomGridView(Scenes.PLTCM, dataSet1));
  31. panel1.Controls.Add(new CustomGridView(Scenes.CAL,dataSet1));
  32. panel1.Controls.Add(new CustomGridView(Scenes.RCL, dataSet1));
  33. //刷新数据
  34. RefreshData();
  35. timer1.Start();
  36. }
  37. /// <summary>
  38. /// 定时器
  39. /// </summary>
  40. /// <param name="sender"></param>
  41. /// <param name="e"></param>
  42. private void timer1_Tick(object sender, EventArgs e)
  43. {
  44. RefreshData();
  45. }
  46. /// <summary>
  47. /// 实时刷新数据
  48. /// </summary>
  49. private void RefreshData()
  50. {
  51. GetMillData(dataSet1.Tables["tmp"], dataSet1.Tables["pltcm"], Scenes.PLTCM);
  52. GetMillData(dataSet1.Tables["tmp"], dataSet1.Tables["cal"], Scenes.CAL);
  53. GetMillData(dataSet1.Tables["tmp"], dataSet1.Tables["rcl"], Scenes.RCL);
  54. }
  55. private void GetMillData(DataTable dtSource,DataTable dtTarget,Scenes sType)
  56. {
  57. try
  58. {
  59. dtSource.Clear();
  60. dtTarget.Clear();
  61. CoreClientParam ccp = new CoreClientParam();
  62. ccp.ServerName = "UIM.UIM05.UIM050010";
  63. switch (sType.ToString())
  64. {
  65. case "PLTCM":
  66. ccp.MethodName = "getPltcmData";
  67. break;
  68. case "CAL":
  69. ccp.MethodName = "getCalData";
  70. break;
  71. case "RCL":
  72. ccp.MethodName = "getRclData";
  73. break;
  74. default:
  75. return;
  76. break;
  77. }
  78. ccp.SourceDataTable = dtSource;
  79. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  80. DataRow drSource = null, drTarget = null;
  81. if (dtSource.Rows.Count > 0)
  82. {
  83. drSource = dtSource.Rows[0];
  84. switch (sType.ToString())
  85. {
  86. case "PLTCM":
  87. _PicBoxPLTCM.Enabled = true;
  88. break;
  89. case "CAL":
  90. _PicBoxCAL.Enabled = true;
  91. break;
  92. case "RCL":
  93. _PicBoxRCL.Enabled = true;
  94. break;
  95. }
  96. }
  97. else
  98. {
  99. drSource = dtSource.NewRow();
  100. switch (sType.ToString())
  101. {
  102. case "PLTCM":
  103. drSource["WKNAME"] = "酸轧机组";
  104. _PicBoxPLTCM.Enabled = false;
  105. break;
  106. case "CAL":
  107. drSource["WKNAME"] = "连退机组";
  108. _PicBoxCAL.Enabled = false;
  109. break;
  110. case "RCL":
  111. drSource["WKNAME"] = "重卷机组";
  112. _PicBoxRCL.Enabled = false;
  113. break;
  114. }
  115. drSource["WKGROUP"] = "班次,班组";
  116. drSource["COIL_NO"] = "卷号";
  117. drSource["SPEC_STL_GRD"] = "牌号";
  118. drSource["COIL_SIZE"] = "规格";
  119. drSource["COIL_WGT"] = "重量";
  120. drSource["ORDNAME"] = "订单号";
  121. drSource["BEGINTIME"] = "生产开始时间 ";
  122. drSource["ORD_NO"] = " ";
  123. drSource["MILLTIME"] = "已生产时间";
  124. }
  125. for (int i = 0; i < 5; i++)
  126. {
  127. drTarget = dtTarget.NewRow();
  128. drTarget["COL1"] = drSource[i * 2];
  129. drTarget["COL2"] = drSource[i * 2 + 1];
  130. dtTarget.Rows.Add(drTarget);
  131. }
  132. }
  133. catch (Exception ex)
  134. {
  135. }
  136. }
  137. private void pictureBoxDoubleClick(object sender, EventArgs e)
  138. {
  139. string stype = "";
  140. if (sender is PictureBox && ((PictureBox)sender).Name.Length > 4)
  141. {
  142. PictureBox pBox = (PictureBox)sender;
  143. stype = pBox.Name.Substring(4);
  144. UIM050011 dlgInfo = new UIM050011(stype);
  145. dlgInfo.StartPosition = FormStartPosition.CenterParent;
  146. dlgInfo.ob = this.ob;
  147. dlgInfo.ShowDialog(this);
  148. }
  149. }
  150. }
  151. }