Commit 2274cf7c authored by wanghao's avatar wanghao

1 提供可以实时查询 老化中时 托盘上各寄存器实时数据的功能。

parent d74c1ae3
......@@ -123,9 +123,9 @@ public class TStoreyInfoController extends BaseController
/**
* 批量读取寄存器
*/
@GetMapping(value = "/handleReadingHoldingRegister/{ipAndPort}")
public AjaxResult handleReadingHoldingRegister(@PathVariable("ipAndPort") String ipAndPort) {
return tStoreyInfoService.handleReadingHoldingRegister(ipAndPort);
@GetMapping(value = "/handleReadingHoldingRegister/{storeyCode}")
public AjaxResult handleReadingHoldingRegister(@PathVariable("storeyCode") String storeyCode) {
return tStoreyInfoService.handleReadingHoldingRegister(storeyCode);
}
/**
......
......@@ -48,7 +48,7 @@ public interface ITStoreyInfoService
public AjaxResult batchReadingCabinetStatus(String fEquipmentCode);
public AjaxResult handleReadingHoldingRegister(String ipAndPort);
public AjaxResult handleReadingHoldingRegister(String storeyCode);
public AjaxResult powerOffAllStore();
......
......@@ -19,10 +19,13 @@ import com.zehong.system.service.IRobotArmCommandService;
import com.zehong.system.service.ITEquipmentAlarmDataService;
import com.zehong.system.service.ITEquipmentInfoService;
import com.zehong.system.service.ITStoreyInfoService;
import com.zehong.system.service.websocket.AgingCabinetWebSocketHandler;
import com.zehong.system.task.CheckPowerOnCommandEvent;
import com.zehong.system.task.DeviceTaskScheduler;
import org.quartz.*;
import com.zehong.system.task.RealTimeReadAgingDataFunction;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerKey;
import org.quartz.impl.matchers.GroupMatcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -73,6 +76,12 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
private final ExecutorService executor = Executors.newFixedThreadPool(10);
@Resource
private ApplicationEventPublisher eventPublisher; // 新增事件发布器
@Resource
private RealTimeReadAgingDataFunction realTimeReadAgingDataFunction;
private final ExecutorService executorService = Executors.newFixedThreadPool(10);
/**
......@@ -674,25 +683,34 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
}
@Override
public AjaxResult handleReadingHoldingRegister(String ipAndPort) {
public AjaxResult handleReadingHoldingRegister(String storeyCode) {
if(StringUtils.isBlank(ipAndPort) || ipAndPort.split("-").length != 2) {
return AjaxResult.error("ip和端口格式错误!!!");
if(StringUtils.isBlank(storeyCode) || storeyCode.split("-").length != 2) {
return AjaxResult.error("柜层号输入有问题!!!");
}
String[] split = ipAndPort.split("-");
List<Integer> registerOffset ;
if("501".equals(split[1])) {
registerOffset = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27);
} else if("502".equals(split[1])) {
registerOffset = Arrays.asList(28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,49, 50, 51, 52, 53,54);
} else {
registerOffset = Arrays.asList(55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72);
try {
List<RealTimeReadAgingDataFunction.DeviceResult> results =
realTimeReadAgingDataFunction.execute(storeyCode);
// 转换为前端需要的格式
List<Map<String, Object>> formattedResults = results.stream()
.map(result -> {
Map<String, Object> map = new HashMap<>();
map.put("serpentineNumber", result.getSerpentineNumber());
map.put("success", result.isSuccess());
if (result.getModbusResult() != null) {
map.put("concentration", result.getModbusResult()[0]);
map.put("status", result.getModbusResult()[1]);
}
map.put("message", result.getMessage());
return map;
})
.collect(Collectors.toList());
return AjaxResult.success(formattedResults);
} catch (Exception e) {
return AjaxResult.error("读取失败: " + e.getMessage());
}
// deviceStatusReaderAndTimeSetter.startMultiDeviceMonitoring(split[0], Integer.parseInt(split[1]),registerOffset, modbusResultHandler, ModbusResultHandler.createDefaultStopCondition());
return null;
}
/**
......
......@@ -105,6 +105,13 @@ export function directBlanking(command) {
})
}
export function readAgingData(fEquipmentCode) {
return request({
url: '/storey/readAgingData/' + fEquipmentCode,
method: 'get'
})
}
export function batchReadingCabinetStatus(fEquipmentCode) {
return request({
url: '/storey/batchReadingCabinetStatus/' + fEquipmentCode,
......@@ -112,9 +119,9 @@ export function batchReadingCabinetStatus(fEquipmentCode) {
})
}
export function readingHoldingRegister(ipAndPort) {
export function readingHoldingRegister(storeyCode) {
return request({
url: '/storey/handleReadingHoldingRegister/' + ipAndPort,
url: '/storey/handleReadingHoldingRegister/' + storeyCode,
method: 'get'
})
}
......
......@@ -56,19 +56,14 @@
<el-table-column label="列" align="center" prop="col" />
<el-table-column label="第几个" align="center" prop="index" />
<el-table-column label="编号" align="center" prop="number" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="绑定时间" align="center" prop="bindingTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.bindingTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.bindingTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="解绑时间" align="center" prop="unbindingTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.unbindingTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.unbindingTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" >
......@@ -108,6 +103,48 @@
</template>
</el-table-column>
<el-table-column label="写自检状态" align="center" width="150">
<template slot-scope="scope">
<span v-if="scope.row.writeSelfCheckStatus === 1" class="write-success">成功</span>
<span v-else-if="scope.row.writeSelfCheckStatus === 0" class="write-failed">失败</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="继电器状态" align="center" width="150">
<template slot-scope="scope">
<span v-if="scope.row.relayStatus === 1" class="write-success">初始</span>
<span v-else-if="scope.row.relayStatus === 0" class="write-failed">动作</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="脉冲状态" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.pulseStatus === 1" class="write-success">初始</span>
<span v-else-if="scope.row.pulseStatus === 0" class="write-failed">动作</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="模块状态" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.moduleStatus === 1" class="write-success">正常</span>
<span v-else-if="scope.row.moduleStatus === 0" class="write-failed">异常</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="SIM卡状态" align="center" width="150">
<template slot-scope="scope">
<span v-if="scope.row.simCardStatus === 1" class="write-success">正常</span>
<span v-else-if="scope.row.simCardStatus === 0" class="write-failed">异常</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="网络状态" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.networkStatus === 1" class="write-success">正常</span>
<span v-else-if="scope.row.networkStatus === 0" class="write-failed">异常</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<!-- <el-table-column label="调零AD" align="center" prop="adjustmentZeroAd" />-->
<!-- <el-table-column label="调零状态" align="center" prop="zeroStatus" >-->
<!-- <template slot-scope="scope">-->
......
......@@ -142,6 +142,49 @@
</template>
</el-table-column>
<el-table-column label="写自检状态" align="center" width="150">
<template slot-scope="scope">
<span v-if="scope.row.writeSelfCheckStatus === 1" class="write-success">成功</span>
<span v-else-if="scope.row.writeSelfCheckStatus === 0" class="write-failed">失败</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="继电器状态" align="center" width="150">
<template slot-scope="scope">
<span v-if="scope.row.relayStatus === 1" class="write-success">初始</span>
<span v-else-if="scope.row.relayStatus === 0" class="write-failed">动作</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="脉冲状态" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.pulseStatus === 1" class="write-success">初始</span>
<span v-else-if="scope.row.pulseStatus === 0" class="write-failed">动作</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="模块状态" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.moduleStatus === 1" class="write-success">正常</span>
<span v-else-if="scope.row.moduleStatus === 0" class="write-failed">异常</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="SIM卡状态" align="center" width="150">
<template slot-scope="scope">
<span v-if="scope.row.simCardStatus === 1" class="write-success">正常</span>
<span v-else-if="scope.row.simCardStatus === 0" class="write-failed">异常</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="网络状态" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.networkStatus === 1" class="write-success">正常</span>
<span v-else-if="scope.row.networkStatus === 0" class="write-failed">异常</span>
<span v-else class="write-unknown">-</span>
</template>
</el-table-column>
<el-table-column label="通信年" prop="recordYear" align="center" width="100">
<template slot-scope="scope">
<div class="device-code">{{ scope.row.recordYear || '-' }}</div>
......
......@@ -20,15 +20,6 @@
@click="handleReading"
>批量读取设备状态</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="info"-->
<!-- plain-->
<!-- icon="el-icon-reading"-->
<!-- size="mini"-->
<!-- @click="handleHoldingRegister"-->
<!-- >测试501端口</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="danger"
......@@ -38,15 +29,25 @@
@click="handleWriteHour"
>写时间测试</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-circle-check"
size="mini"
@click="handleScanAndStartAgingAllCabinetLayers"
>扫描并老化</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-circle-check"-->
<!-- size="mini"-->
<!-- @click="handleScanAndStartAgingAllCabinetLayers"-->
<!-- >扫描并老化</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-circle-check"
size="mini"
@click="handleReadAgineData"
>读取老化中寄存器数据</el-button>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
......@@ -69,7 +70,6 @@
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
......@@ -102,7 +102,8 @@
import {getAgingCabinetAndPowerCheck} from "@/api/testScheduledTasks/testTasks";
import {
batchReadingCabinetStatus, readingHoldingRegister, powerOnAllStore, powerOffAllStore,
scanAndStartAgingAllCabinetLayers, designatedDevicePowerOn, designatedDevicePowerOff
scanAndStartAgingAllCabinetLayers, designatedDevicePowerOn, designatedDevicePowerOff,
readAgingData
} from "@/api/storey/storey";
import {sendWriteHour} from "@/api/robotArm/robotArmCommand";
......@@ -134,7 +135,6 @@ export default {
}
);
},
// 从原组件提取的功能方法
handleReading() {
this.$prompt('请输入老化柜编号', '提示', {
......@@ -150,15 +150,15 @@ export default {
}).catch(() => {});
},
handleHoldingRegister() {
this.$prompt('请输入ip加端口号 逗号分隔', '提示', {
handleReadAgineData() {
this.$prompt('请输入柜号-层号(层数从下往上1-10),例如 1-1,15-5', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(({ value }) => {
readingHoldingRegister(value).then(response => {
if(response.code === 200) {
this.textarea = "测试501端口成功:" + JSON.stringify(response.data);
this.$message.success("测试成功");
this.textarea = "批量读取设备状态成功:" + JSON.stringify(response.data);
this.$message.success("读取成功");
}
})
}).catch(() => {});
......
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