|
|
|
|
@ -118,14 +118,14 @@ public class PlcEventTask { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//输送线心跳
|
|
|
|
|
@Scheduled(fixedDelay = 4000) |
|
|
|
|
public void writePlcheartbeat(){ |
|
|
|
|
public void writePlcheartbeatDps(){ |
|
|
|
|
//根据连接的plcId获取属性
|
|
|
|
|
PlcOperate plcOperate = plcInit.getPlcOperate_dps(); |
|
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
|
Map<String, Object> readPointMap = new HashMap<>(); |
|
|
|
|
String heartbeat="DB320.0.1"; |
|
|
|
|
String heartbeat="DB320.0.0"; |
|
|
|
|
readPointMap.put(heartbeat,"Boolean"); |
|
|
|
|
Map<String, Object> pointMap = plcReadAndWrite.readPlcData(plcOperate, JsonUtil.toJSONString(readPointMap)); |
|
|
|
|
|
|
|
|
|
@ -142,11 +142,38 @@ public class PlcEventTask { |
|
|
|
|
allHbMap.put(heartbeat, writeHbMap); |
|
|
|
|
Boolean heartType = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allHbMap)); |
|
|
|
|
if(!heartType){ |
|
|
|
|
log.info("心跳写入失败,重连服务器"); |
|
|
|
|
log.info("dps心跳写入失败,重连服务器"); |
|
|
|
|
plcInit.connect(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//堆垛机心跳
|
|
|
|
|
@Scheduled(fixedDelay = 4000) |
|
|
|
|
public void writePlcheartbeatStk(){ |
|
|
|
|
//根据连接的plcId获取属性
|
|
|
|
|
PlcOperate plcOperate = plcInit.getPlcOperate_stk(); |
|
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
|
Map<String, Object> readPointMap = new HashMap<>(); |
|
|
|
|
String heartbeat="DB20.0.4"; |
|
|
|
|
readPointMap.put(heartbeat,"Boolean"); |
|
|
|
|
Map<String, Object> pointMap = plcReadAndWrite.readPlcData(plcOperate, JsonUtil.toJSONString(readPointMap)); |
|
|
|
|
|
|
|
|
|
//读取心跳,并判断是写入true还是false;
|
|
|
|
|
Boolean heartbeatV = false; |
|
|
|
|
|
|
|
|
|
if (pointMap.containsKey(heartbeat)) { |
|
|
|
|
heartbeatV = Boolean.valueOf(pointMap.get(heartbeat).toString()); |
|
|
|
|
} |
|
|
|
|
heartbeatV = (heartbeatV == true) ? false : true; |
|
|
|
|
Map<String, Object> writeHbMap = new HashMap<>(1); |
|
|
|
|
writeHbMap.put("Boolean", heartbeatV); |
|
|
|
|
Map<String, Object> allHbMap = new HashMap<>(1); |
|
|
|
|
allHbMap.put(heartbeat, writeHbMap); |
|
|
|
|
Boolean heartType = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allHbMap)); |
|
|
|
|
if(!heartType){ |
|
|
|
|
log.info("stk心跳写入失败,重连服务器"); |
|
|
|
|
plcInit.connect(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void plcTask(PlcOperate plcOperate, WcsPlcConnectVo conn, String pointTables) { |
|
|
|
|
|
|
|
|
|
@ -330,7 +357,7 @@ public class PlcEventTask { |
|
|
|
|
Boolean twoOverlengthV=false,twoLwideV=false,twoRwideV=false,twoHighV=false; |
|
|
|
|
|
|
|
|
|
String oneWcsErrExit ="",twoWcsErrExit =""; |
|
|
|
|
String oneEcsErrExitVT ="",twoWcsErrExitVT =""; |
|
|
|
|
String oneWcsErrExitVT="",twoWcsErrExitVT =""; |
|
|
|
|
for (WcsPlcProperty plcProperty : propertyList) { |
|
|
|
|
String pointType = plcProperty.getPointType(); |
|
|
|
|
//请求分配
|
|
|
|
|
@ -384,7 +411,7 @@ public class PlcEventTask { |
|
|
|
|
twoHigh =plcProperty.getAddress(); |
|
|
|
|
} else if (pointType.equals("ontExit")){ |
|
|
|
|
oneWcsErrExit =plcProperty.getAddress(); |
|
|
|
|
oneEcsErrExitVT = plcProperty.getValueType(); |
|
|
|
|
oneWcsErrExitVT = plcProperty.getValueType(); |
|
|
|
|
} else if (pointType.equals("twoExit")){ |
|
|
|
|
twoWcsErrExit =plcProperty.getAddress(); |
|
|
|
|
twoWcsErrExitVT = plcProperty.getValueType(); |
|
|
|
|
@ -411,12 +438,13 @@ public class PlcEventTask { |
|
|
|
|
PlanOrderLocationVo data = orderResult.getData(); |
|
|
|
|
taskId = data.getOrderNo(); |
|
|
|
|
cargoHeight = data.getType();//获取托盘或模具类型
|
|
|
|
|
}else { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisPutInExeMsg+orderResult.getMsg(),orderResult.getMsg()); |
|
|
|
|
log.info("获取任务信息失败:"+orderResult.getMsg()+"托盘条码:"+barcodeValue); |
|
|
|
|
//回填任务号
|
|
|
|
|
Map<String, Boolean> writeMap = new HashMap<>(1); |
|
|
|
|
writeMap.put(oneEcsErrExitVT, true); |
|
|
|
|
Map<String, Integer> writeMap = new HashMap<>(1); |
|
|
|
|
writeMap.put(oneWcsErrExitVT, 1); |
|
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
|
allMap.put(oneWcsErrExit, writeMap); |
|
|
|
|
Boolean errBoolean = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allMap)); |
|
|
|
|
@ -441,6 +469,10 @@ public class PlcEventTask { |
|
|
|
|
Map<String, String> cargoHeightMap = new HashMap<>(1); |
|
|
|
|
cargoHeightMap.put(oneHignTypeVT, cargoHeight); |
|
|
|
|
allMap.put(oneHignType, cargoHeightMap); |
|
|
|
|
|
|
|
|
|
Map<String, Integer> wcsErrwriteMap = new HashMap<>(1); |
|
|
|
|
wcsErrwriteMap.put(oneWcsErrExitVT, 0); |
|
|
|
|
allMap.put(oneWcsErrExit,wcsErrwriteMap); |
|
|
|
|
log.info("1楼按下入库按钮时,给输送线写命令数据:{}"+allMap); |
|
|
|
|
|
|
|
|
|
Boolean taskBoolean = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allMap)); |
|
|
|
|
@ -476,8 +508,8 @@ public class PlcEventTask { |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisPutInExeMsg+orderResult.getMsg(),orderResult.getMsg()); |
|
|
|
|
log.info("2楼获取任务信息失败:"+orderResult.getMsg()+"托盘条码:"+barcodeValue); |
|
|
|
|
//回填任务号
|
|
|
|
|
Map<String, Boolean> writeMap = new HashMap<>(1); |
|
|
|
|
writeMap.put(twoWcsErrExitVT, true); |
|
|
|
|
Map<String, Integer> writeMap = new HashMap<>(1); |
|
|
|
|
writeMap.put(twoWcsErrExitVT, 1); |
|
|
|
|
Map<String, Object> allMap = new HashMap<>(1); |
|
|
|
|
allMap.put(twoWcsErrExit, writeMap); |
|
|
|
|
Boolean errBoolean = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allMap)); |
|
|
|
|
@ -502,6 +534,10 @@ public class PlcEventTask { |
|
|
|
|
Map<String, String> cargoHeightMap = new HashMap<>(1); |
|
|
|
|
cargoHeightMap.put(twoHignTypeVT, cargoHeight); |
|
|
|
|
allMap.put(twoHignType, cargoHeightMap); |
|
|
|
|
|
|
|
|
|
Map<String, Integer> wcsErrwriteMap = new HashMap<>(1); |
|
|
|
|
wcsErrwriteMap.put(twoWcsErrExitVT, 0); |
|
|
|
|
allMap.put(twoWcsErrExit,wcsErrwriteMap); |
|
|
|
|
log.info("2楼按下入库按钮时,给输送线写命令数据:{}"+allMap); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -670,10 +706,9 @@ public class PlcEventTask { |
|
|
|
|
public void stkRealTimeTask(List<WcsPlcProperty> propertyList,Map<String, Object> pointMap, PLCReadAndWrite plcReadAndWrite,PlcOperate plcOperate,String pointTables){ |
|
|
|
|
try { |
|
|
|
|
if (pointMap.isEmpty()){ |
|
|
|
|
plcInit.connect(); |
|
|
|
|
pointMap = plcReadAndWrite.readPlcData(plcOperate, pointTables); |
|
|
|
|
log.info("堆垛机为空时,重新读取的属性值{} ",pointMap); |
|
|
|
|
}else { |
|
|
|
|
plcInit.connect(); |
|
|
|
|
} |
|
|
|
|
//实时监测堆垛机完成状态,调用库存处理逻辑
|
|
|
|
|
Long taskId=0L; |
|
|
|
|
@ -828,6 +863,9 @@ public class PlcEventTask { |
|
|
|
|
} else if (stkProperty.getPointType().equals("102")) { |
|
|
|
|
plcOrderType = stkProperty.getAddress(); |
|
|
|
|
plcOrderTypeValue=stkProperty.getValueType(); |
|
|
|
|
}else if (stkProperty.getPointType().equals("103")) { |
|
|
|
|
plcPlatform =stkProperty.getAddress(); |
|
|
|
|
plcPlatformValueType=stkProperty.getValueType(); |
|
|
|
|
}else if (stkProperty.getPointType().equals("4")) { |
|
|
|
|
readfinish = stkProperty.getAddress(); |
|
|
|
|
readfinishValueType=stkProperty.getValueType(); |
|
|
|
|
|