|
|
|
|
@ -144,62 +144,76 @@ public class PlcEventTask { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (WcsPlcConnectVo conn : plcList) { |
|
|
|
|
if(conn.getPlcIp().contains(".41")){ |
|
|
|
|
PlcOperate plcOperate_41 = plcInit.getPlcOperate_41(); |
|
|
|
|
if (plcOperate_41 ==null){ |
|
|
|
|
plcInit.connect(conn.getPlcIp()); |
|
|
|
|
} |
|
|
|
|
plcTask(plcInit.getPlcOperate_41(), conn, conn.getPointTables()); |
|
|
|
|
// PlcOperate plc = plcInit.getPlcOperate_41();
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(conn.getPlcIp().contains(".50")){ |
|
|
|
|
plcTask(plcInit.getPlcOperate_50(), conn, conn.getPointTables()); |
|
|
|
|
// PlcOperate plc = plcInit.getPlcOperate_50();
|
|
|
|
|
PlcOperate plcOperate_50 = plcInit.getPlcOperate_50(); |
|
|
|
|
if (plcOperate_50 ==null){ |
|
|
|
|
plcInit.connect(conn.getPlcIp()); |
|
|
|
|
} |
|
|
|
|
plcTask(plcOperate_50, conn, conn.getPointTables()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(conn.getPlcIp().contains(".60")){ |
|
|
|
|
plcTask(plcInit.getPlcOperate_60(), conn, conn.getPointTables()); |
|
|
|
|
// PlcOperate plc = plcInit.getPlcOperate_60();
|
|
|
|
|
doDevStatus(plcInit.getPlcOperate_60(),"1#"); |
|
|
|
|
PlcOperate plcOperate_60 = plcInit.getPlcOperate_60(); |
|
|
|
|
if (plcOperate_60 ==null){ |
|
|
|
|
plcInit.connect(conn.getPlcIp()); |
|
|
|
|
} |
|
|
|
|
plcTask(plcOperate_60, conn, conn.getPointTables()); |
|
|
|
|
doDevStatus(plcOperate_60,"1#"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(conn.getPlcIp().contains(".70")){ |
|
|
|
|
plcTask(plcInit.getPlcOperate_70(), conn, conn.getPointTables()); |
|
|
|
|
// PlcOperate plc = plcInit.getPlcOperate_70();
|
|
|
|
|
doDevStatus(plcInit.getPlcOperate_70(),"2#"); |
|
|
|
|
PlcOperate plcOperate_70 = plcInit.getPlcOperate_70(); |
|
|
|
|
if (plcOperate_70 ==null){ |
|
|
|
|
plcInit.connect(conn.getPlcIp()); |
|
|
|
|
} |
|
|
|
|
plcTask(plcOperate_70, conn, conn.getPointTables()); |
|
|
|
|
doDevStatus(plcOperate_70,"2#"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(conn.getPlcIp().contains(".80")){ |
|
|
|
|
plcTask(plcInit.getPlcOperate_80(), conn, conn.getPointTables()); |
|
|
|
|
// PlcOperate plc = plcInit.getPlcOperate_80();
|
|
|
|
|
doDevStatus(plcInit.getPlcOperate_80(),"3#"); |
|
|
|
|
PlcOperate plcOperate_80 = plcInit.getPlcOperate_80(); |
|
|
|
|
if (plcOperate_80 ==null){ |
|
|
|
|
plcInit.connect(conn.getPlcIp()); |
|
|
|
|
} |
|
|
|
|
plcTask(plcOperate_80, conn, conn.getPointTables()); |
|
|
|
|
doDevStatus(plcOperate_80,"3#"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(conn.getPlcIp().contains(".90")){ |
|
|
|
|
plcTask(plcInit.getPlcOperate_90(), conn, conn.getPointTables()); |
|
|
|
|
// PlcOperate plc = plcInit.getPlcOperate_90();
|
|
|
|
|
doDevStatus(plcInit.getPlcOperate_90(),"4#"); |
|
|
|
|
PlcOperate plcOperate_90 = plcInit.getPlcOperate_90(); |
|
|
|
|
if (plcOperate_90 ==null){ |
|
|
|
|
plcInit.connect(conn.getPlcIp()); |
|
|
|
|
} |
|
|
|
|
plcTask(plcOperate_90, conn, conn.getPointTables()); |
|
|
|
|
doDevStatus(plcOperate_90,"4#"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(conn.getPlcIp().contains(".100")){ |
|
|
|
|
plcTask(plcInit.getPlcOperate_100(), conn, conn.getPointTables()); |
|
|
|
|
PlcOperate plc = plcInit.getPlcOperate_100(); |
|
|
|
|
doDevStatus(plcInit.getPlcOperate_100(),"5#"); |
|
|
|
|
PlcOperate plcOperate_100 = plcInit.getPlcOperate_100(); |
|
|
|
|
if (plcOperate_100 ==null){ |
|
|
|
|
plcInit.connect(conn.getPlcIp()); |
|
|
|
|
} |
|
|
|
|
plcTask(plcOperate_100, conn, conn.getPointTables()); |
|
|
|
|
doDevStatus(plcOperate_100,"5#"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(conn.getPlcIp().contains(".110")){ |
|
|
|
|
plcTask(plcInit.getPlcOperate_110(), conn, conn.getPointTables()); |
|
|
|
|
// PlcOperate plc = plcInit.getPlcOperate_110();
|
|
|
|
|
doDevStatus(plcInit.getPlcOperate_110(),"6#"); |
|
|
|
|
PlcOperate plcOperate_110 = plcInit.getPlcOperate_110(); |
|
|
|
|
if (plcOperate_110 ==null){ |
|
|
|
|
plcInit.connect(conn.getPlcIp()); |
|
|
|
|
} |
|
|
|
|
plcTask(plcOperate_110, conn, conn.getPointTables()); |
|
|
|
|
doDevStatus(plcOperate_110,"6#"); |
|
|
|
|
} |
|
|
|
|
// PlcOperate finalPlc = plc;
|
|
|
|
|
// executorService.scheduleWithFixedDelay(
|
|
|
|
|
// () -> plcTask(finalPlc, conn, conn.getPointTables()), 1, 1, TimeUnit.SECONDS
|
|
|
|
|
// );
|
|
|
|
|
//本地测试用
|
|
|
|
|
/* if(conn.getPlcIp().contains("127.0.0.1")){ |
|
|
|
|
plcTask(plcInit.getPlcOperate_1(), conn, conn.getPointTables()); |
|
|
|
|
doDevStatus(plcInit.getPlcOperate_1(),"4#"); |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -227,7 +241,7 @@ public class PlcEventTask { |
|
|
|
|
Boolean heartType = plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allHbMap)); |
|
|
|
|
if(!heartType){ |
|
|
|
|
log.info("心跳写入失败,重连服务器"); |
|
|
|
|
plcInit.connect(); |
|
|
|
|
plcInit.connect(null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -248,7 +262,9 @@ public class PlcEventTask { |
|
|
|
|
//根据连接的plcId获取属性
|
|
|
|
|
PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); |
|
|
|
|
Map<String, Object> pointMap = plcReadAndWrite.readPlcData(plcOperate, pointTables); |
|
|
|
|
//读取数据失败时,进行重连
|
|
|
|
|
if (ObjectUtils.isEmpty(pointMap)){ |
|
|
|
|
plcInit.connect(conn.getPlcIp()); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -470,7 +486,7 @@ public class PlcEventTask { |
|
|
|
|
BusinDataTask businDataTaskServiceById = iBusinDataTaskService.getById(taskId); |
|
|
|
|
tunnel = businDataTaskServiceById.getTunnel(); |
|
|
|
|
String taskType = businDataTaskServiceById.getTaskType(); |
|
|
|
|
if (!taskType.equals("4") && !taskType.equals("5") && !taskType.equals("15") && !taskType.equals("16")) { |
|
|
|
|
if (!taskType.equals("4") && !taskType.equals("5") && !taskType.equals("15") && !taskType.equals("16")&& !taskType.equals("21")) { |
|
|
|
|
Result<Boolean> booleanResult = iPutInOutStorageService.productDeposit(taskId); |
|
|
|
|
//处理成功 返回状态,写入状态位为0
|
|
|
|
|
if (booleanResult.getCode() == HttpStatus.SUCCESS) { |
|
|
|
|
@ -513,9 +529,9 @@ public class PlcEventTask { |
|
|
|
|
} else if (TaskTypeEnum.normal_out.getValue().equals(taskType) |
|
|
|
|
|| TaskTypeEnum.urgent_out.getValue().equals(taskType) |
|
|
|
|
||TaskTypeEnum.abnormal_delivery.getValue().equals(taskType) |
|
|
|
|
|| TaskTypeEnum.punching_delivery.getValue().equals(taskType) |
|
|
|
|
|| "21".equals(taskType) |
|
|
|
|
|| TaskTypeEnum.replenish_out.getValue().equals(taskType)){ |
|
|
|
|
//处理 4正常出库 5紧急出库 17异常出库 18冲孔出库 10补货出库 库存
|
|
|
|
|
//处理 4正常出库 5紧急出库 17异常出库 21冲孔出库 10补货出库 库存
|
|
|
|
|
log.info("扣减库存的任务类型:"+taskType); |
|
|
|
|
Boolean delStock = iBusinPickupService.subtractStockDetailByLocation(businDataTaskServiceById); |
|
|
|
|
log.info("扣减库存的结果:"+delStock); |
|
|
|
|
@ -822,7 +838,7 @@ public class PlcEventTask { |
|
|
|
|
businDataTask.setPlcId(30L); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (TaskTypeEnum.punching_delivery.getValue().equals(businDataTask.getTaskType()) |
|
|
|
|
if ("21".equals(businDataTask.getTaskType()) |
|
|
|
|
|| TaskTypeEnum.replenish_out.getValue().equals(businDataTask.getTaskType())){ |
|
|
|
|
bo.setTaskType(24); |
|
|
|
|
businDataTask.setPlcId(30L); |
|
|
|
|
|