Browse Source

rev:三楼CTU

master
耿宝印 4 months ago
parent
commit
26b24af58b
  1. 21
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java
  2. 32
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/StandardStackerDeviceDriver.java
  3. 19
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/hk/service/impl/HkToAcsServiceImpl.java
  4. 2
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java
  5. 71
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  6. 10
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  7. 4
      nladmin-ui/.env.production
  8. 2
      nladmin-ui/public/config.js
  9. 2
      nladmin-ui/src/i18n/langs/zh-CN.js
  10. 2
      nladmin-ui/src/views/acs/instruction/index.vue
  11. 26
      nladmin-ui/src/views/acs/task/index.vue

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

@ -6,6 +6,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.util.concurrent.Uninterruptibles;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -32,6 +33,8 @@ import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.enums.AgvSystemTypeEnum;
import org.nl.acs.task.enums.InstTypeEnum;
import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
@ -46,6 +49,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
@ -241,8 +245,14 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
@Override @Override
public void execute() { public void execute() {
try {
this.currentDeviceCode = this.getDevice().getDevice_code(); this.currentDeviceCode = this.getDevice().getDevice_code();
this.loadAssignData(currentDeviceCode, ItemProtocol.class); this.loadAssignData(currentDeviceCode, ItemProtocol.class);
} catch (Exception e) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "当前设备执行逻辑报错,错误信息: " + e.getMessage()));
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "当前设备执行逻辑报错,错误堆栈信息: " + Arrays.toString(e.getStackTrace())));
Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);
}
} }
private void executeLogicBefore() { private void executeLogicBefore() {
@ -944,6 +954,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
this.writing(Arrays.asList(ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_TARGET.getKey()), Arrays.asList(inst.getInstruction_code(), address)); 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)); //this.writing(Arrays.asList(ItemProtocol.TO_TARGET.getKey()), Arrays.asList(address));
// } // }
this.requireSuccess = true;
} }
} }
} }
@ -1054,6 +1065,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
instdto.setTask_id(taskDto.getTask_id()); instdto.setTask_id(taskDto.getTask_id());
instdto.setTask_code(taskDto.getTask_code()); instdto.setTask_code(taskDto.getTask_code());
instdto.setVehicle_code(taskDto.getVehicle_code()); instdto.setVehicle_code(taskDto.getVehicle_code());
instdto.setVehicle_type(taskDto.getVehicle_type());
String now = DateUtil.now(); String now = DateUtil.now();
instdto.setCreate_time(now); instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName()); instdto.setCreate_by(SecurityUtils.getCurrentNickName());
@ -1065,6 +1077,10 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(start_device_code); instdto.setExecute_device_code(start_device_code);
instdto.setInstruction_type(taskDto.getTask_type()); instdto.setInstruction_type(taskDto.getTask_type());
if (StrUtil.equals(next_device_code, "3101")) {
instdto.setInstruction_type(InstTypeEnum.CTU_OUT_TASK.getCode());
instdto.setAgv_system_type(AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode());
}
} }
private void setInstruction(Instruction instdto, TaskDto taskDto, String start_device_code, String start_point_code, String next_device_code, String next_point_code) { private void setInstruction(Instruction instdto, TaskDto taskDto, String start_device_code, String start_point_code, String next_device_code, String next_point_code) {
@ -1077,6 +1093,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
instdto.setTask_id(taskDto.getTask_id()); instdto.setTask_id(taskDto.getTask_id());
instdto.setTask_code(taskDto.getTask_code()); instdto.setTask_code(taskDto.getTask_code());
instdto.setVehicle_code(taskDto.getVehicle_code()); instdto.setVehicle_code(taskDto.getVehicle_code());
instdto.setVehicle_type(taskDto.getVehicle_type());
String now = DateUtil.now(); String now = DateUtil.now();
instdto.setCreate_time(now); instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName()); instdto.setCreate_by(SecurityUtils.getCurrentNickName());
@ -1088,6 +1105,10 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(start_device_code); instdto.setExecute_device_code(start_device_code);
instdto.setInstruction_type(taskDto.getTask_type()); instdto.setInstruction_type(taskDto.getTask_type());
if (StrUtil.equals(next_device_code, "3101")) {
instdto.setInstruction_type(InstTypeEnum.CTU_OUT_TASK.getCode());
instdto.setAgv_system_type(AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode());
}
} }
} }

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

