Commit 9bf6ed22 authored by wanghao's avatar wanghao

1 老化层界面 增加 清理任务操作,如果出现异常情况 要把任务都清理掉

2 测试定时任务 菜单 里面的 读取老化中寄存器数据 功能增加所有结果返回
parent 69cdd52d
...@@ -104,6 +104,14 @@ public class TStoreyInfoController extends BaseController ...@@ -104,6 +104,14 @@ public class TStoreyInfoController extends BaseController
return tStoreyInfoService.handleReAgine(tStoreyInfo); return tStoreyInfoService.handleReAgine(tStoreyInfo);
} }
/**
* 处理清除任务
*/
@GetMapping(value = "/handleClearTasks")
public AjaxResult handleClearTasks(TStoreyInfo tStoreyInfo) {
return tStoreyInfoService.handleClearTasks(tStoreyInfo);
}
/** /**
* 处理直接消 blanking * 处理直接消 blanking
*/ */
......
...@@ -59,7 +59,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP ...@@ -59,7 +59,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
private IRobotArmCommandService robotArmCommandService; private IRobotArmCommandService robotArmCommandService;
@Resource @Resource
private ApplicationEventPublisher eventPublisher; // 新增事件发布器 private ApplicationEventPublisher eventPublisher; // 新增事件发布器
/** /**
* 接收UDP消息 * 接收UDP消息
*/ */
......
...@@ -62,6 +62,8 @@ public interface ITStoreyInfoService ...@@ -62,6 +62,8 @@ public interface ITStoreyInfoService
public AjaxResult handleReAgine(TStoreyInfo tStoreyInfo); public AjaxResult handleReAgine(TStoreyInfo tStoreyInfo);
public AjaxResult handleClearTasks(TStoreyInfo tStoreyInfo);
public AjaxResult handleDirectBlanking(String command); public AjaxResult handleDirectBlanking(String command);
/** /**
......
...@@ -569,6 +569,27 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService ...@@ -569,6 +569,27 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
return AjaxResult.success(); return AjaxResult.success();
} }
/**
* 清理任务
* @param tStoreyInfo c
* @return r
*/
@Override
public AjaxResult handleClearTasks(TStoreyInfo tStoreyInfo) {
if(tStoreyInfo.getfStoreyId() == null) {
return AjaxResult.error("请选择老化层!!!");
}
try {
deviceTaskScheduler.cleanExistingTasks(tStoreyInfo.getfStoreyId());
} catch (SchedulerException e) {
throw new RuntimeException(e);
}
return AjaxResult.success();
}
/** /**
* 重新老化 * 重新老化
* @param tStoreyInfo c * @param tStoreyInfo c
...@@ -701,6 +722,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService ...@@ -701,6 +722,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
if (result.getModbusResult() != null) { if (result.getModbusResult() != null) {
map.put("concentration", result.getModbusResult()[0]); map.put("concentration", result.getModbusResult()[0]);
map.put("status", result.getModbusResult()[1]); map.put("status", result.getModbusResult()[1]);
map.put("modbusResult", result.getModbusResult());
} }
map.put("message", result.getMessage()); map.put("message", result.getMessage());
return map; return map;
...@@ -799,9 +821,10 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService ...@@ -799,9 +821,10 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
if(!aBoolean) { if(!aBoolean) {
Modbus4jUtils.writeCoil(master, 1, registerOffsetInt, true); Modbus4jUtils.writeCoil(master, 1, registerOffsetInt, true);
tStoreyInfo.setfStatus("1"); // 20260104 这些调整不再这儿直接设置了
tStoreyInfo.setfAgingStartTime(new Date()); // tStoreyInfo.setfStatus("1");
tStoreyInfoMapper.updateTStoreyInfo(tStoreyInfo); // tStoreyInfo.setfAgingStartTime(new Date());
// tStoreyInfoMapper.updateTStoreyInfo(tStoreyInfo);
} }
return AjaxResult.success(); return AjaxResult.success();
......
...@@ -491,4 +491,57 @@ public class DeviceTaskScheduler { ...@@ -491,4 +491,57 @@ public class DeviceTaskScheduler {
finalTrigger != null ? finalTrigger.getNextFireTime() : "不存在", finalTrigger != null ? finalTrigger.getNextFireTime() : "不存在",
finalTrigger != null ? finalTrigger.getEndTime() : "不存在"); finalTrigger != null ? finalTrigger.getEndTime() : "不存在");
} }
/**
* 在界面点击完成指令时 判断如果有任务未完成的则直接删除
* 清理所有任务(仅当所有任务完成时清理)
*/
public void onlyCompletedClearAllTasks(Long fStoreyId) throws SchedulerException {
String jobId = "COMM_" + fStoreyId;
JobKey jobKey = new JobKey(jobId, JOB_GROUP);
TriggerKey triggerKey = new TriggerKey(jobId + "_TRIGGER", TRIGGER_GROUP);
// 先删除旧的触发器和任务(彻底清理)
if (scheduler.checkExists(triggerKey)) {
scheduler.unscheduleJob(triggerKey);
}
if (scheduler.checkExists(jobKey)) {
scheduler.deleteJob(jobKey);
}
jobId = "TWO_" + fStoreyId;
jobKey = new JobKey(jobId, JOB_GROUP);
triggerKey = new TriggerKey(jobId + "_TRIGGER", TRIGGER_GROUP);
// 先删除旧的触发器和任务(彻底清理)
if (scheduler.checkExists(triggerKey)) {
scheduler.unscheduleJob(triggerKey);
}
if (scheduler.checkExists(jobKey)) {
scheduler.deleteJob(jobKey);
}
jobId = "PREPARE_" + fStoreyId;
jobKey = new JobKey(jobId, JOB_GROUP);
triggerKey = new TriggerKey(jobId + "_TRIGGER", TRIGGER_GROUP);
// 先删除旧的触发器和任务(彻底清理)
if (scheduler.checkExists(triggerKey)) {
scheduler.unscheduleJob(triggerKey);
}
if (scheduler.checkExists(jobKey)) {
scheduler.deleteJob(jobKey);
}
jobId = "FINAL_" + fStoreyId;
jobKey = new JobKey(jobId, JOB_GROUP);
triggerKey = new TriggerKey(jobId + "_TRIGGER", TRIGGER_GROUP);
// 先删除旧的触发器和任务(彻底清理)
if (scheduler.checkExists(triggerKey)) {
scheduler.unscheduleJob(triggerKey);
}
if (scheduler.checkExists(jobKey)) {
scheduler.deleteJob(jobKey);
}
}
} }
...@@ -98,6 +98,13 @@ export function reAgine(query) { ...@@ -98,6 +98,13 @@ export function reAgine(query) {
}) })
} }
export function clearTasks(query) {
return request({
url: '/storey/handleClearTasks/',
method: 'get',
params: query
})
}
export function directBlanking(command) { export function directBlanking(command) {
return request({ return request({
url: '/storey/handleDirectBlanking/' + command, url: '/storey/handleDirectBlanking/' + command,
......
...@@ -153,6 +153,11 @@ ...@@ -153,6 +153,11 @@
@click="handleReAgine(scope.row)" @click="handleReAgine(scope.row)"
>重新老化</el-button> >重新老化</el-button>
<el-button
size="mini"
type="text"
@click="handleClearTasks(scope.row)"
>清理任务</el-button>
<!-- <el-button--> <!-- <el-button-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- type="text"--> <!-- type="text"-->
...@@ -222,7 +227,7 @@ ...@@ -222,7 +227,7 @@
import { import {
listStorey, getStorey, delStorey, addStorey, updateStorey, listStorey, getStorey, delStorey, addStorey, updateStorey,
exportStorey, PowerOn, PowerOutage, exportStorey, PowerOn, PowerOutage,
feeding, blanking, directBlanking,reAgine feeding, blanking, directBlanking, reAgine, clearTasks
} from "@/api/storey/storey"; } from "@/api/storey/storey";
import {sendHomeCommand, sendStopCommand} from "@/api/robotArm/robotArmCommand"; import {sendHomeCommand, sendStopCommand} from "@/api/robotArm/robotArmCommand";
...@@ -416,6 +421,20 @@ export default { ...@@ -416,6 +421,20 @@ export default {
this.msgSuccess("下料成功"); this.msgSuccess("下料成功");
}).catch(() => {}); }).catch(() => {});
}, },
/** 清空任务 */
handleClearTasks(row) {
const fIp = row.fIp;
this.$confirm('是否确认清空IP为"' + fIp + '"的所有任务?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return clearTasks(row);
}).then(() => {
this.getList();
this.msgSuccess("重新老化开始");
}).catch(() => {});
},
/** 重新老化 */ /** 重新老化 */
handleReAgine(row) { handleReAgine(row) {
const fIp = row.fIp; const fIp = row.fIp;
......
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