Browse Source

rev:更新

master
gengby 10 months ago
parent
commit
75f964bc9f
  1. 4
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
  2. 11
      acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  3. 2
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java
  4. 30
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  5. 6
      acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java
  6. 3
      acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/GenCodeServiceImpl.java
  7. 1
      acs/nladmin-system/src/main/resources/logback-spring.xml

4
acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java

@ -233,10 +233,10 @@ public class NDCAgvServiceImpl implements NDCAgvService {
public boolean deviceOption(String option) {
byte high;
byte low;
if (option.equals("1")) {
if ("1".equals(option)) {
high = (byte) IntToHexHigh(00);
low = (byte) IntToHexHigh(01);
} else if (option.equals("2")) {
} else if ("2".equals(option)) {
high = (byte) IntToHexHigh(00);
low = (byte) IntToHexHigh(00);
} else {

11
acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -16,6 +16,7 @@ import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
@ -254,7 +255,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
// } else {
// device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
// }
if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 ) {
if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19]));
} else {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
@ -319,8 +320,12 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
try {
log.info("下发agv数据:" + Bytes2HexString(b));
System.out.println("下发agv数据:" + Bytes2HexString(b));
dos.write(b);
dos.flush();
if (dos != null) {
dos.write(b);
dos.flush();
} else {
throw new BadRequestException("未连接NDC!");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();

2
acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java

@ -276,4 +276,6 @@ public interface InstructionService {
void init(String id);
List<Instruction> findByTaskcodeFromCache(String task_code);
}

30
acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -278,6 +278,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
public void create(Instruction dto) {
dto = foramte(dto);
String task_code = dto.getTask_code();
List<Instruction> list = this.findByTaskcodeFromCache(task_code);
if (ObjectUtil.isNotEmpty(list)) {
throw new BadRequestException("已存在该任务的指令信息");
}
TaskDto task = taskService.findByCodeFromCache(task_code);
String currentUsername = SecurityUtils.getCurrentUsername();
@ -362,14 +366,19 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
if (ObjectUtil.isEmpty(route)) {
throw new BadRequestException("未查询到相关路由!");
}
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
try {
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
}
} catch (Exception e) {
throw new BadRequestException("下发调度失败,NDC未连接!");
}
} catch (Exception e) {
dto.setSend_status("2");
e.printStackTrace();
log.error("");
throw new BadRequestException(e.getMessage());
// dto.setSend_status("2");
// e.printStackTrace();
// log.error("");
}
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
@ -1438,4 +1447,13 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
((SiemensConveyorDeviceDriver) startDeviceDriver).writing(list);
}
}
@Override
public List<Instruction> findByTaskcodeFromCache(String task_code) {
return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(instruction -> instruction.getTask_code().equals(task_code))
.collect(Collectors.toList());
}
}

6
acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

@ -33,7 +33,6 @@ import java.util.stream.Collectors;
public class AutoCreateInst {
/**
* 根据任务状态创建指令生成下一条指令
* 创建指令前需要判断是否条件具备起始位置是否有货目标位置是否有货
@ -56,7 +55,7 @@ public class AutoCreateInst {
treeMap.putAll(collect);
for (List<TaskDto> value : treeMap.values()) {
list = value;
if(CollUtil.isNotEmpty(list)){
if (CollUtil.isNotEmpty(list)) {
break;
}
}
@ -136,7 +135,7 @@ public class AutoCreateInst {
if (s.equals(taskDto.getNext_device_code())) {
Instruction instruction = instructionService.findByTaskid(taskDto.getTask_id(), "instruction_status < 2");
if (ObjectUtil.isEmpty(instruction) || (Integer.parseInt(StrUtil.isNotBlank
(instruction.getExecute_status()) ? instruction.getExecute_status() : "0") <4)) {
(instruction.getExecute_status()) ? instruction.getExecute_status() : "0") < 4)) {
flag = true;
log.error("当前任务号{},已创建同列起点导致创建指令失败,起点为{},终点为{}", acsTask.getTask_code(), acsTask.getStart_device_code(), acsTask.getNext_device_code());
break;
@ -262,6 +261,7 @@ public class AutoCreateInst {
} catch (Exception e) {
acsTask.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(acsTask);
log.info("自动创建指令失败{}", e.getMessage());
continue;
}
//创建指令后修改任务状态

3
acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/GenCodeServiceImpl.java

@ -15,6 +15,8 @@ import org.nl.modules.wql.util.WqlUtil;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
@ -98,6 +100,7 @@ public class GenCodeServiceImpl implements GenCodeService {
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public String codeDemo(Map form) {
String code = (String) form.get("code");
String id = this.queryIdByCode(code);

1
acs/nladmin-system/src/main/resources/logback-spring.xml

@ -20,6 +20,7 @@ https://juejin.cn/post/6844903775631572999
<property name="SYSTEM_NAME" value="${systemName}"/>
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="${logPath}"/>
<include resource="log/AutoCreateInst.xml"/>
<!--引入默认的一些设置-->
<!-- <include resource="log/AutoCreateInst.xml"/>
<include resource="log/QueryAgvTaskStatus.xml"/>

Loading…
Cancel
Save