Commit d5cbef0d authored by wanghao's avatar wanghao

1 指令指令完成,但是 没有检测到机械臂完成。

parent 6a332201
package com.zehong.web.controller.equipment; package com.zehong.web.controller.equipment;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.utils.TCP.TCPClient; import com.zehong.common.utils.TCP.TCPClient;
import com.zehong.system.domain.TEquipmentAlarmData; import com.zehong.system.domain.TEquipmentAlarmData;
import com.zehong.system.domain.TEquipmentInfo; import com.zehong.system.domain.TEquipmentInfo;
...@@ -7,12 +8,12 @@ import com.zehong.system.domain.TStoreyInfo; ...@@ -7,12 +8,12 @@ import com.zehong.system.domain.TStoreyInfo;
import com.zehong.system.service.ITEquipmentAlarmDataService; import com.zehong.system.service.ITEquipmentAlarmDataService;
import com.zehong.system.service.ITEquipmentInfoService; import com.zehong.system.service.ITEquipmentInfoService;
import com.zehong.system.service.ITStoreyInfoService; import com.zehong.system.service.ITStoreyInfoService;
import com.zehong.system.task.DeviceTaskScheduler;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.*;
/** /**
...@@ -31,6 +32,40 @@ public class EquipmentDataCollection { ...@@ -31,6 +32,40 @@ public class EquipmentDataCollection {
private ITStoreyInfoService tStoreyInfoService; private ITStoreyInfoService tStoreyInfoService;
@Autowired @Autowired
private ITEquipmentAlarmDataService tEquipmentAlarmDataService; private ITEquipmentAlarmDataService tEquipmentAlarmDataService;
@Autowired
private DeviceTaskScheduler deviceTaskScheduler;
/**
* 触发设备监控任务
* @return 执行结果
*/
@GetMapping("/trigger/{ipAndPort}")
public AjaxResult triggerDeviceTask(@PathVariable("ipAndPort") String ipAndPort) {
long storeyId = 0;
try {
String[] split = ipAndPort.split(",");
String storeyIdStr = split[0];
String DEFAULT_TEST_IP = split[1];
int port =Integer.parseInt(split[2]);
TStoreyInfo tStoreyInfo = tStoreyInfoService.selectTStoreyInfoByCode(storeyIdStr);
storeyId = tStoreyInfo.getfStoreyId();
log.info("开始执行测试设备任务:storeyId={}, ip={}, port={}",
storeyId, DEFAULT_TEST_IP, port);
// 调用调度器执行任务
deviceTaskScheduler.scheduleDeviceMonitoring(storeyId, DEFAULT_TEST_IP, port);
log.info("测试设备任务已提交:storeyId={}", storeyId);
return AjaxResult.success("设备任务已成功提交",
String.format("任务参数:storeyId=%d, ip=%s, port=%d",
storeyId, DEFAULT_TEST_IP, port));
} catch (Exception e) {
log.error("触发设备任务失败:storeyId={}", storeyId, e);
return AjaxResult.error("触发设备任务失败:" + e.getMessage());
}
}
/** /**
* 1.老化柜巡查 * 1.老化柜巡查
* 2.老化层断电 * 2.老化层断电
......
...@@ -53,6 +53,13 @@ export function sendStopCommand() { ...@@ -53,6 +53,13 @@ export function sendStopCommand() {
} }
// 停止当前指令
export function sendWriteHour(ipAndPort) {
return request({
url: '/equipmentData/trigger/' + ipAndPort,
method: 'get'
})
}
// 执行上电操作 // 执行上电操作
export function powerOnCommand(commandId) { export function powerOnCommand(commandId) {
return request({ return request({
......
...@@ -111,6 +111,15 @@ ...@@ -111,6 +111,15 @@
@click="handleStop" @click="handleStop"
>机械臂停止</el-button> >机械臂停止</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-circle-close"
size="mini"
@click="handleWriteHour"
>写时间测试</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
...@@ -247,7 +256,7 @@ import { listStorey, getStorey, delStorey, addStorey, updateStorey, ...@@ -247,7 +256,7 @@ import { listStorey, getStorey, delStorey, addStorey, updateStorey,
exportStorey,PowerOn,PowerOutage , exportStorey,PowerOn,PowerOutage ,
batchReadingCabinetStatus,powerOnAllStore,powerOffAllStore, batchReadingCabinetStatus,powerOnAllStore,powerOffAllStore,
feeding, blanking,readingHoldingRegister} from "@/api/storey/storey"; feeding, blanking,readingHoldingRegister} from "@/api/storey/storey";
import {sendHomeCommand, sendStopCommand} from "@/api/robotArm/robotArmCommand"; import {sendHomeCommand, sendStopCommand,sendWriteHour} from "@/api/robotArm/robotArmCommand";
export default { export default {
name: "Info", name: "Info",
...@@ -525,6 +534,20 @@ export default { ...@@ -525,6 +534,20 @@ export default {
}) })
}, },
/** 写时钟 */
handleWriteHour() {
this.$prompt('请输入ip加端口号 逗号分隔', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(({ value }) => {
sendWriteHour(value).then(response => {
if(response.code === 200) {
this.msgSuccess("msg = " + response.data);
}
})
}).catch(() => {
});
},
// 停止 // 停止
handleStop() { handleStop() {
sendStopCommand().then( response => { sendStopCommand().then( response => {
......
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