Browse Source

rev:更新

master
gengby 2 months ago
parent
commit
0e78fa55ae
  1. 2
      nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java
  2. 74
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/bx06_demo.java
  3. 1
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceServiceImpl.java
  4. 137
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java
  5. 1
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/ItemProtocol.java
  6. 226
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/screen/led_screen/LedScreenDeviceDriver.java
  7. 626
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/StandardStackerDeviceDriver.java
  8. 21
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java
  9. 23
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  10. 44
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java
  11. 258
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  12. 7
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java
  13. 124
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  14. 78
      nladmin-system/nlsso-server/src/main/java/org/nl/config/mqtt2/MqttService.java
  15. 2
      nladmin-system/nlsso-server/src/main/java/org/nl/system/service/coderule/impl/SysCodeRuleServiceImpl.java
  16. 2
      nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml
  17. 2
      nladmin-system/nlsso-server/src/main/resources/config/application.yml
  18. 70
      nladmin-ui/src/views/acs/device/driver/appearance_inspection_scanner_conveyor_device.vue
  19. 198
      nladmin-ui/src/views/acs/device/driver/led_screen.vue
  20. 34
      nladmin-ui/src/views/acs/device/driver/standard_stacker_device.vue
  21. 10
      nladmin-ui/src/views/acs/task/index.vue

2
nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java

