Form_Monitior.cs 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239
  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.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using WCS_Client.From.From_Montior;
  11. namespace WCS_Client.From
  12. {
  13. public partial class Form_Monitior : Form
  14. {
  15. #region
  16. System.Timers.Timer _timer;
  17. private delegate void ShowTextDelegate(List<WCS_STACKERDATA> ds);// 创建委托和委托对象
  18. #endregion;
  19. public Form_Monitior()
  20. {
  21. InitializeComponent();
  22. InitOne();
  23. InitTwo();
  24. }
  25. private static Form_Monitior childFromInstanc;
  26. public static Form_Monitior ChildFromInstanc
  27. {
  28. get
  29. {
  30. if (childFromInstanc == null || childFromInstanc.IsDisposed)
  31. {
  32. childFromInstanc = new Form_Monitior();
  33. }
  34. return childFromInstanc;
  35. }
  36. }
  37. private void InitOne()
  38. {
  39. conveyor_1021.button1.Text = "1021";
  40. conveyor_1022.button1.Text = "1022";
  41. conveyor_1038.button1.Text = "1038";
  42. conveyor_1040.button1.Text = "1040";
  43. conveyor_1039.button1.Text = "1039";
  44. conveyor_1037.button1.Text = "1037";
  45. conveyor_1036.button1.Text = "1036";
  46. conveyor3_1027.button1.Text = "1027";
  47. conveyor_1029.button1.Text = "1029";
  48. conveyor_1019.button1.Text = "1019";
  49. conveyor_1046.button1.Text = "1046";
  50. conveyor_1018.button1.Text = "1018";
  51. conveyor_1048.button1.Text = "1048";
  52. conveyor_1017.button1.Text = "1017";
  53. conveyor_1030.button1.Text = "1030";
  54. conveyor_1031.button1.Text = "1031";
  55. conveyor_1015.button1.Text = "1015";
  56. conveyor_1033.button1.Text = "1033";
  57. conveyor_1013.button1.Text = "1013";
  58. conveyor_1012.button1.Text = "1012";
  59. conveyor_1011.button1.Text = "1011";
  60. conveyor_1032.button1.Text = "1032";
  61. conveyor_1035.button1.Text = "1035";
  62. rgv01.btn02.Text = "1024";
  63. rgv01.btn01.Text = "1023";
  64. rgv02.btn02.Text = "1008";
  65. rgv02.btn01.Text = "1007";
  66. rgv03.btn02.Text = "1057";
  67. rgv03.btn01.Text = "1056";
  68. conveyor_1041.button1.Text = "1041";
  69. conveyor_1044.button1.Text = "1044";
  70. conveyor_1118.button1.Text = "1118";
  71. conveyor_1116.button1.Text = "1116";
  72. conveyor_1115.button1.Text = "1115";
  73. conveyor_1112.button1.Text = "1112";
  74. conveyor_1111.button1.Text = "1111";
  75. conveyor_1110.button1.Text = "1110";
  76. conveyor_1138.button1.Text = "1138";
  77. conveyor_1139.button1.Text = "1139";
  78. conveyor_1001.button1.Text = "1001";
  79. conveyor_1002.button1.Text = "1002";
  80. conveyor_1003.button1.Text = "1003";
  81. conveyor_1004.button1.Text = "1004";
  82. conveyor_1005.button1.Text = "1005";
  83. conveyor_1006.button1.Text = "1006";
  84. conveyor_1050.button1.Text = "1050";
  85. conveyor_1051.button1.Text = "1051";
  86. conveyor_1052.button1.Text = "1052";
  87. conveyor_1053.button1.Text = "1053";
  88. conveyor_1054.button1.Text = "1054";
  89. conveyor_1055.button1.Text = "1055";
  90. conveyor_1061.button1.Text = "1061";
  91. conveyor_1062.button1.Text = "1062";
  92. conveyor_1063.button1.Text = "1063";
  93. conveyor_1064.button1.Text = "1064";
  94. conveyor_1065.button1.Text = "1065";
  95. conveyor_1066.button1.Text = "1066";
  96. conveyor_1067.button1.Text = "1067";
  97. conveyor_1068.button1.Text = "1068";
  98. conveyor_1069.button1.Text = "1069";
  99. conveyor_1070.button1.Text = "1070";
  100. conveyor_1071.button1.Text = "1071";
  101. conveyor_1072.button1.Text = "1072";
  102. }
  103. private void InitTwo()
  104. {
  105. conveyor_1080.button1.Text = "1080";
  106. conveyor_1081.button1.Text = "1081";
  107. conveyor_1082.button1.Text = "1082";
  108. conveyor_1083.button1.Text = "1083";
  109. conveyor_1084.button1.Text = "1084";
  110. conveyor_1085.button1.Text = "1085";
  111. rgv04.btn02.Text = "1087";
  112. rgv04.btn01.Text = "1086";
  113. conveyor_1090.button1.Text = "1090";
  114. conveyor_1091.button1.Text = "1091";
  115. conveyor_1092.button1.Text = "1092";
  116. conveyor_1093.button1.Text = "1093";
  117. conveyor_1094.button1.Text = "1094";
  118. conveyor_1095.button1.Text = "1095";
  119. conveyor_1096.button1.Text = "1096";
  120. conveyor_1097.button1.Text = "1097";
  121. conveyor_1098.button1.Text = "1098";
  122. conveyor_1099.button1.Text = "1099";
  123. conveyor_1100.button1.Text = "1100";
  124. conveyor_1101.button1.Text = "1101";
  125. conveyor_1102.button1.Text = "1102";
  126. conveyor_1103.button1.Text = "1103";
  127. conveyor_1116.button1.Text = "1116";
  128. conveyor_1120.button1.Text = "1120";
  129. conveyor_1121.button1.Text = "1121";
  130. conveyor_1123.button1.Text = "1123";
  131. conveyor_1124.button1.Text = "1124";
  132. conveyor_1126.button1.Text = "1126";
  133. conveyor_1127.button1.Text = "1127";
  134. conveyor_1128.button1.Text = "1128";
  135. conveyor_1130.button1.Text = "1130";
  136. conveyor_1129.button1.Text = "1129";
  137. conveyor_1132.button1.Text = "1132";
  138. conveyor_1133.button1.Text = "1133";
  139. conveyor_1134.button1.Text = "1134";
  140. conveyor_1136.button1.Text = "1136";
  141. conveyor_1137.button1.Text = "1137";
  142. conveyor_1112.button1.Text = "1114";
  143. conveyor2_1114.button1.Text = "1114";
  144. conveyor2_1116.button1.Text = "1116";
  145. }
  146. private void myTableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
  147. {
  148. #region RGV01轨道边框
  149. if (e.Row == 2 && e.Column == 9)
  150. {
  151. float x = e.CellBounds.Location.X;
  152. float x2 = e.CellBounds.Right;
  153. float y = e.CellBounds.Location.Y;
  154. float y2 = e.CellBounds.Bottom;
  155. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
  156. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
  157. }
  158. if (e.Row == 3 && e.Column >= 9 && e.Column <= 19)
  159. {
  160. float x = e.CellBounds.Location.X;
  161. float x2 = e.CellBounds.Right;
  162. float y = e.CellBounds.Location.Y;
  163. float y2 = e.CellBounds.Bottom;
  164. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
  165. }
  166. if (e.Row == 2 && e.Column >= 9 && e.Column <= 19)
  167. {
  168. float x = e.CellBounds.Location.X;
  169. float x2 = e.CellBounds.Right;
  170. float y = e.CellBounds.Location.Y;
  171. float y2 = e.CellBounds.Bottom;
  172. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
  173. }
  174. //if (e.Row == 2 && e.Column == 17)
  175. //{
  176. // float x = e.CellBounds.Location.X;
  177. // float x2 = e.CellBounds.Right;
  178. // float y = e.CellBounds.Location.Y;
  179. // float y2 = e.CellBounds.Bottom;
  180. // e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
  181. //}
  182. //e.Graphics.DrawRectangle(new Pen(Color.Blue), e.CellBounds);
  183. #endregion;
  184. #region RGV02轨道边框
  185. if (e.Row == 3 && e.Column == 24)
  186. {
  187. float x = e.CellBounds.Location.X;
  188. float x2 = e.CellBounds.Right;
  189. float y = e.CellBounds.Location.Y;
  190. float y2 = e.CellBounds.Bottom;
  191. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
  192. }
  193. if (e.Row >= 3 && e.Row <= 18 && e.Column == 24)
  194. {
  195. float x = e.CellBounds.Location.X;
  196. float x2 = e.CellBounds.Right;
  197. float y = e.CellBounds.Location.Y;
  198. float y2 = e.CellBounds.Bottom;
  199. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
  200. }
  201. if (e.Row >= 3 && e.Row <= 18 && e.Column == 25)
  202. {
  203. float x = e.CellBounds.Location.X;
  204. float x2 = e.CellBounds.Right;
  205. float y = e.CellBounds.Location.Y;
  206. float y2 = e.CellBounds.Bottom;
  207. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
  208. }
  209. if (e.Row == 19 && e.Column == 24)
  210. {
  211. float x = e.CellBounds.Location.X;
  212. float x2 = e.CellBounds.Right;
  213. float y = e.CellBounds.Location.Y;
  214. float y2 = e.CellBounds.Bottom;
  215. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
  216. }
  217. #endregion;
  218. #region RGV03轨道边框
  219. if (e.Row == 5 && e.Column == 2)
  220. {
  221. float x = e.CellBounds.Location.X;
  222. float x2 = e.CellBounds.Right;
  223. float y = e.CellBounds.Location.Y;
  224. float y2 = e.CellBounds.Bottom;
  225. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
  226. }
  227. if (e.Row >= 5 && e.Row <= 19 && e.Column == 2)
  228. {
  229. float x = e.CellBounds.Location.X;
  230. float x2 = e.CellBounds.Right;
  231. float y = e.CellBounds.Location.Y;
  232. float y2 = e.CellBounds.Bottom;
  233. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
  234. }
  235. if (e.Row >= 5 && e.Row <= 19 && e.Column == 3)
  236. {
  237. float x = e.CellBounds.Location.X;
  238. float x2 = e.CellBounds.Right;
  239. float y = e.CellBounds.Location.Y;
  240. float y2 = e.CellBounds.Bottom;
  241. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
  242. }
  243. if (e.Row == 20 && e.Column == 2)
  244. {
  245. float x = e.CellBounds.Location.X;
  246. float x2 = e.CellBounds.Right;
  247. float y = e.CellBounds.Location.Y;
  248. float y2 = e.CellBounds.Bottom;
  249. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
  250. }
  251. #endregion;
  252. }
  253. private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
  254. {
  255. #region RGV03轨道边框
  256. if (e.Row == 4 && e.Column == 2)
  257. {
  258. float x = e.CellBounds.Location.X;
  259. float x2 = e.CellBounds.Right;
  260. float y = e.CellBounds.Location.Y;
  261. float y2 = e.CellBounds.Bottom;
  262. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
  263. }
  264. if (e.Row >= 4 && e.Row <= 18 && e.Column == 2)
  265. {
  266. float x = e.CellBounds.Location.X;
  267. float x2 = e.CellBounds.Right;
  268. float y = e.CellBounds.Location.Y;
  269. float y2 = e.CellBounds.Bottom;
  270. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
  271. }
  272. if (e.Row >= 4 && e.Row <= 18 && e.Column == 3)
  273. {
  274. float x = e.CellBounds.Location.X;
  275. float x2 = e.CellBounds.Right;
  276. float y = e.CellBounds.Location.Y;
  277. float y2 = e.CellBounds.Bottom;
  278. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
  279. }
  280. if (e.Row == 19 && e.Column == 2)
  281. {
  282. float x = e.CellBounds.Location.X;
  283. float x2 = e.CellBounds.Right;
  284. float y = e.CellBounds.Location.Y;
  285. float y2 = e.CellBounds.Bottom;
  286. e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
  287. }
  288. #endregion;
  289. }
  290. private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
  291. {
  292. //设置笔刷
  293. //SolidBrush a = new SolidBrush(Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(144)))), ((int)(((byte)(154))))));
  294. //SolidBrush blue = new SolidBrush(Color.Blue);
  295. //StringFormat sf = new StringFormat();
  296. //sf.Alignment = StringAlignment.Center;
  297. //sf.LineAlignment = StringAlignment.Center;
  298. //for (int i = 0; i < tabControl1.TabPages.Count; i++)
  299. //{
  300. // //绘制背景
  301. // Rectangle rec1 = tabControl1.GetTabRect(i);
  302. // e.Graphics.FillRectangle(a, rec1);
  303. // Rectangle rec = tabControl1.GetTabRect(i);
  304. // e.Graphics.DrawString(tabControl1.TabPages[i].Text, new Font("宋体", 10), blue, rec, sf);
  305. //}
  306. }
  307. private void Form_Monitior_Load(object sender, EventArgs e)
  308. {
  309. _timer = new System.Timers.Timer(5000);
  310. _timer.Elapsed += new System.Timers.ElapsedEventHandler(theout);//到达时间的时候执行事件;
  311. _timer.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
  312. _timer.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;
  313. }
  314. private void theout(object sender, EventArgs e)
  315. {
  316. var plcnameSet = new List<string>();
  317. plcnameSet.Add("conveyor01");
  318. plcnameSet.Add("conveyor02");
  319. plcnameSet.Add("srm01");
  320. plcnameSet.Add("srm02");
  321. plcnameSet.Add("srm03");
  322. plcnameSet.Add("rgv01");
  323. plcnameSet.Add("rgv02");
  324. plcnameSet.Add("rgv03");
  325. plcnameSet.Add("rgv04");
  326. // var list = BaseWorkflow.QueryStackerdData(plcnameSet);
  327. //ShowData(list);
  328. }
  329. private void ShowData(object Dat)
  330. {
  331. try
  332. {
  333. if (InvokeRequired)
  334. {
  335. //List<WCS_STACKERDATA> data = (List<WCS_STACKERDATA>)Dat;//传过来的数据
  336. object[] obj = { Dat };
  337. //异步调用委托(后面添加方法需要将方法委托其中)
  338. this.BeginInvoke(new ShowTextDelegate(pan11), obj);
  339. //this.BeginInvoke(new ShowTextDelegate(pan10), obj);
  340. }
  341. else
  342. {
  343. }
  344. }
  345. catch (Exception ex)
  346. {
  347. LogHelper.Sys_Log.WriteLog(ex.ToString());
  348. }
  349. }
  350. public void pan11(List<WCS_STACKERDATA> dt)
  351. {
  352. try
  353. {
  354. var conveyorSet = dt.Where(v => v.STA_TYPE == "conveyor").ToList();
  355. var conveyor1 = conveyorSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == "1032");
  356. SetConveyor_R(conveyor_1032, conveyor1);
  357. var conveyor2 = conveyorSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == "1035");
  358. SetConveyor_R(conveyor_1035, conveyor2);
  359. Control.ControlCollection sonControls = this.Controls;
  360. var conveyors = sonControls[0].Controls[0].Controls[0];
  361. //遍历窗体所有控件,
  362. foreach (Control control in conveyors.Controls)
  363. {
  364. var equipmentno = control.Name.Substring(control.Name.Length - 4);
  365. var conveyor = conveyorSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == equipmentno);
  366. if (conveyor != null)
  367. {
  368. if (control is Conveyor3_B)
  369. {
  370. SetConveyor3_B(control, conveyor);
  371. }
  372. else if (control is Conveyor3)
  373. {
  374. SetConveyor3(control, conveyor);
  375. }
  376. else if (control is Conveyor_L)
  377. {
  378. SetConveyor_L(control, conveyor);
  379. }
  380. else if (control is Conveyor_R)
  381. {
  382. SetConveyor_R(control, conveyor);
  383. }
  384. else if (control is Conveyor)
  385. {
  386. SetConveyor(control, conveyor);
  387. }
  388. else if (control is Conveyor4_left)
  389. {
  390. SetConveyor4_left(control, conveyor);
  391. }
  392. else if (control is Conveyor4_right)
  393. {
  394. SetConveyor4_right(control, conveyor);
  395. }
  396. else if (control is Conveyor4_L_R)
  397. {
  398. SetConveyor4_L_R(control, conveyor);
  399. }
  400. else if (control is Conveyor5)
  401. {
  402. SetConveyor5(control, conveyor);
  403. }
  404. else if (control is Conveyor6)
  405. {
  406. SetConveyor6(control, conveyor);
  407. }
  408. }
  409. }
  410. var rgvSet = dt.Where(v => v.STA_TYPE == "rgv").ToList();
  411. foreach (Control control in conveyors.Controls)
  412. {
  413. if (control.Name.Contains("rgv"))
  414. {
  415. var rgv = rgvSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == control.Name);
  416. if (rgv != null)
  417. {
  418. if (control is Rgv02)
  419. {
  420. SetRgv02(control, rgv);
  421. }
  422. else if (control is Rgv)
  423. {
  424. SetRgv(control, rgv);
  425. }
  426. }
  427. }
  428. }
  429. var srmSet = dt.Where(v => v.STA_TYPE == "srm").ToList();
  430. foreach (Control control in conveyors.Controls)
  431. {
  432. if (control.Name.Contains("srm"))
  433. {
  434. var srm = srmSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == control.Name);
  435. if (srm != null)
  436. {
  437. if (control is Srm3)
  438. {
  439. SetSrmInfo(srm, control);
  440. }
  441. }
  442. }
  443. }
  444. var conveyors2 = sonControls[0].Controls[1].Controls[0];
  445. foreach (Control control in conveyors2.Controls)
  446. {
  447. var equipmentno = control.Name.Substring(control.Name.Length - 4);
  448. var conveyor = conveyorSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == equipmentno);
  449. if (conveyor != null)
  450. {
  451. if (control is Conveyor)
  452. {
  453. SetConveyor(control, conveyor);
  454. }
  455. else if (control is Conveyor4_L_R)
  456. {
  457. SetConveyor4_L_R(control, conveyor);
  458. }
  459. else if (control is Conveyor4_left)
  460. {
  461. SetConveyor4_left(control, conveyor);
  462. }
  463. else if (control is Conveyor4_right)
  464. {
  465. SetConveyor4_right(control, conveyor);
  466. }
  467. else if (control is Conveyor5)
  468. {
  469. SetConveyor5(control, conveyor);
  470. }
  471. else if (control is Conveyor3)
  472. {
  473. SetConveyor3(control, conveyor);
  474. }
  475. else if (control is Conveyor6)
  476. {
  477. SetConveyor6(control, conveyor);
  478. }
  479. }
  480. }
  481. foreach (Control control in conveyors2.Controls)
  482. {
  483. if (control.Name.Contains("rgv"))
  484. {
  485. var rgv = rgvSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == control.Name);
  486. if (rgv != null)
  487. {
  488. if (control is Rgv)
  489. {
  490. SetRgv(control, rgv);
  491. }
  492. }
  493. }
  494. }
  495. }
  496. catch (Exception ex)
  497. {
  498. LogHelper.Sys_Log.WriteLog(ex.ToString());
  499. }
  500. }
  501. private void SetConveyor_R(Conveyor_R conveyor_R, WCS_STACKERDATA conveyor)
  502. {
  503. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  504. {
  505. if (conveyor_R.button1.Tag.ToString() != "pall")
  506. {
  507. conveyor_R.button1.BackgroundImage = Image.FromFile("Resources/Conveyor_R.png");
  508. conveyor_R.button1.Tag = "pall";
  509. }
  510. }
  511. else
  512. {
  513. if (conveyor_R.button1.Tag.ToString() != "empty")
  514. {
  515. conveyor_R.button1.BackgroundImage = Image.FromFile("Resources/1009L1.png");
  516. conveyor_R.button1.Tag = "empty";
  517. }
  518. }
  519. if (conveyor.ConveyorSignalItem.DB523_Fault && conveyor_R.button1.BackColor != Color.Red)
  520. {
  521. conveyor_R.button1.BackColor = Color.Red;
  522. }
  523. if (conveyor.ConveyorSignalItem.DB523_Fault == false && conveyor_R.button1.BackColor != Color.FromArgb(0, 144, 154))
  524. {
  525. conveyor_R.button1.BackColor = Color.FromArgb(0, 144, 154);
  526. }
  527. }
  528. private void SetConveyor3_B(Control control, WCS_STACKERDATA conveyor)
  529. {
  530. var con = (Conveyor3_B)control;
  531. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  532. {
  533. if (con.button1.Tag.ToString() != "pall")
  534. {
  535. con.button1.BackgroundImage = Image.FromFile("Resources/1009R1_B.png");//1009R1_A.png
  536. con.button1.Tag = "pall";
  537. }
  538. }
  539. else
  540. {
  541. if (con.button1.Tag.ToString() != "empty")
  542. {
  543. con.button1.BackgroundImage = Image.FromFile("Resources/1009R1.png");//1009R1.png
  544. con.button1.Tag = "empty";
  545. }
  546. }
  547. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  548. {
  549. con.button1.BackColor = Color.Red;
  550. }
  551. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  552. {
  553. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  554. }
  555. }
  556. private void SetConveyor3(Control control, WCS_STACKERDATA conveyor)
  557. {
  558. var con = (Conveyor3)control;
  559. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  560. {
  561. if (con.button1.Tag.ToString() != "pall")
  562. {
  563. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor3.png");//1009R1_A.png
  564. con.button1.Tag = "pall";
  565. }
  566. }
  567. else
  568. {
  569. if (con.button1.Tag.ToString() != "empty")
  570. {
  571. con.button1.BackgroundImage = Image.FromFile("Resources/1004LR.png");//1009R1.png
  572. con.button1.Tag = "empty";
  573. }
  574. }
  575. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  576. {
  577. con.button1.BackColor = Color.Red;
  578. }
  579. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  580. {
  581. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  582. }
  583. }
  584. private void SetConveyor_L(Control control, WCS_STACKERDATA conveyor)
  585. {
  586. var con = (Conveyor_L)control;
  587. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  588. {
  589. if (con.button1.Tag.ToString() != "pall")
  590. {
  591. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor_L.png");//1009L11.png
  592. con.button1.Tag = "pall";
  593. }
  594. }
  595. else
  596. {
  597. if (con.button1.Tag.ToString() != "empty")
  598. {
  599. con.button1.BackgroundImage = Image.FromFile("Resources/1009L11.png");//1009L11.png
  600. con.button1.Tag = "empty";
  601. }
  602. }
  603. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  604. {
  605. con.button1.BackColor = Color.Red;
  606. }
  607. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  608. {
  609. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  610. }
  611. }
  612. private void SetConveyor_R(Control control, WCS_STACKERDATA conveyor)
  613. {
  614. var con = (Conveyor_R)control;
  615. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  616. {
  617. if (con.button1.Tag.ToString() != "pall")
  618. {
  619. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor_R.png");//1009L1.png
  620. con.button1.Tag = "pall";
  621. }
  622. }
  623. else
  624. {
  625. if (con.button1.Tag.ToString() != "empty")
  626. {
  627. con.button1.BackgroundImage = Image.FromFile("Resources/1009L1.png");//1009L1.png
  628. con.button1.Tag = "empty";
  629. }
  630. }
  631. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  632. {
  633. con.button1.BackColor = Color.Red;
  634. }
  635. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  636. {
  637. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  638. }
  639. }
  640. private void SetConveyor(Control control, WCS_STACKERDATA conveyor)
  641. {
  642. var con = (Conveyor)control;
  643. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  644. {
  645. if (con.button1.Tag.ToString() != "pall")
  646. {
  647. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor.png");
  648. con.button1.Tag = "pall";
  649. }
  650. }
  651. else
  652. {
  653. if (con.button1.Tag.ToString() != "empty")
  654. {
  655. con.button1.BackgroundImage = Image.FromFile("Resources/1009LR.png");
  656. con.button1.Tag = "empty";
  657. }
  658. }
  659. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  660. {
  661. con.button1.BackColor = Color.Red;
  662. }
  663. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  664. {
  665. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  666. }
  667. }
  668. private void SetConveyor4_left(Control control, WCS_STACKERDATA conveyor)
  669. {
  670. var con = (Conveyor4_left)control;
  671. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  672. {
  673. if (con.button1.Tag.ToString() != "pall")
  674. {
  675. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor4_left.png");
  676. con.button1.Tag = "pall";
  677. }
  678. }
  679. else
  680. {
  681. if (con.button1.Tag.ToString() != "empty")
  682. {
  683. con.button1.BackgroundImage = Image.FromFile("Resources/1001L.gif");
  684. con.button1.Tag = "empty";
  685. }
  686. }
  687. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  688. {
  689. con.button1.BackColor = Color.Red;
  690. }
  691. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  692. {
  693. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  694. }
  695. }
  696. private void SetConveyor4_right(Control control, WCS_STACKERDATA conveyor)
  697. {
  698. var con = (Conveyor4_right)control;
  699. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  700. {
  701. if (con.button1.Tag.ToString() != "pall")
  702. {
  703. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor4_right.png");
  704. con.button1.Tag = "pall";
  705. }
  706. }
  707. else
  708. {
  709. if (con.button1.Tag.ToString() != "empty")
  710. {
  711. con.button1.BackgroundImage = Image.FromFile("Resources/1001LR.gif");
  712. con.button1.Tag = "empty";
  713. }
  714. }
  715. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  716. {
  717. con.button1.BackColor = Color.Red;
  718. }
  719. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  720. {
  721. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  722. }
  723. }
  724. private void SetConveyor4_L_R(Control control, WCS_STACKERDATA conveyor)
  725. {
  726. var con = (Conveyor4_L_R)control;
  727. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  728. {
  729. if (con.button1.Tag.ToString() != "pall")
  730. {
  731. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor4_L_R.png");
  732. con.button1.Tag = "pall";
  733. }
  734. }
  735. else
  736. {
  737. if (con.button1.Tag.ToString() != "empty")
  738. {
  739. con.button1.BackgroundImage = Image.FromFile("Resources/1001LR.gif");
  740. con.button1.Tag = "empty";
  741. }
  742. }
  743. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  744. {
  745. con.button1.BackColor = Color.Red;
  746. }
  747. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  748. {
  749. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  750. }
  751. }
  752. private void SetConveyor5(Control control, WCS_STACKERDATA conveyor)
  753. {
  754. var con = (Conveyor5)control;
  755. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  756. {
  757. if (con.button1.Tag.ToString() != "pall")
  758. {
  759. con.button1.BackgroundImage = Image.FromFile("Resources/rgv03.png");
  760. con.button1.Tag = "pall";
  761. }
  762. }
  763. else
  764. {
  765. if (con.button1.Tag.ToString() != "empty")
  766. {
  767. con.button1.BackgroundImage = Image.FromFile("Resources/shelf16UD1.png");
  768. con.button1.Tag = "empty";
  769. }
  770. }
  771. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  772. {
  773. con.button1.BackColor = Color.Red;
  774. }
  775. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  776. {
  777. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  778. }
  779. }
  780. private void SetConveyor6(Control control, WCS_STACKERDATA conveyor)
  781. {
  782. var con = (Conveyor6)control;
  783. if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
  784. {
  785. if (con.button1.Tag.ToString() != "pall")
  786. {
  787. con.button1.BackgroundImage = Image.FromFile("Resources/Rgv02.png");
  788. con.button1.Tag = "pall";
  789. }
  790. }
  791. else
  792. {
  793. if (con.button1.Tag.ToString() != "empty")
  794. {
  795. con.button1.BackgroundImage = Image.FromFile("Resources/shelf16UD.png");
  796. con.button1.Tag = "empty";
  797. }
  798. }
  799. if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
  800. {
  801. con.button1.BackColor = Color.Red;
  802. }
  803. if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
  804. {
  805. con.button1.BackColor = Color.FromArgb(0, 144, 154);
  806. }
  807. }
  808. private void SetRgv02(Control control, WCS_STACKERDATA rgv)
  809. {
  810. var con = (Rgv02)control;
  811. if (con.Name == "rgv01")
  812. {
  813. //var tablecelllabel1 = new TableCellLabel2();
  814. //tablecelllabel1.Dock = DockStyle.Fill;
  815. //tablecelllabel1.Name = "tableCellLabel23";
  816. //var tablecelllabel2 = new TableCellLabel2();
  817. //tablecelllabel2.Dock = DockStyle.Fill;
  818. //tablecelllabel2.Name = "tableCellLabel27";
  819. //int column = myTableLayoutPanel1.GetColumn(con);
  820. //int rgvposCout = 18;
  821. ////int rgvrunpos = 18;
  822. //int rgvrunpos = GetRgv01Pos(rgv.RGVSignalItem.DB522_Position_1, 8, 220000, 11, true);
  823. //if (column != rgvrunpos)
  824. //{
  825. // myTableLayoutPanel1.Controls.Remove(con);
  826. // var tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel23", false).ToList();
  827. // if (tablecelllabelSet.Count > 0)
  828. // {
  829. // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
  830. // }
  831. // tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel27", false).ToList();
  832. // if (tablecelllabelSet.Count > 0)
  833. // {
  834. // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
  835. // }
  836. // myTableLayoutPanel1.Controls.Add(con, rgvrunpos, 2);
  837. // if (rgvrunpos == 9)
  838. // {
  839. // myTableLayoutPanel1.Controls.Add(tablecelllabel2, rgvrunpos + 2, 2);
  840. // myTableLayoutPanel1.SetColumnSpan(tablecelllabel2, rgvposCout - rgvrunpos);
  841. // }
  842. // else if (rgvrunpos == 18)
  843. // {
  844. // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 9, 2);
  845. // myTableLayoutPanel1.SetColumnSpan(tablecelllabel1, rgvrunpos - 9);
  846. // }
  847. // else
  848. // {
  849. // myTableLayoutPanel1.Controls.Add(tablecelllabel2, rgvrunpos + 2, 2);
  850. // myTableLayoutPanel1.SetColumnSpan(tablecelllabel2, rgvposCout - rgvrunpos);
  851. // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 9, 2);
  852. // myTableLayoutPanel1.SetColumnSpan(tablecelllabel1, rgvrunpos - 9);
  853. // }
  854. //}
  855. if (rgv.RGVSignalItem.DB522_PH_Status_1)
  856. {
  857. if (con.btn01.Tag.ToString() != "pall")
  858. {
  859. con.btn01.BackgroundImage = Image.FromFile("Resources/Rgv02.png");
  860. con.btn01.Tag = "pall";
  861. }
  862. }
  863. else
  864. {
  865. if (con.btn01.Tag.ToString() != "empty")
  866. {
  867. con.btn01.BackgroundImage = Image.FromFile("Resources/shelf16UD.png");
  868. con.btn01.Tag = "empty";
  869. }
  870. }
  871. if (rgv.RGVSignalItem.DB522_PH_Status_2)
  872. {
  873. if (con.btn02.Tag.ToString() != "pall")
  874. {
  875. con.btn02.BackgroundImage = Image.FromFile("Resources/Rgv02.png");
  876. con.btn02.Tag = "pall";
  877. }
  878. }
  879. else
  880. {
  881. if (con.btn02.Tag.ToString() != "empty")
  882. {
  883. con.btn02.BackgroundImage = Image.FromFile("Resources/shelf16UD.png");
  884. con.btn02.Tag = "empty";
  885. }
  886. }
  887. if (rgv.RGVSignalItem.DB522_Fault_1 && con.btn01.BackColor != Color.Red)
  888. {
  889. con.btn01.BackColor = Color.Red;
  890. }
  891. if (rgv.RGVSignalItem.DB522_Fault_2 == false && con.btn02.BackColor != Color.FromArgb(0, 144, 154))
  892. {
  893. con.btn02.BackColor = Color.FromArgb(0, 144, 154);
  894. }
  895. }
  896. }
  897. private void SetRgv(Control control, WCS_STACKERDATA rgv)
  898. {
  899. var con = (Rgv)control;
  900. if (con.Name == "rgv02")
  901. {
  902. //var tablecelllabel1 = new TableCellLabel();
  903. //tablecelllabel1.Dock = DockStyle.Fill;
  904. //tablecelllabel1.Name = "tableCellLabel1";
  905. //var tablecelllabel2 = new TableCellLabel();
  906. //tablecelllabel2.Dock = DockStyle.Fill;
  907. //tablecelllabel2.Name = "tableCellLabel12";
  908. //int column = myTableLayoutPanel1.GetRow(con);
  909. //int rgvposCout = 19;
  910. //////int rgvrunpos = 16;
  911. //int rgvpositon_1 = rgv.RGVSignalItem.DB522_Position_1;
  912. //int rgvrunpos = GetRgv01Pos(rgvpositon_1, 3, 490000, 16, false);
  913. ////rgvrunpos = 3;//起点
  914. ////rgvrunpos = 17;//终点
  915. //if (column != rgvrunpos)
  916. //{
  917. // myTableLayoutPanel1.Controls.Remove(con);
  918. // var tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel1", false).ToList();
  919. // if (tablecelllabelSet.Count > 0)
  920. // {
  921. // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
  922. // }
  923. // tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel12", false).ToList();
  924. // if (tablecelllabelSet.Count > 0)
  925. // {
  926. // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
  927. // }
  928. // myTableLayoutPanel1.Controls.Add(con, 24, rgvrunpos);
  929. // if (rgvrunpos == 3)
  930. // {
  931. // myTableLayoutPanel1.Controls.Add(tablecelllabel2, 24, rgvrunpos + 2);
  932. // myTableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
  933. // }
  934. // else if (rgvrunpos == 17)
  935. // {
  936. // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 24, 3);
  937. // myTableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 3);
  938. // }
  939. // else
  940. // {
  941. // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 24, 3);
  942. // myTableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 3);
  943. // myTableLayoutPanel1.Controls.Add(tablecelllabel2, 24, rgvrunpos + 2);
  944. // myTableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
  945. // }
  946. //}
  947. SetRgvInfo(rgv, con);
  948. }
  949. else if (con.Name == "rgv03")
  950. {
  951. //var tablecelllabel1 = new TableCellLabel();
  952. //tablecelllabel1.Dock = DockStyle.Fill;
  953. //tablecelllabel1.Name = "tableCellLabel15";
  954. //var tablecelllabel2 = new TableCellLabel();
  955. //tablecelllabel2.Dock = DockStyle.Fill;
  956. //tablecelllabel2.Name = "tableCellLabel18";
  957. //int column = myTableLayoutPanel1.GetRow(con);
  958. //int rgvposCout = 20;
  959. //////int rgvrunpos = 18;
  960. //int rgvpositon_1 = rgv.RGVSignalItem.DB522_Position_1 + 300;
  961. //int rgvrunpos = GetRgv01Pos(rgvpositon_1, 4, 240300, 15, true);
  962. //if (column != rgvrunpos)
  963. //{
  964. // myTableLayoutPanel1.Controls.Remove(con);
  965. // var tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel15", false).ToList();
  966. // if (tablecelllabelSet.Count > 0)
  967. // {
  968. // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
  969. // }
  970. // tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel18", false).ToList();
  971. // if (tablecelllabelSet.Count > 0)
  972. // {
  973. // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
  974. // }
  975. // myTableLayoutPanel1.Controls.Add(con, 2, rgvrunpos);
  976. // if (rgvrunpos == 5)
  977. // {
  978. // myTableLayoutPanel1.Controls.Add(tablecelllabel2, 2, rgvrunpos + 2);
  979. // myTableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
  980. // }
  981. // else if (rgvrunpos == 18)
  982. // {
  983. // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 2, 5);
  984. // myTableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 5);
  985. // }
  986. // else
  987. // {
  988. // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 2, 5);
  989. // myTableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 5);
  990. // myTableLayoutPanel1.Controls.Add(tablecelllabel2, 2, rgvrunpos + 2);
  991. // myTableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
  992. // }
  993. //}
  994. SetRgvInfo(rgv, con);
  995. }
  996. else if (con.Name == "rgv04")
  997. {
  998. //var tablecelllabel1 = new TableCellLabel();
  999. //tablecelllabel1.Dock = DockStyle.Fill;
  1000. //tablecelllabel1.Name = "tableCellLabel16";
  1001. //var tablecelllabel2 = new TableCellLabel();
  1002. //tablecelllabel2.Dock = DockStyle.Fill;
  1003. //tablecelllabel2.Name = "tableCellLabel41";
  1004. //int column = tableLayoutPanel1.GetRow(con);
  1005. //int rgvposCout = 19;
  1006. //////int rgvrunpos = 18;
  1007. //int rgvpositon_1 = rgv.RGVSignalItem.DB522_Position_1 + 8000;
  1008. //int rgvrunpos = GetRgv01Pos(rgvpositon_1, 3, 238000, 15, false);
  1009. ////rgvrunpos = 4;//起点
  1010. ////rgvrunpos = 17;//终点
  1011. //if (column != rgvrunpos)
  1012. //{
  1013. // tableLayoutPanel1.Controls.Remove(con);
  1014. // var tablecelllabelSet = tableLayoutPanel1.Controls.Find("tableCellLabel16", false).ToList();
  1015. // if (tablecelllabelSet.Count > 0)
  1016. // {
  1017. // tableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
  1018. // }
  1019. // tablecelllabelSet = tableLayoutPanel1.Controls.Find("tableCellLabel41", false).ToList();
  1020. // if (tablecelllabelSet.Count > 0)
  1021. // {
  1022. // tableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
  1023. // }
  1024. // tableLayoutPanel1.Controls.Add(con, 2, rgvrunpos);
  1025. // if (rgvrunpos == 4)
  1026. // {
  1027. // tableLayoutPanel1.Controls.Add(tablecelllabel2, 2, rgvrunpos + 2);
  1028. // tableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
  1029. // }
  1030. // else if (rgvrunpos == 17)
  1031. // {
  1032. // tableLayoutPanel1.Controls.Add(tablecelllabel1, 2, 4);
  1033. // tableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 4);
  1034. // }
  1035. // else
  1036. // {
  1037. // tableLayoutPanel1.Controls.Add(tablecelllabel1, 2, 4);
  1038. // tableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 4);
  1039. // tableLayoutPanel1.Controls.Add(tablecelllabel2, 2, rgvrunpos + 2);
  1040. // tableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
  1041. // }
  1042. //}
  1043. SetRgvInfo(rgv, con);
  1044. }
  1045. }
  1046. private static void SetRgvInfo(WCS_STACKERDATA rgv, Rgv con)
  1047. {
  1048. if (rgv.RGVSignalItem.DB522_PH_Status_1)
  1049. {
  1050. if (con.btn01.Tag.ToString() != "pall")
  1051. {
  1052. con.btn01.BackgroundImage = Image.FromFile("Resources/rgv03.png");
  1053. con.btn01.Tag = "pall";
  1054. }
  1055. }
  1056. else
  1057. {
  1058. if (con.btn01.Tag.ToString() != "empty")
  1059. {
  1060. con.btn01.BackgroundImage = Image.FromFile("Resources/shelf16UD1.png");
  1061. con.btn01.Tag = "empty";
  1062. }
  1063. }
  1064. if (rgv.RGVSignalItem.DB522_PH_Status_2)
  1065. {
  1066. if (con.btn02.Tag.ToString() != "pall")
  1067. {
  1068. con.btn02.BackgroundImage = Image.FromFile("Resources/rgv03.png");
  1069. con.btn02.Tag = "pall";
  1070. }
  1071. }
  1072. else
  1073. {
  1074. if (con.btn02.Tag.ToString() != "empty")
  1075. {
  1076. con.btn02.BackgroundImage = Image.FromFile("Resources/shelf16UD1.png");
  1077. con.btn02.Tag = "empty";
  1078. }
  1079. }
  1080. if (rgv.RGVSignalItem.DB522_Fault_1 && con.btn01.BackColor != Color.Red)
  1081. {
  1082. con.btn01.BackColor = Color.Red;
  1083. }
  1084. if (rgv.RGVSignalItem.DB522_Fault_2 == false && con.btn02.BackColor != Color.FromArgb(0, 144, 154))
  1085. {
  1086. con.btn02.BackColor = Color.FromArgb(0, 144, 154);
  1087. }
  1088. }
  1089. private static void SetSrmInfo(WCS_STACKERDATA srm, Control con)
  1090. {
  1091. var srmitem = (Srm3)con;
  1092. if (srm.SrmSignalItem.SrmDB541_Alarm && srmitem.BackColor != Color.Red)
  1093. {
  1094. srmitem.button1.BackColor = Color.Red;
  1095. }
  1096. if (srm.SrmSignalItem.SrmDB541_Alarm && srmitem.BackColor != Color.FromArgb(0, 144, 154))
  1097. {
  1098. srmitem.button1.BackColor = Color.FromArgb(0, 144, 154);
  1099. }
  1100. }
  1101. protected override void Dispose(bool disposing)
  1102. {
  1103. if (disposing && (components != null))
  1104. {
  1105. components.Dispose();
  1106. }
  1107. base.Dispose(disposing);
  1108. if (_timer != null)
  1109. {
  1110. _timer.Stop();
  1111. _timer.Dispose();
  1112. }
  1113. System.GC.Collect();
  1114. }
  1115. /// <summary>
  1116. /// 计算RGV要移动的位置
  1117. /// </summary>
  1118. /// <param name="rgvCurPosLength">rgv当前位置长度</param>
  1119. /// <param name="offsets">偏移量</param>
  1120. /// <param name="rgvTracklength">rgv轨道长度</param>
  1121. /// <param name="rgvTrackPosCount">rgv轨道位置总数</param>
  1122. /// <param name="isGetRgvPosBack">是否取AGV反位置</param>
  1123. /// <returns></returns>
  1124. private int GetRgv01Pos(int rgvCurPosLength, int offsets,int rgvTracklength,int rgvTrackPosCount,bool isGetRgvPosBack)
  1125. {
  1126. //取rgv当前位置
  1127. int rgvpos = rgvCurPosLength;
  1128. if (isGetRgvPosBack)
  1129. {
  1130. rgvpos = rgvTracklength - rgvCurPosLength;
  1131. }
  1132. //单个位置长度
  1133. int OnePosLength = rgvTracklength / rgvTrackPosCount;
  1134. int OnePosNum = rgvpos / OnePosLength;
  1135. if ((rgvpos % OnePosLength) > 0)
  1136. {
  1137. if (isGetRgvPosBack==false)
  1138. {
  1139. OnePosNum = OnePosNum + 1;
  1140. }
  1141. }
  1142. if (OnePosNum == 0) OnePosNum++;
  1143. return OnePosNum + offsets;
  1144. }
  1145. }
  1146. }