diff --git a/WindowsFormsApp1/MainForm.cs b/WindowsFormsApp1/MainForm.cs index fddd083..ce53c77 100644 --- a/WindowsFormsApp1/MainForm.cs +++ b/WindowsFormsApp1/MainForm.cs @@ -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 diff --git a/WindowsFormsApp1/db/MES_PLC.db b/WindowsFormsApp1/db/MES_PLC.db index 15b4cab..b20bc4b 100644 Binary files a/WindowsFormsApp1/db/MES_PLC.db and b/WindowsFormsApp1/db/MES_PLC.db differ diff --git a/WindowsFormsApp1/form/SerialPort_Manage.Designer.cs b/WindowsFormsApp1/form/SerialPort_Manage.Designer.cs index aaa2350..00aca2a 100644 --- a/WindowsFormsApp1/form/SerialPort_Manage.Designer.cs +++ b/WindowsFormsApp1/form/SerialPort_Manage.Designer.cs @@ -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 // diff --git a/WindowsFormsApp1/mod/server/otherdata.cs b/WindowsFormsApp1/mod/server/otherdata.cs index e3d2532..0df6af4 100644 --- a/WindowsFormsApp1/mod/server/otherdata.cs +++ b/WindowsFormsApp1/mod/server/otherdata.cs @@ -14,7 +14,7 @@ namespace WindowsFormsApp1.mod.server public int Plc_Status { get; set; } /// - /// PLC反馈的机台报警 + /// PLC反馈的机台报警(默认获取0位) /// public List Plc_ErrorMsgs { get; set; } @@ -24,15 +24,20 @@ namespace WindowsFormsApp1.mod.server public string FileUploadAddress { get; set; } /// - /// 胶水码 + /// 前端返回的扫码 /// public string JS_SN { get; set; } /// - /// 螺丝枪扭力角度 + /// 螺丝枪扭力 /// public List FinalTorqueValue { get; set; } + /// + /// 螺丝枪角度 + /// + public List FinalAngleValue { get; set; } + /// /// 螺丝枪扭力曲线 ///