@ -40,7 +40,7 @@ public class AppRun {
public static void main(String[] args) {
SpringApplication.run(AppRun.class, args);
new HeartServer(new InetSocketAddress("127.0.0.1", 20889));
new HeartServer(new InetSocketAddress("192.168.8.218", 20889));
System.out.println("项目启动成功");
}

74
nladmin-system/nlsso-server/src/main/java/org/nl/acs/bx06_demo.java

@ -21,6 +21,7 @@ import onbon.bx06.utils.DisplayStyleFactory;
import onbon.bx06.utils.TextBinary;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
@ -31,7 +32,7 @@ import java.util.List;
* @create: 2019-08-21 14:52
**/
public class bx06_demo {
private static String ip = "192.168.81.56";
private static String ip = "192.168.8.148";
private static int port = 5005;
public static void main(String[] args)throws Exception
{
@ -260,15 +261,17 @@ public class bx06_demo {
{
DisplayStyle[] styles = DisplayStyleFactory.getStyles().toArray(new DisplayStyle[0]);
Bx6GScreenClient screen = new Bx6GScreenClient( "MyScreen",new Bx6E() );
Bx6GScreenClient screen = new Bx6GScreenClient( "MyScreen1",new Bx6E() );
screen.connect( ip,port );
ProgramBxFile pf = new ProgramBxFile( 0,screen.getProfile() );
TextCaptionBxArea area = new TextCaptionBxArea( 0,0,160,32,screen.getProfile() );
TextCaptionBxArea area = new TextCaptionBxArea( 0,0,192,16,screen.getProfile() );
TextBxPage page = new TextBxPage( "入库模式148");
TextBxPage page = new TextBxPage( "这是节目" );
page.setForeground(Color.green);
area.addPage( page );
@ -276,8 +279,28 @@ public class bx06_demo {
screen.writeProgram( pf );
// 创建第一个动态区
DynamicBxAreaRule rule_2 = new DynamicBxAreaRule();
rule_2.setId( 0 );
rule_2.setRunMode( (byte)0 );
rule_2.setRelativeAllPrograms( false );
rule_2.addRelativeProgram( 0 );
DynamicBxArea area_2 = new DynamicBxArea( 0,22,192,22,screen.getProfile() );
String errorMsg = "报警信息: 无报警!";
TextBxPage page_2 = new TextBxPage( errorMsg);
if (errorMsg.length() > 10){
page_2.setDisplayStyle( styles[4] );
} else {
page_2.setDisplayStyle( styles[1] );
}
page_2.setFont( new Font("Microsoft YaHei",Font.PLAIN,12) );
page_2.setForeground(Color.green);
page_2.setLineHeight(12);
area_2.addPage( page_2 );
screen.writeDynamic( rule_2,area_2 );
DynamicBxAreaRule rule = new DynamicBxAreaRule();
rule.setId(0);
rule.setId(1);
rule.setRunMode( (byte)0 );
// 新增动态区关联异步节目
// 一旦关联了某个异步节目,则该节目和动态区一起播放
@ -287,24 +310,41 @@ public class bx06_demo {
// false:由规则来决定
rule.setRelativeAllPrograms( false );
rule.addRelativeProgram( 0 );
DynamicBxArea dArea = new DynamicBxArea( 0,37,192,37,screen.getProfile() );
String msg = "任务信息: 载具T00001由1120->T01-01-01,载具T00002由1120->T01-02-01,载具T00003由1120->T01-03-01";
TextBxPage dPage = new TextBxPage(msg);
boolean stringWidth = getStringWidth(msg);
if (msg.length() > 20){
dPage.setDisplayStyle( styles[4] );
} else {
dPage.setDisplayStyle( styles[1] );
}
dPage.setFont( new Font( "Microsoft YaHei",Font.PLAIN,12 ) );
dPage.setForeground(Color.green);
dPage.setLineHeight(12);
dArea.addPage( dPage );
screen.writeDynamic( rule,dArea );
screen.disconnect();
}
DynamicBxArea dArea = new DynamicBxArea( 0,32,160,32,screen.getProfile() );
private static boolean getStringWidth(String msg) {
Font font = new Font("Microsoft YaHei", Font.PLAIN, 12);
TextBxPage dPage = new TextBxPage( "这是动态区" );
dPage.setDisplayStyle( styles[2] );
dPage.setFont( new Font( "宋体",Font.PLAIN,12 ) );
// 创建一个临时的 BufferedImage 来获取 Graphics 对象
BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Graphics g = image.getGraphics();
dArea.addPage( dPage );
// 设置字体
g.setFont(font);
screen.writeDynamic( rule,dArea );
// 获取 FontMetrics
FontMetrics metrics = g.getFontMetrics();
List<String> pfs = screen.readProgramList();
for(String program : pfs)
{
System.out.println( program );
}
// 计算字符串的宽度
int width = metrics.stringWidth(msg);
screen.disconnect();
// 判断宽度是否小于 192
return width < 192;
}
// 关于语音播报区域

1
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceServiceImpl.java

@ -1458,6 +1458,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
jo.put("maxZ", new LambdaQueryChainWrapper<>(deviceExtraMapper).eq(DeviceExtra::getDevice_id, device_id).eq(DeviceExtra::getExtra_code, "maxZ").one().getExtra_value());
jo.put("minZ", new LambdaQueryChainWrapper<>(deviceExtraMapper).eq(DeviceExtra::getDevice_id, device_id).eq(DeviceExtra::getExtra_code, "minZ").one().getExtra_value());
jo.put("tunnel", new LambdaQueryChainWrapper<>(deviceExtraMapper).eq(DeviceExtra::getDevice_id, device_id).eq(DeviceExtra::getExtra_code, "tunnel").one().getExtra_value());
jo.put("x", new LambdaQueryChainWrapper<>(deviceExtraMapper).eq(DeviceExtra::getDevice_id, device_id).eq(DeviceExtra::getExtra_code, "x").one().getExtra_value());
return jo;
}

137
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java

@ -18,7 +18,6 @@ import org.nl.acs.device.device.service.dto.DeviceAssignedDto;
import org.nl.acs.device.driver.*;
import org.nl.acs.device.driver.conveyor.appearance_inspection_scannner_conveyor.enums.*;
import org.nl.acs.device.driver.conveyor.strip_conveyor.StripConveyorDeviceDriver;
import org.nl.acs.device.driver.storage.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.ext.UnifiedResponse;
import org.nl.acs.ext.socket.Online;
import org.nl.acs.ext.wms.data.req.CommonRequest;
@ -41,6 +40,7 @@ import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@ -71,6 +71,11 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
*/
private int heartbeat = 0;
private int lastHeartbeat = 0;
/**
* 手自动状态 0手动 1自动
*/
private int status = 0;
private int lastStatus = 0;
/**
* 工作模式
*/
@ -273,6 +278,8 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
this.executeLogicBefore();
if (!this.online) {
this.message = "设备离线";
} else if (this.status == 0) {
this.message = "输送线为手动状态";
} else if (this.mode == 0) {
this.message = "设备未联机";
} else if (this.error != 0) {
@ -588,6 +595,8 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
}
}
private static CopyOnWriteArrayList<String> bindTaskCode = new CopyOnWriteArrayList<>();
public void createOutInstruction(String deviceCode) {
long currentTimeMillis = System.currentTimeMillis();
if (!isTimeValid(currentTimeMillis)) {
@ -602,6 +611,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) cacheDevice.getDeviceDriver();
checkoutStartDeviceCode = appearanceInspectionScannerConveyorDeviceDriver.getExtraDeviceCodes("checkoutStartDeviceCode");
}
List<TaskDto> taskDtos = taskService.findReadyTasksByNextDeviceCode(deviceCode, checkoutStartDeviceCode);
TaskDto taskDto = taskService.findReadyTaskByNextDeviceCode(deviceCode, checkoutStartDeviceCode);
Instruction instDto = instructionService.findReadyInstByEnd(deviceCode);
if (ObjectUtil.isNotEmpty(taskDto) && ObjectUtil.isEmpty(instDto)) {
@ -614,12 +624,74 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
}
DeviceAssignedDto assignedDto = null;
if (assignedDtos.size() > 1) {
for (DeviceAssignedDto deviceAssignedDto : assignedDtos) {
Map<Integer, List<DeviceAssignedDto>> tempAss = new HashMap<>();
for (int i = 0; i < assignedDtos.size(); i++) {
DeviceAssignedDto deviceAssignedDto = assignedDtos.get(i);
String inst_nextDevice_code = deviceAssignedDto.getInst_nextDevice_code();
Instruction inst = instructionService.findReadyInstByEnd(inst_nextDevice_code);
if (ObjectUtil.isEmpty(inst)) {
assignedDto = deviceAssignedDto;
break;
int num = instructionService.findReadyInstNumByEnd(inst_nextDevice_code);
List<DeviceAssignedDto> deviceAssignedDtos = tempAss.get(num);
if (CollectionUtil.isEmpty(deviceAssignedDtos)) {
deviceAssignedDtos = new ArrayList<>();
tempAss.put(num, deviceAssignedDtos);
}
deviceAssignedDtos.add(deviceAssignedDto);
}
Integer from_y = Integer.parseInt(taskDto.getFrom_y());
if (bindTaskCode.contains(taskDto.getTask_code())) {
for (DeviceAssignedDto dto : assignedDtos) {
String inst_nextDevice_code = dto.getInst_nextDevice_code();
Device inst_nextDevice = deviceAppService.findDeviceByCode(inst_nextDevice_code);
if (inst_nextDevice != null) {
Boolean isFront = Optional.ofNullable(inst_nextDevice.getExtraValue().get("isFront")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
if (from_y % 4 == 1 || from_y % 4 == 2) {
//分配后叉
if (!isFront) {
assignedDto = dto;
break;
}
} else if (from_y % 4 == 3 || from_y % 4 == 0) {
//分配前叉
if (isFront) {
assignedDto = dto;
break;
}
}
}
}
} else {
TaskDto bindTaskDto = this.isBind(taskDtos, taskDto, taskDto.getTask_code());
if (bindTaskDto != null) {
bindTaskCode.add(bindTaskDto.getTask_code());
for (DeviceAssignedDto dto : assignedDtos) {
String inst_nextDevice_code = dto.getInst_nextDevice_code();
Device inst_nextDevice = deviceAppService.findDeviceByCode(inst_nextDevice_code);
if (inst_nextDevice != null) {
Boolean isFront = Optional.ofNullable(inst_nextDevice.getExtraValue().get("isFront")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
if (from_y % 4 == 1 || from_y % 4 == 2) {
//分配后叉
if (!isFront) {
assignedDto = dto;
break;
}
} else if (from_y % 4 == 3 || from_y % 4 == 0) {
//分配前叉
if (isFront) {
assignedDto = dto;
break;
}
}
}
}
} else {
Set<Integer> keys = tempAss.keySet();
Integer minKey = Collections.min(keys);
Integer maxKey = Collections.max(keys);
List<DeviceAssignedDto> minList = tempAss.get(minKey);
List<DeviceAssignedDto> maxList = tempAss.get(maxKey);
if (minList.size() == maxList.size()) {
}
assignedDto = minList.get(0);
}
}
} else {
@ -726,6 +798,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建出库指令成功,指令号:" + instDto.getInstruction_code() + " , 任务号:" + instDto.getTask_code()));
this.unExecutedMessage = "";
this.requireSuccess = true;
bindTaskCode.remove(taskDto.getTask_code());
}
} else {
this.unExecutedMessage = "未查找到对应的就绪状态任务或执行中出库指令信息";
@ -736,36 +809,11 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
}
}
private boolean isBind(TaskDto link_task, TaskDto taskDto) {
List<TaskDto> taskDtos = Arrays.asList(link_task);
String from_x = taskDto.getFrom_x();
String from_y = taskDto.getFrom_y();
String from_z = taskDto.getFrom_z();
TaskDto dto = taskDtos.stream()
.filter(dto1 -> taskDto.getFrom_x().equals(from_x) && taskDto.getFrom_z().equals(from_z))
.filter(dto1 -> {
int frontFromY = Integer.parseInt(from_y);
int taskDtoFromY = Integer.parseInt(taskDto.getFrom_y());
int frontGroup = (frontFromY - 1) / 4;
int taskDtoGroup = (taskDtoFromY - 1) / 4;
if (frontGroup != taskDtoGroup) {
return false;
}
int frontMod = frontFromY % 4;
int taskDtoMod = taskDtoFromY % 4;
return (frontMod + taskDtoMod == 2 || frontMod + taskDtoMod == 4);
})
.findFirst()
.orElse(null);
return dto != null;
}
private boolean isBind(List<TaskDto> taskDtos, TaskDto link_task, String task_code) {
private TaskDto isBind(List<TaskDto> taskDtos, TaskDto link_task, String task_code) {
String from_x = link_task.getFrom_x();
String from_y = link_task.getFrom_y();
String from_z = link_task.getFrom_z();
TaskDto dto = taskDtos.stream()
return taskDtos.stream()
.filter(taskDto -> !taskDto.getTask_code().equals(task_code))
.filter(taskDto -> taskDto.getTask_status().equals(TaskStatusEnum.READY.getIndex()))
.filter(taskDto -> taskDto.getFrom_x().equals(from_x) && taskDto.getFrom_z().equals(from_z))
@ -785,7 +833,6 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst()
.orElse(null);
return dto != null;
}
/**
@ -804,10 +851,14 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
if (next_device != null && next_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
List<String> targetDeviceCode = this.getExtraDeviceCodes("targetDeviceCode");
if (targetDeviceCode != null && targetDeviceCode.contains(next_device_code)) {
Integer address = Optional.ofNullable(next_device.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
this.writing(Arrays.asList(ItemProtocol.TO_TASK.getKey()), Arrays.asList(inst.getInstruction_code()));
this.writing(Arrays.asList(ItemProtocol.TO_COMMAND.getKey(), ItemProtocol.TO_TARGET.getKey()), Arrays.asList(CommandEnum.COMMAND_1.getValue(), address));
this.requireSuccess = true;
// if (StrUtil.equals(String.valueOf(this.task), inst.getInstruction_code())) {
// this.writing(Arrays.asList(ItemProtocol.TO_COMMAND.getKey()), Arrays.asList(CommandEnum.COMMAND_1.getValue()));
// this.requireSuccess = true;
// } else {
Integer address = Optional.ofNullable(next_device.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
this.writing(Arrays.asList(ItemProtocol.TO_TASK.getKey(),ItemProtocol.TO_TARGET.getKey()), Arrays.asList(inst.getInstruction_code(),address));
//this.writing(Arrays.asList(ItemProtocol.TO_TARGET.getKey()), Arrays.asList(address));
// }
}
}
}
@ -829,6 +880,16 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
@SneakyThrows
private void update_inst_status(Instruction instruction) {
if (InstructionStatusEnum.READY.getIndex().equals(instruction.getInstruction_status()) && this.currentDeviceCode.equals(instruction.getStart_device_code())) {
String next_device_code = instruction.getNext_device_code();
Device next_device = deviceAppService.findDeviceByCode(next_device_code);
if (next_device != null && next_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
List<String> targetDeviceCode = this.getExtraDeviceCodes("targetDeviceCode");
if (targetDeviceCode != null && targetDeviceCode.contains(next_device_code)) {
if (StrUtil.equals(String.valueOf(this.task), instruction.getInstruction_code())) {
this.writing(Arrays.asList(ItemProtocol.TO_COMMAND.getKey()), Arrays.asList(CommandEnum.COMMAND_1.getValue()));
}
}
}
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 " + InstructionStatusEnum.getName(instruction.getInstruction_status()) + " -> " + InstructionStatusEnum.BUSY.getName()));
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
instruction.setExecute_device_code(this.currentDeviceCode);

1
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/ItemProtocol.java

@ -9,6 +9,7 @@ import java.util.ArrayList;
public enum ItemProtocol implements DeviceDriverBaseReader.KeyProvider {
HEARTBEAT("heartbeat", "心跳", "DB1000.B0"),
STATUS("status", "手自动", "DB1000.B1"),
MODE("mode", "工作模式", "DB1101.B0"),
MOVE("move", "光电信号", "DB1101.B1"),
ACTION("action", "动作信号", "DB1101.B2"),

226
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/screen/led_screen/LedScreenDeviceDriver.java

@ -1,26 +1,239 @@
package org.nl.acs.device.driver.screen.led_screen;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import onbon.bx06.Bx6GEnv;
import onbon.bx06.Bx6GScreenClient;
import onbon.bx06.area.DynamicBxArea;
import onbon.bx06.area.TextCaptionBxArea;
import onbon.bx06.area.page.TextBxPage;
import onbon.bx06.cmd.dyn.DynamicBxAreaRule;
import onbon.bx06.file.ProgramBxFile;
import onbon.bx06.series.Bx6E;
import onbon.bx06.utils.DisplayStyleFactory;
import org.nl.acs.device.device.domain.Device;
import org.nl.acs.device.device.service.DeviceAppService;
import org.nl.acs.device.driver.DeviceDriver;
import org.nl.acs.device.driver.RouteableDeviceDriver;
import org.nl.acs.device.driver.AbstractDeviceDriver;
import org.nl.acs.device.driver.ExecutableDeviceDriver;
import org.nl.acs.device.driver.conveyor.appearance_inspection_scannner_conveyor.AppearanceInspectionScannerConveyorDeviceDriver;
import org.nl.acs.device.driver.conveyor.appearance_inspection_scannner_conveyor.enums.ErrorEnum;
import org.nl.acs.device.driver.conveyor.strip_conveyor.StripConveyorDeviceDriver;
import org.nl.acs.device.driver.stacker.double_stacker.StandardStackerDeviceDriver;
import org.nl.acs.monitor.DeviceStageMonitor;
import onbon.bx06.utils.DisplayStyleFactory.DisplayStyle;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* LED点阵屏
*
* @author 涂强
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class LedScreenDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
private static AtomicBoolean isInitialized = new AtomicBoolean(false);
private Bx6GScreenClient screen = null;
private final LuceneExecuteLogService logService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
private final TaskService taskService = SpringContextHolder.getBean(TaskService.class);
private final DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
private final int screenWidth = 192;
private String modeMsgInfo = "";
private String errorMsgInfo = "";
private String taskMsgInfo = "";
@Override
public void execute() {
public void execute() throws Exception {
if (isInitialized.compareAndSet(false, true)) {
Bx6GEnv.initial(30000);
}
//建立连接
if (this.screen == null) {
String ip = Optional.ofNullable(this.getDevice().getExtraValue().get("ip_address")).map(Object::toString).orElse(null);
int port = Optional.ofNullable(this.getDevice().getExtraValue().get("ip_port")).map(Object::toString).map(Integer::parseInt).orElse(0);
if (ip == null || port == 0) {
return;
}
this.screen = new Bx6GScreenClient(this.getDevice().getDevice_code(), new Bx6E());
this.screen.connect(ip, port);
}
//设置节目
DisplayStyle[] styles = DisplayStyleFactory.getStyles().toArray(new DisplayStyle[0]);
ProgramBxFile pf = new ProgramBxFile(0, this.screen.getProfile());
TextCaptionBxArea area = new TextCaptionBxArea(0, 0, 192, 16, this.screen.getProfile());
StringBuilder sb = new StringBuilder();
//判断是否关联出入库模式
boolean inOutFlag = Optional.ofNullable(this.getDevice().getExtraValue().get("inOut")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
if (!inOutFlag) {
String inOutMode = Optional.ofNullable(this.getDevice().getExtraValue().get("inOutMode")).map(Object::toString).orElse("");
sb.append(inOutMode);
} else {
String linkSSX = Optional.ofNullable(this.getDevice().getExtraValue().get("linkSSX")).map(Object::toString).orElse(null);
Device device = deviceAppService.findDeviceByCode(linkSSX);
if (device != null && device.getDeviceDriver() instanceof StripConveyorDeviceDriver) {
StripConveyorDeviceDriver stripConveyorDeviceDriver = (StripConveyorDeviceDriver) device.getDeviceDriver();
if (stripConveyorDeviceDriver.getInOutMode() == 0) {
sb.append("入库模式");
} else {
sb.append("出库模式");
}
}
}
if (!StrUtil.equals(this.modeMsgInfo, sb.toString())) {
TextBxPage page = new TextBxPage(sb.toString());
page.setForeground(Color.green);
area.addPage(page);
pf.addArea(area);
this.screen.writeProgram(pf);
this.modeMsgInfo = sb.toString();
}
//设置动态区1报警信息
List<String> errorDevices = this.getExtraDeviceCodes("errorDevices");
StringBuilder sbMsg = new StringBuilder();
if (CollectionUtil.isNotEmpty(errorDevices)) {
sbMsg.append("报警信息: ");
String errorMsg = "";
for (int i = 0; i < errorDevices.size(); i++) {
String deviceCode = errorDevices.get(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if (device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
if (appearanceInspectionScannerConveyorDeviceDriver.getError() > 0) {
String label = ErrorEnum.getLabel(appearanceInspectionScannerConveyorDeviceDriver.getError());
errorMsg = "设备" + deviceCode + " " + label + ",";
}
} else if (device != null && device.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
StandardStackerDeviceDriver standardStackerDeviceDriver = (StandardStackerDeviceDriver) device.getDeviceDriver();
if (standardStackerDeviceDriver.getFront_Zerror() > 0 || standardStackerDeviceDriver.getBack_Zerror() > 0) {
errorMsg = deviceCode + " ";
if (standardStackerDeviceDriver.getFront_Zerror() > 0) {
errorMsg = "设备" + deviceCode + " 前叉报警 " + org.nl.acs.device.driver.stacker.double_stacker.enums.ErrorEnum.getDesc(standardStackerDeviceDriver.getFront_Zerror()) + ",";
}
if (standardStackerDeviceDriver.getBack_Zerror() > 0) {
errorMsg = "设备" + deviceCode + " 后叉报警 " + org.nl.acs.device.driver.stacker.double_stacker.enums.ErrorEnum.getDesc(standardStackerDeviceDriver.getFront_Zerror()) + ",";
}
}
}
}
if (StrUtil.isEmpty(errorMsg)) {
sbMsg.append("无报警!");
} else {
sbMsg.append(errorMsg);
if (sbMsg.length() > 0 && sbMsg.charAt(sbMsg.length() - 1) == ',') {
sbMsg.deleteCharAt(sbMsg.length() - 1);
}
}
}
if (!StrUtil.equals(this.errorMsgInfo, sbMsg.toString())) {
DynamicBxAreaRule rule_2 = new DynamicBxAreaRule();
rule_2.setId(0);
rule_2.setRunMode((byte) 0);
rule_2.setRelativeAllPrograms(false);
rule_2.addRelativeProgram(0);
DynamicBxArea area_2 = new DynamicBxArea(0, 22, 192, 22, screen.getProfile());
TextBxPage page_2 = new TextBxPage(sbMsg.toString());
boolean flag = getStringWidth(sbMsg.toString());
if (flag) {
page_2.setDisplayStyle(styles[1]);
} else {
page_2.setDisplayStyle(styles[4]);
}
page_2.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
page_2.setForeground(Color.green);
page_2.setLineHeight(12);
area_2.addPage(page_2);
this.screen.writeDynamic(rule_2, area_2);
this.errorMsgInfo = sbMsg.toString();
}
//设置动态区2任务信息
StringBuilder sb2 = new StringBuilder();
sb2.append("任务信息: ");
List<String> startDevices = this.getExtraDeviceCodes("startDevices");
if (CollectionUtil.isNotEmpty(startDevices)) {
for (int i = 0; i < startDevices.size(); i++) {
String start_device_code = startDevices.get(i);
List<TaskDto> taskDtos = taskService.findTasksByStartCode(start_device_code);
if (ObjectUtil.isNotEmpty(taskDtos)) {
for (TaskDto taskDto : taskDtos) {
sb2.append("载具" + taskDto.getVehicle_code() + "由" + taskDto.getStart_point_code() + "->" + taskDto.getNext_point_code() + ",");
}
}
}
}
List<String> nextDevices = this.getExtraDeviceCodes("nextDevices");
if (CollectionUtil.isNotEmpty(nextDevices)) {
for (int i = 0; i < nextDevices.size(); i++) {
String next_device_code = nextDevices.get(i);
List<TaskDto> taskDtos = taskService.findTasksByNextCode(next_device_code);
if (ObjectUtil.isNotEmpty(taskDtos)) {
for (TaskDto taskDto : taskDtos) {
sb2.append("载具" + taskDto.getVehicle_code() + "由" + taskDto.getStart_point_code() + "->" + taskDto.getNext_point_code() + ",");
}
}
}
}
if (sb2.length() > 0 && sb2.charAt(sb2.length() - 1) == ',') {
sb2.deleteCharAt(sb2.length() - 1);
} else {
sb2.append("无任务!");
}
if (!StrUtil.equals(this.taskMsgInfo, sb2.toString())) {
DynamicBxAreaRule rule = new DynamicBxAreaRule();
rule.setId(1);
rule.setRunMode((byte) 0);
rule.setRelativeAllPrograms(false);
rule.addRelativeProgram(0);
DynamicBxArea dArea = new DynamicBxArea(0, 37, 192, 37, screen.getProfile());
TextBxPage dPage = new TextBxPage(sb2.toString());
boolean flag = getStringWidth(sb2.toString());
if (flag) {
dPage.setDisplayStyle(styles[1]);
} else {
dPage.setDisplayStyle(styles[4]);
}
dPage.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
dPage.setForeground(Color.green);
dPage.setLineHeight(12);
dArea.addPage(dPage);
screen.writeDynamic(rule, dArea);
this.taskMsgInfo = sb2.toString();
}
Integer upTime = Optional.ofNullable(this.getDevice().getExtraValue().get("upTime")).map(Object::toString).map(Integer::parseInt).orElse(60);
Thread.sleep(upTime * 1000);
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
synchronized (this) {
if (this.screen != null && this.screen.isConnected()) {
this.screen.disconnect();
System.out.println(this.getDevice().getDevice_code() + "关闭Screen连接!");
}
}
}));
}
@Override
@ -32,4 +245,15 @@ public class LedScreenDeviceDriver extends AbstractDeviceDriver implements Devic
public void setDeviceStatus(JSONObject data) {
}
private boolean getStringWidth(String msg) {
Font font = new Font("Microsoft YaHei", Font.PLAIN, 12);
BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Graphics g = image.getGraphics();
g.setFont(font);
FontMetrics metrics = g.getFontMetrics();
int width = metrics.stringWidth(msg);
return width < screenWidth;
}
}

626
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/StandardStackerDeviceDriver.java

File diff suppressed because it is too large

21
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java

@ -73,6 +73,20 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
if (!applyTaskFlag) return;
long currentTimeMillis = System.currentTimeMillis();
if (!isTimeValid(currentTimeMillis)) {
List<String> linkDeviceCodeList = this.getExtraDeviceCodes("link_device_code");
for (int i = 0; i < linkDeviceCodeList.size(); i++) {
String deviceCode = linkDeviceCodeList.get(i);
Device device = deviceAppservice.findDeviceByCode(deviceCode);
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
if (ObjectUtil.isNotEmpty(device) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
if (appearanceInspectionScannerConveyorDeviceDriver.getMove() == 0 && this.requireSuccess) {
this.requireSuccess = false;
logServer.deviceExecuteLog(new LuceneLogDto(this.device_code, "标记复位:" + this.requireSuccess));
continue;
}
}
}
log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut);
} else {
this.requireTime = currentTimeMillis;
@ -84,11 +98,12 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
if (ObjectUtil.isNotEmpty(device) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
if (appearanceInspectionScannerConveyorDeviceDriver.getMove() == 0) {
requireSuccess = false;
if (appearanceInspectionScannerConveyorDeviceDriver.getMove() == 0 && this.requireSuccess) {
this.requireSuccess = false;
logServer.deviceExecuteLog(new LuceneLogDto(this.device_code, "标记复位:" + this.requireSuccess));
continue;
}
if (!requireSuccess && StrUtil.isNotEmpty(appearanceInspectionScannerConveyorDeviceDriver.getBarcode())
if (!this.requireSuccess && StrUtil.isNotEmpty(appearanceInspectionScannerConveyorDeviceDriver.getBarcode())
&& !appearanceInspectionScannerConveyorDeviceDriver.isWithStationRequireSuccess()) {
TaskDto taskDto = taskServer.findByContainer(appearanceInspectionScannerConveyorDeviceDriver.getBarcode());
if (ObjectUtil.isEmpty(taskDto)) {

23
nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

@ -145,17 +145,17 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
errArr.add(json);
continue;
}
if (!StrUtil.isEmpty(vehicle_code)) {
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
if (vehicle_dto != null) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("msg", "已存在任务编号为" + vehicle_dto.getTask_code() + "托盘号:" + vehicle_code);
errArr.add(json);
continue;
}
}
// if (!StrUtil.isEmpty(vehicle_code)) {
// TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
// if (vehicle_dto != null) {
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("msg", "已存在任务编号为" + vehicle_dto.getTask_code() + "托盘号:" + vehicle_code);
// errArr.add(json);
// continue;
// }
// }
if (StrUtil.isEmpty(start_point_code)) {
JSONObject json = new JSONObject();
@ -348,6 +348,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (toHeight != null) {
appearanceInspectionScannerConveyorDeviceDriver.writing("toHeight", toHeight);
}
appearanceInspectionScannerConveyorDeviceDriver.writing("toTarget", 0);
appearanceInspectionScannerConveyorDeviceDriver.writing("toCommand", toCommand);
}
JSONObject resp = new JSONObject();

44
nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java

@ -461,6 +461,24 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
*/
List<Instruction> findReadyInstByStartDeviceCode(List<String> start_device_code_list, String noY);
/**
* 入库时,根据起点查询就绪指令,并且放货位是深货位
*
* @param start_device_code_list
* @param noY
* @return
*/
List<Instruction> findDeepReadyInstByStartDeviceCode(List<String> start_device_code_list, String noY);
/**
* 入库时,根据起点查询就绪指令,并且放货位是深货位
*
* @param start_device_code_list
* @param noY
* @return
*/
List<Instruction> findShallowReadyInstByStartDeviceCode(List<String> start_device_code_list, String noY);
/**
* 用于优先出库策略
@ -473,6 +491,8 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
* @return
*/
List<Instruction> findReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY);
List<Instruction> findDeepReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY);
List<Instruction> findShallowReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY);
/**
* 用于时间顺序出入库策略
@ -503,9 +523,25 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
* @param noY
* @return
*/
Instruction findReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY);
Instruction findReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList);
Instruction findReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY);
/**
* @param linkDeviceCode
* @param noY
* @return
*/
Instruction findDeepReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList);
/**
* @param linkDeviceCode
* @param noY
* @return
*/
Instruction findShallowReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList);
Instruction findReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList);
Instruction findDeepReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY,List<String> getDeviceCodeList);
Instruction findShallowReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY,List<String> getDeviceCodeList);
/**
* 用于优先出库策略和时间顺序策略 -出库
@ -518,6 +554,8 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
* @return
*/
Instruction findReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY);
Instruction findDeepReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY, List<String> getDeviceCodeList);
Instruction findShallowReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY, List<String> getDeviceCodeList);
/**
@ -532,6 +570,8 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
Instruction findReadyInstByEnd(String next_device_code);
int findReadyInstNumByEnd(String next_device_code);
Instruction findReadyInstByVehicleCode(String vehicleCode);
Instruction findBusyInstByNextDeviceCode(String getLinkDeviceCode);

258
nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -76,6 +76,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -381,7 +382,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.eq(InstructionMybatis::getTask_code, dto.getTask_code()));
if (CollUtil.isNotEmpty(instructionMybatis) && instructionMybatis.stream().anyMatch(inst -> inst.getStart_device_code()
.equals(start_device_code))) {
return;
// throw new BadRequestException("已经存在相同任务号的起点!");
//return;
}
}
String currentUsername = SecurityUtils.getCurrentNickName();
@ -505,7 +507,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} catch (Exception e) {
dto.setSend_status("2");
e.printStackTrace();
log.error("");
log.error("创建指令出错, {}", e.getMessage());
}
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
instructionMapper.insert(entity);
@ -1755,7 +1757,49 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> start_device_code_list.contains(inst.getStart_device_code()))
.filter(inst -> (ObjectUtil.isNotEmpty(inst.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getTo_y())))))
.sorted(Comparator.comparing(Instruction::getPriority)
//.sorted(Comparator.comparing(Instruction::getPriority)
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4)
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getTo_z()) ? "0" : inst.getTo_z()))
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getTo_y()) ? "0" : inst.getTo_y()))
.thenComparing(Comparator.comparing(Instruction::getPriority))
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList());
}
@Override
public List<Instruction> findDeepReadyInstByStartDeviceCode(List<String> start_device_code_list, String noY) {
// String currentNoY = noY == null ? "" : noY;
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> start_device_code_list.contains(inst.getStart_device_code()))
.filter(inst -> (ObjectUtil.isNotEmpty(inst.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getTo_y())))))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4 == 1 || Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4 == 0)
//.sorted(Comparator.comparing(Instruction::getPriority)
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4)
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getTo_z()) ? "0" : inst.getTo_z()))
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getTo_y()) ? "0" : inst.getTo_y()))
.thenComparing(Comparator.comparing(Instruction::getPriority)).reversed()
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList());
}
@Override
public List<Instruction> findShallowReadyInstByStartDeviceCode(List<String> start_device_code_list, String noY) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> start_device_code_list.contains(inst.getStart_device_code()))
.filter(inst -> (ObjectUtil.isNotEmpty(inst.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getTo_y())))))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4 == 2 || Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4 == 3)
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4)
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getTo_z()) ? "0" : inst.getTo_z()))
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getTo_y()) ? "0" : inst.getTo_y()))
.thenComparing(Comparator.comparing(Instruction::getPriority)).reversed()
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList());
}
@ -1770,11 +1814,60 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> next_device_code_list.contains(inst.getNext_device_code()))
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
.sorted(Comparator.comparing(Instruction::getPriority)
// .sorted(Comparator.comparing(Instruction::getPriority)
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
.thenComparing(Comparator.comparing(Instruction::getPriority))
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList());
}
@Override
public List<Instruction> findDeepReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> next_device_code_list.contains(inst.getNext_device_code()))
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 1 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 0)
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
.thenComparing(Comparator.comparing(Instruction::getPriority)).reversed()
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList());
}
@Override
public List<Instruction> findShallowReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> next_device_code_list.contains(inst.getNext_device_code()))
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 2 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 3 == 0)
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
.thenComparing(Comparator.comparing(Instruction::getPriority))
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList());
}
private String getNumericPart(String device_c0de) {
Pattern pattern = Pattern.compile("\\d+");
Matcher matcher = pattern.matcher(device_c0de);
if (matcher.find()) {
return matcher.group();
}
return "0";
}
@Override
public List<Instruction> findReadyInstByDeviceCode(List<String> device_code_list, String noY) {
//String currentNoY = noY == null ? "" : noY;
@ -1820,7 +1913,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
@Override
public Instruction findReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY) {
public Instruction findReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
// String currentNoY = noY == null ? "" : noY;
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
@ -1828,6 +1921,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getStart_device_code().equals(linkDeviceCode))
.filter(inst -> getDeviceCodeList.contains(inst.getStart_device_code()))
.filter(inst -> StrUtil.isNotBlank(inst.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getTo_y()))))
.sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
@ -1836,16 +1930,93 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
@Override
public Instruction findReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY) {
//String currentNoY = noY == null ? "" : noY;
public Instruction findDeepReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getStart_device_code().equals(linkDeviceCode))
.filter(inst -> getDeviceCodeList.contains(inst.getStart_device_code()))
.filter(inst -> StrUtil.isNotBlank(inst.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getTo_y()))))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4 == 1 || Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4 == 0)
.sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst()
.orElse(null);
}
@Override
public Instruction findShallowReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getStart_device_code().equals(linkDeviceCode))
.filter(inst -> getDeviceCodeList.contains(inst.getStart_device_code()))
.filter(inst -> StrUtil.isNotBlank(inst.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getTo_y()))))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4 == 2 || Integer.parseInt(getNumericPart(inst.getNext_device_code())) % 4 == 3)
.sorted(Comparator.comparing(Instruction::getPriority).reversed()
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst()
.orElse(null);
}
@Override
public Instruction findReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getNext_device_code().equals(linkDeviceCode))
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()))
.filter(inst -> StrUtil.isNotBlank(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
.sorted(Comparator.comparing(Instruction::getPriority)
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
.thenComparing(Comparator.comparing(Instruction::getPriority))
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst()
.orElse(null);
}
@Override
public Instruction findDeepReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getNext_device_code().equals(linkDeviceCode))
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()))
.filter(inst -> StrUtil.isNotBlank(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 1 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 0)
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
.thenComparing(Comparator.comparing(Instruction::getPriority))
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst()
.orElse(null);
}
@Override
public Instruction findShallowReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getNext_device_code().equals(linkDeviceCode))
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()))
.filter(inst -> StrUtil.isNotBlank(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 2 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 3)
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
.thenComparing(Comparator.comparing(Instruction::getPriority))
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst()
.orElse(null);
@ -1882,6 +2053,66 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.findFirst().orElse(null);
}
@Override
public Instruction findDeepReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY, List<String> getDeviceCodeList) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getNext_device_code().equals(link_device_code))
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(inst.getFrom_y()))
.filter(inst -> Integer.parseInt(StringUtil.handleString(inst.getFrom_x())) == Integer.parseInt(StringUtil.handleString(frontInst.getFrom_x())))
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()))
.filter(inst -> {
int frontY = Integer.parseInt(frontInst.getFrom_y());
int instY = Integer.parseInt(inst.getFrom_y());
int frontGroup = (frontY - 1) / 4;
int instGroup = (instY - 1) / 4;
if (frontGroup != instGroup) {
return false;
}
int frontMod = frontY % 4;
int instMod = instY % 4;
return (frontMod + instMod == 2 || frontMod + instMod == 4);
})
.filter(inst -> Integer.parseInt(inst.getFrom_z()) == Integer.parseInt(frontInst.getFrom_z()))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 0 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 1)
.sorted(Comparator.comparing(Instruction::getPriority).reversed()
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst().orElse(null);
}
@Override
public Instruction findShallowReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY, List<String> getDeviceCodeList) {
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getNext_device_code().equals(link_device_code))
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(inst.getFrom_y()))
.filter(inst -> Integer.parseInt(StringUtil.handleString(inst.getFrom_x())) == Integer.parseInt(StringUtil.handleString(frontInst.getFrom_x())))
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()))
.filter(inst -> {
int frontY = Integer.parseInt(frontInst.getFrom_y());
int instY = Integer.parseInt(inst.getFrom_y());
int frontGroup = (frontY - 1) / 4;
int instGroup = (instY - 1) / 4;
if (frontGroup != instGroup) {
return false;
}
int frontMod = frontY % 4;
int instMod = instY % 4;
return (frontMod + instMod == 2 || frontMod + instMod == 4);
})
.filter(inst -> Integer.parseInt(inst.getFrom_z()) == Integer.parseInt(frontInst.getFrom_z()))
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 2 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 3)
.sorted(Comparator.comparing(Instruction::getPriority).reversed()
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst().orElse(null);
}
@Override
public Instruction findReadyInst(String start_device_code) {
return Optional.ofNullable(this.instructions)
@ -1902,6 +2133,17 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.findFirst().orElse(null);
}
@Override
public int findReadyInstNumByEnd(String next_device_code) {
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
.filter(inst -> inst.getNext_device_code().equals(next_device_code))
.collect(Collectors.toList())
.size();
}
@Override
public Instruction findReadyInstByVehicleCode(String vehicleCode) {
return Optional.ofNullable(this.instructions)

7
nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java

@ -265,6 +265,7 @@ public interface TaskService extends CommonService<Task> {
* @return
*/
TaskDto findByNextCode(String device_code);
TaskDto findByNextPointCode(String device_code);
/**
@ -275,6 +276,12 @@ public interface TaskService extends CommonService<Task> {
*/
TaskDto findByStartCode(String device_code);
List<TaskDto> findTasksByStartCode(String device_code);
List<TaskDto> findTasksByNextCode(String device_code);
TaskDto findByStartPointCode(String device_code);
TaskDto findReadyByVehicleCode(String vehicleCode);

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

