完善反馈的result

This commit is contained in:
bnala 2025-02-19 20:27:41 +08:00
parent 7b2c4fa68a
commit 29587623fe
4 changed files with 33 additions and 10 deletions

View File

@ -139,16 +139,22 @@ namespace WindowsFormsApp1
if (oldstatus != PlcData.Read_Status || (Plc_Time - oldPlcstatus_LastTime).TotalSeconds > 5)
{
//反馈状态
Init.Plcstatus = PlcData.Read_Status;
Init.Plcstatus_LastTime = DateTime.Now;
otherdata.Plc_Status = PlcData.Read_Status;
var statusresult = apiClient.CallFunctionByName("Status", PlcData, otherdata);
if (statusresult.Success)
{
Init.Plcstatus = PlcData.Read_Status;
Init.Plcstatus_LastTime = DateTime.Now;
MES链接状态.Text = "MES链接状态:OK";
MES链接状态.BackColor = SystemColors.Control;
MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
MES_MsgfORM("Status", statusresult.Mesresult, statusresult.Requesttime);
if (statusresult.Mesresult != mesresult.PASS)
{
PlcData.Write_Status = 1001;
siemensHelp.WriteAddress(plcaddress, PlcData);
continue;
}
}
else
{
@ -168,15 +174,21 @@ namespace WindowsFormsApp1
///////////////////////////////测试用
list.Add("M03CVSO-01");
otherdata.Plc_ErrorMsgs = list;
Init.Plcstatus = PlcData.Read_Status;
Init.Plcstatus_LastTime = DateTime.Now;
var statusresult = apiClient.CallFunctionByName("Alarm", PlcData, otherdata);
if (statusresult.Success)
{
Init.Plcstatus = PlcData.Read_Status;
Init.Plcstatus_LastTime = DateTime.Now;
MES链接状态.Text = "MES链接状态:OK";
MES链接状态.BackColor = SystemColors.Control;
MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
MES_MsgfORM("Alarm", statusresult.Mesresult, statusresult.Requesttime);
if (statusresult.Mesresult != mesresult.PASS)
{
PlcData.Write_Status = 1001;
siemensHelp.WriteAddress(plcaddress, PlcData);
continue;
}
}
else
{
@ -230,7 +242,7 @@ namespace WindowsFormsApp1
if(nowinterface.code == "SN_CheckIN")
{
请扫描LOT号.Enabled = true;
ScanPort.Read();
//ScanPort.Read();
}
@ -243,7 +255,7 @@ namespace WindowsFormsApp1
var result = apiClient.CallFunctionByName(nowinterface.code,PlcData, otherdata);
if (result.Success)
{
var writeresult = siemensHelp.WriteAddress(Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id),PlcData);
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
if (!writeresult.Success)
{
PLC链接状态.Text = "PLC链接状态:NG";
@ -256,6 +268,12 @@ namespace WindowsFormsApp1
MES链接状态.Text = "MES链接状态:OK";
MES链接状态.BackColor = SystemColors.Control;
MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
if (result.Mesresult != mesresult.PASS)
{
PlcData.Write_Status = 1001;
siemensHelp.WriteAddress(plcaddress, PlcData);
continue;
}
}
}
else

Binary file not shown.

View File

@ -175,7 +175,6 @@
this.portName.HeaderText = "COM口";
this.portName.MinimumWidth = 9;
this.portName.Name = "portName";
this.portName.ReadOnly = true;
//
// baudRate
//
@ -217,6 +216,7 @@
this.reamrk.HeaderText = "备注";
this.reamrk.MinimumWidth = 9;
this.reamrk.Name = "reamrk";
this.reamrk.ReadOnly = true;
//
// SerialPort_Manage
//

View File

@ -14,7 +14,7 @@ namespace WindowsFormsApp1.mod.server
public int Plc_Status { get; set; }
/// <summary>
/// PLC反馈的机台报警
/// PLC反馈的机台报警(默认获取0位)
/// </summary>
public List<string> Plc_ErrorMsgs { get; set; }
@ -24,15 +24,20 @@ namespace WindowsFormsApp1.mod.server
public string FileUploadAddress { get; set; }
/// <summary>
/// 胶水码
/// 前端返回的扫码
/// </summary>
public string JS_SN { get; set; }
/// <summary>
/// 螺丝枪扭力角度
/// 螺丝枪扭力
/// </summary>
public List<float> FinalTorqueValue { get; set; }
/// <summary>
/// 螺丝枪角度
/// </summary>
public List<float> FinalAngleValue { get; set; }
/// <summary>
/// 螺丝枪扭力曲线
/// </summary>