using Module.Plc.ModbusTcp.Tool;
using RS.Common;
using RS.Module.Common;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MorClient
{
public partial class UnitRobot : UserControl
{
public UnitRobot()
{
InitializeComponent();
}
#region 实时展示状态值
private delegate void PrintCSStateValueCallBack(); //委托事件
private PrintCSStateValueCallBack ShowCSStateValue;
public static bool IsPrintReadValue = false;
///
/// 开始显示实时值线程
///
private void StartPrintParamRealValue()
{
if (MorClient.FrmMainFrame.instanceObject.CheckUser1Visibility())
{
while (true)
{
if (this.IsHandleCreated)
{
this.BeginInvoke(ShowCSStateValue, null);
}
System.Threading.Thread.Sleep(1000);
}
}
}
///
/// 展示参数实时值
///
private async void PrintParamRealValue()
{
try
{
if (MorClient.PublicPara.PlcTool != null)
{
await loadingData();
}
}
catch (Exception ex)
{
ex.ToString();
}
}
///
/// 是否展示内容
///
static bool isShow = true;
///
/// 实时展示内容
///
public async Task loadingData()
{
if (Common.stationRobot.PBTState == 1)
uiLabel2.Text = "准备";
else if (Common.stationRobot.PBTState == 2)
uiLabel2.Text = "运行";
else
uiLabel2.Text = "错误";
uiLabel38.Text = ASCIIHelper.int16ToASCII(Common.stationRobot.alarmNum.ToString());
uiButton30.FillColor = Common.stationRobot.F_RobotInitialization ? Color.FromArgb(146, 208, 80) : Color.FromArgb(32, 56, 100);
uiButton28.FillColor = Common.stationRobot.F_ClearAllSlices ? Color.FromArgb(146, 208, 80) : Color.FromArgb(32, 56, 100);
uiButton27.FillColor = Common.stationRobot.F_FlowerBasketAFindSieces ? Color.FromArgb(146, 208, 80) : Color.FromArgb(32, 56, 100);
uiButton31.FillColor = Common.stationRobot.F_FlowerBasketBFindSieces ? Color.FromArgb(146, 208, 80) : Color.FromArgb(32, 56, 100);
uiButton35.FillColor = Common.stationRobot.upFingerVacuumSingal ? Color.FromArgb(146, 208, 80) : Color.FromArgb(32, 56, 100);
uiButton36.FillColor = Common.stationRobot.downFingerVacuumSingal ? Color.FromArgb(146, 208, 80) : Color.FromArgb(32, 56, 100);
if (PublicParams.currUserInfo.userGroup == "Operator")
{
uiButton27.Enabled = false;
uiButton28.Enabled = false;
uiButton30.Enabled = false;
uiButton31.Enabled = false;
uiButton35.Enabled = false;
uiButton36.Enabled = false;
}
else
{
uiButton27.Enabled = true;
uiButton28.Enabled = true;
uiButton30.Enabled = true;
uiButton31.Enabled = true;
uiButton35.Enabled = true;
uiButton36.Enabled = true;
}
try
{
if (PublicPara.PlcTool != null)
{
ObtainCs1WaferState();
}
}
catch (Exception ex)
{
ex.ToString();
}
}
///
/// 窗体控件内容赋值
///
public void ObtainCs1WaferState()
{
#region 设置CS1晶圆颜色
SeWafertColor(Common.stationCS1.waferState00, butCS1_1);
SeWafertColor(Common.stationCS1.waferState01, butCS1_2);
SeWafertColor(Common.stationCS1.waferState02, butCS1_3);
SeWafertColor(Common.stationCS1.waferState03, butCS1_4);
SeWafertColor(Common.stationCS1.waferState04, butCS1_5);
SeWafertColor(Common.stationCS1.waferState05, butCS1_6);
SeWafertColor(Common.stationCS1.waferState06, butCS1_7);
SeWafertColor(Common.stationCS1.waferState07, butCS1_8);
SeWafertColor(Common.stationCS1.waferState08, butCS1_9);
SeWafertColor(Common.stationCS1.waferState09, butCS1_10);
SeWafertColor(Common.stationCS1.waferState10, butCS1_11);
SeWafertColor(Common.stationCS1.waferState11, butCS1_12);
SeWafertColor(Common.stationCS1.waferState12, butCS1_13);
SeWafertColor(Common.stationCS1.waferState13, butCS1_14);
SeWafertColor(Common.stationCS1.waferState14, butCS1_15);
SeWafertColor(Common.stationCS1.waferState15, butCS1_16);
SeWafertColor(Common.stationCS1.waferState16, butCS1_17);
SeWafertColor(Common.stationCS1.waferState17, butCS1_18);
SeWafertColor(Common.stationCS1.waferState18, butCS1_19);
SeWafertColor(Common.stationCS1.waferState19, butCS1_20);
SeWafertColor(Common.stationCS1.waferState20, butCS1_21);
SeWafertColor(Common.stationCS1.waferState21, butCS1_22);
SeWafertColor(Common.stationCS1.waferState22, butCS1_23);
SeWafertColor(Common.stationCS1.waferState23, butCS1_24);
SeWafertColor(Common.stationCS1.waferState24, butCS1_25);
#endregion 设置晶圆颜色
#region 设置CS2晶圆颜色
SeWafertColor(Common.stationCS2.waferState00, butCS2_1);
SeWafertColor(Common.stationCS2.waferState01, butCS2_2);
SeWafertColor(Common.stationCS2.waferState02, butCS2_3);
SeWafertColor(Common.stationCS2.waferState03, butCS2_4);
SeWafertColor(Common.stationCS2.waferState04, butCS2_5);
SeWafertColor(Common.stationCS2.waferState05, butCS2_6);
SeWafertColor(Common.stationCS2.waferState06, butCS2_7);
SeWafertColor(Common.stationCS2.waferState07, butCS2_8);
SeWafertColor(Common.stationCS2.waferState08, butCS2_9);
SeWafertColor(Common.stationCS2.waferState09, butCS2_10);
SeWafertColor(Common.stationCS2.waferState10, butCS2_11);
SeWafertColor(Common.stationCS2.waferState11, butCS2_12);
SeWafertColor(Common.stationCS2.waferState12, butCS2_13);
SeWafertColor(Common.stationCS2.waferState13, butCS2_14);
SeWafertColor(Common.stationCS2.waferState14, butCS2_15);
SeWafertColor(Common.stationCS2.waferState15, butCS2_16);
SeWafertColor(Common.stationCS2.waferState16, butCS2_17);
SeWafertColor(Common.stationCS2.waferState17, butCS2_18);
SeWafertColor(Common.stationCS2.waferState18, butCS2_19);
SeWafertColor(Common.stationCS2.waferState19, butCS2_20);
SeWafertColor(Common.stationCS2.waferState20, butCS2_21);
SeWafertColor(Common.stationCS2.waferState21, butCS2_22);
SeWafertColor(Common.stationCS2.waferState22, butCS2_23);
SeWafertColor(Common.stationCS2.waferState23, butCS2_24);
SeWafertColor(Common.stationCS2.waferState24, butCS2_25);
#endregion 设置晶圆颜色
}
///
/// 设置晶圆颜色
///
///
///
public void SeWafertColor(ushort waferSeq, UILabel uIButton)
{
switch (waferSeq)
{
case 0:
uIButton.BackColor = Color.FromArgb(173, 185, 202);
break;
case 1:
uIButton.BackColor = Color.FromArgb(112, 48, 160);
break;
case 2:
uIButton.BackColor = Color.FromArgb(146, 208, 80);
break;
case 3:
uIButton.BackColor = Color.FromArgb(0, 176, 80);
break;
case 4:
uIButton.BackColor = Color.FromArgb(255, 0, 0);
break;
}
}
#endregion 实时展示状态值
#region 鼠标进入事件
private void uiTextBox4_MouseEnter(object sender, EventArgs e)
{
isShow = false;
}
private void uiTextBox1_MouseEnter(object sender, EventArgs e)
{
isShow = false;
}
private void uiTextBox2_MouseEnter(object sender, EventArgs e)
{
isShow = false;
}
private void uiTextBox3_MouseEnter(object sender, EventArgs e)
{
isShow = false;
}
private void uiComboBox1_MouseEnter(object sender, EventArgs e)
{
isShow = false;
}
private void uiComboBox2_MouseEnter(object sender, EventArgs e)
{
isShow = false;
}
private void uiComboBox3_MouseEnter(object sender, EventArgs e)
{
isShow = false;
}
#endregion 鼠标进入
#region 按钮点击事件
private void uiButton34_MouseDown(object sender, MouseEventArgs e)
{
MorClient.PublicPara.PlcTool.MouseDownLowOrder("4531");
}
private void uiButton34_MouseUp(object sender, MouseEventArgs e)
{
MorClient.PublicPara.PlcTool.MouseUpLowOrder("4531");
}
#endregion 按钮点击事件
public void UnitRobot_Load(object sender, EventArgs e)
{
if (!PubStaticClass.bthreedunitRobot)
{
PubStaticClass.bthreedunitRobot = true;
//委托展示参数实时值
ShowCSStateValue = new PrintCSStateValueCallBack(PrintParamRealValue);
//开始显示实时值线程
System.Threading.Thread printRealValueThread = new System.Threading.Thread(StartPrintParamRealValue);
printRealValueThread.IsBackground = true;
printRealValueThread.Start();
System.Threading.Thread.Sleep(200);
}
}
private void uiButton35_MouseDown(object sender, MouseEventArgs e)
{
MorClient.PublicPara.PlcTool.ValveControlHighOrder("4531");
}
private void uiButton36_MouseDown(object sender, MouseEventArgs e)
{
MorClient.PublicPara.PlcTool.ValveControlLowOrder("4532");
}
private void uiButton30_MouseDown(object sender, MouseEventArgs e)
{
MorClient.PublicPara.PlcTool.ValveControlLowOrder("4534");
}
private void uiButton28_MouseDown(object sender, MouseEventArgs e)
{
MorClient.PublicPara.PlcTool.ValveControlHighOrder("4532");
}
private void uiButton27_MouseDown(object sender, MouseEventArgs e)
{
MorClient.PublicPara.PlcTool.ValveControlLowOrder("4533");
}
private void uiButton31_MouseDown(object sender, MouseEventArgs e)
{
MorClient.PublicPara.PlcTool.ValveControlHighOrder("4533");
}
private void uiButton30_MouseEnter(object sender, EventArgs e)
{
if (uiButton30.FillColor == Color.FromArgb(146, 208, 80))
{
uiButton30.FillColor = Color.FromArgb(146, 208, 80);
uiButton30.FillHoverColor = Color.FromArgb(146, 208, 80);
}
else if (uiButton30.FillColor == Color.FromArgb(32, 56, 100))
{
uiButton30.FillColor = Color.FromArgb(32, 56, 100);
uiButton30.FillHoverColor = Color.FromArgb(32, 56, 100);
}
}
private void uiButton28_MouseEnter(object sender, EventArgs e)
{
if (uiButton28.FillColor == Color.FromArgb(146, 208, 80))
{
uiButton28.FillColor = Color.FromArgb(146, 208, 80);
uiButton28.FillHoverColor = Color.FromArgb(146, 208, 80);
}
else if (uiButton28.FillColor == Color.FromArgb(32, 56, 100))
{
uiButton28.FillColor = Color.FromArgb(32, 56, 100);
uiButton28.FillHoverColor = Color.FromArgb(32, 56, 100);
}
}
private void uiButton27_MouseEnter(object sender, EventArgs e)
{
if (uiButton27.FillColor == Color.FromArgb(146, 208, 80))
{
uiButton27.FillColor = Color.FromArgb(146, 208, 80);
uiButton27.FillHoverColor = Color.FromArgb(146, 208, 80);
}
else if (uiButton27.FillColor == Color.FromArgb(32, 56, 100))
{
uiButton27.FillColor = Color.FromArgb(32, 56, 100);
uiButton27.FillHoverColor = Color.FromArgb(32, 56, 100);
}
}
private void uiButton31_MouseEnter(object sender, EventArgs e)
{
if (uiButton31.FillColor == Color.FromArgb(146, 208, 80))
{
uiButton31.FillColor = Color.FromArgb(146, 208, 80);
uiButton31.FillHoverColor = Color.FromArgb(146, 208, 80);
}
else if (uiButton31.FillColor == Color.FromArgb(32, 56, 100))
{
uiButton31.FillColor = Color.FromArgb(32, 56, 100);
uiButton31.FillHoverColor = Color.FromArgb(32, 56, 100);
}
}
private void uiButton35_MouseEnter(object sender, EventArgs e)
{
if (uiButton35.FillColor == Color.FromArgb(146, 208, 80))
{
uiButton35.FillColor = Color.FromArgb(146, 208, 80);
uiButton35.FillHoverColor = Color.FromArgb(146, 208, 80);
}
else if (uiButton35.FillColor == Color.FromArgb(32, 56, 100))
{
uiButton35.FillColor = Color.FromArgb(32, 56, 100);
uiButton35.FillHoverColor = Color.FromArgb(32, 56, 100);
}
}
private void uiButton36_MouseEnter(object sender, EventArgs e)
{
if (uiButton36.FillColor == Color.FromArgb(146, 208, 80))
{
uiButton36.FillColor = Color.FromArgb(146, 208, 80);
uiButton36.FillHoverColor = Color.FromArgb(146, 208, 80);
}
else if (uiButton36.FillColor == Color.FromArgb(32, 56, 100))
{
uiButton36.FillColor = Color.FromArgb(32, 56, 100);
uiButton36.FillHoverColor = Color.FromArgb(32, 56, 100);
}
}
}
}