fix: 报错信息显示

This commit is contained in:
2024-06-19 10:54:14 +08:00
parent 39fa9a00da
commit 2724907920
9 changed files with 82 additions and 63 deletions

View File

@@ -87,7 +87,7 @@ public class AgvWaitUtil {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) endDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(2);
if(manipulatorAgvStationDeviceDriver.getAction() != 1){
log.info("不允许仙工AGV取货,烘箱对接位有报警,设备号 - {}", endDevice);
log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDevice);
throw new BadRequestException("上位系统不允许取货");
}
}

View File

@@ -363,9 +363,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
jo1.put("blockId", IdUtil.simpleUUID());
jo1.put("location", pointCode);
jo1.put("operation", "JackLoad");
// jo1.put("operationArgs", new JSONObject() {{
// put("recognize", true);
// }});
jo1.put("operationArgs", new JSONObject() {{
put("recognize", true);
}});
ja.add(jo1);

View File

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.agv.server.AgvService;
import org.nl.acs.common.base.CommonFinalParam;
@@ -89,6 +90,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
String notCreateInstMessage = "";
/**
* 心跳
*/
@@ -167,7 +169,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
int last_to_height_level = 0;
//子卷条码
String material_barcode = null;
String last_material_barcode = null;
@@ -200,6 +201,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
String hand_barcode = null;
Boolean ignore_pickup_check = false;
/**
* led点阵屏信息
*/
@@ -234,14 +237,13 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
to_container_no = this.itemProtocol.getContainer_direction();
if (move != last_move && move==0 && last_move==1) {
if (move != last_move && move == 0 && last_move == 1) {
requireSucess = false;
clearWrite();
}
if (move != 0 && task > 0) {
CompletableFuture.runAsync(() -> {
CompletableFuture.runAsync(() -> {
// 异步更新指令状态
try {
update_instruction_status();
@@ -259,7 +261,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
//申请空托盘出库
if (mode == 8 && !requireSucess) {
if (container_type==0){
if (container_type == 0) {
message = "托盘类型为空";
}
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode);
@@ -287,7 +289,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
break;
case 2:
//申请任务
if (move == 1 && !requireSucess) {
if (move == 1 && !requireSucess) {
instruction_require();
} else {
String remark = "";
@@ -322,8 +324,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
break;
default:
break;
}
@@ -344,26 +344,26 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
last_to_container_type = to_container_type;
}
public void clearWrite() {
List list = new ArrayList<>();
Map map = new HashMap<>();
map.put("code","to_target");
map.put("value","0");
list.add(map);
Map map2 = new HashMap<>();
map2.put("code","to_task");
map2.put("value","0");
list.add(map2);
Map map4 = new HashMap<>();
map4.put("code","to_container_type");
map4.put("value","0");
list.add(map4);
public void clearWrite() {
List list = new ArrayList<>();
Map map = new HashMap<>();
map.put("code", "to_target");
map.put("value", "0");
list.add(map);
Map map2 = new HashMap<>();
map2.put("code", "to_task");
map2.put("value", "0");
list.add(map2);
Map map4 = new HashMap<>();
map4.put("code", "to_container_type");
map4.put("value", "0");
list.add(map4);
this.writing(list);
message=null;
vehicle_code=null;
this.writing(list);
message = null;
vehicle_code = null;
}
}
public void writing(int command) {
@@ -430,9 +430,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
}
/**
* 申请任务
*/
@@ -471,10 +468,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
String containerType = "";
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
containerType = interactionJsonDTO.getContainerType();
containerType = interactionJsonDTO.getContainerType();
}
List list = new ArrayList();
writeData(next_addr, list, inst,containerType);
writeData(next_addr, list, inst, containerType);
// led_message = getLedMessage(inst);
requireSucess = true;
return true;
@@ -522,7 +519,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + taskDtoHandCode.getTo_y() + "-" + taskDtoHandCode.getTo_z();
Instruction instdto = new Instruction();
packageData(instdto, route_plan_code, taskDtoHandCode, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType,vehicleCode);
packageData(instdto, route_plan_code, taskDtoHandCode, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority, containerType, vehicleCode);
try {
instructionService.create(instdto);
} catch (Exception e) {
@@ -606,14 +603,18 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
//异常位到叠盘位
FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver;
if (nextdevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextdevice.getDeviceDriver();
if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) {
log.error("输送机,{}未联机或执行中", next_device_code);
this.setNotCreateInstMessage("universal_notCreateInstMessage4");
return false;
Boolean ignorePickupCheck = (Boolean) beltConveyorDeviceDriver.getExtraValue().get("ignore_pickup_check");
if (!ignorePickupCheck) {
if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) {
log.error("输送机,{}未联机或执行中", next_device_code);
this.setNotCreateInstMessage("universal_notCreateInstMessage4");
return false;
}
}
}else if (nextdevice.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver){
} else if (nextdevice.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) {
foldDiscSiteDeviceDriver = (FoldDiscSiteDeviceDriver) nextdevice.getDeviceDriver();
if (foldDiscSiteDeviceDriver.getMode() != 2 || foldDiscSiteDeviceDriver.getMove() == 1) {
log.error("输送机,{}未联机或执行中", next_device_code);
@@ -653,7 +654,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
String containerType = "";
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
containerType = interactionJsonDTO.getContainerType();
containerType = interactionJsonDTO.getContainerType();
}
List list = new ArrayList();
writeData(next_addr, list, instdto, containerType);
@@ -662,7 +663,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
return true;
}
private void writeData(String next_addr, List list, Instruction inst,String containerType) {
private void writeData(String next_addr, List list, Instruction inst, String containerType) {
List list1 = new ArrayList();
Map map = new HashMap();
map.put("code", "to_target");
@@ -824,6 +825,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
jo.put("isOnline", this.getIsonline());
jo.put("requireSucess", requireSucess);
jo.put("hand_barcode", hand_barcode);
jo.put("materiel", material_barcode);
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
return jo;
}

View File

@@ -260,6 +260,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
}
break;
case 25:
if ( StrUtil.isEmpty(material_barcode)) {
message = "子卷码为空";
}
//二楼到一楼输送线申请行架任务
if (move == 1 && !requireSucess) {
applyManipulatorTask();

View File

@@ -295,10 +295,11 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
List toInstructions;
//木箱入库申请入库任务
if (mode == 6 && !requireSucess) {
if (StrUtil.isEmpty(barcode)) {
message = "托盘条码为空";
if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空、或者子卷码为空";
}else {
applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
}
applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
}
@@ -306,8 +307,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (mode == 7 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空、或者子卷码为空";
}else {
applyIn(StorageTypeEnum.STORAGE.getType(), mode);
}
applyIn(StorageTypeEnum.STORAGE.getType(), mode);
}
@@ -316,25 +318,27 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (mode == 9 && move == 1 && !requireSucess) {
if (container_type == 0) {
message = "托盘类型为空";
}else {
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
}
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
}
//申请退货入库
if (mode == 18 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode)) {
message = "托盘条码为空";
}else {
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
}
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
}
//申请高度
if (mode == 23 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "条码为空";
}else {
applyErrorHeight();
}
applyErrorHeight();
}
@@ -399,7 +403,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", hand_barcode);
}
if (StrUtil.isNotEmpty(barcode)) {
if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) {
param.put("vehicle_code", barcode);
}
if (StrUtil.isNotEmpty(material_barcode)) {
@@ -464,7 +468,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", hand_barcode);
}
if (StrUtil.isNotEmpty(barcode)) {
if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) {
param.put("vehicle_code", barcode);
}
if (StrUtil.isNotEmpty(material_barcode)) {
@@ -529,6 +533,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
this.writing(list);
message = null;
vehicle_code = null;
hand_barcode = null;
}
@@ -575,12 +580,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("container_type", container_type);
if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", hand_barcode);
}
if (StrUtil.isNotEmpty(barcode)) {
param.put("vehicle_code", barcode);
}
param.put("type", type);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
@@ -632,7 +631,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", hand_barcode);
}
if (StrUtil.isNotEmpty(barcode)) {
if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) {
param.put("vehicle_code", barcode);
}
if (StrUtil.isNotEmpty(material_barcode)) {
@@ -998,6 +997,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("hand_barcode", hand_barcode);
jo.put("barcode", barcode);
jo.put("material_barcode", material_barcode);
jo.put("move", move);
jo.put("action", action);
jo.put("task", task);

View File

@@ -620,7 +620,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
jo.put("isError", this.getIserror());
jo.put("message", LangProcess.msg(message));
jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
jo.put("feedMessage", LangProcess.msg(feedMessage));
jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true);

View File

@@ -833,6 +833,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
requireSucess = true;
return true;
}
}else {
message = "不是取货中或者取货完成报警";
}
}
//放货中报警
@@ -843,6 +845,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
requireSucess = true;
return true;
}
}else {
message = "不是放货中报警";
}
}
//出库报警
@@ -855,6 +859,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
requireSucess = true;
return true;
}
}else {
message = "不是取货中或者取货完成报警";
}
//放货中报警
if ("3".equals(instructionErro.getExecute_code()) && forkCargo == 2) {
@@ -866,6 +872,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
requireSucess = true;
return true;
}
}else {
message = "不是放货中报警";
}
}
}

View File

@@ -1085,9 +1085,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
@Override
public TaskDto findByStartCodeAndReady(String device_code) {
//根据时间升序取第一个
Optional<TaskDto> optionalTask = tasks.stream()
.filter(task -> StrUtil.equals(task.getStart_device_code(), device_code)
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex()))
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())).sorted(Comparator.comparing(TaskDto::getCreate_time))
.findFirst();
return optionalTask.orElse(null);
}