@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.util.concurrent.Uninterruptibles;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -37,6 +38,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -398,8 +400,14 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
@Override @Override
public void execute() { public void execute() {
try {
this.currentDeviceCode = this.getDevice().getDevice_code(); this.currentDeviceCode = this.getDevice().getDevice_code();
this.loadAssignData(currentDeviceCode, ItemProtocol.class); this.loadAssignData(currentDeviceCode, ItemProtocol.class);
} catch (Exception e) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "当前设备执行逻辑报错,错误信息: " + e.getMessage()));
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "当前设备执行逻辑报错,错误堆栈信息: " + Arrays.toString(e.getStackTrace())));
Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS);
}
} }
private boolean isTimeValid(long currentTimeMillis) { private boolean isTimeValid(long currentTimeMillis) {
@ -486,7 +494,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
@SneakyThrows
@Override @Override
public void executeLogic() { public void executeLogic() {
if (this.front_task != 0 && this.back_task != 0) { if (this.front_task != 0 && this.back_task != 0) {
@ -599,7 +606,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
if (ObjectUtil.isEmpty(frontInst) && ObjectUtil.isEmpty(backInst)) { if (ObjectUtil.isEmpty(frontInst) && ObjectUtil.isEmpty(backInst)) {
if (this.to_command != 0) { if (this.to_command != 0) {
this.writing(ItemProtocol.TO_COMMAND.getKey(), 0); this.writing(ItemProtocol.TO_COMMAND.getKey(), 0);
Thread.sleep(1000); Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
} }
if (this.stopReceiveTask) { if (this.stopReceiveTask) {
this.unExecutedMessage = "堆垛机设置为停止接收任务"; this.unExecutedMessage = "堆垛机设置为停止接收任务";
@ -884,7 +891,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
// List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); // List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice"); List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice");
List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice"); List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice");
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, front_start_device_code); String getLinkDeviceCode = Optional.ofNullable(front_start_device.getExtraValue().get("getLinkDeviceCode")).map(Object::toString).orElse(null);
if (StrUtil.isNotEmpty(getLinkDeviceCode)){
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, front_start_device_code, getLinkDeviceCode);
if (ObjectUtil.isNotEmpty(backInst)) { if (ObjectUtil.isNotEmpty(backInst)) {
String back_start_device_code = backInst.getStart_device_code(); String back_start_device_code = backInst.getStart_device_code();
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code); Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code);
@ -892,6 +901,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} else { } else {
this.sendPutInfoToPlc(frontInst, backInst); this.sendPutInfoToPlc(frontInst, backInst);
} }
} else {
this.sendPutInfoToPlc(frontInst, backInst);
}
} }
} else { } else {
//下发前叉放货信息 //下发前叉放货信息
@ -976,11 +988,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
this.sendPutInfoToPlc(frontInst, backInst); this.sendPutInfoToPlc(frontInst, backInst);
} }
} else if (instanceAppearance(back_start_device) && instanceAppearance(back_next_device)) { } else if (instanceAppearance(back_start_device) && instanceAppearance(back_next_device)) {
if (ObjectUtil.isEmpty(backInst)) { if (ObjectUtil.isEmpty(frontInst)) {
//List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); //List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice"); List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice");
List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice"); List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice");
frontInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getFrontDeviceCodeList, specialGetDevice, specialPutDevice, back_start_device_code); String getLinkDeviceCode = Optional.ofNullable(back_start_device.getExtraValue().get("getLinkDeviceCode")).map(Object::toString).orElse(null);
if (StrUtil.isNotEmpty(getLinkDeviceCode)){
frontInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getFrontDeviceCodeList, specialGetDevice, specialPutDevice, back_start_device_code, getLinkDeviceCode);
if (ObjectUtil.isNotEmpty(frontInst)) { if (ObjectUtil.isNotEmpty(frontInst)) {
String front_start_device_code = frontInst.getStart_device_code(); String front_start_device_code = frontInst.getStart_device_code();
Device front_start_device = deviceAppService.findDeviceByCode(front_start_device_code); Device front_start_device = deviceAppService.findDeviceByCode(front_start_device_code);
@ -988,6 +1002,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} else { } else {
this.sendPutInfoToPlc(frontInst, backInst); this.sendPutInfoToPlc(frontInst, backInst);
} }
} else {
this.sendPutInfoToPlc(frontInst, backInst);
}
} }
} else { } else {
this.sendPutInfoToPlc(frontInst, backInst); this.sendPutInfoToPlc(frontInst, backInst);
@ -1250,7 +1267,10 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
if (front_start_device == null) { if (front_start_device == null) {
return false; return false;
} }
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, start_device_code); String getLinkDeviceCode = Optional.ofNullable(front_start_device.getExtraValue().get("getLinkDeviceCode")).map(Object::toString).orElse(null);
if (StrUtil.isNotEmpty(getLinkDeviceCode)){
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, start_device_code,getLinkDeviceCode);
}
} }
} else { } else {
List<Instruction> backInsts = instructionService.findReadyInstBySpecialDevice(getBackDeviceCodeList, specialGetDevice, specialPutDevice); List<Instruction> backInsts = instructionService.findReadyInstBySpecialDevice(getBackDeviceCodeList, specialGetDevice, specialPutDevice);

19
nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/hk/service/impl/HkToAcsServiceImpl.java

@ -52,6 +52,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
String reqCode = requestParam.getString("reqCode"); String reqCode = requestParam.getString("reqCode");
// String reqTime = requestParam.getString("reqTime"); // String reqTime = requestParam.getString("reqTime");
String currentPositionCode = requestParam.getString("currentPositionCode"); String currentPositionCode = requestParam.getString("currentPositionCode");
String stgBinCode = requestParam.getString("stgBinCode");
String robotCode = requestParam.getString("robotCode"); String robotCode = requestParam.getString("robotCode");
String taskCode = requestParam.getString("taskCode"); String taskCode = requestParam.getString("taskCode");
String method = requestParam.getString("method"); String method = requestParam.getString("method");
@ -68,7 +69,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
//修改指令状态执行中并修改CTU车号 //修改指令状态执行中并修改CTU车号
instruction.setCarno(robotCode); instruction.setCarno(robotCode);
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
instruction.setExecute_device_code(currentPositionCode); instruction.setExecute_device_code(stgBinCode);
instruction.setUpdate_time(now); instruction.setUpdate_time(now);
instructionService.update(instruction); instructionService.update(instruction);
} }
@ -76,13 +77,13 @@ public class HkToAcsServiceImpl implements HkToAcsService {
else if (StrUtil.equals(method, "end")) { else if (StrUtil.equals(method, "end")) {
Device device = deviceAppService.findDeviceByCode(instruction.getNext_device_code()); Device device = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver; AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
if (StrUtil.equals(instruction.getNext_device_code(), currentPositionCode) && device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { if (StrUtil.equals(instruction.getNext_device_code(), stgBinCode) && device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver(); appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
appearanceInspectionScannerConveyorDeviceDriver.writing(ItemProtocol.TO_COMMAND.getKey(), CommandEnum.COMMAND_5.getValue()); appearanceInspectionScannerConveyorDeviceDriver.writing(ItemProtocol.TO_COMMAND.getKey(), CommandEnum.COMMAND_5.getValue());
} }
//修改指令状态完成 //修改指令状态完成
instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex()); instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
instruction.setExecute_device_code(currentPositionCode); instruction.setExecute_device_code(stgBinCode);
instruction.setUpdate_time(now); instruction.setUpdate_time(now);
instructionService.finish(instruction); instructionService.finish(instruction);
} }
@ -95,7 +96,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
} }
//method 回调4、CTU取料箱申请inApply //method 回调4、CTU取料箱申请inApply
else if (StrUtil.equals(method, "inApply")) { else if (StrUtil.equals(method, "inApply")) {
Device device = deviceAppService.findDeviceByCode(currentPositionCode); Device device = deviceAppService.findDeviceByCode(stgBinCode);
if (ObjectUtil.isEmpty(device)) { if (ObjectUtil.isEmpty(device)) {
resp.put("code", "1"); resp.put("code", "1");
resp.put("message", "请求失败,请求位置编号不存在!"); resp.put("message", "请求失败,请求位置编号不存在!");
@ -105,7 +106,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver; AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
//CTU取放货申请 //CTU取放货申请
//如果请求位置编号与指令起点一致并且是输送线则是取货申请 //如果请求位置编号与指令起点一致并且是输送线则是取货申请
if (StrUtil.equals(instruction.getStart_device_code(), currentPositionCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { if (StrUtil.equals(instruction.getStart_device_code(), stgBinCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
String ctuWaitTime = Optional.ofNullable(sysParamService.findByCode("ctuWaitTime").getValue()).map(Object::toString).orElse("60"); String ctuWaitTime = Optional.ofNullable(sysParamService.findByCode("ctuWaitTime").getValue()).map(Object::toString).orElse("60");
GenPreScheduleTaskReq gpsReq = GenPreScheduleTaskReq.builder() GenPreScheduleTaskReq gpsReq = GenPreScheduleTaskReq.builder()
.positionCode(instruction.getStart_device_code()) .positionCode(instruction.getStart_device_code())
@ -120,7 +121,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
} }
//method 回调5、CTU放料箱申请outApply //method 回调5、CTU放料箱申请outApply
else if (StrUtil.equals(method, "outApply")) { else if (StrUtil.equals(method, "outApply")) {
Device device = deviceAppService.findDeviceByCode(currentPositionCode); Device device = deviceAppService.findDeviceByCode(stgBinCode);
if (ObjectUtil.isEmpty(device)) { if (ObjectUtil.isEmpty(device)) {
resp.put("code", "1"); resp.put("code", "1");
resp.put("message", "请求失败,请求位置编号不存在!"); resp.put("message", "请求失败,请求位置编号不存在!");
@ -129,7 +130,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
} }
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver; AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
//如果请求位置编号与指令终点一致并且是输送线则是放货申请 //如果请求位置编号与指令终点一致并且是输送线则是放货申请
if (StrUtil.equals(instruction.getNext_device_code(), currentPositionCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { if (StrUtil.equals(instruction.getNext_device_code(), stgBinCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver(); appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
if (!appearanceInspectionScannerConveyorDeviceDriver.getReqPutRequireSuccess() && appearanceInspectionScannerConveyorDeviceDriver.getReqPutInstCode() == null) { if (!appearanceInspectionScannerConveyorDeviceDriver.getReqPutRequireSuccess() && appearanceInspectionScannerConveyorDeviceDriver.getReqPutInstCode() == null) {
appearanceInspectionScannerConveyorDeviceDriver.setReqPutRequireSuccess(true); appearanceInspectionScannerConveyorDeviceDriver.setReqPutRequireSuccess(true);
@ -139,7 +140,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
} }
//method 回调6、CTU取货完成通知 //method 回调6、CTU取货完成通知
else if (StrUtil.equals(method, "inApplyOK")) { else if (StrUtil.equals(method, "inApplyOK")) {
Device device = deviceAppService.findDeviceByCode(currentPositionCode); Device device = deviceAppService.findDeviceByCode(stgBinCode);
if (ObjectUtil.isEmpty(device)) { if (ObjectUtil.isEmpty(device)) {
resp.put("code", "1"); resp.put("code", "1");
resp.put("message", "请求失败,请求位置编号不存在!"); resp.put("message", "请求失败,请求位置编号不存在!");
@ -147,7 +148,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
return resp; return resp;
} }
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver; AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
if (StrUtil.equals(instruction.getStart_device_code(), currentPositionCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { if (StrUtil.equals(instruction.getStart_device_code(), stgBinCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver(); appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
appearanceInspectionScannerConveyorDeviceDriver.writing(ItemProtocol.TO_COMMAND.getKey(), CommandEnum.COMMAND_3.getValue()); appearanceInspectionScannerConveyorDeviceDriver.writing(ItemProtocol.TO_COMMAND.getKey(), CommandEnum.COMMAND_3.getValue());
} }

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

@ -582,7 +582,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
List<Instruction> findReadyInstBySpecialDevice(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice); List<Instruction> findReadyInstBySpecialDevice(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice);
Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String front_start_device_code); Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String front_start_device_code, String getLinkDeviceCode);
void cancelInstAndTaskNoSendWms(String instruction_id); void cancelInstAndTaskNoSendWms(String instruction_id);

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

@ -1020,6 +1020,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
instdto.setTask_id(acsTask.getTask_id()); instdto.setTask_id(acsTask.getTask_id());
instdto.setTask_code(acsTask.getTask_code()); instdto.setTask_code(acsTask.getTask_code());
instdto.setVehicle_code(acsTask.getVehicle_code()); instdto.setVehicle_code(acsTask.getVehicle_code());
instdto.setVehicle_type(acsTask.getVehicle_type());
String now = DateUtil.now(); String now = DateUtil.now();
instdto.setCreate_time(now); instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName()); instdto.setCreate_by(SecurityUtils.getCurrentNickName());
@ -1030,6 +1031,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
instdto.setPriority(acsTask.getPriority()); instdto.setPriority(acsTask.getPriority());
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(dto.getNext_device_code()); instdto.setExecute_device_code(dto.getNext_device_code());
if (StrUtil.equals(instdto.getStart_device_code(),"3204")){
instdto.setInstruction_type(InstTypeEnum.CTU_IN_TASK.getCode());
instdto.setAgv_system_type(AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode());
}
try { try {
this.create(instdto); this.create(instdto);
} catch (Exception e) { } catch (Exception e) {
@ -1584,14 +1589,69 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void init(String id) { public void init(String id) {
InstructionDto inst = this.findById(id); Instruction inst = Optional.ofNullable(this.instructions).orElse(new CopyOnWriteArrayList<>())
.stream()
.filter(instruction -> instruction.getInstruction_id().equals(id))
.findFirst()
.orElse(null);
if (inst == null) { if (inst == null) {
throw new BadRequestException("指令不存在或已删除"); throw new BadRequestException("指令不存在");
}
if (!StrUtil.equals(inst.getSend_status(),"2")){
throw new BadRequestException("该指令已成功执行,重新下发失败!");
}
if (StrUtil.equals(inst.getAgv_system_type(),AgvSystemTypeEnum.XG_SYSTEM_TYPE.getCode())){
UnifiedResponse<JSONObject> resp = xiangGongAgvService.sendOrderSequencesToXZ(inst);
if (!resp.isSuccess()) {
inst.setRemark(resp.getMessage());
inst.setSend_status("2");
} else {
inst.setSend_status("1");
}
} else if (StrUtil.equals(inst.getAgv_system_type(),AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode())){
List<Map<String, String>> positionCodePath = new ArrayList<>();
if (StrUtil.equals(InstTypeEnum.CTU_IN_TASK.getCode(), inst.getInstruction_type())) {
StorageCell storageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getNext_point_code()));
if (ObjectUtil.isEmpty(storageCell)) {
throw new BadRequestException("货位表不存在该点位信息:" + inst.getNext_point_code());
}
positionCodePath = Arrays.asList(MapOf.of("positionCode", inst.getStart_point_code(), "type", "05"), MapOf.of("positionCode", storageCell.getParent_storage_code(), "type", "05"));
} else if (StrUtil.equals(InstTypeEnum.CTU_OUT_TASK.getCode(), inst.getInstruction_type())) {
StorageCell storageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getStart_point_code()));
if (ObjectUtil.isEmpty(storageCell)) {
throw new BadRequestException("货位表不存在该点位信息:" + inst.getStart_point_code());
}
positionCodePath = Arrays.asList(MapOf.of("positionCode", storageCell.getParent_storage_code(), "type", "05"), MapOf.of("positionCode", inst.getNext_point_code(), "type", "05"));
} else if (StrUtil.equals(InstTypeEnum.CTU_MOVE_TASK.getCode(), inst.getInstruction_type())) {
StorageCell startStorageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getStart_point_code()));
if (ObjectUtil.isEmpty(startStorageCell)) {
throw new BadRequestException("货位表不存在该点位信息:" + inst.getStart_point_code());
}
StorageCell nextStorageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getNext_point_code()));
if (ObjectUtil.isEmpty(nextStorageCell)) {
throw new BadRequestException("货位表不存在该点位信息:" + inst.getNext_point_code());
}
positionCodePath = Arrays.asList(MapOf.of("positionCode", startStorageCell.getParent_storage_code(), "type", "05"), MapOf.of("positionCode", nextStorageCell.getParent_storage_code(), "type", "05"));
}
GenAgvSchedulingTaskReq gasReq = GenAgvSchedulingTaskReq
.builder()
.taskTyp(inst.getInstruction_type())
.ctnrTyp(inst.getVehicle_type())
.positionCodePath(positionCodePath)
.priority(inst.getPriority())
.taskCode(inst.getInstruction_code())
.build();
UnifiedResponse<String> resp = acsToHkService.genAgvSchedulingTask(gasReq, String.class);
if (!resp.isSuccess()) {
inst.setRemark(resp.getMessage());
inst.setSend_status("2");
} else {
inst.setSend_status("1");
} }
if (InstructionStatusEnum.FINISHED.getIndex().equals(inst.getInstruction_status())) {
throw new BadRequestException("指令已经完成");
} }
this.update(inst);
} }
@Override @Override
@ -2278,7 +2338,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} }
@Override @Override
public Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String start_device_code) { public Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String start_device_code, String getLinkDeviceCode) {
if (getDeviceCodeList != null && specialGetDevice != null && specialPutDevice != null) { if (getDeviceCodeList != null && specialGetDevice != null && specialPutDevice != null) {
return Optional.ofNullable(this.instructions) return Optional.ofNullable(this.instructions)
.orElse(new CopyOnWriteArrayList<>()) .orElse(new CopyOnWriteArrayList<>())
@ -2287,6 +2347,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.filter(inst -> !inst.getStart_device_code().equals(start_device_code)) .filter(inst -> !inst.getStart_device_code().equals(start_device_code))
.filter(inst -> getDeviceCodeList.contains(inst.getStart_device_code()) && specialGetDevice.contains(inst.getStart_device_code())) .filter(inst -> getDeviceCodeList.contains(inst.getStart_device_code()) && specialGetDevice.contains(inst.getStart_device_code()))
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()) && specialPutDevice.contains(inst.getNext_device_code())) .filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()) && specialPutDevice.contains(inst.getNext_device_code()))
.filter(inst -> inst.getStart_device_code().equals(getLinkDeviceCode))
.sorted(Comparator.comparing(Instruction::getPriority) .sorted(Comparator.comparing(Instruction::getPriority)
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) .thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.findFirst().orElse(null); .findFirst().orElse(null);

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

@ -41,6 +41,7 @@ import org.nl.acs.route.domain.RoutePlan;
import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.route.service.mapper.RoutePlanMapper; import org.nl.acs.route.service.mapper.RoutePlanMapper;
import org.nl.acs.task.enums.AgvSystemTypeEnum;
import org.nl.acs.task.enums.InstTypeEnum; import org.nl.acs.task.enums.InstTypeEnum;
import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.enums.TaskTypeEnum;
@ -739,9 +740,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
instdto.setStart_device_code2(start_point_code2); instdto.setStart_device_code2(start_point_code2);
instdto.setNext_device_code2(next_point_code2); instdto.setNext_device_code2(next_point_code2);
instdto.setNext_point_code2(next_point_code2); instdto.setNext_point_code2(next_point_code2);
instdto.setAgv_system_type(agv_system_type);
instdto.setAgv_inst_type(CommonFinalParam.ONE); instdto.setAgv_inst_type(CommonFinalParam.ONE);
instdto.setAgv_system_type(agv_system_type);
if (StrUtil.equals(instdto.getNext_device_code(),"3101")){
instdto.setAgv_system_type(AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode());
instdto.setInstruction_type(InstTypeEnum.CTU_OUT_TASK.getCode());
}
instructionservice.create(instdto); instructionservice.create(instdto);
acsTask.setTask_status(CommonFinalParam.ONE); acsTask.setTask_status(CommonFinalParam.ONE);
@ -1336,7 +1340,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
String type = shortPathsList.get(0).getType(); String type = shortPathsList.get(0).getType();
// != 0 为agv任务 // != 0 为agv任务
if (!StrUtil.equals(type, "0")) { if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGV_TYPE).getValue(), "3")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.AGV_TYPE).getValue(), "3") && StrUtil.equals(taskDto.getAgv_system_type(),AgvSystemTypeEnum.XG_SYSTEM_TYPE.getCode())) {
try { try {
JSONObject reqParam = new JSONObject(); JSONObject reqParam = new JSONObject();
reqParam.put("id", taskDto.getTask_code()); reqParam.put("id", taskDto.getTask_code());

4
nladmin-ui/.env.production

@ -2,6 +2,6 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http # 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
VUE_APP_BASE_API = 'http://192.168.1.218:8011' VUE_APP_BASE_API = 'http://192.168.18.218:8011'
# 如果接口是 http 形式, wss 需要改为 ws # 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'http://192.168.1.218:8011' VUE_APP_WS_API = 'http://192.168.18.218:8011'

2
nladmin-ui/public/config.js

@ -3,7 +3,7 @@ window.g = {
VUE_APP_BASE_API: 'http://127.0.0.1:8011' VUE_APP_BASE_API: 'http://127.0.0.1:8011'
}, },
prod: { prod: {
VUE_APP_BASE_API: 'http://192.168.1.218:8011' VUE_APP_BASE_API: 'http://192.168.18.218:8011'
} }
} }

2
nladmin-ui/src/i18n/langs/zh-CN.js

@ -46,7 +46,7 @@ export default {
'Confirm': '确认', 'Confirm': '确认',
'Cancel': '取消', 'Cancel': '取消',
'Forced_cancellation': '强制取消', 'Forced_cancellation': '强制取消',
'Initialize': '初始化', 'Initialize': '重新下发',
'Operate': '操作', 'Operate': '操作',
'Refresh': '刷新', 'Refresh': '刷新',
'Closes': '关闭', 'Closes': '关闭',

2
nladmin-ui/src/views/acs/instruction/index.vue

@ -71,7 +71,7 @@
style="width: 200px" style="width: 200px"
@change="crud.toQuery" @change="crud.toQuery"
> >
<el-option v-for="item in dict.task_type" :key="item.id" :label="item.label" :value="item.value" /> <el-option v-for="item in dict.instruction_type" :key="item.id" :label="item.label" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('task.txt_box.start_or_end')"> <el-form-item :label="$t('task.txt_box.start_or_end')">

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

@ -301,6 +301,9 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('task.select.Description')" prop="description">
<el-input v-model="form.remark" style="width: 370px;" type="textarea" @change="isDisabled=false" />
</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<div class="grid-content bg-purple-light" /> <div class="grid-content bg-purple-light" />
@ -405,14 +408,29 @@
<el-form-item :label="$t('task.txt_box.Vehicle_number')"> <el-form-item :label="$t('task.txt_box.Vehicle_number')">
<el-input v-model="form.vehicle_code" style="width: 370px;" @change="isDisabled=false" /> <el-input v-model="form.vehicle_code" style="width: 370px;" @change="isDisabled=false" />
</el-form-item> </el-form-item>
<el-form-item label="载具类型">
<el-select
v-model="form.vehicle_type"
style="width: 370px;"
filterable
clearable
:placeholder="$t('task.select.Placeholder')"
@change="isDisabled=false"
>
<el-option
v-for="item in dict.vehicle_type"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
<!-- <el-input v-model="form.vehicle_type" style="width: 370px;" @change="isDisabled=false" />-->
</el-form-item>
<el-form-item :label="$t('task.txt_box.extension_field')"> <el-form-item :label="$t('task.txt_box.extension_field')">
<div> <div>
<el-button @click="openDialog">{{ $t('task.select.Placeholder') }}</el-button> <el-button @click="openDialog">{{ $t('task.select.Placeholder') }}</el-button>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item :label="$t('task.select.Description')" prop="description">
<el-input v-model="form.remark" style="width: 370px;" type="textarea" @change="isDisabled=false" />
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
@ -585,7 +603,7 @@ import i18n from '@/i18n'
export default { export default {
name: 'Task', name: 'Task',
components: { pagination, crudOperation, rrOperation }, components: { pagination, crudOperation, rrOperation },
dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type', 'kezhuan'], dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type', 'kezhuan', 'vehicle_type'],
mixins: [presenter(), header(), crud()], mixins: [presenter(), header(), crud()],
cruds() { cruds() {
return CRUD({ title: i18n.t('task.txt_box.Task'), url: 'api/task', idField: 'task_id', sort: 'task_id,desc', return CRUD({ title: i18n.t('task.txt_box.Task'), url: 'api/task', idField: 'task_id', sort: 'task_id,desc',

Loading…
Cancel
Save