Commit 9bf6ed22 authored by wanghao's avatar wanghao

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

2 测试定时任务 菜单 里面的 读取老化中寄存器数据 功能增加所有结果返回
parent 69cdd52d
......@@ -21,7 +21,7 @@ import com.zehong.common.core.page.TableDataInfo;
/**
* 老化层信息Controller
*
*
* @author zehong
* @date 2025-05-28
*/
......@@ -104,6 +104,14 @@ public class TStoreyInfoController extends BaseController
return tStoreyInfoService.handleReAgine(tStoreyInfo);
}
/**
* 处理清除任务
*/
@GetMapping(value = "/handleClearTasks")
public AjaxResult handleClearTasks(TStoreyInfo tStoreyInfo) {
return tStoreyInfoService.handleClearTasks(tStoreyInfo);
}
/**
* 处理直接消 blanking
*/
......
......@@ -59,7 +59,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
private IRobotArmCommandService robotArmCommandService;
@Resource
private ApplicationEventPublisher eventPublisher; // 新增事件发布器
/**
* 接收UDP消息
*/
......
......@@ -7,15 +7,15 @@ import com.zehong.system.domain.TStoreyInfo;
/**
* 老化层信息Service接口
*
*
* @author zehong
* @date 2025-05-28
*/
public interface ITStoreyInfoService
public interface ITStoreyInfoService
{
/**
* 查询老化层信息
*
*
* @param fStoreyId 老化层信息ID
* @return 老化层信息
*/
......@@ -34,7 +34,7 @@ public interface ITStoreyInfoService
/**
* 查询老化层信息列表
*
*
* @param tStoreyInfo 老化层信息
* @return 老化层信息集合
*/
......@@ -62,11 +62,13 @@ public interface ITStoreyInfoService
public AjaxResult handleReAgine(TStoreyInfo tStoreyInfo);
public AjaxResult handleClearTasks(TStoreyInfo tStoreyInfo);
public AjaxResult handleDirectBlanking(String command);
/**
* 新增老化层信息
*
*
* @param tStoreyInfo 老化层信息
* @return 结果
*/
......@@ -74,7 +76,7 @@ public interface ITStoreyInfoService
/**
* 修改老化层信息
*
*
* @param tStoreyInfo 老化层信息
* @return 结果
*/
......@@ -82,7 +84,7 @@ public interface ITStoreyInfoService
/**
* 批量删除老化层信息
*
*
* @param fStoreyIds 需要删除的老化层信息ID
* @return 结果
*/
......@@ -90,7 +92,7 @@ public interface ITStoreyInfoService
/**
* 删除老化层信息信息
*
*
* @param fStoreyId 老化层信息ID
* @return 结果
*/
......
......@@ -44,12 +44,12 @@ import static com.zehong.system.task.DeviceTaskScheduler.TRIGGER_GROUP;
/**
* 老化层信息Service业务层处理
*
*
* @author zehong
* @date 2025-05-28
*/
@Service
public class TStoreyInfoServiceImpl implements ITStoreyInfoService
public class TStoreyInfoServiceImpl implements ITStoreyInfoService
{
public static final Logger log = LoggerFactory.getLogger(TStoreyInfoServiceImpl.class);
@Resource
......@@ -86,7 +86,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
/**
* 查询老化层信息
*
*
* @param fStoreyId 老化层信息ID
* @return 老化层信息
*/
......@@ -358,7 +358,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
/**
* 查询老化层信息列表
*
*
* @param tStoreyInfo 老化层信息
* @return 老化层信息
*/
......@@ -569,6 +569,27 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
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
......@@ -701,6 +722,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
if (result.getModbusResult() != null) {
map.put("concentration", result.getModbusResult()[0]);
map.put("status", result.getModbusResult()[1]);
map.put("modbusResult", result.getModbusResult());
}
map.put("message", result.getMessage());
return map;
......@@ -799,9 +821,10 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
if(!aBoolean) {
Modbus4jUtils.writeCoil(master, 1, registerOffsetInt, true);
tStoreyInfo.setfStatus("1");
tStoreyInfo.setfAgingStartTime(new Date());
tStoreyInfoMapper.updateTStoreyInfo(tStoreyInfo);
// 20260104 这些调整不再这儿直接设置了
// tStoreyInfo.setfStatus("1");
// tStoreyInfo.setfAgingStartTime(new Date());
// tStoreyInfoMapper.updateTStoreyInfo(tStoreyInfo);
}
return AjaxResult.success();
......@@ -812,7 +835,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
/**
* 新增老化层信息
*
*
* @param tStoreyInfo 老化层信息
* @return 结果
*/
......@@ -850,7 +873,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
/**
* 修改老化层信息
*
*
* @param tStoreyInfo 老化层信息
* @return 结果
*/
......@@ -864,7 +887,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
/**
* 批量删除老化层信息
*
*
* @param fStoreyIds 需要删除的老化层信息ID
* @return 结果
*/
......@@ -876,7 +899,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
/**
* 删除老化层信息信息
*
*
* @param fStoreyId 老化层信息ID
* @return 结果
*/
......
......@@ -491,4 +491,57 @@ public class DeviceTaskScheduler {
finalTrigger != null ? finalTrigger.getNextFireTime() : "不存在",
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) {
})
}
export function clearTasks(query) {
return request({
url: '/storey/handleClearTasks/',
method: 'get',
params: query
})
}
export function directBlanking(command) {
return request({
url: '/storey/handleDirectBlanking/' + command,
......
......@@ -153,6 +153,11 @@
@click="handleReAgine(scope.row)"
>重新老化</el-button>
<el-button
size="mini"
type="text"
@click="handleClearTasks(scope.row)"
>清理任务</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
......@@ -222,7 +227,7 @@
import {
listStorey, getStorey, delStorey, addStorey, updateStorey,
exportStorey, PowerOn, PowerOutage,
feeding, blanking, directBlanking,reAgine
feeding, blanking, directBlanking, reAgine, clearTasks
} from "@/api/storey/storey";
import {sendHomeCommand, sendStopCommand} from "@/api/robotArm/robotArmCommand";
......@@ -416,6 +421,20 @@ export default {
this.msgSuccess("下料成功");
}).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) {
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