Browse Source

add:添加报警灯交互逻辑

master
涂强 1 week ago
parent
commit
ae8098736f
  1. 7
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java
  2. 19
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/lamp_three_color/ItemProtocol.java
  3. 8
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/lamp_three_color/LampThreecolorDefination.java
  4. 30
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/lamp_three_color/LampThreecolorDeviceDriver.java
  5. 19
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

7
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java

@ -266,6 +266,11 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
standardAutodoorDeviceDriver.writing("to_command", 1);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver();
if (lampThreecolorDeviceDriver.getAction() == 1) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
} else {
log.info(agvaddr + "对应设备号为空!");
@ -278,8 +283,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
}
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isNotEmpty(device)) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
standardAutodoorDeviceDriver.writing("to_command", 2);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}

19
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/lamp_three_color/ItemProtocol.java

@ -9,7 +9,10 @@ import java.util.List;
@Slf4j
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_action = "action";
public static String item_error = "error";
public static String item_to_command = "to_command";
@ -19,10 +22,22 @@ public class ItemProtocol {
this.driver = driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
@ -31,6 +46,7 @@ public class ItemProtocol {
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
log.error("读取错误!");
} else {
return value;
}
@ -40,13 +56,12 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_mode, "模式", "08010"));
list.add(new ItemDto(item_action, "动作信号", "DB51.B3"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "08011"));
return list;
}

8
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/lamp_three_color/LampThreecolorDefination.java

@ -7,6 +7,7 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@ -51,9 +52,14 @@ public class LampThreecolorDefination implements OpcDeviceDriverDefination {
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
return getReadableItemDtos2();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_action, "动作信号", "DB600.B3"));
return list;
}
@Override
public List<ItemDto> getWriteableItemDtos() {

30
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/lamp_three_color/LampThreecolorDeviceDriver.java

@ -30,10 +30,14 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
int mode;
int to_command;
int last_mode;
int last_to_command;
int mode = 0;
int action = 0;
int error = 0;
int last_action = 0;
int last_mode = 0;
int last_error = 0;
/**
* 放货准备锁
*/
@ -82,12 +86,24 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
@Override
public void execute() {
String message = null;
device_code = this.getDevice().getDevice_code();
mode = this.itemProtocol.getOpcIntegerValue(ItemProtocol.item_mode);
to_command = this.itemProtocol.getOpcIntegerValue(ItemProtocol.item_to_command);
last_mode = mode;
last_to_command = to_command;
String device_code = this.getDevice().getDevice_code();
mode = this.itemProtocol.getMode();
action = this.itemProtocol.getAction();
error = this.itemProtocol.getError();
if (mode != last_mode) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
}
if (action != last_action) {
logServer.deviceExecuteLog(this.device_code, "", "", "action:" + last_action + "->" + action);
}
if (error != last_error) {
//this.execute_log.setContainer("");
logServer.deviceExecuteLog(this.device_code, "", "", "error:" + last_error + "->" + error);
}
last_action = action;
last_mode = mode;
last_error = error;
}
public void writing(String param, String value) {

19
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -587,8 +587,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
task_code = CodeUtil.getNewCode("TASK_NO");
task_code = CommonFinalParam.HYPHEN_ + task_code;
}
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
String route_plan_code = dto.getRoute_plan_code();
dto.setCreate_by(StrUtil.isNotEmpty(currentUsername) ? currentUsername : "LMS");
dto.setUpdate_by(currentUsername);
@ -597,10 +595,15 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
dto.setTask_code(task_code);
dto.setRoute_plan_code(route_plan_code);
dto.setTask_status(TaskStatusEnum.READY.getIndex());
dto.setStart_point_code(start_device_code);
dto.setNext_point_code(next_device_code);
dto.setStart_device_code(start_device_code);
dto.setNext_device_code(next_device_code);
if (StrUtil.isNotEmpty(dto.getStart_point_code())&&StrUtil.isNotEmpty(dto.getNext_point_code())){
dto.setStart_device_code(dto.getStart_point_code());
dto.setNext_device_code(dto.getNext_point_code());
}
if (StrUtil.isNotEmpty(dto.getStart_device_code())&&StrUtil.isNotEmpty(dto.getNext_device_code())) {
dto.setStart_point_code(dto.getStart_device_code());
dto.setNext_point_code(dto.getNext_device_code());
}
if (StrUtil.isEmpty(dto.getPriority())) {
dto.setPriority(CommonFinalParam.ONE);
}
@ -614,12 +617,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
}
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device nextdevice = appService.findDeviceByCode(next_device_code);
Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code());
if (nextdevice == null) {
//TODO 国际化处理
throw new BadRequestException("终点设备未配置");
}
Device startdevice = appService.findDeviceByCode(start_device_code);
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
if (startdevice == null) {
//TODO 国际化处理
throw new BadRequestException("起点设备未配置");

Loading…
Cancel
Save