#
Junjie
4 天以前 a3d44470b704e81d4f66399bed2f37529ddb31be
src/main/java/com/zy/core/network/real/ZyStationRealConnect.java
@@ -73,7 +73,7 @@
    }
    @Override
    public List<ZyStationStatusEntity> getStatus() {
    public List<ZyStationStatusEntity> getStatus(Integer deviceNo) {
        if (statusList == null) {
            BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
            if (basDevpService == null) {
@@ -132,7 +132,7 @@
    }
    @Override
    public CommandResponse sendCommand(StationCommand command) {
    public CommandResponse sendCommand(Integer deviceNo, StationCommand command) {
        CommandResponse commandResponse = new CommandResponse(false);
        if (null == command) {
            commandResponse.setMessage("命令为空");
@@ -186,6 +186,34 @@
        return commandResponse;
    }
    @Override
    public CommandResponse sendOriginCommand(String address, short[] data) {
        CommandResponse commandResponse = new CommandResponse(false);
        if (null == data || data.length == 0) {
            commandResponse.setMessage("数据为空");
            return commandResponse;
        }
        OperateResult write = siemensNet.Write(address, data);
        if (write.IsSuccess) {
            log.info("写入原始命令成功。地址={},数据={}", address, JSON.toJSON(data));
            commandResponse.setResult(true);
        } else {
            log.error("写入原始命令失败。地址={},数据={}", address, JSON.toJSON(data));
            commandResponse.setResult(false);
        }
        return commandResponse;
    }
    @Override
    public byte[] readOriginCommand(String address, int length) {
        OperateResultExOne<byte[]> result = siemensNet.Read(address, (short) length);
        if (result.IsSuccess) {
            return result.Content;
        }
        return new byte[0];
    }
    private ZyStationStatusEntity findStatusEntity(Integer stationId) {
        for (ZyStationStatusEntity statusEntity : statusList) {
            if (statusEntity.getStationId().equals(stationId)) {
@@ -204,4 +232,4 @@
        }
        return -1;
    }
}
}