init: 北航大学BH-DAS项目首次入库
This commit is contained in:
654
CCYQ_JieFang/OP/OP50/DAS_OP50.cs
Normal file
654
CCYQ_JieFang/OP/OP50/DAS_OP50.cs
Normal file
@@ -0,0 +1,654 @@
|
||||
|
||||
using DK_DC_Tool;
|
||||
using HslCommunication.Core;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.SS.UserModel;
|
||||
using OpcBasic;
|
||||
using Robot.Common;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
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;
|
||||
using SystemFramework;
|
||||
|
||||
namespace MesWork
|
||||
{
|
||||
public partial class DAS_OP50
|
||||
{
|
||||
InitServer initServer = null;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private static string OpNameCurrent = "";
|
||||
/// <summary>
|
||||
/// 字典 ,存储12个开始测量图片控件,key为测量位置,value为图片控件
|
||||
/// </summary>
|
||||
Dictionary<int, PictureBox> dicStartMasurePictureBox = new Dictionary<int, PictureBox>();
|
||||
/// <summary>
|
||||
/// 字典 ,存储12个结束测量图片控件,key为测量位置,value为图片控件
|
||||
/// </summary>
|
||||
Dictionary<int, PictureBox> dicEndMasurePictureBox = new Dictionary<int, PictureBox>();
|
||||
/// <summary>
|
||||
/// 字典 ,存储12个结束测量文本框控件,key为测量位置,value文本框的值
|
||||
/// </summary>
|
||||
Dictionary<int, TextBox> dicMeasureTextBox = new Dictionary<int, TextBox>();
|
||||
/// <summary>
|
||||
/// PLC事件变化委托
|
||||
/// </summary>
|
||||
public static Action<DeviceDriver_BasicData.CustomeEvetnArgs> MIS_Funtion_PLC_OP = null;
|
||||
|
||||
/// <summary>
|
||||
/// PLC事件变化委托
|
||||
/// </summary>
|
||||
public static Action<string> AGV_Task_change = null;
|
||||
/// <summary>
|
||||
/// PLC事件变化委托--处理托盘信息
|
||||
/// </summary>
|
||||
public static Action<string> AGV_Task_Info = null;
|
||||
|
||||
// 每个工位的满工件数量
|
||||
// 工位OP50 3个
|
||||
public static int partCount = 3;
|
||||
|
||||
public static bool isConnect = false;
|
||||
|
||||
public DAS_OP50(string opName)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
publicCore.partCount = partCount;
|
||||
OpNameCurrent = opName;
|
||||
|
||||
Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang;
|
||||
Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang;
|
||||
|
||||
MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking;
|
||||
MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking;
|
||||
|
||||
MIS_Funtion_PLC_OP -= MIS_Funtion_PLC;
|
||||
MIS_Funtion_PLC_OP += MIS_Funtion_PLC;
|
||||
|
||||
AGV_Task_change -= SolveAgvDeviceStatus;
|
||||
AGV_Task_change += SolveAgvDeviceStatus;
|
||||
|
||||
|
||||
if (MesWorkForm.IsDemoMesServer == 1)
|
||||
{
|
||||
MoNiHeartBeat();
|
||||
}
|
||||
SolvePicAndMeasureValueInit();
|
||||
|
||||
new Thread(new ThreadStart(delegate () {
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
|
||||
}
|
||||
catch (Exception err) { }
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
}))
|
||||
{ IsBackground = true }.Start();
|
||||
|
||||
//var aa =
|
||||
//new Thread(new ThreadStart(delegate () {
|
||||
// while (true)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// if (!isConnect)
|
||||
// {
|
||||
// if (publicCore.Get_PartPosition(OpNameCurrent) != -1)
|
||||
// {
|
||||
// isConnect = true;
|
||||
// ProductInfo_search();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (Exception err) { }
|
||||
// Thread.Sleep(1000);
|
||||
// }
|
||||
//}));
|
||||
//aa.IsBackground = true;
|
||||
//aa.Start();
|
||||
|
||||
}
|
||||
public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tagID = msgEvent.TagID.ToString();
|
||||
// var opName = msgEvent.OpName.ToString();
|
||||
var tagTypeCodeID = (int)msgEvent.TagTypeCodeID;
|
||||
var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID;
|
||||
string tagValue;
|
||||
switch (tagTypeID)
|
||||
{
|
||||
case EnumTagTypeID.BOOL:
|
||||
tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
|
||||
break;
|
||||
default:
|
||||
tagValue = msgEvent.TagValue.ToString();
|
||||
break;
|
||||
}
|
||||
switch (tagTypeCodeID)
|
||||
{
|
||||
case 14:
|
||||
DeviceHeartBeat(tagValue);
|
||||
break;
|
||||
// AGV任务
|
||||
case 50:
|
||||
publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue);
|
||||
break;
|
||||
// 51 空闲(请求上料)
|
||||
// 52 完成(请求下料)
|
||||
// 53 故障
|
||||
case 51:
|
||||
case 52:
|
||||
case 53:
|
||||
publicCore.SolveDeviceStatus(OpNameCurrent);
|
||||
SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent));
|
||||
break;
|
||||
// 54 第几个件
|
||||
case 54:
|
||||
ProductInfo_search();
|
||||
SolvePicAndMeasureValueWorking();
|
||||
break;
|
||||
case 55:
|
||||
publicCore.MeasurePositionChange(OpNameCurrent, 2);
|
||||
SolvePicAndMeasureValueWorking();
|
||||
break;
|
||||
//读电批
|
||||
case 56:
|
||||
if (tagValue == "1")
|
||||
{
|
||||
publicCore.LogInsert("OP50", "Info", "【PLC_读电批置位】");
|
||||
// 不在这个地方写true,写在接收数据的地方写
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
publicCore.LogInsert("OP50", "Info", "【PLC_读电批复位】");
|
||||
MesWorkForm.WritePLC(83, OpNameCurrent, false);
|
||||
publicCore.LogInsert("OP50", "Info", "【IPC_读电批完成复位】");
|
||||
}
|
||||
break;
|
||||
//读泄漏量1 2或者压力
|
||||
case 59:
|
||||
if (tagValue == "1")
|
||||
{
|
||||
//publicCore.ReadQualityData_LeakageRate(OpNameCurrent);
|
||||
//publicCore.ReadQualityData_Pressure(OpNameCurrent);
|
||||
MesWorkForm.WritePLC(84, OpNameCurrent, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
MesWorkForm.WritePLC(84, OpNameCurrent, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化界面显示
|
||||
/// </summary>
|
||||
private void SolvePicAndMeasureValueInit()
|
||||
{
|
||||
try
|
||||
{
|
||||
dicStartMasurePictureBox.Add(1, pictureBox2_start_1);
|
||||
dicStartMasurePictureBox.Add(2, pictureBox2_start_2);
|
||||
dicStartMasurePictureBox.Add(3, pictureBox2_start_3);
|
||||
dicStartMasurePictureBox.Add(4, pictureBox2_start_4);
|
||||
dicStartMasurePictureBox.Add(5, pictureBox2_start_5);
|
||||
dicStartMasurePictureBox.Add(6, pictureBox2_start_6);
|
||||
dicStartMasurePictureBox.Add(7, pictureBox2_start_7);
|
||||
dicStartMasurePictureBox.Add(8, pictureBox2_start_8);
|
||||
dicStartMasurePictureBox.Add(9, pictureBox2_start_9);
|
||||
dicStartMasurePictureBox.Add(10, pictureBox2_start_10);
|
||||
dicStartMasurePictureBox.Add(11, pictureBox2_start_11);
|
||||
dicStartMasurePictureBox.Add(12, pictureBox2_start_12);
|
||||
|
||||
dicEndMasurePictureBox.Add(1, pictureBox12_end_1);
|
||||
dicEndMasurePictureBox.Add(2, pictureBox12_end_2);
|
||||
dicEndMasurePictureBox.Add(3, pictureBox12_end_3);
|
||||
dicEndMasurePictureBox.Add(4, pictureBox12_end_4);
|
||||
dicEndMasurePictureBox.Add(5, pictureBox12_end_5);
|
||||
dicEndMasurePictureBox.Add(6, pictureBox12_end_6);
|
||||
dicEndMasurePictureBox.Add(7, pictureBox12_end_7);
|
||||
dicEndMasurePictureBox.Add(8, pictureBox12_end_8);
|
||||
dicEndMasurePictureBox.Add(9, pictureBox12_end_9);
|
||||
dicEndMasurePictureBox.Add(10, pictureBox12_end_10);
|
||||
dicEndMasurePictureBox.Add(11, pictureBox12_end_11);
|
||||
dicEndMasurePictureBox.Add(12, pictureBox12_end_12);
|
||||
|
||||
dicMeasureTextBox.Add(1, textBox_MeasureValue_1);
|
||||
dicMeasureTextBox.Add(2, textBox_MeasureValue_2);
|
||||
dicMeasureTextBox.Add(3, textBox_MeasureValue_3);
|
||||
dicMeasureTextBox.Add(4, textBox_MeasureValue_4);
|
||||
dicMeasureTextBox.Add(5, textBox_MeasureValue_5);
|
||||
dicMeasureTextBox.Add(6, textBox_MeasureValue_6);
|
||||
dicMeasureTextBox.Add(7, textBox_MeasureValue_7);
|
||||
dicMeasureTextBox.Add(8, textBox_MeasureValue_8);
|
||||
dicMeasureTextBox.Add(9, textBox_MeasureValue_9);
|
||||
dicMeasureTextBox.Add(10, textBox_MeasureValue_10);
|
||||
dicMeasureTextBox.Add(11, textBox_MeasureValue_11);
|
||||
dicMeasureTextBox.Add(12, textBox_MeasureValue_12);
|
||||
|
||||
|
||||
foreach (var item in dicStartMasurePictureBox)
|
||||
{
|
||||
item.Value.Visible = false;
|
||||
}
|
||||
foreach (var item in dicEndMasurePictureBox)
|
||||
{
|
||||
item.Value.Visible = false;
|
||||
}
|
||||
foreach (var item in dicMeasureTextBox)
|
||||
{
|
||||
item.Value.Text = "";
|
||||
}
|
||||
|
||||
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
|
||||
|
||||
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
|
||||
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
|
||||
string tagValue = dt.Rows[i]["测量值"].ToString();
|
||||
string isOk = dt.Rows[i]["是否合格"].ToString();
|
||||
|
||||
// 测量状态为1 表示初始状态,两张图片都不显示
|
||||
// 测量状态为2 表示正在测量,显示第二张图片
|
||||
// 测量状态为3 表示测量完成,显示第一张图片
|
||||
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
|
||||
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
|
||||
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
|
||||
|
||||
if (measureStatus == 1)
|
||||
{
|
||||
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
|
||||
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
|
||||
}
|
||||
else if (measureStatus == 2)
|
||||
{
|
||||
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
|
||||
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
|
||||
}
|
||||
else if (measureStatus == 3)
|
||||
{
|
||||
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
|
||||
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
|
||||
}
|
||||
if (isOk == "1")
|
||||
{
|
||||
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 工作时界面显示
|
||||
/// </summary>
|
||||
private void SolvePicAndMeasureValueWorking()
|
||||
{
|
||||
try
|
||||
{
|
||||
int partPosition = publicCore.Get_PartPosition(OpNameCurrent);
|
||||
publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]);
|
||||
int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]);
|
||||
string tagValue = dt.Rows[i]["测量值"].ToString();
|
||||
string isOk = dt.Rows[i]["是否合格"].ToString();
|
||||
// 测量状态为1 表示初始状态,两张图片都不显示
|
||||
// 测量状态为2 表示正在测量,显示第二张图片
|
||||
// 测量状态为3 表示测量完成,显示第一张图片
|
||||
|
||||
var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition];
|
||||
var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition];
|
||||
var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition];
|
||||
|
||||
if (measureStatus == 1)
|
||||
{
|
||||
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
|
||||
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
|
||||
}
|
||||
else if (measureStatus == 2)
|
||||
{
|
||||
ShowPicBoxControl(control_DicStartMasurePictureBox, true);
|
||||
ShowPicBoxControl(control_DicEndMasurePictureBox, false);
|
||||
}
|
||||
else if (measureStatus == 3)
|
||||
{
|
||||
ShowPicBoxControl(control_DicStartMasurePictureBox, false);
|
||||
ShowPicBoxControl(control_DicEndMasurePictureBox, true);
|
||||
}
|
||||
if (isOk == "2")
|
||||
{
|
||||
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 界面产品编码和装配位置的显示
|
||||
/// </summary>
|
||||
public void ProductInfo_search()
|
||||
{
|
||||
try
|
||||
{
|
||||
//textBox1_EngineID.Text = "";
|
||||
//textBox1_PartPosition.Text = "";
|
||||
ShowTextBoxControl(textBox1_EngineID, "", Color.White);
|
||||
ShowTextBoxControl(textBox1_PartPosition, "", Color.White);
|
||||
int PartPosition = publicCore.Get_PartPosition(OpNameCurrent);
|
||||
publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White);
|
||||
ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White);
|
||||
//textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString();
|
||||
//textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
}
|
||||
private void ShowPicBoxControl(Control c, bool ststus)
|
||||
{
|
||||
c.BeginInvoke(new Action(delegate () {
|
||||
c.Visible = ststus;
|
||||
}));
|
||||
}
|
||||
private void ShowTextBoxControl(Control c, string value, Color color)
|
||||
{
|
||||
c.BeginInvoke(new Action(delegate () {
|
||||
c.Text = value;
|
||||
c.BackColor = color;
|
||||
}));
|
||||
}
|
||||
private void ShowLabelControl(Control c, Color color)
|
||||
{
|
||||
//if (c.InvokeRequired)
|
||||
//{
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// c.ForeColor = color;
|
||||
//}
|
||||
c.BeginInvoke(new Action(delegate () {
|
||||
c.ForeColor = color;
|
||||
}));
|
||||
}
|
||||
private void ShowButtonControl(Control c, Color color)
|
||||
{
|
||||
c.BeginInvoke(new Action(delegate () {
|
||||
c.BackColor = color;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化设备状态
|
||||
/// 1工作中 2空闲(请求上料) 3完成(请求下料) 4 报警
|
||||
/// </summary>
|
||||
private void SolveDeviceStatusInit(string currentStatus)
|
||||
{
|
||||
try
|
||||
{
|
||||
ShowButtonControl(button_running, Color.Gray);
|
||||
ShowButtonControl(button_finished, Color.Gray);
|
||||
ShowButtonControl(button_empty, Color.Gray);
|
||||
ShowButtonControl(button_alarm, Color.Gray);
|
||||
//button_running.BackColor = Color.Gray;
|
||||
//button_finished.BackColor = Color.Gray;
|
||||
//button_empty.BackColor = Color.Gray;
|
||||
//button_alarm.BackColor = Color.Gray;
|
||||
|
||||
if (currentStatus == "1")
|
||||
{
|
||||
ShowButtonControl(button_running, Color.Green);
|
||||
//button_running.BackColor = Color.Green;
|
||||
}
|
||||
else if (currentStatus == "2")
|
||||
{
|
||||
ShowButtonControl(button_empty, Color.SkyBlue);
|
||||
|
||||
//button_empty.BackColor = Color.SkyBlue;
|
||||
}
|
||||
else if (currentStatus == "3")
|
||||
{
|
||||
ShowButtonControl(button_finished, Color.DarkOrange);
|
||||
|
||||
//button_finished.BackColor = Color.DarkOrange;
|
||||
}
|
||||
else if (currentStatus == "4")
|
||||
{
|
||||
ShowButtonControl(button_alarm, Color.Red);
|
||||
|
||||
//button_alarm.BackColor = Color.Red;
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// AGV设备状态显示
|
||||
/// </summary>
|
||||
/// <param name="PLC_AgvTaskNum"></param>
|
||||
private void SolveAgvDeviceStatus(string PLC_AgvTaskNum)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 77 反馈AGV任务
|
||||
switch (PLC_AgvTaskNum)
|
||||
{
|
||||
case "10":
|
||||
// AGV触发装配任务 正在送料
|
||||
//label_AgvSongliao.ForeColor = Color.Green;
|
||||
|
||||
//label_AgvRequestLeave.ForeColor = Color.Black;
|
||||
//label_AgvRequestEnter.ForeColor = Color.Black;
|
||||
|
||||
//label_AgvCanEnter.ForeColor = Color.Black;
|
||||
//label_AgvCanLeave.ForeColor = Color.Black;
|
||||
|
||||
//label_AgvLeaved.ForeColor = Color.Black;
|
||||
|
||||
ShowLabelControl(label_AgvSongliao, Color.Green);
|
||||
ShowLabelControl(label_AgvRequestLeave, Color.Black);
|
||||
ShowLabelControl(label_AgvRequestEnter, Color.Black);
|
||||
ShowLabelControl(label_AgvCanEnter, Color.Black);
|
||||
ShowLabelControl(label_AgvCanLeave, Color.Black);
|
||||
ShowLabelControl(label_AgvLeaved, Color.Black);
|
||||
|
||||
|
||||
ProductInfo_search();
|
||||
SolvePicAndMeasureValueWorking();
|
||||
|
||||
break;
|
||||
case "11":
|
||||
|
||||
ShowLabelControl(label_AgvRequestLeave, Color.Black);
|
||||
ShowLabelControl(label_AgvRequestEnter, Color.Green);
|
||||
|
||||
//label_AgvRequestEnter.ForeColor = Color.Green;
|
||||
//label_AgvRequestLeave.ForeColor = Color.Black;
|
||||
break;
|
||||
// 允许AGV进行上料 --允许进入
|
||||
// 允许AGV进行下料 --允许进入
|
||||
case "2":
|
||||
case "4":
|
||||
ShowLabelControl(label_AgvCanEnter, Color.Green);
|
||||
ShowLabelControl(label_AgvCanLeave, Color.Black);
|
||||
//label_AgvCanEnter.ForeColor = Color.Green;
|
||||
//label_AgvCanLeave.ForeColor = Color.Black;
|
||||
break;
|
||||
case "21":
|
||||
// AGV 上料完成
|
||||
ShowLabelControl(label_AgvRequestLeave, Color.Black);
|
||||
ShowLabelControl(label_AgvRequestEnter, Color.Green);
|
||||
//label_AgvRequestLeave.ForeColor = Color.Black;
|
||||
//label_AgvRequestEnter.ForeColor = Color.Green;
|
||||
break;
|
||||
case "3":
|
||||
// 1.调用FSS-接收IPC下料请求的接口
|
||||
// 2.反馈任务号:30 AGV已呼叫成功正在去往下料区
|
||||
break;
|
||||
case "31":
|
||||
ShowLabelControl(label_AgvRequestEnter, Color.Black);
|
||||
ShowLabelControl(label_AgvRequestLeave, Color.Green);
|
||||
//label_AgvRequestEnter.ForeColor = Color.Black;
|
||||
//label_AgvRequestLeave.ForeColor = Color.Green;
|
||||
// AGV已到达下料区
|
||||
break;
|
||||
case "41":
|
||||
// AGV下料完成
|
||||
break;
|
||||
// 允许AGV离开
|
||||
case "5":
|
||||
ShowLabelControl(label_AgvCanEnter, Color.Black);
|
||||
ShowLabelControl(label_AgvCanLeave, Color.Green);
|
||||
//label_AgvCanEnter.ForeColor = Color.Black;
|
||||
//label_AgvCanLeave.ForeColor = Color.Green;
|
||||
break;
|
||||
case "51":
|
||||
//label_AgvSongliao.ForeColor = Color.Black;
|
||||
|
||||
//label_AgvRequestLeave.ForeColor = Color.Black;
|
||||
//label_AgvRequestEnter.ForeColor = Color.Black;
|
||||
|
||||
//label_AgvCanEnter.ForeColor = Color.Black;
|
||||
//label_AgvCanLeave.ForeColor = Color.Black;
|
||||
|
||||
//label_AgvLeaved.ForeColor = Color.Green;
|
||||
ShowLabelControl(label_AgvSongliao, Color.Black);
|
||||
ShowLabelControl(label_AgvRequestLeave, Color.Black);
|
||||
ShowLabelControl(label_AgvRequestEnter, Color.Black);
|
||||
ShowLabelControl(label_AgvCanEnter, Color.Black);
|
||||
ShowLabelControl(label_AgvCanLeave, Color.Black);
|
||||
ShowLabelControl(label_AgvLeaved, Color.Green);
|
||||
ProductInfo_search();
|
||||
SolvePicAndMeasureValueWorking();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备PLC心跳button5_heartBeat_Ning
|
||||
/// </summary>
|
||||
/// <param name="tagValue"></param>
|
||||
private void DeviceHeartBeat(string tagValue)
|
||||
{
|
||||
WritePLC(15, OpNameCurrent, tagValue);
|
||||
if (tagValue == "1")
|
||||
{
|
||||
ShowButtonControl(button5_heartBeat, Color.Green);
|
||||
|
||||
//button5_heartBeat.BackColor = Color.Green;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowButtonControl(button5_heartBeat, Color.Gray);
|
||||
|
||||
//button5_heartBeat.BackColor = Color.Gray;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 设备PLC心跳
|
||||
/// </summary>
|
||||
/// <param name="tagValue"></param>
|
||||
private void DeviceHeartBeat_NingJinQiang(string tagValue)
|
||||
{
|
||||
if (tagValue == "1")
|
||||
{
|
||||
ShowButtonControl(button5_heartBeat_Ning, Color.Green);
|
||||
|
||||
//button5_heartBeat_Ning.BackColor = Color.Green;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowButtonControl(button5_heartBeat_Ning, Color.Red);
|
||||
|
||||
//button5_heartBeat_Ning.BackColor = Color.Red;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void MoNiHeartBeat()
|
||||
{
|
||||
bool tv = false;
|
||||
new Thread(new ThreadStart(delegate () {
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
WritePLC(14, OpNameCurrent, tv);
|
||||
tv = !tv;
|
||||
}
|
||||
catch (Exception err) { }
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
}))
|
||||
{ IsBackground = true }.Start();
|
||||
}
|
||||
|
||||
private void label5_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user