You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
8.1 KiB
161 lines
8.1 KiB
using Module.Plc.ModbusTcp.Tool;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace MorClient.UserControls
|
|
{
|
|
public partial class Supcontrol_DO : UserControl
|
|
{
|
|
// 更新状态栏委托
|
|
//private delegate void PrintSysTime(); //委托事件
|
|
//private PrintSysTime DgRealSysTimeValue;
|
|
public Supcontrol_DO()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public void SetInputSingalColor(bool b, PictureBox box)
|
|
{
|
|
if (b)
|
|
{
|
|
box.Image = WindowsFormsApp1.Properties.Resources.Status_Green;
|
|
//box.Refresh();
|
|
}
|
|
else
|
|
{
|
|
box.Image = WindowsFormsApp1.Properties.Resources.Status_Gray;
|
|
//box.Refresh();
|
|
}
|
|
}
|
|
|
|
private void Supcontrol_DO_Load(object sender, EventArgs e)
|
|
{
|
|
if (!PubStaticClass.bthreedDO)
|
|
{
|
|
PubStaticClass.bthreedDO = true;
|
|
//DgRealSysTimeValue = new PrintSysTime(DetectionRecipeThread);
|
|
Thread printRealTimeThread = new Thread(/*StartPrintRealTime*/DetectionRecipeThread);
|
|
printRealTimeThread.IsBackground = true;
|
|
printRealTimeThread.Start();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 实时检测配方下发
|
|
/// </summary>
|
|
public/* async*/ void DetectionRecipeThread()
|
|
{
|
|
/*await Task.Run(() =>
|
|
{*/
|
|
while (true)
|
|
{
|
|
try
|
|
{
|
|
if (PublicPara.twoFunctionButtons == "[监控]" && PublicPara.fristFunctionButtons == "[操作]")
|
|
{
|
|
SetInputSingalColor(Common.outputSingal.host01, o1p1);
|
|
SetInputSingalColor(Common.outputSingal.host02, o1p2);
|
|
SetInputSingalColor(Common.outputSingal.host03, o1p3);
|
|
SetInputSingalColor(Common.outputSingal.host04, o1p4);
|
|
SetInputSingalColor(Common.outputSingal.host05, o1p5);
|
|
SetInputSingalColor(Common.outputSingal.host06, o1p6);
|
|
SetInputSingalColor(Common.outputSingal.host07, o1p7);
|
|
SetInputSingalColor(Common.outputSingal.host08, o1p8);
|
|
SetInputSingalColor(Common.outputSingal.host09, o1p9);
|
|
SetInputSingalColor(Common.outputSingal.host10, o1p10);
|
|
SetInputSingalColor(Common.outputSingal.host11, o1p11);
|
|
SetInputSingalColor(Common.outputSingal.host12, o1p12);
|
|
SetInputSingalColor(Common.outputSingal.host13, o1p13);
|
|
SetInputSingalColor(Common.outputSingal.host14, o1p14);
|
|
SetInputSingalColor(Common.outputSingal.host15, o1p15);
|
|
SetInputSingalColor(Common.outputSingal.host16, o1p16);
|
|
|
|
SetInputSingalColor(Common.outputSingal.do1_00, o2p0);
|
|
SetInputSingalColor(Common.outputSingal.do1_01, o2p1);
|
|
SetInputSingalColor(Common.outputSingal.do1_02, o2p2);
|
|
SetInputSingalColor(Common.outputSingal.do1_03, o2p3);
|
|
SetInputSingalColor(Common.outputSingal.do1_04, o2p4);
|
|
SetInputSingalColor(Common.outputSingal.do1_05, o2p5);
|
|
SetInputSingalColor(Common.outputSingal.do1_06, o2p6);
|
|
SetInputSingalColor(Common.outputSingal.do1_07, o2p7);
|
|
SetInputSingalColor(Common.outputSingal.do1_08, o2p8);
|
|
SetInputSingalColor(Common.outputSingal.do1_09, o2p9);
|
|
SetInputSingalColor(Common.outputSingal.do1_10, o2p10);
|
|
SetInputSingalColor(Common.outputSingal.do1_11, o2p11);
|
|
SetInputSingalColor(Common.outputSingal.do1_12, o2p12);
|
|
SetInputSingalColor(Common.outputSingal.do1_13, o2p13);
|
|
SetInputSingalColor(Common.outputSingal.do1_14, o2p14);
|
|
SetInputSingalColor(Common.outputSingal.do1_15, o2p15);
|
|
|
|
SetInputSingalColor(Common.outputSingal.do2_00, o3p0);
|
|
SetInputSingalColor(Common.outputSingal.do2_01, o3p1);
|
|
SetInputSingalColor(Common.outputSingal.do2_02, o3p2);
|
|
SetInputSingalColor(Common.outputSingal.do2_03, o3p3);
|
|
SetInputSingalColor(Common.outputSingal.do2_04, o3p4);
|
|
SetInputSingalColor(Common.outputSingal.do2_05, o3p5);
|
|
SetInputSingalColor(Common.outputSingal.do2_06, o3p6);
|
|
SetInputSingalColor(Common.outputSingal.do2_07, o3p7);
|
|
SetInputSingalColor(Common.outputSingal.do2_08, o3p8);
|
|
SetInputSingalColor(Common.outputSingal.do2_09, o3p9);
|
|
SetInputSingalColor(Common.outputSingal.do2_10, o3p10);
|
|
SetInputSingalColor(Common.outputSingal.do2_11, o3p11);
|
|
SetInputSingalColor(Common.outputSingal.do2_12, o3p12);
|
|
SetInputSingalColor(Common.outputSingal.do2_13, o3p13);
|
|
SetInputSingalColor(Common.outputSingal.do2_14, o3p14);
|
|
SetInputSingalColor(Common.outputSingal.do2_15, o3p15);
|
|
|
|
SetInputSingalColor(Common.outputSingal.do3_00, o4p0);
|
|
SetInputSingalColor(Common.outputSingal.do3_01, o4p1);
|
|
SetInputSingalColor(Common.outputSingal.do3_02, o4p2);
|
|
SetInputSingalColor(Common.outputSingal.do3_03, o4p3);
|
|
SetInputSingalColor(Common.outputSingal.do3_04, o4p4);
|
|
SetInputSingalColor(Common.outputSingal.do3_05, o4p5);
|
|
SetInputSingalColor(Common.outputSingal.do3_06, o4p6);
|
|
SetInputSingalColor(Common.outputSingal.do3_07, o4p7);
|
|
SetInputSingalColor(Common.outputSingal.do3_08, o4p8);
|
|
SetInputSingalColor(Common.outputSingal.do3_09, o4p9);
|
|
SetInputSingalColor(Common.outputSingal.do3_10, o4p10);
|
|
SetInputSingalColor(Common.outputSingal.do3_11, o4p11);
|
|
SetInputSingalColor(Common.outputSingal.do3_12, o4p12);
|
|
SetInputSingalColor(Common.outputSingal.do3_13, o4p13);
|
|
SetInputSingalColor(Common.outputSingal.do3_14, o4p14);
|
|
SetInputSingalColor(Common.outputSingal.do3_15, o4p15);
|
|
|
|
SetInputSingalColor(Common.outputSingal.d04_00, o5p0);
|
|
SetInputSingalColor(Common.outputSingal.d04_01, o5p1);
|
|
SetInputSingalColor(Common.outputSingal.d04_02, o5p2);
|
|
SetInputSingalColor(Common.outputSingal.d04_03, o5p3);
|
|
SetInputSingalColor(Common.outputSingal.d04_04, o5p4);
|
|
SetInputSingalColor(Common.outputSingal.d04_05, o5p5);
|
|
SetInputSingalColor(Common.outputSingal.d04_06, o5p6);
|
|
SetInputSingalColor(Common.outputSingal.d04_07, o5p7);
|
|
SetInputSingalColor(Common.outputSingal.d04_08, o5p8);
|
|
SetInputSingalColor(Common.outputSingal.d04_09, o5p9);
|
|
|
|
//21, 174, 103 绿色
|
|
//112, 112, 112 灰色
|
|
|
|
}
|
|
System.Threading.Thread.Sleep(500);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ex.ToString();
|
|
}
|
|
GC.Collect();
|
|
GC.WaitForPendingFinalizers();
|
|
System.Threading.Thread.Sleep(200);
|
|
}
|
|
/* });*/
|
|
|
|
}
|
|
|
|
}
|
|
}
|