Commit 439a952c authored by wanghao's avatar wanghao

1 测试 501 502 503 端口号

parent d06703a1
...@@ -126,20 +126,22 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService ...@@ -126,20 +126,22 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
// 如果是下料,则 先断电再去下料 // 如果是下料,则 先断电再去下料
if("UNLOAD".equals(commandType)) { if("UNLOAD".equals(commandType)) {
String trayCode = command.getTrayCode(); String trayCode = command.getTrayCode();
String[] split = trayCode.split("-"); if(StringUtils.isNotBlank(trayCode)) {
String[] split = trayCode.split("-");
TEquipmentInfo tEquipmentInfo = equipmentInfoMapper.selectTEquipmentInfoByCode(split[0]); TEquipmentInfo tEquipmentInfo = equipmentInfoMapper.selectTEquipmentInfoByCode(split[0]);
int layer = Integer.parseInt(split[0]); int layer = Integer.parseInt(split[0]);
try { try {
ModbusMaster master = Modbus4jUtils.getMaster(tEquipmentInfo.getfPowerOutageIp(), tEquipmentInfo.getfPowerOutagePort()); ModbusMaster master = Modbus4jUtils.getMaster(tEquipmentInfo.getfPowerOutageIp(), tEquipmentInfo.getfPowerOutagePort());
Modbus4jUtils.writeCoil(master, 1, layer, false); Modbus4jUtils.writeCoil(master, 1, layer, false);
log.info("已发送断电指令 - 设备:{} 层:{}", tEquipmentInfo.getfEquipmentCode(), layer); log.info("已发送断电指令 - 设备:{} 层:{}", tEquipmentInfo.getfEquipmentCode(), layer);
master.destroy(); master.destroy();
} catch (ModbusTransportException | ModbusInitException e) { } catch (ModbusTransportException | ModbusInitException e) {
log.info("下料发送断电指令失败 - 设备:{} 层:{}", tEquipmentInfo.getfEquipmentCode(), layer); log.info("下料发送断电指令失败 - 设备:{} 层:{}", tEquipmentInfo.getfEquipmentCode(), layer);
throw new RuntimeException(e); throw new RuntimeException(e);
}
} }
} }
......
...@@ -339,7 +339,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService ...@@ -339,7 +339,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
registerOffset = Arrays.asList(55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72); registerOffset = Arrays.asList(55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72);
} }
ModbusResultHandler modbusResultHandler = new ModbusResultHandler(); ModbusResultHandler modbusResultHandler = new ModbusResultHandler();
deviceStatusReaderAndTimeSetter.startMultiDeviceMonitoring(split[0], Integer.parseInt(split[1]),registerOffset, modbusResultHandler, null); deviceStatusReaderAndTimeSetter.startMultiDeviceMonitoring(split[0], Integer.parseInt(split[1]),registerOffset, modbusResultHandler, ModbusResultHandler.createDefaultStopCondition());
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment