opt:西门子项目优化

This commit is contained in:
2026-01-23 09:00:19 +08:00
parent 77706cc835
commit 86ade918c5
14 changed files with 307 additions and 34 deletions

View File

@@ -1,5 +1,6 @@
package org.nl.acs.auto.run;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
@@ -258,8 +259,12 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (ObjectUtil.isNotEmpty(bjdDevice)) {
if (bjdDevice.getDeviceDriver() instanceof GuardLampDeviceDriver) {
try {
GuardLampDeviceDriver guardLampDeviceDriver = (GuardLampDeviceDriver) bjdDevice.getDeviceDriver();
guardLampDeviceDriver.writing("to_open", "1");
List<Dict> guard_lamp_open_flag_list = dictService.getDictByName("guard_lamp_open_flag");
if(CollectionUtil.isNotEmpty(guard_lamp_open_flag_list) && "1".equals(guard_lamp_open_flag_list.get(0).getValue())
&& guard_lamp_open_flag_list.get(0).getPara1().contains(bjdDevice.getDevice_code())) {
GuardLampDeviceDriver guardLampDeviceDriver = (GuardLampDeviceDriver) bjdDevice.getDeviceDriver();
guardLampDeviceDriver.writing("to_open", "1");
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} catch (Exception e) {
log.info("下发告警灯告警信号失败");
@@ -279,8 +284,12 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (ObjectUtil.isNotEmpty(bjdDevice)) {
if (bjdDevice.getDeviceDriver() instanceof GuardLampDeviceDriver) {
try {
GuardLampDeviceDriver guardLampDeviceDriver = (GuardLampDeviceDriver) bjdDevice.getDeviceDriver();
guardLampDeviceDriver.writing("to_open", "0");
List<Dict> guard_lamp_open_flag_list = dictService.getDictByName("guard_lamp_open_flag");
if(CollectionUtil.isNotEmpty(guard_lamp_open_flag_list) && "1".equals(guard_lamp_open_flag_list.get(0).getValue())
&& guard_lamp_open_flag_list.get(0).getPara1().contains(bjdDevice.getDevice_code())) {
GuardLampDeviceDriver guardLampDeviceDriver = (GuardLampDeviceDriver) bjdDevice.getDeviceDriver();
guardLampDeviceDriver.writing("to_open", "0");
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} catch (Exception e) {
log.info("下发告警灯取消告警信号失败");

View File

@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.agv.ndcone;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -39,9 +40,12 @@ import org.nl.acs.task.domain.Task;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.system.service.dict.ISysDictService;
import org.nl.system.service.dict.dao.Dict;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.HashMap;
@@ -65,6 +69,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
ISysDictService dictService = SpringContextHolder.getBean(ISysDictService.class);
int agvaddr = 0;
int agvaddr_copy = 0;
int weight = 0;
@@ -533,8 +539,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
try {
Device guardLamp = deviceAppService.findDeviceByCode("BJD" + agvaddr);
if (guardLamp != null) {
GuardLampDeviceDriver guardLampDeviceDriver = (GuardLampDeviceDriver) device.getDeviceDriver();
guardLampDeviceDriver.writing("to_open", "1");
List<Dict> guard_lamp_open_flag_list = dictService.getDictByName("guard_lamp_open_flag");
if(CollectionUtil.isNotEmpty(guard_lamp_open_flag_list) && "1".equals(guard_lamp_open_flag_list.get(0).getValue())
&& guard_lamp_open_flag_list.get(0).getPara1().contains(guardLamp.getDevice_code())) {
GuardLampDeviceDriver guardLampDeviceDriver = (GuardLampDeviceDriver) guardLamp.getDeviceDriver();
guardLampDeviceDriver.writing("to_open", "1");
}
}
} catch (Exception e) {
log.info("下发告警灯告警信号失败");
@@ -546,8 +556,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
try {
Device guardLamp = deviceAppService.findDeviceByCode("BJD" + agvaddr);
if (guardLamp != null) {
GuardLampDeviceDriver guardLampDeviceDriver = (GuardLampDeviceDriver) device.getDeviceDriver();
guardLampDeviceDriver.writing("to_open", "0");
List<Dict> guard_lamp_open_flag_list = dictService.getDictByName("guard_lamp_open_flag");
if(CollectionUtil.isNotEmpty(guard_lamp_open_flag_list) && "1".equals(guard_lamp_open_flag_list.get(0).getValue())
&& guard_lamp_open_flag_list.get(0).getPara1().contains(guardLamp.getDevice_code())) {
GuardLampDeviceDriver guardLampDeviceDriver = (GuardLampDeviceDriver) guardLamp.getDeviceDriver();
guardLampDeviceDriver.writing("to_open", "0");
}
}
} catch (Exception e) {
log.info("下发告警灯取消告警信号失败");