|
|
@@ -4,8 +4,10 @@ import cn.sciento.farm.automationv2.api.dto.GatewayControlDto;
|
|
|
import cn.sciento.farm.automationv2.app.handler.DeviceControlHelper;
|
|
|
import cn.sciento.farm.automationv2.domain.business.DeviceBusiness;
|
|
|
import cn.sciento.farm.automationv2.domain.entity.TaskExecution;
|
|
|
+import cn.sciento.farm.automationv2.domain.entity.mongo.IrrigationTaskLog;
|
|
|
import cn.sciento.farm.automationv2.domain.entity.mongo.IrrigationTaskMainVO;
|
|
|
import cn.sciento.farm.automationv2.domain.enums.AckStatus;
|
|
|
+import cn.sciento.farm.automationv2.domain.repository.IrrigationTaskLogRepository;
|
|
|
import cn.sciento.farm.automationv2.domain.repository.TaskExecutionRepository;
|
|
|
import cn.sciento.farm.automationv2.domain.valueobject.DeviceInfo;
|
|
|
import cn.sciento.farm.automationv2.domain.valueobject.ExecutionNode;
|
|
|
@@ -40,6 +42,7 @@ public class SafeShutdownService {
|
|
|
private final AckManager ackManager;
|
|
|
private final ExecutionPlanStore executionPlanStore;
|
|
|
private final TaskLogService logService;
|
|
|
+ private final IrrigationTaskLogRepository taskLogRepository;
|
|
|
|
|
|
/**
|
|
|
* 安全关闭所有已开启的设备
|
|
|
@@ -47,15 +50,16 @@ public class SafeShutdownService {
|
|
|
* @param executionId 执行实例ID
|
|
|
* @return 关闭结果摘要
|
|
|
*/
|
|
|
- public ShutdownResult shutdown(Long executionId) {
|
|
|
+ public ShutdownResult shutdown(TaskExecution execution) {
|
|
|
+ Long executionId = execution.getId();
|
|
|
log.info("开始安全关闭设备,executionId={}", executionId);
|
|
|
|
|
|
// 加载执行实例
|
|
|
- TaskExecution execution = taskExecutionRepository.selectByPrimaryKey(executionId);
|
|
|
- if (execution == null) {
|
|
|
- log.error("执行实例不存在,executionId={}", executionId);
|
|
|
- return ShutdownResult.error("执行实例不存在");
|
|
|
- }
|
|
|
+// TaskExecution execution = taskExecutionRepository.selectByPrimaryKey(executionId);
|
|
|
+// if (execution == null) {
|
|
|
+// log.error("执行实例不存在,executionId={}", executionId);
|
|
|
+// return ShutdownResult.error("执行实例不存在");
|
|
|
+// }
|
|
|
|
|
|
// 提取已开启的设备
|
|
|
OpenedDevices openedDevices = extractOpenedDevices(executionId);
|
|
|
@@ -225,6 +229,7 @@ public class SafeShutdownService {
|
|
|
"BALL_VALVE".equals(d.getDeviceType()))
|
|
|
.collect(Collectors.toList());
|
|
|
result.valves.addAll(valves);
|
|
|
+ // 如果存在同灌区ack部分成功的,需要额外查出
|
|
|
break;
|
|
|
|
|
|
default:
|