delete-去除plc的isConneced判断

collectionStore
liuwf 11 months ago
parent bb7d41c102
commit 4374e00852

@ -255,8 +255,7 @@ namespace Aucma.Scada.Business
{ {
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
do do
{ {
//读取PLC应答字为2时上位机清空写入的入库内容 //读取PLC应答字为2时上位机清空写入的入库内容
@ -275,11 +274,7 @@ namespace Aucma.Scada.Business
} }
Thread.Sleep(500); Thread.Sleep(500);
} while (isFlag); } while (isFlag);
}
else
{
logHelper.Info($"仓库{appConfig.shellStoreCode}PLC未连接");
}
} }
else else
{ {
@ -309,8 +304,7 @@ namespace Aucma.Scada.Business
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
if (_plc.readInt32ByAddress(plcConfig.in_liner_answer) == 1) if (_plc.readInt32ByAddress(plcConfig.in_liner_answer) == 1)
{ {
@ -332,11 +326,7 @@ namespace Aucma.Scada.Business
result = 2; result = 2;
logHelper.PlcLog("内胆应答字为2下发新任务plc未就绪"); logHelper.PlcLog("内胆应答字为2下发新任务plc未就绪");
} }
}
else
{
logHelper.Info($"仓库{taskInfo.storeCode}PLC未连接");
}
} }
else else
{ {
@ -366,8 +356,7 @@ namespace Aucma.Scada.Business
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
do do
{ {
//读取PLC应答字为2时上位机清空写入的入库内容 //读取PLC应答字为2时上位机清空写入的入库内容
@ -392,11 +381,7 @@ namespace Aucma.Scada.Business
Thread.Sleep(1000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
}
else
{
logHelper.Info($"仓库{appConfig.linerStoreCode}PLC未连接");
}
} }
else else
{ {
@ -429,8 +414,7 @@ namespace Aucma.Scada.Business
{ {
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
do do
{ {
//读取PLC入库任务完成 //读取PLC入库任务完成
@ -447,11 +431,7 @@ namespace Aucma.Scada.Business
Thread.Sleep(1000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
}
else
{
logHelper.Info($"仓库{appConfig.shellStoreCode}PLC未连接");
}
} }
else else
{ {
@ -481,8 +461,7 @@ namespace Aucma.Scada.Business
IPlc _plc = _plcDictionary[appConfig.linerStoreCode]; IPlc _plc = _plcDictionary[appConfig.linerStoreCode];
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
do do
{ {
//读取PLC入库任务完成 //读取PLC入库任务完成
@ -500,11 +479,7 @@ namespace Aucma.Scada.Business
Thread.Sleep(1000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
}
else
{
logHelper.Info($"仓库{appConfig.linerStoreCode}PLC未连接");
}
} }
else else
{ {
@ -666,12 +641,11 @@ namespace Aucma.Scada.Business
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
spaceInfo.spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore); spaceInfo.spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore);
spaceInfo.onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute); spaceInfo.onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute);
// spaceInfo.spaceStatus = _plc.readInt32ByAddress(spaceAddress.spaceStatus); // spaceInfo.spaceStatus = _plc.readInt32ByAddress(spaceAddress.spaceStatus);
}
} }
return spaceInfo; return spaceInfo;
@ -690,8 +664,7 @@ namespace Aucma.Scada.Business
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
var spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore); var spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore);
var onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute); var onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute);
@ -705,7 +678,7 @@ namespace Aucma.Scada.Business
_plc.writeInt32ByAddress(spaceAddress.onRoute, onRouteAmount + 1); _plc.writeInt32ByAddress(spaceAddress.onRoute, onRouteAmount + 1);
} }
}
} }
} }
} }

@ -114,8 +114,7 @@ namespace Aucma.Scada.Business
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
if (_plc.readInt32ByAddress(plcConfig.out_shell_answer) == 1) if (_plc.readInt32ByAddress(plcConfig.out_shell_answer) == 1)
{ {
@ -135,11 +134,7 @@ namespace Aucma.Scada.Business
result = 2; result = 2;
logHelper.Info("应答字为2下发新任务plc未就绪"); logHelper.Info("应答字为2下发新任务plc未就绪");
} }
}
else
{
logHelper.Info($"仓库{taskInfo.storeCode}PLC未连接");
}
} }
else else
{ {
@ -167,8 +162,7 @@ namespace Aucma.Scada.Business
{ {
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
do do
{ {
//读取PLC应答字为2时上位机清空写入的出库内容 //读取PLC应答字为2时上位机清空写入的出库内容
@ -187,11 +181,7 @@ namespace Aucma.Scada.Business
Thread.Sleep(500); Thread.Sleep(500);
} while (isFlag); } while (isFlag);
}
else
{
logHelper.Info($"仓库{appConfig.shellStoreCode}PLC未连接");
}
} }
else else
{ {
@ -268,8 +258,7 @@ namespace Aucma.Scada.Business
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
if (_plc.readInt32ByAddress(plcConfig.out_liner_answer) == 1) if (_plc.readInt32ByAddress(plcConfig.out_liner_answer) == 1)
{ {
@ -290,11 +279,7 @@ namespace Aucma.Scada.Business
logHelper.Info("内胆应答字为2下发新任务plc未就绪"); logHelper.Info("内胆应答字为2下发新任务plc未就绪");
} }
}
else
{
logHelper.Info($"仓库{taskInfo.storeCode}PLC未连接");
}
} }
else else
{ {
@ -322,8 +307,7 @@ namespace Aucma.Scada.Business
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
do do
{ {
@ -344,11 +328,7 @@ namespace Aucma.Scada.Business
Thread.Sleep(500); Thread.Sleep(500);
} while (isFlag); } while (isFlag);
}
else
{
logHelper.Info($"仓库{appConfig.linerStoreCode}PLC未连接");
}
} }
else else
{ {
@ -374,8 +354,7 @@ namespace Aucma.Scada.Business
IPlc _plc = _plcDictionary[appConfig.linerStoreCode]; IPlc _plc = _plcDictionary[appConfig.linerStoreCode];
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
do do
{ {
//读取PLC出库任务完成 //读取PLC出库任务完成
@ -394,11 +373,7 @@ namespace Aucma.Scada.Business
Thread.Sleep(1000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
}
else
{
logHelper.Info($"仓库{appConfig.linerStoreCode}PLC未连接");
}
} }
else else
{ {
@ -550,12 +525,11 @@ namespace Aucma.Scada.Business
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
spaceInfo.spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore); spaceInfo.spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore);
spaceInfo.onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute); spaceInfo.onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute);
// spaceInfo.spaceStatus = _plc.readInt32ByAddress(spaceAddress.spaceStatus); // spaceInfo.spaceStatus = _plc.readInt32ByAddress(spaceAddress.spaceStatus);
}
} }
return spaceInfo; return spaceInfo;
@ -574,14 +548,13 @@ namespace Aucma.Scada.Business
if (_plc != null) if (_plc != null)
{ {
if (_plc.IsConnected)
{
var spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore); var spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore);
//var onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute); //var onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute);
_plc.writeInt32ByAddress(spaceAddress.onStore, spaceStock - 1); _plc.writeInt32ByAddress(spaceAddress.onStore, spaceStock - 1);
}
} }
} }
} }

Loading…
Cancel
Save