@ -103,8 +103,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
private XianGongAgvService agvService;
@Autowired
private RouteLineService routeLineService;
@Autowired
private DeviceAssignedService deviceAssignedService;
// @Autowired
// private DeviceAssignedService deviceAssignedService;
@Autowired
private InstructionService instructionService;
@Autowired
@ -842,6 +842,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return optionalTask.orElse(null);
}
@Override
public TaskDto findByNextPointCode(String device_code) {
Optional<TaskDto> optionalTask = tasks.stream()
.filter(task -> StrUtil.equals(task.getNext_point_code(), device_code))
.findFirst();
return optionalTask.orElse(null);
}
@Override
public TaskDto findReadyByVehicleCode(String vehicleCode) {
@ -864,6 +872,39 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
.orElse(null);
}
@Override
public List<TaskDto> findTasksByStartCode(String device_code) {
return Optional
.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(task -> StrUtil.equals(task.getStart_device_code(), device_code))
.filter(task -> StrUtil.equals(task.getTask_status(),TaskStatusEnum.BUSY.getIndex()))
.collect(Collectors.toList());
}
@Override
public List<TaskDto> findTasksByNextCode(String device_code) {
return Optional
.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(task -> StrUtil.equals(task.getNext_device_code(), device_code))
.filter(task -> StrUtil.equals(task.getTask_status(),TaskStatusEnum.BUSY.getIndex()))
.collect(Collectors.toList());
}
@Override
public TaskDto findByStartPointCode(String device_code) {
return Optional
.ofNullable(this.tasks)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(task -> StrUtil.equals(task.getStart_point_code(), device_code))
.findFirst()
.orElse(null);
}
@Override
public TaskDto foramte(TaskDto task) {
String start_point_code = task.getStart_point_code();
@ -1011,42 +1052,42 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
@Override
public String queryAssignedByDevice(String device_code, String task_nextdeice_code) {
List<DeviceAssignedDto> list =
deviceAssignedService.queryAssignedByDevice(device_code, task_nextdeice_code);
int flag1 = 0;
String flag2 = null;
for (int i = 0; i < list.size(); i++) {
DeviceAssignedDto dto = list.get(i);
String inst_nextDevice_code = dto.getInst_nextDevice_code();
String task_nextDevice_code = dto.getTask_nextDevice_code();
String param = dto.getParam();
JSONObject jo = JSON.parseObject(param);
String regEx = "[`~!@#$%^&*()+=|{}':;'\\[\\].<>/?~!@#¥%……&*()——+|{}【】':”“’。、?]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(inst_nextDevice_code);
String toSpeechText = m.replaceAll("").trim();
String[] str = toSpeechText.split(",");
List pathlist = Arrays.asList(str);
for (int j = 0; j < pathlist.size(); j++) {
String this_device_code = pathlist.get(j).toString();
JSONObject data = JSON.parseObject(jo.getString(this_device_code));
String limit = data.getString("limit");
int num = instructionService.querySameDestinationInst(this_device_code);
if (num >= Integer.parseInt(limit)) {
continue;
}
if (j == 0) {
flag1 = num;
}
if (num <= flag1) {
flag2 = this_device_code;
}
}
}
if (!StrUtil.isEmpty(flag2)) {
return flag2;
}
// List<DeviceAssignedDto> list =
// deviceAssignedService.queryAssignedByDevice(device_code, task_nextdeice_code);
// int flag1 = 0;
// String flag2 = null;
// for (int i = 0; i < list.size(); i++) {
// DeviceAssignedDto dto = list.get(i);
// String inst_nextDevice_code = dto.getInst_nextDevice_code();
// String task_nextDevice_code = dto.getTask_nextDevice_code();
// String param = dto.getParam();
// JSONObject jo = JSON.parseObject(param);
// String regEx = "[`~!@#$%^&*()+=|{}':;'\\[\\].<>/?~!@#¥%……&*()——+|{}【】':”“’。、?]";
// Pattern p = Pattern.compile(regEx);
// Matcher m = p.matcher(inst_nextDevice_code);
// String toSpeechText = m.replaceAll("").trim();
//
// String[] str = toSpeechText.split(",");
// List pathlist = Arrays.asList(str);
// for (int j = 0; j < pathlist.size(); j++) {
// String this_device_code = pathlist.get(j).toString();
// JSONObject data = JSON.parseObject(jo.getString(this_device_code));
// String limit = data.getString("limit");
// int num = instructionService.querySameDestinationInst(this_device_code);
// if (num >= Integer.parseInt(limit)) {
// continue;
// }
// if (j == 0) {
// flag1 = num;
// }
// if (num <= flag1) {
// flag2 = this_device_code;
// }
// }
// }
// if (!StrUtil.isEmpty(flag2)) {
// return flag2;
// }
return null;
}
@ -1357,7 +1398,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
.filter(taskDto -> StrUtil.isNotBlank(taskDto.getFrom_y()) && StrUtil.isNotBlank(taskDto.getTo_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(taskDto.getFrom_y()))) && !currentNoY.contains(String.valueOf(Integer.parseInt(taskDto.getTo_y()))))
// .sorted(Comparator.comparing(TaskDto::getPriority)
// .thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.sorted(Comparator.comparing((TaskDto taskDto) -> !taskDto.getVehicle_code().contains("YCZJ"))
//.sorted(Comparator.comparing((TaskDto taskDto) -> !taskDto.getVehicle_code().contains("YCZJ"))
.sorted(Comparator.comparingInt((TaskDto taskDto) -> Integer.parseInt(getNumericPart(taskDto.getStart_device_code())) % 4).reversed()
.thenComparing(taskDto -> Integer.parseInt(getNumericPart(taskDto.getNext_device_code())) % 4)
.thenComparing(taskDto -> Integer.parseInt(ObjectUtil.isEmpty(taskDto.getFrom_z()) ? "0" : taskDto.getFrom_z()))
.thenComparing(taskDto -> Integer.parseInt(ObjectUtil.isEmpty(taskDto.getFrom_y()) ? "0" : taskDto.getFrom_y()))
.thenComparing((TaskDto taskDto) -> !taskDto.getVehicle_code().contains("YCZJ"))
.thenComparing(TaskDto::getPriority)
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.collect(Collectors.toList());

78
nladmin-system/nlsso-server/src/main/java/org/nl/config/mqtt2/MqttService.java

@ -24,7 +24,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.DependsOn;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
@ -39,8 +39,7 @@ import java.util.stream.Collectors;
* @author onepiece
*/
@Component
//@ConditionalOnProperty(name = "spring.mqtt.active", havingValue = "true")
@ConditionalOnBean({LuceneExecuteLogService.class, DeviceAppService.class, RedisTemplate.class})
@DependsOn({"luceneExecuteLogServiceImpl", "deviceAppServiceImpl", "redisTemplate"})
@Slf4j
public class MqttService {
@ -137,16 +136,11 @@ public class MqttService {
(r, executor) -> MSG_QUEUE.add(r)
);
/**
* 不需要记录日志的点位
*/
private static final List<String> NO_SET_LOG_KEYS = Arrays.asList("heartbeat");
private final CountDownLatch latch = new CountDownLatch(1);
@PostConstruct
public void init() {
log.info("执行MQTT初始化");
log.info("[MQTT 初始化]");
initTopicMap();
loadTags();
initMqttClient();
@ -175,7 +169,7 @@ public class MqttService {
.serverHost(mqttConfig.getUrl())
.addDisconnectedListener((context -> {
Throwable cause = context.getCause();
log.error("mqtt client disconnected , {}", cause.getMessage());
log.error("[MQTT 断开连接, {}]", cause.getMessage());
MqttClientReconnector reconnect = context.getReconnector();
reconnect.reconnect(true);
reconnect.delay(RECONNECT_DELAY, TimeUnit.MILLISECONDS);
@ -194,11 +188,11 @@ public class MqttService {
.cleanSession(mqttConfig.getCleanSession())
.send()
.thenAccept(connAck -> {
log.info("mqtt client connection success.");
log.info("[MQTT 连接成功]");
subscribeToTopics(Arrays.asList(mqttConfig.getTopics()));
})
.exceptionally(throwable -> {
log.error("mqtt client connection failed: " + throwable.getMessage(), throwable);
log.error("[MQTT 连接失败, {}]", throwable.getMessage());
return null;
});
@ -207,6 +201,17 @@ public class MqttService {
String payload = new String(publish.getPayloadAsBytes(), StandardCharsets.UTF_8);
messageArrived(topic, payload);
});
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
latch.await();
log.info("[MQTT 关闭程序]");
System.out.println("[关闭程序]");
} catch (InterruptedException e) {
e.printStackTrace();
}
}));
}
private void subscribeToTopics(List<String> topics) {
@ -216,9 +221,9 @@ public class MqttService {
.send()
.whenComplete((subAck, throwable) -> {
if (throwable != null) {
log.error("mqtt subscript failed Topic {}, error reason {} ", topic, throwable.getMessage());
log.error("[MQTT 订阅失败, {}, {}]", topic, throwable.getMessage());
} else {
log.info("mqtt subscript success Topic {}", topic);
log.info("[MQTT 订阅成功, {}]", topic);
}
}));
}
@ -227,9 +232,9 @@ public class MqttService {
//接收到消息:先放队列,根据不同topic处理不同处理dd逻辑
if (topicMap.containsKey(topic)) {
topicMap.get(topic).add(payload);
System.out.println("接收到消息---" + topic + "内容:" + payload);
System.out.println("接收到消息---" + topic);
} else {
log.info("topic---{} , payload----{} ", topic, payload);
log.info("[MQTT 订阅主题不存在, {}]", topic);
}
}
@ -240,10 +245,10 @@ public class MqttService {
.qos(MqttQos.EXACTLY_ONCE)
.send()
.thenAccept(pubAck -> {
log.info("mqtt client publish success Topic {} , Payload: {}", PUBLISH_TOPIC, payload);
log.info("[MQTT 发布成功, {}, {}]", PUBLISH_TOPIC, payload);
})
.exceptionally(throwable -> {
log.error("mqtt client publish Topic {} ,Payload {} , failed reason {}", PUBLISH_TOPIC, payload, throwable.getMessage());
log.error("[MQTT 发布成功, {}, {}, {}]", PUBLISH_TOPIC, payload, throwable.getMessage());
return null;
});
}
@ -253,12 +258,12 @@ public class MqttService {
*/
private void run() {
topicMap.forEach((topic, values) -> threadPool.execute(() -> {
log.info("mqtt create Topic thread:{}", topic);
log.info("[MQTT 创建订阅主题线程 {}]", topic);
while (true) {
try {
execute(topic, values.take());
} catch (Exception e) {
log.error("mqtt execute handler failed Topic {} , reason {}", topic, e.getMessage());
log.error("[MQTT {}, 执行处理失败 {}]", topic, e.getMessage());
}
}
}));
@ -276,7 +281,7 @@ public class MqttService {
List<Tag> tagList = msgValues.toJavaList(Tag.class);
Map<String, List<Tag>> groupTags = tagList.stream().collect(Collectors.groupingBy(tag -> tag.getId().substring(0, TagsUtil.nthIndexOf(tag.getId(), ".", 3))));
groupTags.forEach((tagId, tags) -> updateDeviceStatus(tagId.substring(TagsUtil.nthIndexOf(tagId, ".", 2) + 1), tags));
System.out.println("线程名称:'" + Thread.currentThread() + "',接收到消息" + topic + "-" + body + "-");
System.out.println("线程名称:'" + Thread.currentThread() + "',接收到消息 topic: " + topic);
}
/**
@ -307,7 +312,7 @@ public class MqttService {
AbstractDeviceDriver deviceDriver = (AbstractDeviceDriver) device.getDeviceDriver();
if (!Objects.equals(deviceDriver.online, q)) {
deviceDriver.setOnline(q);
log.info("device : {}, online status: {} ", deviceCode, q);
log.info("[MQTT 设备在线状态 {}, {}]", deviceCode, q);
}
}
});
@ -338,19 +343,36 @@ public class MqttService {
@PreDestroy
public void cleanup() {
if (mqttClient != null) {
mqttClient.disconnect().thenAccept(disconnectAck -> log.info("Application Close, So MQTT client disconnected."));
}
unloadTags();
threadPool.shutdown();
CompletableFuture<Void> mqttDisconnectFuture = CompletableFuture.runAsync(() -> {
if (mqttClient != null) {
mqttClient.disconnect().thenAccept(disconnectAck -> System.out.println("[关闭MQTT Client]"));
log.info("[关闭MQTT Client]");
}
});
mqttDisconnectFuture.thenRun(() -> {
this.unloadTags();
log.info("[加载Tags到Redis]");
System.out.println("[加载Tags到Redis]");
}).thenRun(() -> {
threadPool.shutdown();
log.info("[关闭线程池]");
System.out.println("[关闭线程池]");
}).exceptionally(throwable -> {
log.error("[关闭异常 {}]", throwable.getMessage());
System.out.println("[关闭异常]" + throwable.getMessage());
return null;
}).join();
latch.countDown();
}
private void loadTags() {
Map<Object, Object> entries = redisTemplateHash.opsForHash().entries(KEY);
entries.forEach((key, value) -> ACCESSOR_VALUE.setValue((String) key, value));
redisTemplateHash.delete(KEY);
}
private void unloadTags() {
List<String> allKey = ACCESSOR_VALUE.getAllKey();
Map<String, Object> map = new HashMap<>();

2
nladmin-system/nlsso-server/src/main/java/org/nl/system/service/coderule/impl/SysCodeRuleServiceImpl.java

@ -21,6 +21,7 @@ import org.nl.system.service.coderule.dao.mapper.SysCodeRuleMapper;
import org.nl.system.service.coderule.utils.CodeRuleTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@ -57,6 +58,7 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public synchronized String codeDemo(Map form) {
String code = (String) form.get("code");
String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId();

2
nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml

@ -77,7 +77,7 @@ spring:
active: true
username: root
password: 123456
url: 192.168.1.218
url: 192.168.8.218
clientId: hs_mqtt_prod
cleanSession: false
topics:

2
nladmin-system/nlsso-server/src/main/resources/config/application.yml

@ -7,7 +7,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev2
active: prod
jackson:
time-zone: GMT+8
data:

70
nladmin-ui/src/views/acs/device/driver/appearance_inspection_scanner_conveyor_device.vue

@ -52,7 +52,7 @@
<el-row>
<el-col :span="8">
<el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.address"/>
<el-input v-model="form.address" />
</el-form-item>
</el-col>
</el-row>
@ -67,23 +67,23 @@
<el-row>
<el-col :span="6">
<el-form-item label="堆垛机对接位:" label-width="110px" prop="stackerDock">
<el-switch v-model="form.stackerDock"/>
<el-switch v-model="form.stackerDock" />
</el-form-item>
</el-col>
<span v-if="form.stackerDock">
<el-col :span="6">
<el-form-item label="当前排:" label-width="110px" prop="currentX">
<el-input v-model.number="form.currentX"/>
<el-input v-model.number="form.currentX" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="当前列:" label-width="150px" prop="currentY">
<el-input v-model.number="form.currentY" style="width: 130px"/>
<el-input v-model.number="form.currentY" style="width: 130px" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="当前层:" label-width="110px" prop="currentZ">
<el-input v-model.number="form.currentZ" style="width: 170px"/>
<el-input v-model.number="form.currentZ" style="width: 170px" />
</el-form-item>
</el-col>
</span>
@ -91,7 +91,7 @@
<el-row>
<el-col :span="6">
<el-form-item label="堆垛机双任务:" label-width="110px" prop="stackerDoubleTask">
<el-switch v-model="form.stackerDoubleTask"/>
<el-switch v-model="form.stackerDoubleTask" />
</el-form-item>
</el-col>
<span v-if="form.stackerDoubleTask">
@ -119,7 +119,7 @@
<el-row>
<el-col :span="6">
<el-form-item label="输送指令起点:" label-width="110px" prop="conveyorStartPoint">
<el-switch v-model="form.conveyorStartPoint"/>
<el-switch v-model="form.conveyorStartPoint" />
</el-form-item>
</el-col>
<span v-if="form.conveyorStartPoint">
@ -145,7 +145,7 @@
</el-col>
<el-col :span="6">
<el-form-item label="关联拣选台:" label-width="150px" prop="linkPinkDevice">
<el-switch v-model="form.linkPinkDevice"/>
<el-switch v-model="form.linkPinkDevice" />
</el-form-item>
</el-col>
<span v-if="form.linkPinkDevice">
@ -174,7 +174,7 @@
<el-row>
<el-col :span="6">
<el-form-item label="输送指令终点:" label-width="110px" prop="conveyorEndPoint">
<el-switch v-model="form.conveyorEndPoint"/>
<el-switch v-model="form.conveyorEndPoint" />
</el-form-item>
</el-col>
<span v-if="form.conveyorEndPoint">
@ -200,12 +200,12 @@
</el-col>
<el-col :span="6">
<el-form-item label="扫码申请AGV任务:" label-width="150px">
<el-switch v-model="form.scanApplyTask"/>
<el-switch v-model="form.scanApplyTask" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="自动申请AGV任务:" label-width="150px">
<el-switch v-model="form.applyTask"/>
<el-switch v-model="form.applyTask" />
</el-form-item>
</el-col>
</span>
@ -213,7 +213,7 @@
<el-row>
<el-col :span="6">
<el-form-item label="输送缓存设备:" label-width="110px" prop="conveyorCachePoint">
<el-switch v-model="form.conveyorCachePoint"/>
<el-switch v-model="form.conveyorCachePoint" />
</el-form-item>
</el-col>
<span v-if="form.conveyorCachePoint">
@ -241,7 +241,7 @@
<el-row>
<el-col :span="6">
<el-form-item label="拣选台设备:" label-width="110px" prop="pinkDevicePoint">
<el-switch v-model="form.pinkDevicePoint"/>
<el-switch v-model="form.pinkDevicePoint" />
</el-form-item>
</el-col>
<span v-if="form.pinkDevicePoint">
@ -269,7 +269,7 @@
<el-row>
<el-col :span="6">
<el-form-item label="双向点位:" label-width="110px" prop="toWay">
<el-switch v-model="form.toWay"/>
<el-switch v-model="form.toWay" />
</el-form-item>
</el-col>
<span v-if="form.toWay">
@ -295,7 +295,7 @@
</span>
<el-col :span="6">
<el-form-item label="同一出入点:" label-width="110px" prop="samePoint">
<el-switch v-model="form.samePoint"/>
<el-switch v-model="form.samePoint" />
</el-form-item>
</el-col>
<span v-if="!form.samePoint">
@ -320,13 +320,13 @@
</el-col>
</span>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="6">-->
<!-- <el-form-item label="靠近前叉:" label-width="110px" prop="isFront">-->
<!-- <el-switch v-model="form.isFront"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="6">
<el-form-item label="靠近前叉:" label-width="110px" prop="isFront">
<el-switch v-model="form.isFront"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
@ -338,12 +338,12 @@
<el-row>
<el-col :span="8">
<el-form-item label="取货">
<el-switch v-model="form.is_pickup"/>
<el-switch v-model="form.is_pickup" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="放货">
<el-switch v-model="form.is_release"/>
<el-switch v-model="form.is_release" />
</el-form-item>
</el-col>
</el-row>
@ -362,8 +362,8 @@
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途"/>
<el-table-column prop="code" label="别名要求"/>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
@ -379,7 +379,7 @@
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input"/>
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
@ -399,8 +399,8 @@
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途"/>
<el-table-column prop="code" label="别名要求"/>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
@ -416,7 +416,7 @@
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input"/>
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
<el-table-column prop="dbw_value">
@ -424,7 +424,7 @@
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input"/>
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
@ -433,7 +433,7 @@
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span"/>
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
@ -456,9 +456,9 @@ import {
testRead,
testwrite
} from '@/api/acs/device/driverConfig'
import {selectOpcList} from '@/api/acs/device/opc'
import {selectPlcList} from '@/api/acs/device/opcPlc'
import {selectListByOpcID} from '@/api/acs/device/opcPlc'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device'

198
nladmin-ui/src/views/acs/device/driver/led_screen.vue

@ -3,84 +3,130 @@
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">设备协议</span>
</div>
<el-row>
<el-col :span="12">
OpcServer:
<el-select
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option
v-for="item in dataOpcservers"
:key="item.opc_id"
:label="item.opc_name"
:value="item.opc_id"
/>
</el-select>
</el-col>
<el-col :span="12">
PLC:
<el-select
v-model="plc_id"
placeholder="无"
clearable
@change="changePlc"
>
<el-option
v-for="item in dataOpcPlcs"
:key="item.plc_id"
:label="item.plc_name"
:value="item.plc_id"
/>
</el-select>
</el-col>
</el-row>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">输送系统</span>
<span class="role-span">指令相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-form ref="form" :inline="true" :model="form" size="small" label-width="95px">
<el-row>
<el-col :span="8">
<el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.OPCServer" />
<el-col :span="12">
<el-form-item label="ip地址:" prop="ip_address">
<el-input
v-model="form.ip_address"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="ip端口号:" prop="ip_port">
<el-input
v-model="form.ip_port"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">指令相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="关联设备" prop="device_code">
<el-col :span="12">
<el-form-item label="任务起点:" prop="startDevices">
<el-select
v-model="form.link_device_code"
v-model="form.startDevices"
filterable
clearable
multiple
reserve-keyword
placeholder="请选择要查询的任务起点"
style="width: 170px"
>
<el-option
v-for=" item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务终点:" prop="nextDevices">
<el-select
v-model="form.nextDevices"
filterable
clearable
placeholder="请选择"
multiple
reserve-keyword
placeholder="请选择要查询的任务终点"
style="width: 170px"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
v-for=" item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="可进可出:" prop="inOut">
<el-switch v-model="form.inOut"/>
</el-form-item>
</el-col>
<span v-if="!form.inOut">
<el-col :span="12">
<el-form-item label="出入模式:" prop="inOutMode">
<el-input
v-model="form.inOutMode"
/>
</el-form-item>
</el-col>
</span>
<span v-if="form.inOut">
<el-col :span="12">
<el-form-item label="关联输送线:" prop="linkSSX">
<el-select
v-model="form.linkSSX"
filterable
clearable
reserve-keyword
placeholder="请选择所属输送线"
style="width: 170px"
>
<el-option
v-for=" item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
</span>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="报警设备:" prop="errorDevices">
<el-select
v-model="form.errorDevices"
filterable
clearable
multiple
reserve-keyword
placeholder="请选择要关联的报警设备"
style="width: 170px"
>
<el-option
v-for=" item in deviceList"
:key="item.device_id"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="刷新时间:" prop="upTime">
<el-input
v-model="form.upTime"
/>
</el-form-item>
</el-col>
</el-row>
@ -88,7 +134,7 @@
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<span class="role-span"/>
<el-button
:loading="false"
icon="el-icon-check"
@ -111,9 +157,9 @@ import {
testRead,
testwrite
} from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import {selectOpcList} from '@/api/acs/device/opc'
import {selectPlcList} from '@/api/acs/device/opcPlc'
import {selectListByOpcID} from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device'
@ -143,17 +189,15 @@ export default {
data1: [],
data2: [],
form: {
inspect_in_stocck: true,
ignore_pickup_check: true,
ignore_release_check: true,
apply_task: true,
link_three_lamp: '',
manual_create_task: true,
is_pickup: true,
is_release: true,
link_device_code: [],
get_device_code: [],
put_device_code: []
inOut: true,
inOutMode: '',
ip_address: '',
ip_port: 0,
nextDevices: [],
startDevices: [],
linkSSX: '',
errorDevices: [],
upTime: 60
},
rules: {}
}

34
nladmin-ui/src/views/acs/device/driver/standard_stacker_device.vue

@ -58,7 +58,7 @@
<el-row>
<el-col :span="8">
<el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.address"/>
<el-input v-model="form.address" />
</el-form-item>
</el-col>
</el-row>
@ -157,12 +157,12 @@
</el-col>
<el-col :span="8">
<el-form-item label="前叉禁止列:" label-width="110px" prop="frontNoY">
<el-input v-model="form.frontNoY" placeholder="以英文, 分隔"/>
<el-input v-model="form.frontNoY" placeholder="以英文, 分隔" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="后叉禁止列:" label-width="110px" prop="backNoY">
<el-input v-model="form.backNoY" placeholder="以英文, 分隔"/>
<el-input v-model="form.backNoY" placeholder="以英文, 分隔" />
</el-form-item>
</el-col>
</el-row>
@ -245,7 +245,7 @@
</el-col>
<el-col :span="8">
<el-form-item label="对接位坐标:" label-width="110px" prop="originPoint">
<el-input v-model="form.originPoint" placeholder="排列层以,分隔"/>
<el-input v-model="form.originPoint" placeholder="排列层以,分隔" />
</el-form-item>
</el-col>
</el-row>
@ -259,7 +259,7 @@
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left"/>
<slot name="left" />
<el-button
slot="left"
class="filter-item"
@ -361,8 +361,8 @@
size="small"
style="width: 100%; margin-bottom: 15px"
>
<el-table-column prop="name" label="用途"/>
<el-table-column prop="code" label="别名要求"/>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
@ -413,8 +413,8 @@
size="small"
style="width: 100%; margin-bottom: 15px"
>
<el-table-column prop="name" label="用途"/>
<el-table-column prop="code" label="别名要求"/>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
@ -465,7 +465,7 @@
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span"/>
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
@ -488,13 +488,13 @@ import {
testwrite,
getStrategy
} from '@/api/acs/device/driverConfig'
import {selectOpcList} from '@/api/acs/device/opc'
import {selectPlcList} from '@/api/acs/device/opcPlc'
import {selectListByOpcID} from '@/api/acs/device/opcPlc'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device'
import {findDeviceStrategyOption} from '@/api/acs/device/customPolicyType'
import { findDeviceStrategyOption } from '@/api/acs/device/customPolicyType'
export default {
name: 'DoubleStationStacker',
@ -569,7 +569,7 @@ export default {
{
label: '3L->1L->2L',
value: '3,1,2'
},
}
],
form: {
strategyValue: '',
@ -639,9 +639,9 @@ export default {
methods: {
insertdtl() {
if (!Array.isArray(this.form.floorPoint)) {
this.$set(this.form, 'floorPoint', []);
this.$set(this.form, 'floorPoint', [])
}
this.form.floorPoint.push({floor: '', inPoints: [], outPoints: []});
this.form.floorPoint.push({ floor: '', inPoints: [], outPoints: [] })
},
deleteRow(index, rows) {
rows.splice(index, 1)

10
nladmin-ui/src/views/acs/task/index.vue

@ -851,6 +851,9 @@ export default {
let storage_obj = {}
deviceCrud.queryStorageExtra(obj.device_code).then(data => {
storage_obj = data
console.log(111)
console.log(storage_obj)
console.log(111)
const n1 = storage_obj.minY
const n2 = storage_obj.maxY
const m1 = storage_obj.minZ
@ -879,7 +882,7 @@ export default {
}
this.fromYList = from_y
this.fromZList = from_z
this.form.from_x = storage_obj.tunnel
this.form.from_x = storage_obj.x
})
} else {
this.start_flag = false
@ -899,6 +902,9 @@ export default {
let storage_obj = {}
deviceCrud.queryStorageExtra(obj.device_code).then(data => {
storage_obj = data
console.log(222)
console.log(storage_obj)
console.log(222)
const n1 = storage_obj.minY
const n2 = storage_obj.maxY
const m1 = storage_obj.minZ
@ -927,7 +933,7 @@ export default {
}
this.toYList = to_y
this.toZList = to_z
this.form.to_x = storage_obj.tunnel
this.form.to_x = storage_obj.x
})
} else {
this.end_flag = false

Loading…
Cancel
Save