delete-删除plc的isConnected判断

change-plc出库应答即视为出库完成
foamRearStore
liuwf 10 months ago
parent f165ada25f
commit 608a5e03ae

Binary file not shown.

@ -121,20 +121,20 @@ namespace Aucma.Scada.Business
StartPassDown();
//Task.Run(() =>
//{
// Thread.Sleep(3000);
// for (int i = 1; i < 2; i++)
// {
// // 8302501181 8302500586 9
// InStore("B2401018302500586001" + i);
// Thread.Sleep(1000);
// }
// InStore("B2401018302501181001" + 1);
// Thread.Sleep(1000);
// InStore("B2401018302500889001" + 1);
// });
Task.Run(() =>
{
Thread.Sleep(3000);
for (int i = 1; i < 2; i++)
{
// 8302501181 8302500586 9
InStore("B2401018302500586001" + i);
Thread.Sleep(1000);
}
InStore("B2401018302501181001" + 1);
Thread.Sleep(1000);
InStore("B2401018302500889001" + 1);
});
}
#region delete 2024-01-04出库时堵塞入库 ,不需要堵塞整个库

@ -270,8 +270,7 @@ namespace Aucma.Scada.Business
if (_plc != null)
{
if (_plc.IsConnected)
{
// 测试方法模拟plc正式启用删除
// _plc.writeInt32ByAddress(plcConfig.in_foam_answer, 1);
if (_plc.readInt32ByAddress(plcConfig.in_foam_answer) == 1)
@ -295,11 +294,7 @@ namespace Aucma.Scada.Business
logHelper.Info("应答字为2下发新任务plc未就绪");
}
}
else
{
logHelper.Info($"仓库{taskInfo.storeCode}PLC未连接");
}
}
else
{
@ -329,8 +324,7 @@ namespace Aucma.Scada.Business
{
if (_plc != null)
{
if (_plc.IsConnected)
{
do
{
// 测试方法模拟plc正式启用删除
@ -351,11 +345,7 @@ namespace Aucma.Scada.Business
Thread.Sleep(500);
} while (isFlag);
}
else
{
logHelper.Info($"仓库{appConfig.foamStoreCode}PLC未连接");
}
}
else
{

@ -407,6 +407,8 @@ namespace Aucma.Scada.Business
{
PrintLogInfoMessage("出库应答成功,自动释放信号量,进行下发新任务");
semaphore.Release();
// 视为出库完成,后续改为监测在库数
OutStoreFinish(storeCode, taskCode);
}
/// <summary>

@ -81,7 +81,7 @@ namespace Aucma.Scada.Business
{
_plcDictionary = _pool.GetAll();
_taskInfoService = registerServices.GetService<IRealTaskInfoService>();
RealReadFinish();
// RealReadFinish();
}
@ -102,7 +102,7 @@ namespace Aucma.Scada.Business
if (_plcDictionary.Count > 0)
{
IPlc _plc = _plcDictionary[appConfig.foamStoreCode];
if (_plc != null && _plc.IsConnected)
if (_plc != null)
{
//出库完成
if (_plc.readInt32ByAddress(plcConfig.out_foam_finish) == 1)
@ -160,8 +160,7 @@ namespace Aucma.Scada.Business
if (_plc != null)
{
if (_plc.IsConnected)
{
if (_plc.readInt32ByAddress(plcConfig.out_foam_answer) == 1)
{
logHelper.Info("泡后出库应答字为1货道号:" + plcConfig.out_foam_spaceCode + ";写" + short.Parse(taskInfo.spaceCode.Substring(5, 1)));
@ -180,11 +179,7 @@ namespace Aucma.Scada.Business
result = 2;
logHelper.Info("应答字为2下发新任务plc未就绪");
}
}
else
{
logHelper.Info($"仓库{taskInfo.storeCode}PLC未连接");
}
}
else
{
@ -214,17 +209,19 @@ namespace Aucma.Scada.Business
{
if (_plc != null)
{
if (_plc.IsConnected)
{
do
{
//读取PLC应答字为2时上位机清空写入的出库内容
if (_plc.readInt32ByAddress(plcConfig.out_foam_answer) == 2)
{
logHelper.Info("出库应答字为2货道号:" + plcConfig.out_foam_spaceCode + ";复位写0");
logHelper.Info("出库应答字写3应答字为2货道号:" + plcConfig.out_foam_spaceCode + ";复位写0");
//写入货道号
_plc.writeInt32ByAddress(plcConfig.out_foam_spaceCode, 0);
//写入应答字3
_plc.writeInt32ByAddress(plcConfig.out_foam_answer, 3);
//写入出库数量
_plc.writeInt32ByAddress(plcConfig.out_foam_amount, 0);
isFlag = false;
@ -234,11 +231,7 @@ namespace Aucma.Scada.Business
Thread.Sleep(500);
} while (isFlag);
}
else
{
logHelper.Info($"仓库{appConfig.foamStoreCode}PLC未连接");
}
}
else
{
@ -268,12 +261,11 @@ namespace Aucma.Scada.Business
if (_plc != null)
{
if (_plc.IsConnected)
{
spaceInfo.spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore);
spaceInfo.onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute);
// spaceInfo.spaceStatus = _plc.readInt32ByAddress(spaceAddress.spaceStatus);
}
}
return spaceInfo;

Loading…
Cancel
Save