|
|
@@ -171,31 +171,26 @@ namespace FryPot_DosingSystem.Control |
|
|
|
if (devices.Devices.Count > 0) |
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < devices.Devices.Count; i++) |
|
|
|
{ |
|
|
|
for (int i = 0; i < devices.Devices.Count; i++) |
|
|
|
string Ip = devices.Devices[i].Ip; |
|
|
|
string Port = devices.Devices[i].Port; |
|
|
|
string DeviceName = devices.Devices[i].DeviceName; |
|
|
|
switch (DeviceName) |
|
|
|
{ |
|
|
|
string Ip = devices.Devices[i].Ip; |
|
|
|
string Port = devices.Devices[i].Port; |
|
|
|
string DeviceName = devices.Devices[i].DeviceName; |
|
|
|
switch (DeviceName) |
|
|
|
{ |
|
|
|
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break; |
|
|
|
case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break; |
|
|
|
case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break; |
|
|
|
case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break; |
|
|
|
case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break; |
|
|
|
case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break; |
|
|
|
} |
|
|
|
|
|
|
|
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break; |
|
|
|
case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break; |
|
|
|
case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break; |
|
|
|
case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break; |
|
|
|
case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break; |
|
|
|
case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowRunLog("PLC连接失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|