Browse Source

rev:更新

master
gengby 5 months ago
parent
commit
dcef47fff8
  1. 4
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceServiceImpl.java
  2. 194
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/AppearanceInspectionScannerConveyorDeviceDriver.java
  3. 35
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/enums/AppModeEnum.java
  4. 3
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/enums/CommandEnum.java
  5. 28
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/enums/ErrorEnum.java
  6. 21
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/enums/InOutModeEnum.java
  7. 29
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/enums/PinkEnum.java
  8. 2
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/strip_conveyor/StripConveyorDeviceDriver.java
  9. 267
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/StandardStackerDeviceDriver.java
  10. 2
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/enums/CommandEnum.java
  11. 47
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/enums/ErrorEnum.java
  12. 9
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/enums/ModeEnum.java
  13. 11
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/enums/StrategyEnum.java
  14. 7
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/station/with_station/WithStationDeviceDriver.java
  15. 55
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
  16. 32
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/GateWayService.java
  17. 49
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java
  18. 19
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/dto/InteracteDto.java
  19. 709
      nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  20. 8
      nladmin-system/nlsso-server/src/main/java/org/nl/common/base/TableDataInfo.java
  21. 2
      nladmin-ui/src/i18n/langs/monitor/en.js
  22. 2
      nladmin-ui/src/i18n/langs/monitor/in.js
  23. 2
      nladmin-ui/src/i18n/langs/monitor/zh.js
  24. 11
      nladmin-ui/src/views/acs/device/driver/appearance_inspection_scanner_conveyor_device.vue
  25. 534
      nladmin-ui/src/views/system/monitor/device/index.vue

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

@ -25,6 +25,7 @@ import org.nl.acs.device.device.enums.DeviceType;
import org.nl.acs.device.device.service.mapper.DeviceExtraMapper;
import org.nl.acs.device.device.domain.DeviceRunpoint;
import org.nl.acs.device.device.service.mapper.DeviceRunpointMapper;
import org.nl.acs.device.driver.conveyor.appearance_inspection_scannner_conveyor.AppearanceInspectionScannerConveyorDeviceDriver;
import org.nl.acs.device.driver.stacker.double_stacker.StandardStackerDeviceDriver;
import org.nl.acs.opc.opc.OpcConfig;
import org.nl.acs.route.domain.RouteLine;
@ -967,6 +968,9 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
} else if (device.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
StandardStackerDeviceDriver standardStackerDeviceDriver = (StandardStackerDeviceDriver) device.getDeviceDriver();
standardStackerDeviceDriver.setDeviceStatus(form);
} else if (device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
appearanceInspectionScannerConveyorDeviceDriver.setDeviceStatus(form);
}
}

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

@ -16,7 +16,7 @@ import org.nl.acs.device.device.service.DeviceAppService;
import org.nl.acs.device.device.service.DeviceAssignedService;
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.CommandEnum;
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.ext.UnifiedResponse;
import org.nl.acs.ext.wms.data.req.CommonRequest;
@ -123,7 +123,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
private int toTask = 0;
private int lastToTask = 0;
/**
* 下发托盘类型
* 下发高度
*/
private int toHeight = 0;
private int lastToHeight = 0;
@ -165,6 +165,16 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
*/
private boolean isError = false;
/**
* 未执行任务原因
*/
private String unExecutedMessage;
/**
* 补码
*/
private String handBarcode;
@Override
public Device getDevice() {
@ -203,9 +213,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
if (pinkFlag) {
JSONObject param = new JSONObject();
param.put("devicePoint", this.currentDeviceCode);
// TODO 拣选工位启停状态尚未定义
//0和1 代表mode的0和2
param.put("status", "");
param.put("status", PinkEnum.getWmsValueByAcsValue(String.valueOf(this.mode)));
CommonRequest request =
CommonRequest.builder()
.service("Device")
@ -234,26 +242,35 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
this.isError = false;
this.message = "";
//编写业务逻辑方法
if (this.mode == 2 && this.move > 0 && StrUtil.isNotEmpty(this.barcode) && !requireSuccess) {
//查询入库信息
if (this.mode == AppModeEnum.MODE_2.getCode() && this.move > 0 && (StrUtil.isNotEmpty(this.barcode) || StrUtil.isNotEmpty(this.handBarcode)) && !requireSuccess) {
this.message = "正在执行查找入库任务";
this.createInInstruction();
} else if (this.mode == 2 && this.move == 0 && !requireSuccess) {
//查询出库信息
} else if (this.mode == AppModeEnum.MODE_2.getCode() && this.move == 0 && !requireSuccess) {
this.message = "正在执行查找出库任务";
//指令终点
String cacheDeviceCode = Optional.ofNullable(this.getExtraValue().get("cacheDeviceCode")).map(Object::toString).orElse("");
if (ObjectUtil.isNotEmpty(cacheDeviceCode)) {
this.createOutInstruction(cacheDeviceCode);
} else {
this.createOutInstruction(this.currentDeviceCode);
}
} else if (this.mode == 2 && this.move > 0 && StrUtil.isEmpty(this.barcode) && !requireSuccess) {
} else if (this.mode == AppModeEnum.MODE_2.getCode() && this.move > 0 && (StrUtil.isEmpty(this.barcode) || StrUtil.isEmpty(this.handBarcode)) && !requireSuccess) {
this.message = "正在执行下发输送线指令信息";
//下发输送线指令信息
this.distribute();
} else if (this.mode == 6 && move > 0 && !requireSuccess) {
} else if (this.mode == AppModeEnum.MODE_6.getCode() && move > 0 && !requireSuccess) {
this.message = "正在执行申请入库任务";
//向上位申请任务
this.applyInTask();
} else if (this.mode == 7 && this.move > 0 && StrUtil.isNotEmpty(this.barcode) && !requireSuccess) {
} else if (this.mode == AppModeEnum.MODE_7.getCode() && this.move > 0 && StrUtil.isNotEmpty(this.barcode) && !requireSuccess) {
//是否扫码申请AGV任务
boolean scanApplyFlag = Optional.ofNullable(this.getExtraValue().get("scanApplyTask")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
if (scanApplyFlag) {
this.message = "正在执行申请AGV任务";
this.applyAgvTask();
} else if (this.mode == 8 && this.move > 0 && StrUtil.isNotEmpty(this.barcode) && !requireSuccess) {
}
} else if (this.mode == AppModeEnum.MODE_8.getCode() && this.move > 0 && StrUtil.isNotEmpty(this.barcode) && !requireSuccess) {
this.message = "正在获取外形检测高度";
this.getHeightByVehicleCode();
}
}
@ -324,18 +341,19 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut);
} else {
this.requireTime = currentTimeMillis;
// JSONObject param = new JSONObject();
// param.put(this.barcode, this.currentDeviceCode);
// CommonRequest request =
// CommonRequest.builder()
// .service("InStorage")
// .type("groupInStorage")
// .data(param)
// .build();
// UnifiedResponse<JSONObject> response = acsToWmsService.apply(request);
// if (response.isSuccess()) {
// this.requireSuccess = true;
// }
JSONObject param = new JSONObject();
param.put(this.barcode, this.currentDeviceCode);
CommonRequest request =
CommonRequest.builder()
.service("InStorage")
.type("groupInStorage")
.data(param)
.build();
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request);
if (response.isSuccess()) {
this.writing(ItemProtocol.TO_COMMAND.getKey(), CommandEnum.COMMAND_7.getValue());
this.requireSuccess = true;
}
}
}
@ -352,15 +370,15 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut);
} else {
this.requireTime = currentTimeMillis;
// JSONObject param = new JSONObject();
// param.put(barcode, this.currentDeviceCode);
// CommonRequest request =
// CommonRequest.builder()
// .service("InStorage")
// .type("groupInStorage")
// .data(param)
// .build();
// return acsToWmsService.apply(request);
JSONObject param = new JSONObject();
param.put(barcode, this.currentDeviceCode);
CommonRequest request =
CommonRequest.builder()
.service("InStorage")
.type("groupInStorage")
.data(param)
.build();
return acsToWmsService.apply(request);
}
return null;
}
@ -372,10 +390,18 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut);
} else {
this.requireTime = currentTimeMillis;
TaskDto taskDto = taskService.findReadyByVehicleCode(this.barcode);
Instruction instDto = instructionService.findReadyInstByVehicleCode(this.barcode);
TaskDto taskDto = null;
Instruction instDto = null;
if (StrUtil.isNotEmpty(this.handBarcode)) {
taskDto = taskService.findReadyByVehicleCode(this.handBarcode);
instDto = instructionService.findReadyInstByVehicleCode(this.handBarcode);
} else {
taskDto = taskService.findReadyByVehicleCode(this.barcode);
instDto = instructionService.findReadyInstByVehicleCode(this.barcode);
}
if (ObjectUtil.isNotEmpty(taskDto) && ObjectUtil.isEmpty(instDto)) {
if (!StrUtil.equals(this.currentDeviceCode, taskDto.getStart_device_code())) {
this.unExecutedMessage = "任务起点与当前设备号不一致,查找入库任务结束";
return;
}
instDto = new Instruction();
@ -386,7 +412,8 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
if (CollectionUtil.isEmpty(assignedDtos)) {
shortPathsList = routeLineService.getShortPathLines(taskDto.getStart_device_code(), taskDto.getNext_device_code(), taskDto.getRoute_plan_code());
if (CollectionUtil.isEmpty(shortPathsList)) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 不存在该点的路由信息!"));
this.unExecutedMessage = taskDto.getStart_device_code() + "->" + taskDto.getNext_device_code() + "的路由信息或间接路由信息不存在,查找入库任务结束";
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, taskDto.getStart_device_code() + "->" + taskDto.getNext_device_code() + "的路由信息或间接路由信息不存在"));
return;
}
RouteLineDto routeLineDto = shortPathsList.get(0);
@ -421,6 +448,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
}
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (nextDevice == null) {
this.unExecutedMessage = "未配置指令终点 '" + next_device_code + "'驱动信息, 查找入库任务结束";
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 未配置指令终点驱动信息, 终点: " + next_device_code));
return;
}
@ -435,23 +463,29 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
if (belongToConveyorDevice != null && belongToConveyorDevice.getDeviceDriver() instanceof StripConveyorDeviceDriver) {
StripConveyorDeviceDriver stripConveyorDeviceDriver = (StripConveyorDeviceDriver) belongToConveyorDevice.getDeviceDriver();
//如果所属输送线不是入库模式
if (stripConveyorDeviceDriver.getInOutMode() != 0) {
if (stripConveyorDeviceDriver.getInOutMode() != InOutModeEnum.IN.getValue()) {
String samePoint = Optional.ofNullable(this.getExtraValue().get("samePoint")).map(Object::toString).orElse(null);
TaskDto existTask;
String tempPoint = "";
if (StrUtil.isNotEmpty(samePoint)) {
existTask = taskService.findByNextCode(samePoint);
tempPoint = samePoint;
} else {
existTask = taskService.findByNextCode(this.currentDeviceCode);
tempPoint = this.currentDeviceCode;
}
if (ObjectUtil.isNotEmpty(existTask)) {
this.unExecutedMessage = tempPoint + "是双向点位,存在该点的出库任务, 查找入库任务结束";
return;
}
//判断所属输送线是否允许切换出入库模式
if (stripConveyorDeviceDriver.getSwitchInOut() == 0) {
//切换出入库模式
stripConveyorDeviceDriver.writing("toCommand", 0);
if (stripConveyorDeviceDriver.getSwitchInOut() == InOutModeEnum.SWITCH_IN_OUT.getValue()) {
//切换入库模式
stripConveyorDeviceDriver.writing("toCommand", InOutModeEnum.IN.getValue());
this.unExecutedMessage = "切换为入库模式,查找入库任务结束";
return;
} else {
this.unExecutedMessage = "不允许切换为入库模式,查找入库任务结束";
return;
}
}
@ -474,10 +508,13 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
this.writing(Arrays.asList(ItemProtocol.TO_TARGET.getKey(), ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_COMMAND.getKey()), Arrays.asList(nextAddress, instDto.getInstruction_code(), CommandEnum.COMMAND_1.getValue()));
}
}
this.handBarcode = null;
} catch (Exception e) {
this.unExecutedMessage = "创建入库指令异常,原因: " + e.getMessage();
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
return;
}
this.unExecutedMessage = "";
this.requireSuccess = true;
} else if (ObjectUtil.isEmpty(taskDto) && ObjectUtil.isNotEmpty(instDto)) {
String next_device_code = instDto.getNext_device_code();
@ -490,6 +527,8 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
this.requireSuccess = true;
}
}
} else {
this.unExecutedMessage = "未查找到对应的就绪状态任务或执行中入库指令信息";
}
}
}
@ -514,7 +553,8 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
instDto = new Instruction();
List<DeviceAssignedDto> assignedDtos = deviceAssignedService.queryAssignedByDevice(taskDto.getStart_device_code(), taskDto.getNext_device_code());
if (CollectionUtil.isEmpty(assignedDtos)) {
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 不存在该点的路由信息!"));
this.unExecutedMessage = taskDto.getStart_device_code() + "->" + taskDto.getNext_device_code() + "的平均分配信息不存在,查找出库任务结束";
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 不存在该点的平均分配信息!"));
return;
}
DeviceAssignedDto assignedDto = null;
@ -531,6 +571,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
assignedDto = assignedDtos.get(0);
}
if (ObjectUtil.isEmpty(assignedDto)) {
this.unExecutedMessage = taskDto.getStart_device_code() + "->" + taskDto.getNext_device_code() + "的平均分配信息的指令终点,对应的指令信息已经存在,查找出库任务结束";
return;
}
String start_device_code = assignedDto.getDevice_code();
@ -543,6 +584,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
if (pinkDevice != null && pinkDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) pinkDevice.getDeviceDriver();
if (appearanceInspectionScannerConveyorDeviceDriver.getMode() == 0) {
this.unExecutedMessage = "拣选台 '" + pinkDeviceCode + "' 未启用,查找出库任务结束";
return;
}
Instruction inst = instructionService.findReadyInstByEnd(next_device_code);
@ -570,6 +612,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
}
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (nextDevice == null) {
this.unExecutedMessage = "未配置指令终点 '" + next_device_code + "'驱动信息, 查找出库任务结束";
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 未配置指令终点驱动信息, 终点: " + next_device_code));
return;
}
@ -587,19 +630,25 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
if (stripConveyorDeviceDriver.getInOutMode() != 1) {
String samePoint = Optional.ofNullable(this.getExtraValue().get("samePoint")).map(Object::toString).orElse(null);
TaskDto existTask;
String tempPoint = "";
if (StrUtil.isNotEmpty(samePoint)) {
existTask = taskService.findByStartCode(samePoint);
tempPoint = samePoint;
} else {
existTask = taskService.findByStartCode(this.currentDeviceCode);
tempPoint = this.currentDeviceCode;
}
if (ObjectUtil.isNotEmpty(existTask)) {
this.unExecutedMessage = tempPoint + "是双向点位,存在该点的入库任务, 查找出库任务结束";
return;
}
//不是出库模式 判断是否允许切换出入库模式
if (stripConveyorDeviceDriver.getSwitchInOut() == 0) {
stripConveyorDeviceDriver.writing("toCommand", 1);
if (stripConveyorDeviceDriver.getSwitchInOut() == InOutModeEnum.SWITCH_IN_OUT.getValue()) {
stripConveyorDeviceDriver.writing("toCommand", InOutModeEnum.OUT.getValue());
this.unExecutedMessage = "切换为出库模式,查找出库任务结束";
return;
} else {
this.unExecutedMessage = "不允许切换为出库模式,查找出库任务结束";
return;
}
}
@ -612,12 +661,16 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskService.update(taskDto);
} catch (Exception e) {
this.unExecutedMessage = "创建出库指令异常,原因: " + e.getMessage();
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
return;
}
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建出库指令成功,指令号:" + instDto.getInstruction_code() + " , 任务号:" + instDto.getTask_code()));
this.unExecutedMessage = "";
this.requireSuccess = true;
}
} else {
this.unExecutedMessage = "未查找到对应的就绪状态任务或执行中出库指令信息";
}
} finally {
LOCK.unlock();
@ -665,41 +718,72 @@ 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())) {
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);
instructionService.update(instruction);
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 -> " + InstructionStatusEnum.BUSY.getName()));
} else if ((InstructionStatusEnum.BUSY.getIndex().equals(instruction.getInstruction_status()) || InstructionStatusEnum.READY.getIndex().equals(instruction.getInstruction_status())) && this.currentDeviceCode.equals(instruction.getNext_device_code())) {
boolean applyTaskFlag = Optional.ofNullable(this.getExtraValue().get("applyTask")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
if (applyTaskFlag) {
UnifiedResponse<JSONObject> response = this.applyAgvTask(instruction.getVehicle_code());
if (response == null || !response.isSuccess()) {
this.unExecutedMessage = "WMS未返回成功信号,申请AGV任务失败";
return;
}
this.unExecutedMessage = "";
}
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 '" + InstructionStatusEnum.getName(instruction.getInstruction_status()) + "' -> " + InstructionStatusEnum.FINISHED.getName()));
instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
instruction.setExecute_device_code(this.currentDeviceCode);
instructionService.finish(instruction);
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 -> " + InstructionStatusEnum.FINISHED.getName()));
}
}
@Override
public JSONObject getDeviceStatusName() throws Exception {
JSONObject jo = new JSONObject();
jo.put("device_code", this.currentDeviceCode);
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("driver_type", "appearance_inspection_scanner_conveyor_device");
jo.put("is_click", true);
jo.put("message", this.message);
jo.put("isOnline", this.online);
jo.put("isError", this.isError);
Map<String, Object> map = new LinkedHashMap<>();
map.put("device_code", this.currentDeviceCode);
map.put("device_name", this.getDevice().getDevice_name());
map.put("driver_type", "appearance_inspection_scanner_conveyor_device");
map.put("is_click", true);
map.put("message", this.message);
map.put("isOnline", this.online);
map.put("isError", this.isError);
map.put("unExecutedMessage", this.unExecutedMessage);
map.put("requireSuccess", this.requireSuccess);
map.put("mode", AppModeEnum.getLabelByCode(this.mode));
String belongToConveyor = Optional.ofNullable(this.getExtraValue().get("belongToConveyor")).map(Object::toString).orElse(null);
if (belongToConveyor != null) {
Device deviceToConveyor = deviceAppService.findDeviceByCode(belongToConveyor);
if (deviceToConveyor != null && deviceToConveyor.getDeviceDriver() instanceof StripConveyorDeviceDriver) {
StripConveyorDeviceDriver stripConveyorDeviceDriver = (StripConveyorDeviceDriver) deviceToConveyor.getDeviceDriver();
map.put("inOutMode", stripConveyorDeviceDriver.getInOutMode() == 0 ? "入库模式" : "出库模式");
map.put("switchInOut", stripConveyorDeviceDriver.getSwitchInOut() == 0 ? "允许切换" : "不允许切换");
}
}
map.put("move", this.move == 0 ? "无货" : "有货");
map.put("hasGoods", this.move);
map.put("task", this.task);
map.put("action", this.action == 0 ? "不允许取放" : "允许取放");
map.put("error", ErrorEnum.getLabel(this.error));
map.put("barcode", this.barcode);
map.put("handBarcode", this.handBarcode);
map.put("weight", this.weight);
map.put("height", this.height);
JSONObject jo = new JSONObject(map);
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
if (ObjectUtil.isNotEmpty(data)) {
Boolean requireSuccess = data.getBoolean("requireSuccess");
if (requireSuccess != null) {
this.requireSuccess = requireSuccess;
}
String hand_barcode = data.getString("hand_barcode");
this.handBarcode = hand_barcode;
}
}
private void setInstruction(Instruction instdto, TaskDto taskDto, String start_device_code, String next_device_code) {

35
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/enums/AppModeEnum.java

@ -0,0 +1,35 @@
package org.nl.acs.device.driver.conveyor.appearance_inspection_scannner_conveyor.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/6/26
*/
@Getter
@AllArgsConstructor
public enum AppModeEnum {
MODE_0(0, "脱机"),
MODE_1(1, "备用"),
MODE_2(2, "待机"),
MODE_3(3, "运行中"),
MODE_4(4, "备用"),
MODE_5(5, "备用"),
MODE_6(6, "申请入库"),
MODE_7(7, "申请AGV任务"),
MODE_8(8, "获取外形检测高度");
private int code;
private String label;
public static String getLabelByCode(int code) {
for (AppModeEnum mode : AppModeEnum.values()) {
if (mode.getCode() == code) {
return mode.getLabel();
}
}
return "MODE值错误";
}
}

3
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/enums/CommandEnum.java

@ -17,8 +17,7 @@ public enum CommandEnum {
COMMAND_4(4, "开始放货"),
COMMAND_5(5, "放货完成"),
COMMAND_6(6, "反馈申请入库任务成功"),
COMMAND_7(7, "反馈申请二楼出库任务成功"),
COMMAND_8(8, "反馈申请三楼出库任务成功"),
COMMAND_7(7, "反馈申请AGV任务成功"),
COMMAND_99(99, "申请失败");
private final int value;

28
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/enums/ErrorEnum.java

@ -0,0 +1,28 @@
package org.nl.acs.device.driver.conveyor.appearance_inspection_scannner_conveyor.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/6/28
*/
@Getter
@AllArgsConstructor
public enum ErrorEnum {
NO(0, "无报警");
private int value;
private String label;
public static String getLabel(Integer value) {
for (ErrorEnum e : ErrorEnum.values()) {
if (e.getValue() == value) {
return e.getLabel();
}
}
return "未知报警信息";
}
}

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

@ -0,0 +1,21 @@
package org.nl.acs.device.driver.conveyor.appearance_inspection_scannner_conveyor.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/6/26
*/
@Getter
@AllArgsConstructor
public enum InOutModeEnum {
IN(0, "入库模式"),
OUT(1, "出库模式"),
SWITCH_IN_OUT(0, "允许切换出入库模式");
private int value;
private String label;
}

29
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/appearance_inspection_scannner_conveyor/enums/PinkEnum.java

@ -0,0 +1,29 @@
package org.nl.acs.device.driver.conveyor.appearance_inspection_scannner_conveyor.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/6/26
*/
@Getter
@AllArgsConstructor
public enum PinkEnum {
START("1", "2", "拣选启用"),
STOP("0", "0", "拣选停用");
private String wmsValue;
private String acsValue;
private String desc;
public static String getWmsValueByAcsValue(String acsValue) {
for (PinkEnum pinkEnum : PinkEnum.values()) {
if (pinkEnum.getAcsValue().equals(acsValue)) {
return pinkEnum.getWmsValue();
}
}
return "0";
}
}

2
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/conveyor/strip_conveyor/StripConveyorDeviceDriver.java

@ -109,6 +109,8 @@ public class StripConveyorDeviceDriver extends AbstractOpcDeviceDriver implement
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("driver_type", "strip_conveyor_device");
jo.put("is_click", false);
jo.put("inOutMode", this.inOutMode == 0 ? "入库模式" : "出库模式");
jo.put("switchInOut", this.switchInOut == 0 ? "允许切换出入库模式" : "不允许切换出入库模式");
jo.put("message", this.message);
jo.put("isOnline", this.online);
return jo;

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

@ -38,6 +38,11 @@ import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @Description 1适用于单/双堆垛机;2默认优先执行移库任务;3其次按照堆垛机设置的策略(入库优先(含拣选出库)策略出库优先策略时间顺序策略)执行;4除移库任务是从任务列表中查找其余任务都是从指令列表中查找就绪状态下的信息
* @Author Gengby
* @Date 2024/6/26
*/
@Slf4j
@Getter
@Setter
@ -277,10 +282,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
* 禁止入库
*/
private boolean prohibitInWarehouse = false;
/**
* 禁止出库
*/
private boolean prohibitOutWarehouse = false;
/**
* 停止接收任务
*/
@ -292,10 +299,20 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
private int stackerNum = 1;
/**
* 空出满入阻挡请求标记
* 空出满入阻挡异常请求标记
*/
private boolean againRequireSuccess = false;
/**
* 未执行任务原因
*/
private String unExecutedMessage;
/**
* 空出满入阻挡异常报警码
*/
private static final List<Integer> AGAIN_ERROR = Arrays.asList(ErrorEnum.MR.getCode(), ErrorEnum.KC.getCode(), ErrorEnum.ZD.getCode());
@Override
public Device getDevice() {
@ -401,7 +418,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
return Integer.parseInt(devicePoint.split("-")[2]);
}
private static final List<Integer> AGAIN_ERROR = Arrays.asList(ErrorEnum.MR.getCode(), ErrorEnum.KC.getCode(), ErrorEnum.ZD.getCode());
@SneakyThrows
@Override
@ -418,31 +434,25 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
//前叉满入
if (this.front_Zerror == ErrorEnum.MR.getCode()) {
if (!this.againRequireSuccess) {
this.mR(this.front_task, ForkTypeEnum.FRONT.getCode());
}
return;
}
//后叉满入
else if (this.back_Zerror == ErrorEnum.MR.getCode()) {
} else if (this.back_Zerror == ErrorEnum.MR.getCode()) {
if (!this.againRequireSuccess) {
this.mR(this.back_task, ForkTypeEnum.BACK.getCode());
}
return;
}
//前叉和后叉都空出
if (this.front_Zerror == ErrorEnum.KC.getCode() && this.back_Zerror == ErrorEnum.KC.getCode()) {
if (!this.againRequireSuccess) {
this.kC(this.front_task);
this.kC(this.back_task);
}
return;
}
//前叉空出
else if (this.front_Zerror == ErrorEnum.KC.getCode()) {
} else if (this.front_Zerror == ErrorEnum.KC.getCode()) {
if (!this.againRequireSuccess) {
this.kC(this.front_task);
Instruction back_inst = instructionService.findByCodeFromCache(String.valueOf(this.back_task));
@ -451,9 +461,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
return;
}
//后叉空出
else if (this.back_Zerror == ErrorEnum.KC.getCode()) {
} else if (this.back_Zerror == ErrorEnum.KC.getCode()) {
if (!this.againRequireSuccess) {
this.kC(this.back_task);
Instruction front_inst = instructionService.findByCodeFromCache(String.valueOf(this.front_task));
@ -464,31 +472,33 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
return;
}
//前叉浅货位有货
if (this.front_Zerror == ErrorEnum.ZD.getCode()) {
if (this.front_Zerror == ErrorEnum.ZD.getCode() && this.back_Zerror == ErrorEnum.ZD.getCode()
&& this.front_command == CommandEnum.PICKUP.getStatus() && this.back_command == CommandEnum.PICKUP.getStatus()
) {
if (!this.againRequireSuccess) {
this.getzD(this.front_task);
this.getzD(this.back_task);
}
} else if (this.front_Zerror == ErrorEnum.ZD.getCode()) {
if (!this.againRequireSuccess) {
if (this.front_command == CommandEnum.PICKUP.getStatus()) {
this.getzD(this.front_task);
Instruction back_inst = instructionService.findByCodeFromCache(String.valueOf(this.back_task));
if (ObjectUtil.isNotEmpty(back_inst)) {
this.backWrite(back_inst);
Thread.sleep(1000);
}
} else if (this.front_command == CommandEnum.RELEASE.getStatus()) {
this.putzD(this.front_task, ForkTypeEnum.FRONT.getCode());
}
}
return;
}
//后叉浅货位有货
else if (this.back_Zerror == ErrorEnum.ZD.getCode()) {
} else if (this.back_Zerror == ErrorEnum.ZD.getCode()) {
if (!this.againRequireSuccess) {
if (this.back_command == CommandEnum.PICKUP.getStatus()) {
this.getzD(this.back_task);
Instruction front_inst = instructionService.findByCodeFromCache(String.valueOf(this.front_task));
if (ObjectUtil.isNotEmpty(front_inst)) {
this.frontWrite(front_inst);
Thread.sleep(1000);
}
} else if (this.back_command == CommandEnum.RELEASE.getStatus()) {
this.putzD(this.back_task, ForkTypeEnum.BACK.getCode());
@ -503,9 +513,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
this.message = "设备离线";
} else if (this.mode != ModeEnum.MODE_3.getNum()) {
this.message = "设备未联机";
} else if (this.stacker_error != 0) {
this.message = "设备主体报警";
this.isError = true;
} else if (this.front_Zerror != 0) {
this.message = "设备前叉报警";
this.isError = true;
@ -525,7 +532,10 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
this.writing(ItemProtocol.TO_COMMAND.getKey(), 0);
Thread.sleep(1000);
}
if (this.stopReceiveTask) return;
if (this.stopReceiveTask) {
this.unExecutedMessage = "堆垛机设置为停止接收任务";
return;
}
this.applyTask();
} else {
this.sendPutInfoToPlc(frontInst, backInst);
@ -694,6 +704,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
/**
* 放货阻挡满入更改任务指令终点信息
*
* @param devicePoint
* @param inst
*/
private void updateNextPointCode(String devicePoint, Instruction inst) {
Integer x = getX(devicePoint);
Integer y = getY(devicePoint);
@ -716,6 +732,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
/**
* 查找任务
*/
private void applyTask() {
long currentTimeMillis = System.currentTimeMillis();
if (!isTimeValid(currentTimeMillis)) {
@ -733,7 +752,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
/**
* 移库任务
* 移库
*/
private void applyMoveTask() {
List<String> xDeviceCodeList = this.getExtraDeviceCodes("xDeviceCodeList");
@ -743,7 +762,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
TaskDto frontTaskDto = null;
TaskDto backTaskDto = null;
if (CollectionUtil.isNotEmpty(frontTaskDtos)) {
//如果当前堆垛机是双叉
if (this.stackerNum == 2) {
for (TaskDto frontTask : frontTaskDtos) {
//查找一起取放的移库任务
@ -760,11 +778,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
if (ObjectUtil.isEmpty(frontTaskDto) && ObjectUtil.isEmpty(backTaskDto)) {
//查询前叉移库任务
frontTaskDto = frontTaskDtos.get(0);
}
} else {
//查找后叉移库任务
if (this.stackerNum == 2) {
List<TaskDto> backTaskDtos = taskService.findReadyTaskByXDeviceCode(xDeviceCodeList, backNoY);
if (CollectionUtil.isNotEmpty(backTaskDtos)) {
@ -785,14 +801,14 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
taskService.update(frontTaskDto);
taskService.update(backTaskDto);
} catch (Exception e) {
this.unExecutedMessage = "创建移库指令时出现异常,原因:" + e.getMessage();
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
return;
}
this.FBWrite(frontInst, backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
//下发双叉任务
} else if (ObjectUtil.isNotEmpty(frontTaskDto)) {
//下发前叉任务
Instruction frontInst = new Instruction();
setInstruction(frontInst, frontTaskDto);
try {
@ -800,13 +816,14 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
frontTaskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskService.update(frontTaskDto);
} catch (Exception e) {
this.unExecutedMessage = "创建移库指令时出现异常,原因:" + e.getMessage();
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
return;
}
this.frontWrite(frontInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else if (ObjectUtil.isNotEmpty(backTaskDto)) {
//下发后叉任务
Instruction backInst = new Instruction();
setInstruction(backInst, backTaskDto);
try {
@ -814,10 +831,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
backTaskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskService.update(backTaskDto);
} catch (Exception e) {
this.unExecutedMessage = "创建移库指令时出现异常,原因:" + e.getMessage();
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
return;
}
this.backWrite(backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else {
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse("");
@ -836,6 +855,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
/**
* 拣选出库
*
* @return
*/
private boolean applySpecialTask() {
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
@ -892,8 +916,10 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
private void applyInTask() {
boolean flag = this.applySpecialTask();
if (flag) {
this.unExecutedMessage = null;
return;
}
if (!prohibitInWarehouse) {
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
@ -943,25 +969,38 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) {
this.FBWrite(front_start_device, frontInst, backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else if (ObjectUtil.isNotEmpty(frontInst)) {
this.frontWrite(front_start_device, frontInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else if (ObjectUtil.isNotEmpty(backInst)) {
this.backWrite(back_start_device, backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else {
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse("");
if (ObjectUtil.equals(strategyValue, StrategyEnum.IN.getValue())) {
this.applyOutTask();
} else if (ObjectUtil.equals(strategyValue, StrategyEnum.OUT.getValue()) && !ObjectUtil.equals(strategyValue, StrategyEnum.TIME.getValue())) {
this.unExecutedMessage = "堆垛机未查询到就绪状态下可执行的任务或指令信息";
}
}
} else {
if (this.prohibitOutWarehouse) {
this.unExecutedMessage = "堆垛机设置为禁止出库、禁止入库";
return;
}
this.applyOutTask();
}
}
/**
* 出库
* 出库(含拣选)
*/
private void applyOutTask() {
if (!this.prohibitOutWarehouse) {
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
@ -989,25 +1028,42 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) {
this.FBWrite(frontInst, backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else if (ObjectUtil.isNotEmpty(frontInst)) {
this.frontWrite(frontInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else if (ObjectUtil.isNotEmpty(backInst)) {
this.backWrite(backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else {
Integer strategyValue = this.handExtraIntValue(this.getDevice(), "strategyValue");
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse("");
if (ObjectUtil.equals(strategyValue, StrategyEnum.OUT.getValue())) {
this.applyInTask();
} else if (ObjectUtil.equals(strategyValue, StrategyEnum.IN.getValue()) && !ObjectUtil.equals(strategyValue, StrategyEnum.TIME.getValue())) {
this.unExecutedMessage = "堆垛机未查询到就绪状态下可执行的任务或指令信息";
}
}
} else {
if (this.prohibitInWarehouse) {
this.unExecutedMessage = "堆垛机设置为禁止出库、禁止入库";
return;
}
this.applyInTask();
}
}
/**
* 时间顺序策略
*/
private void applyTaskByTime() {
boolean flag = this.applySpecialTask();
if (flag) {
this.unExecutedMessage = null;
return;
}
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
List<Instruction> frontInsts = instructionService.findReadyInstByDeviceCode(getFrontDeviceCodeList, frontNoY);
@ -1024,9 +1080,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Instruction backInst = instructionService.findReadyInstByStartDeviceCode(frontInst, getLinkDeviceCode, backNoY);
if (ObjectUtil.isNotEmpty(getLinkDeviceCode) && deviceAppService.findDeviceByCode(getLinkDeviceCode) != null && ObjectUtil.isNotEmpty(backInst)) {
this.FBWrite(front_start_device, frontInst, backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else {
this.frontWrite(front_start_device, frontInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
}
} else if (front_start_device != null && front_start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
@ -1037,9 +1095,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Instruction backInst = instructionService.findReadyInstByNextDeviceCode(frontInst, getLinkDeviceCode, backNoY);
if (ObjectUtil.isNotEmpty(getLinkDeviceCode) && deviceAppService.findDeviceByCode(getLinkDeviceCode) != null && ObjectUtil.isNotEmpty(backInst)) {
this.FBWrite(frontInst, backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else {
this.frontWrite(frontInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
}
}
@ -1057,20 +1117,35 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code);
if (back_start_device != null && back_start_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
this.backWrite(back_start_device, backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
} else if (back_start_device != null && back_start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
this.backWrite(backInst);
this.unExecutedMessage = null;
this.requireSuccess = true;
}
} else {
this.unExecutedMessage = "堆垛机未查询到就绪状态下可执行的任务或指令信息";
}
}
}
/**
* 下发前叉取货信息(取货位是输送线)
*
* @param frontInst
*/
private void frontWrite(Instruction frontInst) {
List<Object> values = Arrays.asList(Integer.parseInt(StringUtil.handleString(frontInst.getFrom_x())), Integer.parseInt(frontInst.getFrom_y()), Integer.parseInt(frontInst.getFrom_z()), frontInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_ONE.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum());
this.writing(this.getFrontKeys(), values);
}
/**
* 下发前叉取货信息(取货位是输送线)
*
* @param frontDevice
* @param frontInst
*/
private void frontWrite(Device frontDevice, Instruction frontInst) {
Integer frontX = this.handExtraIntValue(frontDevice, "currentX");
Integer frontY = this.handExtraIntValue(frontDevice, "currentY");
@ -1079,11 +1154,22 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
this.writing(this.getFrontKeys(), values);
}
/**
* 下发后叉取货信息(取货位是货架)
*
* @param backInst
*/
private void backWrite(Instruction backInst) {
List<Object> values = Arrays.asList(Integer.parseInt(StringUtil.handleString(backInst.getFrom_x())), Integer.parseInt(backInst.getFrom_y()), Integer.parseInt(backInst.getFrom_z()), backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum());
this.writing(this.getBackKeys(), values);
}
/**
* 下发后叉取货信息(取货位是输送线)
*
* @param backDevice
* @param backInst
*/
private void backWrite(Device backDevice, Instruction backInst) {
Integer backX = this.handExtraIntValue(backDevice, "currentX");
Integer backY = this.handExtraIntValue(backDevice, "currentY");
@ -1092,11 +1178,25 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
this.writing(this.getBackKeys(), values);
}
/**
* 下发双叉取货信息(取货位是货架)
*
* @param frontInst
* @param backInst
*/
private void FBWrite(Instruction frontInst, Instruction backInst) {
List<Object> values = Arrays.asList(Integer.parseInt(StringUtil.handleString(frontInst.getFrom_x())), Integer.parseInt(frontInst.getFrom_y()), Integer.parseInt(frontInst.getFrom_z()), frontInst.getInstruction_code(), backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_THREE.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum());
this.writing(this.getFBKeys(), values);
}
/**
* 下发双叉取货信息(取货位是输送线)
*
* @param frontDevice
* @param frontInst
* @param backInst
*/
private void FBWrite(Device frontDevice, Instruction frontInst, Instruction backInst) {
Integer frontX = this.handExtraIntValue(frontDevice, "currentX");
Integer frontY = this.handExtraIntValue(frontDevice, "currentY");
@ -1146,18 +1246,35 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
@Override
public JSONObject getDeviceStatusName() throws Exception {
JSONObject jo = new JSONObject();
jo.put("device_code", this.currentDeviceCode);
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("driver_type", "standard_stacker_device");
jo.put("is_click", true);
jo.put("message", this.message);
jo.put("isOnline", this.online);
jo.put("isError", this.isError);
jo.put("prohibitInWarehouse", this.prohibitInWarehouse);
jo.put("prohibitOutWarehouse", this.prohibitOutWarehouse);
jo.put("stopReceiveTask", this.stopReceiveTask);
jo.put("requireSuccess", this.requireSuccess ? "1" : "0");
Map<String, Object> map = new LinkedHashMap();
map.put("device_code", this.currentDeviceCode);
map.put("device_name", this.getDevice().getDevice_name());
map.put("driver_type", "standard_stacker_device");
map.put("is_click", true);
map.put("isOnline", this.online);
map.put("isError", this.isError);
map.put("message", this.message);
map.put("unExecutedMessage", this.unExecutedMessage);
map.put("prohibitInWarehouse", this.prohibitInWarehouse);
map.put("prohibitOutWarehouse", this.prohibitOutWarehouse);
map.put("stopReceiveTask", this.stopReceiveTask);
map.put("requireSuccess", this.requireSuccess);
map.put("againRequireSuccess", this.againRequireSuccess);
map.put("mode", ModeEnum.getDescByNum(this.mode));
map.put("front_command", CommandEnum.getDesc(this.front_command));
map.put("front_task", this.front_task + " (" + (instructionService.findByCodeFromCache(String.valueOf(this.front_task)) == null ? "已结束" : "执行中") + ")");
map.put("front_Zerror", ErrorEnum.getDesc(this.front_Zerror));
map.put("front_z", this.front_z);
map.put("front_x", this.front_x);
map.put("front_y", this.front_y);
map.put("back_command", CommandEnum.getDesc(this.back_command));
map.put("back_task", this.back_task + " (" + (instructionService.findByCodeFromCache(String.valueOf(this.back_task)) == null ? "已结束" : "执行中") + ")");
map.put("back_Zerror", ErrorEnum.getDesc(this.back_Zerror));
map.put("back_z", this.back_z);
map.put("back_x", this.back_x);
map.put("back_y", this.back_y);
map.put("strategy", StrategyEnum.getLabel(Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse("")));
JSONObject jo = new JSONObject(map);
return jo;
}
@ -1171,16 +1288,24 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
//ACS监控大屏设置禁止入库、禁止出库、停止接收任务
Boolean prohibitInWarehouse = data.getBoolean("prohibitInWarehouse");
if (prohibitInWarehouse != null) {
this.prohibitInWarehouse = prohibitInWarehouse;
}
Boolean prohibitOutWarehouse = data.getBoolean("prohibitOutWarehouse");
if (prohibitOutWarehouse != null) {
this.prohibitOutWarehouse = prohibitOutWarehouse;
}
Boolean stopReceiveTask = data.getBoolean("stopReceiveTask");
if (stopReceiveTask != null) {
this.stopReceiveTask = stopReceiveTask;
String requireSuccess = data.getString("requireSuccess");
if (StrUtil.equals("0", requireSuccess)) {
this.requireSuccess = false;
} else if (StrUtil.equals("1", requireSuccess)) {
this.requireSuccess = true;
}
Boolean requireSuccess = data.getBoolean("requireSuccess");
if (requireSuccess != null) {
this.requireSuccess = requireSuccess;
}
Boolean againRequireSuccess = data.getBoolean("againRequireSuccess");
if (againRequireSuccess != null) {
this.againRequireSuccess = againRequireSuccess;
}
}
}
@ -1219,6 +1344,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Integer z = this.handExtraIntValue(next_device, "currentZ");
this.writing(this.getBackKeys(), Arrays.asList(x, y, z, backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_TWO.getSignalNum()));
}
} else {
this.unExecutedMessage = "未执行放货原因, 堆垛机上报任务号不存在";
}
}
@ -1285,28 +1412,22 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
.type("rm")
.data(param)
.build();
// UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
// if (response.isSuccess()) {
// JSONObject data = response.getData();
JSONObject data = new JSONObject();
if (this.stackerNum == 1) {
data.put("devicePoint", "T02-89-03");
} else {
data.put("devicePoint", "L02-22-03");
}
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
if (response.isSuccess()) {
JSONObject data = response.getData();
String devicePoint = data.getString("devicePoint");
if (devicePoint != null && devicePoint.contains("-") && devicePoint.split("-").length == 3) {
this.updateNextPointCode(devicePoint, inst);
//清警
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5);
if ("1".equals(type)) {
if (ForkTypeEnum.FRONT.getCode().equals(type)) {
this.sendPutInfoToPlc(inst, null);
} else {
this.sendPutInfoToPlc(null, inst);
}
this.againRequireSuccess = true;
}
// }
}
}
}
@ -1325,12 +1446,14 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
.type("ck")
.data(param)
.build();
// acsToWmsService.apply(request);
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
if (response.isSuccess()) {
instructionService.cancelInstAndTask(inst.getInstruction_id());
}
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum());
this.againRequireSuccess = true;
}
}
}
/**
* 取货阻挡
@ -1347,13 +1470,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
.type("czd")
.data(param)
.build();
//UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
// if (response.isSuccess()) {
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
if (response.isSuccess()) {
//取消ACS指令和任务
instructionService.cancelInstAndTaskNoSendWms(inst.getInstruction_id());
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum());
this.againRequireSuccess = true;
// }
}
}
}
@ -1371,23 +1494,21 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
.type("rzd")
.data(param)
.build();
// UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
// if (response.isSuccess()) {
// JSONObject data = response.getData();
JSONObject data = new JSONObject();
data.put("devicePoint", "L03-89-03");
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
if (response.isSuccess()) {
JSONObject data = response.getData();
String devicePoint = data.getString("devicePoint");
if (devicePoint != null && devicePoint.contains("-") && devicePoint.split("-").length == 3) {
this.updateNextPointCode(devicePoint, inst);
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum());
if ("1".equals(type)) {
if (ForkTypeEnum.FRONT.getCode().equals(type)) {
this.sendPutInfoToPlc(inst, null);
} else {
this.sendPutInfoToPlc(null, inst);
}
this.againRequireSuccess = true;
}
// }
}
}
}

2
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/enums/CommandEnum.java

@ -24,7 +24,7 @@ public enum CommandEnum {
STOP(8, "急停"),
UNKNOWN(9, "不明"),
CHECKING(10, "盘库中"),
CHECKED(10, "盘库完成");
CHECKED(11, "盘库完成");
private Integer status;
private String desc;

47
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/enums/ErrorEnum.java

@ -11,10 +11,55 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ErrorEnum {
NO(0, "无故障"),
ERROR_1(1, "货位超限"),
ERROR_2(2, "作业条件不满足"),
ERROR_3(3, "与输送线通讯故障"),
ERROR_4(4, "传送地址错误"),
MR(5, "满入"),
KC(6, "空出"),
ZD(16, "阻挡/浅货位有货");
ERROR_7(7, "行走变频器报警"),
ERROR_8(8, "升降变频器报警"),
ERROR_9(9, "货叉变频器报警"),
ERROR_10(10, "行走超时"),
ERROR_11(11, "升降超时"),
ERROR_12(12, "货叉超时"),
ERROR_13(13, "水平测距出错"),
ERROR_14(14, "垂直测距出错"),
ERROR_15(15, "放货异常"),
ZD(16, "阻挡/浅货位有货"),
ERROR_17(17, "烟感报警"),
ERROR_18(18, "货叉数据出错"),
ERROR_19(19, "货叉左右超限"),
ERROR_20(20, "货叉货叉右报警"),
ERROR_21(21, "货叉伸缩过头报警"),
ERROR_22(22, "低位上升过头报警"),
ERROR_23(23, "高位下降过头报警"),
ERROR_24(24, "松绳报警"),
ERROR_25(25, "急停触发"),
ERROR_26(26, "安全门打开"),
ERROR_27(27, "红外温感报警"),
ERROR_28(28, "红外温感探测"),
ERROR_29(29, "行走超时保护触发"),
ERROR_30(30, "放货完成确认超时"),
ERROR_31(31, "对接设备不允许取/放货"),
ERROR_32(32, "未探测到检测件"),
ERROR_33(33, "行走超速度保护触发"),
ERROR_34(34, "升降超速度保护触发"),
ERROR_35(35, "减速开关信号异常"),
ERROR_36(36, "防撞开关被触发"),
ERROR_37(37, "防撞激光被遮挡"),
ERROR_38(38, "高货物禁止上楼承接位");
private int code;
private String desc;
public static String getDesc(Integer code) {
for (ErrorEnum e : ErrorEnum.values()) {
if (e.getCode() == code) {
return e.getDesc();
}
}
return "未知报警信息";
}
}

9
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/enums/ModeEnum.java

@ -20,4 +20,13 @@ public enum ModeEnum {
private final Integer num;
private final String desc;
public static String getDescByNum(Integer num) {
for (ModeEnum mode : ModeEnum.values()) {
if (mode.getNum().equals(num)) {
return mode.getDesc();
}
}
return "未知模式";
}
}

11
nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/driver/stacker/double_stacker/enums/StrategyEnum.java

@ -11,10 +11,19 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum StrategyEnum {
IN("1", "入库优先策略"),
IN("1", "入库优先(含拣选出库)策略"),
OUT("2", "出库优先策略"),
TIME("3", "时间顺序策略");
private final String value;
private final String label;
public static String getLabel(String value) {
for (StrategyEnum strategy : StrategyEnum.values()) {
if (strategy.getValue().equals(value)) {
return strategy.getLabel();
}
}
return "未知策略";
}
}

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

@ -24,7 +24,9 @@ import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
@ -160,7 +162,10 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
Map<String, Object> map = new LinkedHashMap<>();
map.put("device_code", this.device_code);
map.put("device_name", this.getDevice().getDevice_name());
JSONObject jo = new JSONObject(map);
return jo;
}

55
nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java

@ -2,8 +2,18 @@
package org.nl.acs.ext.wms.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.ext.wms.service.GateWayService;
import org.nl.acs.ext.wms.service.WmsToAcsService;
import org.nl.acs.ext.wms.service.dto.InteracteDto;
import org.nl.common.base.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -14,42 +24,17 @@ import org.springframework.web.bind.annotation.RestController;
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/wms")
@RequestMapping("/api/wmsToAcs")
@Slf4j
public class WmsToAcsController {
// private final WmsToAcsService wmstoacsService;
//
// @PostMapping("/task")
// @Log(value = "ACS接收WMS任务")
// @SaIgnore
// public ResponseEntity<Object> createFromWms(@RequestBody String whereJson) {
// return new ResponseEntity<>(wmstoacsService.crateTask(whereJson), HttpStatus.OK);
// }
//
// @PostMapping("/cancelTask")
// @Log(value = "WMS取消任务")
// @SaIgnore
// public ResponseEntity<Object> cancelFromWms(@RequestBody List<CancelTaskRequest> reqs) throws Exception {
// return new ResponseEntity<>(wmstoacsService.cancelFromWms(reqs), HttpStatus.OK);
// }
//
// @PostMapping("/switchInOut")
// @Log(value = "切换出入库模式")
// @SaIgnore
// public ResponseEntity<Object> switchInOut(@RequestBody JSONObject reqs) throws Exception {
// return new ResponseEntity<>(wmstoacsService.switchInOut(reqs), HttpStatus.OK);
// }
//
// @PostMapping("/pinckStartStop")
// @Log(value = "拣选工位启停")
// @SaIgnore
// public ResponseEntity<Object> pinckStartStop(@RequestBody JSONObject reqs) throws Exception {
// return new ResponseEntity<>(wmstoacsService.pinkStartStop(reqs), HttpStatus.OK);
// }
//
//
//
//
//
@Autowired
private GateWayService gateWayService;
@PostMapping("/apply")
@SaIgnore
public ResponseEntity<Object> apply(@RequestBody InteracteDto form) {
return new ResponseEntity<>(gateWayService.apply(form), HttpStatus.OK);
}
}

32
nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/GateWayService.java

@ -0,0 +1,32 @@
package org.nl.acs.ext.wms.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.ext.wms.service.dto.InteracteDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/6/28
*/
@Service
public class GateWayService {
@Autowired
private WmsToAcsService wmsToAcsService;
public JSONObject apply(InteracteDto param) {
if ("crateTask".equals(param.getType())) {
return wmsToAcsService.crateTask(param.getData());
} else if ("switchInOut".equals(param.getType())) {
return wmsToAcsService.switchInOut(param.getData());
} else if ("pinkStartStop".equals(param.getType())) {
return wmsToAcsService.pinkStartStop(param.getData());
}
JSONObject resp = new JSONObject();
resp.put("code", "400");
resp.put("msg", "type有误");
return resp;
}
}

49
nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java

@ -1,31 +1,34 @@
package org.nl.acs.ext.wms.service;
import com.alibaba.fastjson.JSONObject;
public interface WmsToAcsService {
// /**
// * crateTask
// * @param param
// * @return
// */
// crateTask(String param);
//
// /**
// * 创建任务
// *
// * @param reqs
// * @return
// */
// CreateTaskResponse crateTask(List<CreateTaskRequest> reqs);
//
//
// /**
// * 取消任务
// * @param reqs
// * @return
// * @throws Exception
// */
// CancelTaskResponse cancelFromWms(List<CancelTaskRequest> reqs) throws Exception;
/**
* 创建任务
*
* @param req
* @return
*/
JSONObject crateTask(JSONObject req);
/**
* 出入库模式切换
*
* @param req
* @return
*/
JSONObject switchInOut(JSONObject req);
/**
* 拣选工位启停
*
* @param req
* @return
*/
JSONObject pinkStartStop(JSONObject req);
}

19
nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/dto/InteracteDto.java

@ -0,0 +1,19 @@
package org.nl.acs.ext.wms.service.dto;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
/*
* @author ZZQ
* @Date 2024/5/29 16:26
*/
@Data
public class InteracteDto {
String service;
String type;
String ip;
String request_time;
String trace_id;
JSONObject data;
}

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

@ -4,7 +4,6 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -14,7 +13,6 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device.domain.Device;
import org.nl.acs.device.driver.conveyor.appearance_inspection_scannner_conveyor.AppearanceInspectionScannerConveyorDeviceDriver;
import org.nl.acs.device.driver.conveyor.strip_conveyor.StripConveyorDeviceDriver;
import org.nl.acs.ext.wms.data.*;
import org.nl.acs.ext.wms.service.WmsToAcsService;
@ -24,15 +22,9 @@ import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.system.service.param.ISysParamService;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Service
@ -40,416 +32,295 @@ import java.util.Optional;
@Slf4j
public class WmsToAcsServiceImpl implements WmsToAcsService {
// @Autowired
// private StorageCellMapper storageCellMapper;
//
// @Autowired
// private DeviceAppService deviceAppService;
//
// @Autowired
// private LuceneExecuteLogService luceneExecuteLogService;
//
// @Autowired
// private AcsToLiKuService acsToLiKuService;
//
// @Autowired
// private TaskService taskserver;
//
//
// private String log_file_type = "log_file_type";
// private String log_type = "LMS请求ACS";
//
// @Override
// public CreateTaskResponse crateTask(String param) {
// try {
// MDC.put(log_file_type, log_type);
// log.info("crateTask-----输入参数{}", param);
// JSONArray datas = JSONArray.parseArray(param);
// CreateTaskResponse response = new CreateTaskResponse();
//// ParamService paramService = SpringContextHolder.getBean(ParamService.class);
// ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
//// String cancelTaskCheck = paramService.findByCode(AcsConfig.ISALLOWTASK).getValue();
// JSONArray errArr = new JSONArray();
//// if (StrUtil.equals(cancelTaskCheck, "0")) {
//// response.setStatus(400);
//// response.setMessage("ACS系统需要更新,请稍等");
//// response.setErrArr(datas);
//// return response;
//// }
// for (int i = 0; i < datas.size(); i++) {
// String data = datas.get(i).toString();
// CreateTaskRequest request = JSON.parseObject(data, CreateTaskRequest.class);
// String paper_array = request.getPaper_array();
// String ext_task_id = request.getExt_task_id();
// String task_code = request.getTask_code();
// String start_device_code = request.getStart_device_code();
// String start_device_code2 = request.getStart_device_code2();
// String next_device_code = request.getNext_device_code();
// String next_device_code2 = request.getNext_device_code2();
// String put_device_code = request.getPut_device_code();
// String priority = request.getPriority();
// String vehicle_code = request.getVehicle_code();
// String vehicle_type = request.getVehicle_type();
// String route_plan_code = request.getRoute_plan_code();
// String task_type = request.getTask_type();
// String truss_type = request.getTruss_type();
// String empty_site = request.getEmpty_site();
// String is_bushing = request.getIs_bushing();
// String is_pulling = request.getIs_pulling();
// String size = request.getSize();
// String version = request.getVersion();
// String bushing_num = request.getBushing_num();
// String storage_task_type = request.getDtl_type();
// String agv_system_type = request.getAgv_system_type();
// String remark = request.getRemark();
// double oven_time = 0.00d;
// if (StrUtil.isNotEmpty(request.getOven_time())) {
// oven_time = Double.parseDouble(request.getOven_time());
// }
// String temperature = request.getTemperature();
// String start_height = request.getStart_height();
// String next_height = request.getNext_height();
// String params2 = request.getParams2();
// Map<String, String> params = request.getParams();
//
// String start_point_code = "";
// String start_point_code2 = "";
// String next_point_code = "";
// String next_point_code2 = "";
// String put_point_code = "";
// if (StrUtil.isEmpty(task_code)) {
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", "任务号不能为空");
// errArr.add(json);
// continue;
// }
// if (StrUtil.isEmpty(start_device_code)) {
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", "起点不能为空");
// errArr.add(json);
// continue;
// }
// if (StrUtil.isEmpty(next_device_code)) {
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", "终点不能为空");
// errArr.add(json);
// continue;
// }
//
// if (StrUtil.equals(task_type, "8")) {
// next_device_code = request.getPut_device_code();
// put_device_code = request.getNext_device_code();
// }
//
// StorageCell start_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
// .eq(StorageCell::getStorage_code, start_device_code)
// .one();
// StorageCell next_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
// .eq(StorageCell::getStorage_code, next_device_code)
// .one();
// StorageCell start2_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
// .eq(StorageCell::getStorage_code, start_device_code2)
// .one();
// StorageCell next2_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
// .eq(StorageCell::getStorage_code, next_device_code2)
// .one();
// StorageCell put_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
// .eq(StorageCell::getStorage_code, put_device_code)
// .one();
//
// JSONObject start_device_json = (JSONObject) JSONObject.toJSON(start_storageCell);
// if (!ObjectUtil.isEmpty(start_device_json)) {
// start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code");
// }
// JSONObject next_device_json = (JSONObject) JSONObject.toJSON(next_storageCell);
// if (!ObjectUtil.isEmpty(next_device_json)) {
// next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
// }
// JSONObject start_device_json2 = (JSONObject) JSONObject.toJSON(start2_storageCell);
// if (!ObjectUtil.isEmpty(start_device_json2)) {
// start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json2.get("storage_code");
// }
// JSONObject next_device_json2 = (JSONObject) JSONObject.toJSON(next2_storageCell);
// if (!ObjectUtil.isEmpty(next_device_json2)) {
// next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_device_code2 : (String) next_device_json2.get("storage_code");
// }
// JSONObject put_device_json = (JSONObject) JSONObject.toJSON(put_storageCell);
// if (!ObjectUtil.isEmpty(put_device_json)) {
// put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code");
// }
// if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) {
// String str[] = start_point_code.split("-");
// start_device_code = str[0];
// } else {
// start_device_code = start_point_code;
// }
//
// if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) {
// String str[] = next_point_code.split("-");
// next_device_code = str[0];
// } else {
// next_device_code = next_point_code;
// }
//
// if (StrUtil.isNotEmpty(start_point_code2) && start_point_code2.indexOf("-") > 0) {
// String str[] = start_point_code2.split("-");
// start_device_code2 = str[0];
// } else {
// start_device_code2 = start_point_code2;
// }
//
// if (StrUtil.isNotEmpty(next_point_code2) && next_point_code2.indexOf("-") > 0) {
// String str[] = next_point_code2.split("-");
// next_device_code2 = str[0];
// } else {
// next_device_code2 = next_point_code2;
// }
//
// if (StrUtil.isNotEmpty(put_point_code) && put_point_code.indexOf("-") > 0) {
// String str[] = put_point_code.split("-");
// put_device_code = str[0];
// } else {
// put_device_code = put_point_code;
// }
//
// if (StrUtil.isEmpty(route_plan_code)) {
// route_plan_code = "normal";
// }
//
// if (StrUtil.equals(task_type, "5")) {
// if (taskserver.querySameDeviceReadyTask(start_device_code, next_device_code, "0") > 1) {
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", "已存在相同的起点:" + start_device_code + "终点:" + next_device_code + "未执行的输送任务");
// errArr.add(json);
// continue;
// }
// }
//
// TaskDto taskDto = taskserver.findByCodeFromCache(task_code);
// if (taskDto != null) {
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", "存在相同的任务号:" + task_code);
// errArr.add(json);
// continue;
// }
// if (!StrUtil.isEmpty(vehicle_code)) {
// TaskDto vehicle_dto = taskserver.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("message", "已存在任务编号为" + vehicle_dto.getTask_code() + "托盘号:" + vehicle_code);
// errArr.add(json);
// continue;
// }
// }
//
// if (StrUtil.isEmpty(start_point_code)) {
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", request.getStart_device_code() + " 该设备号未找到对应点位");
// errArr.add(json);
// continue;
// }
// if (StrUtil.isEmpty(next_point_code)) {
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", request.getNext_device_code() + " 该设备号未找到对应点位");
// errArr.add(json);
// continue;
// }
//
// JSONObject jo = new JSONObject();
// jo.put("task_id", IdUtil.simpleUUID());
// jo.put("task_code", task_code);
// jo.put("start_point_code", start_point_code);
// jo.put("next_point_code", next_point_code);
// jo.put("start_point_code2", start_point_code2);
// jo.put("next_point_code2", next_point_code2);
// jo.put("put_point_code", put_point_code);
// jo.put("start_parent_code", start_point_code);
// jo.put("next_parent_code", next_point_code);
// jo.put("start_device_code", start_device_code);
// jo.put("next_device_code", next_device_code);
// jo.put("start_device_code2", start_device_code2);
// jo.put("next_device_code2", next_device_code2);
// jo.put("put_device_code", put_device_code);
// jo.put("priority", priority);
// jo.put("vehicle_code", vehicle_code);
// jo.put("vehicle_type", vehicle_type);
// jo.put("storage_task_type", storage_task_type);
// jo.put("agv_system_type", agv_system_type);
// jo.put("start_height", start_height);
// jo.put("next_height", next_height);
// jo.put("oven_time", (int) Math.ceil(oven_time));
// jo.put("remark", remark);
// jo.put("params", params);
// jo.put("params2", params2);
// jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
// jo.put("paper_array", JSONUtil.toJsonStr(paper_array));
// jo.put("truss_type", JSONUtil.toJsonStr(truss_type));
// jo.put("empty_site", JSONUtil.toJsonStr(empty_site));
// jo.put("is_bushing", JSONUtil.toJsonStr(is_bushing));
// jo.put("is_pulling", JSONUtil.toJsonStr(is_pulling));
// jo.put("size", JSONUtil.toJsonStr(size));
// jo.put("version", JSONUtil.toJsonStr(version));
// jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num));
//
//
// if (!StrUtil.isEmpty(ext_task_id)) {
// jo.put("ext_task_id", ext_task_id);
// }
//
// TaskDto task_dto = jo.toJavaObject(TaskDto.class);
// try {
// if (ObjectUtil.isNotEmpty(request.getInteraction_json())) {
// task_dto.setInteractionJson(request.getInteraction_json());
// }
// taskserver.create(task_dto);
//
// } catch (Exception e) {
//// e.printStackTrace();
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("ext_task_id", ext_task_id);
// json.put("message", e.getMessage());
// errArr.add(json);
// continue;
// }
// }
// if (ObjectUtil.isEmpty(errArr)) {
// response.setStatus(200);
// response.setMessage("success");
// } else {
// response.setStatus(400);
// if (ObjectUtil.isNotEmpty(errArr)) {
// response.setMessage(errArr.getJSONObject(0).getString("message"));
// } else {
// response.setMessage("false");
// }
// response.setErrArr(errArr);
// }
// log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
//
// return response;
// } finally {
// MDC.remove(log_file_type);
// }
// }
//
// @Override
// public org.nl.acs.ext.wms.data.one.CreateTaskResponse crateTask(List<org.nl.acs.ext.wms.data.one.CreateTaskRequest> reqs) {
// return null;
// }
//
// @Override
// public org.nl.acs.ext.wms.data.one.CancelTaskResponse cancelFromWms(List<org.nl.acs.ext.wms.data.one.CancelTaskRequest> reqs) throws Exception {
// return null;
// }
//
// @Override
// public JSONObject switchInOut(JSONObject reqs) {
// Assert.notNull(reqs);
// String device_code = reqs.getString("device_code");
// if (StrUtil.isBlank(device_code)) {
// throw new BadRequestException("设备号不能为空!");
// }
// String type = reqs.getString("type");
// if (StrUtil.isBlank(type)) {
// throw new BadRequestException("出入库类型不能为空!");
// }
// Device device = deviceAppService.findDeviceByCode(device_code);
// String belongToConveyorDeviceCode = Optional.ofNullable(device.getExtraValue().get("belongToConveyor")).map(Object::toString).orElse(null);
// Device belongToConveyorDevice = deviceAppService.findDeviceByCode(belongToConveyorDeviceCode);
// if (belongToConveyorDevice != null && belongToConveyorDevice.getDeviceDriver() instanceof StripConveyorDeviceDriver) {
// StripConveyorDeviceDriver stripConveyorDeviceDriver = (StripConveyorDeviceDriver) belongToConveyorDevice.getDeviceDriver();
// //切换为入库
// if ("1".equals(type)) {
// String samePoint = Optional.ofNullable(device.getExtraValue().get("samePoint")).map(Object::toString).orElse(null);
// TaskDto taskDto;
// if (StrUtil.isNotEmpty(samePoint)) {
// taskDto = taskserver.findByNextCode(samePoint);
// } else {
// taskDto = taskserver.findByNextCode(device_code);
// }
// if (ObjectUtil.isNotEmpty(taskDto)) {
// throw new BadRequestException("ACS存在出库任务,无法切换为入库模式");
// }
// if (stripConveyorDeviceDriver.getInOutMode() == 0) {
// throw new BadRequestException("已经是入库模式,无法再次切换为入库模式");
// } else {
// if (stripConveyorDeviceDriver.getSwitchInOut() == 0) {
// throw new BadRequestException("输送线不允许切换为入库模式");
// }
// }
// stripConveyorDeviceDriver.writing("toCommand", 0);
// }
// //切换为出库
// else if ("2".equals(type)) {
// String samePoint = Optional.ofNullable(device.getExtraValue().get("samePoint")).map(Object::toString).orElse(null);
// TaskDto taskDto;
// if (StrUtil.isNotEmpty(samePoint)) {
// taskDto = taskserver.findByStartCode(samePoint);
// } else {
// taskDto = taskserver.findByStartCode(device_code);
// }
// if (ObjectUtil.isNotEmpty(taskDto)) {
// throw new BadRequestException("ACS存在入库任务,无法切换为出库模式");
// }
// if (stripConveyorDeviceDriver.getInOutMode() == 1) {
// throw new BadRequestException("已经是出库模式,无法再次切换为出库模式");
// } else {
// if (stripConveyorDeviceDriver.getSwitchInOut() == 0) {
// throw new BadRequestException("输送线不允许切换为出库模式");
// }
// }
// stripConveyorDeviceDriver.writing("toCommand", 1);
// }
// }
// JSONObject resp = new JSONObject();
// resp.put("status", 200);
// resp.put("message", "切换出入库模式成功");
// return null;
// }
//
// @Override
// public JSONObject pinkStartStop(JSONObject reqs) {
// Assert.notNull(reqs);
// JSONObject resp = new JSONObject();
// String device_code = reqs.getString("device_code");
// if (StrUtil.isBlank(device_code)) {
// throw new BadRequestException("设备号不能为空!");
// }
// String type = reqs.getString("type");
// if (StrUtil.isEmpty(type)) {
// throw new BadRequestException("启停类型不能为空!");
// }
// Device device = deviceAppService.findDeviceByCode(device_code);
// if (device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
// AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
// if ("1".equals(type)) {
// appearanceInspectionScannerConveyorDeviceDriver.writing("mode", 2);
// } else {
// appearanceInspectionScannerConveyorDeviceDriver.writing("mode", 0);
// }
// } else {
// throw new BadRequestException("设备不存在");
// }
// resp.put("status", 200);
// resp.put("message", "切换成功");
// return resp;
// }
@Autowired
private StorageCellMapper storageCellMapper;
@Autowired
private DeviceAppService deviceAppService;
@Autowired
private TaskService taskserver;
@Override
public JSONObject crateTask(JSONObject req) {
log.info("createFromWms--------------:输入参数:" + JSON.toJSONString(req));
try {
JSONArray datas = req.getJSONArray("tasks");
JSONArray errArr = new JSONArray();
for (int i = 0; i < datas.size(); i++) {
JSONObject task = datas.getJSONObject(i);
String ext_task_id = task.getString("ext_task_id");
String task_code = task.getString("task_code");
String start_device_code = task.getString("start_device_code");
String next_device_code = task.getString("next_device_code");
String put_device_code = task.getString("put_device_code");
String priority = task.getString("priority");
String vehicle_code = task.getString("vehicle_code");
String vehicle_type = task.getString("vehicle_type");
String route_plan_code = task.getString("route_plan_code");
String task_type = task.getString("task_type");
String remark = task.getString("remark");
String storage_task_type = task.getString("storage_task_type");
String agv_system_type = task.getString("agv_system_type");
JSONObject param = task.getJSONObject("param");
String start_point_code = "";
String next_point_code = "";
String put_point_code = "";
if (StrUtil.isEmpty(task_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "任务号不能为空");
errArr.add(json);
continue;
}
if (StrUtil.isEmpty(start_device_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "起点不能为空");
errArr.add(json);
continue;
}
if (StrUtil.isEmpty(next_device_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "终点不能为空");
errArr.add(json);
continue;
}
StorageCell start_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, start_device_code)
.one();
StorageCell next_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, next_device_code)
.one();
StorageCell put_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, put_device_code)
.one();
JSONObject start_device_json = (JSONObject) JSONObject.toJSON(start_storageCell);
if (!ObjectUtil.isEmpty(start_device_json)) {
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code");
}
JSONObject next_device_json = (JSONObject) JSONObject.toJSON(next_storageCell);
if (!ObjectUtil.isEmpty(next_device_json)) {
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
}
JSONObject put_device_json = (JSONObject) JSONObject.toJSON(put_storageCell);
if (!ObjectUtil.isEmpty(put_device_json)) {
put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code");
}
if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) {
String str[] = start_point_code.split("-");
start_device_code = str[0];
} else {
start_device_code = start_point_code;
}
if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) {
String str[] = next_point_code.split("-");
next_device_code = str[0];
} else {
next_device_code = next_point_code;
}
if (StrUtil.isNotEmpty(put_point_code) && put_point_code.indexOf("-") > 0) {
String str[] = put_point_code.split("-");
put_device_code = str[0];
} else {
put_device_code = put_point_code;
}
if (StrUtil.isEmpty(route_plan_code)) {
route_plan_code = "normal";
}
TaskDto taskDto = taskserver.findByCodeFromCache(task_code);
if (taskDto != null) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "存在相同的任务号:" + task_code);
errArr.add(json);
continue;
}
if (!StrUtil.isEmpty(vehicle_code)) {
TaskDto vehicle_dto = taskserver.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("message", "已存在任务编号为" + vehicle_dto.getTask_code() + "托盘号:" + vehicle_code);
errArr.add(json);
continue;
}
}
if (StrUtil.isEmpty(start_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", start_device_code + " 该设备号未找到对应点位");
errArr.add(json);
continue;
}
if (StrUtil.isEmpty(next_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", next_device_code + " 该设备号未找到对应点位");
errArr.add(json);
continue;
}
JSONObject jo = new JSONObject();
jo.put("task_id", IdUtil.simpleUUID());
jo.put("task_code", task_code);
jo.put("start_point_code", start_point_code);
jo.put("next_point_code", next_point_code);
jo.put("put_point_code", put_point_code);
jo.put("start_parent_code", start_point_code);
jo.put("next_parent_code", next_point_code);
jo.put("start_device_code", start_device_code);
jo.put("next_device_code", next_device_code);
jo.put("put_device_code", put_device_code);
jo.put("priority", priority);
jo.put("vehicle_code", vehicle_code);
jo.put("vehicle_type", vehicle_type);
jo.put("agv_system_type", agv_system_type);
jo.put("storage_task_type", storage_task_type);
jo.put("remark", remark);
jo.put("params", param);
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
if (!StrUtil.isEmpty(ext_task_id)) {
jo.put("ext_task_id", ext_task_id);
}
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try {
taskserver.create(task_dto);
} catch (Exception e) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", e.getMessage());
errArr.add(json);
continue;
}
}
JSONObject resp = new JSONObject();
if (ObjectUtil.isEmpty(errArr)) {
resp.put("code", "200");
resp.put("msg", "success");
} else {
resp.put("code", "400");
if (ObjectUtil.isNotEmpty(errArr)) {
resp.put("msg", errArr.getJSONObject(0).getString("message"));
} else {
resp.put("msg", "false");
}
resp.put("errArr", errArr);
}
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(resp));
return resp;
} finally {
}
}
@Override
public JSONObject switchInOut(JSONObject reqs) {
Assert.notNull(reqs);
String device_code = reqs.getString("device_code");
if (StrUtil.isBlank(device_code)) {
throw new BadRequestException("设备号不能为空!");
}
String type = reqs.getString("type");
if (StrUtil.isBlank(type)) {
throw new BadRequestException("出入库类型不能为空!");
}
Device device = deviceAppService.findDeviceByCode(device_code);
String belongToConveyorDeviceCode = Optional.ofNullable(device.getExtraValue().get("belongToConveyor")).map(Object::toString).orElse(null);
Device belongToConveyorDevice = deviceAppService.findDeviceByCode(belongToConveyorDeviceCode);
if (belongToConveyorDevice != null && belongToConveyorDevice.getDeviceDriver() instanceof StripConveyorDeviceDriver) {
StripConveyorDeviceDriver stripConveyorDeviceDriver = (StripConveyorDeviceDriver) belongToConveyorDevice.getDeviceDriver();
//切换为入库
if ("1".equals(type)) {
String samePoint = Optional.ofNullable(device.getExtraValue().get("samePoint")).map(Object::toString).orElse(null);
TaskDto taskDto;
if (StrUtil.isNotEmpty(samePoint)) {
taskDto = taskserver.findByNextCode(samePoint);
} else {
taskDto = taskserver.findByNextCode(device_code);
}
if (ObjectUtil.isNotEmpty(taskDto)) {
throw new BadRequestException("ACS存在出库任务,无法切换为入库模式");
}
if (stripConveyorDeviceDriver.getInOutMode() == 0) {
throw new BadRequestException("已经是入库模式,无法再次切换为入库模式");
} else {
if (stripConveyorDeviceDriver.getSwitchInOut() == 0) {
throw new BadRequestException("输送线不允许切换为入库模式");
}
}
stripConveyorDeviceDriver.writing("toCommand", 0);
}
//切换为出库
else if ("2".equals(type)) {
String samePoint = Optional.ofNullable(device.getExtraValue().get("samePoint")).map(Object::toString).orElse(null);
TaskDto taskDto;
if (StrUtil.isNotEmpty(samePoint)) {
taskDto = taskserver.findByStartCode(samePoint);
} else {
taskDto = taskserver.findByStartCode(device_code);
}
if (ObjectUtil.isNotEmpty(taskDto)) {
throw new BadRequestException("ACS存在入库任务,无法切换为出库模式");
}
if (stripConveyorDeviceDriver.getInOutMode() == 1) {
throw new BadRequestException("已经是出库模式,无法再次切换为出库模式");
} else {
if (stripConveyorDeviceDriver.getSwitchInOut() == 0) {
throw new BadRequestException("输送线不允许切换为出库模式");
}
}
stripConveyorDeviceDriver.writing("toCommand", 1);
}
}
JSONObject resp = new JSONObject();
resp.put("status", 200);
resp.put("message", "切换出入库模式成功");
return resp;
}
@Override
public JSONObject pinkStartStop(JSONObject reqs) {
Assert.notNull(reqs);
JSONObject resp = new JSONObject();
String device_code = reqs.getString("device_code");
if (StrUtil.isBlank(device_code)) {
throw new BadRequestException("设备号不能为空!");
}
String type = reqs.getString("type");
if (StrUtil.isEmpty(type)) {
throw new BadRequestException("启停类型不能为空!");
}
Device device = deviceAppService.findDeviceByCode(device_code);
if (device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
if ("1".equals(type)) {
appearanceInspectionScannerConveyorDeviceDriver.writing("mode", 2);
} else {
appearanceInspectionScannerConveyorDeviceDriver.writing("mode", 0);
}
} else {
throw new BadRequestException("设备不存在");
}
resp.put("status", 200);
resp.put("message", "切换成功");
return resp;
}
}

8
nladmin-system/nlsso-server/src/main/java/org/nl/common/base/TableDataInfo.java

@ -32,7 +32,7 @@ public class TableDataInfo<T> implements Serializable {
/**
* 消息状态码
*/
private int code;
private String code;
/**
* 消息内容
@ -52,7 +52,7 @@ public class TableDataInfo<T> implements Serializable {
public static <T> TableDataInfo<T> build(IPage<T> page) {
TableDataInfo<T> rspData = new TableDataInfo<>();
rspData.setCode(HttpStatus.HTTP_OK);
rspData.setCode(String.valueOf(HttpStatus.HTTP_OK));
rspData.setMsg("查询成功");
rspData.setContent(page.getRecords());
rspData.setTotalElements(page.getTotal());
@ -61,7 +61,7 @@ public class TableDataInfo<T> implements Serializable {
public static <T> TableDataInfo<T> build(List<T> list) {
TableDataInfo<T> rspData = new TableDataInfo<>();
rspData.setCode(HttpStatus.HTTP_OK);
rspData.setCode(String.valueOf(HttpStatus.HTTP_OK));
rspData.setMsg("查询成功");
rspData.setContent(list);
rspData.setTotalElements(list.size());
@ -70,7 +70,7 @@ public class TableDataInfo<T> implements Serializable {
public static <T> TableDataInfo<T> build() {
TableDataInfo<T> rspData = new TableDataInfo<>();
rspData.setCode(HttpStatus.HTTP_OK);
rspData.setCode(String.valueOf(HttpStatus.HTTP_OK));
rspData.setMsg("查询成功");
return rspData;
}

2
nladmin-ui/src/i18n/langs/monitor/en.js

@ -120,7 +120,7 @@ export default {
'barcode_length': 'Vehicle length',
'last_container': 'Last vehicle number',
'applySucess': 'Request task flag',
'requireSucess': 'Request instruction mark'
'requireSuccess': 'Request instruction mark'
}
}

2
nladmin-ui/src/i18n/langs/monitor/in.js

@ -120,7 +120,7 @@ export default {
'barcode_length': 'Perjalanan panjang',
'last_container': 'Nomor muatan terakhir',
'applySucess': 'Meminta tanda tugas',
'requireSucess': 'Kode aplikasicomment'
'requireSuccess': 'Kode aplikasicomment'
}
}

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

@ -120,7 +120,7 @@ export default {
'barcode_length': '载具长度',
'last_container': '上次载具号',
'applySucess': '请求任务标记',
'requireSucess': '申请指令标记'
'requireSuccess': '请求标记'
}
}
}

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

@ -198,6 +198,11 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="扫码申请AGV任务:" label-width="150px">
<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" />
@ -301,7 +306,7 @@
filterable
clearable
reserve-keyword
placeholder="所属输送线"
placeholder="关联出入点"
style="width: 170px"
>
<el-option
@ -497,7 +502,9 @@ export default {
toWay: false,
belongToConveyor: null,
linkInOutDevice: '',
samePoint: false
samePoint: false,
scanApplyTask: false,
applyTask: false
},
rules: {}
}

534
nladmin-ui/src/views/system/monitor/device/index.vue

@ -37,7 +37,8 @@
/>
</el-table>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<!--输送线弹出框-->
<el-dialog :title="$t('monitor.click.device_setup')" :visible.sync="dialogFormVisible" width="35%">
<el-form :model="form" size="small">
<el-form-item :label="$t('monitor.click.equipment_number')" prop="device_code" label-width="120px">
@ -46,10 +47,10 @@
<el-form-item :label="$t('monitor.click.bar_code')" label-width="120px">
<el-input v-model="form.hand_barcode" :disabled="false" />
</el-form-item>
<el-form-item :label="$t('monitor.click.request_flag')" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0">{{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('auto.common.true') }}</el-radio-button>
<el-form-item :label="$t('monitor.click.requireSuccess')" prop="requireSuccess" label-width="120px">
<el-radio-group v-model="requireSuccessDisplay">
<el-radio-button :label="false">{{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="true">{{ $t('auto.common.true') }}</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
@ -58,136 +59,9 @@
<el-button type="primary" @click="dialogSave">{{ $t('auto.common.Confirm') }}</el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog :title="$t('monitor.click.device_setup')" :visible.sync="dialogFormVisible3" width="35%">
<el-form :model="form" size="small">
<el-form-item :label="$t('monitor.click.equipment_number')" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item :label="$t('monitor.click.device_status')" label-width="80px">
<el-radio-group v-model="form.hasGoodStatus">
<el-radio-button :label="0">{{ $t('monitor.click.out_of_stock') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('monitor.click.with_pallets') }}</el-radio-button>
<el-radio-button :label="2">{{ $t('monitor.click.pallets_and_goods') }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('monitor.click.material_code')" prop="material_type" label-width="80px">
<el-input v-model="form.material_type" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible3 = false">{{ $t('auto.common.Cancel') }}</el-button>
<el-button type="primary" @click="dialogSave">{{ $t('auto.common.Confirm') }}</el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog :title="$t('monitor.click.device_setup')" :visible.sync="dialogFormVisible4" width="35%">
<el-form :model="form" size="small">
<el-form-item :label="$t('monitor.click.equipment_number')" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item :label="$t('monitor.click.disabled_manipulator')" prop="is_disable" label-width="120px">
<el-radio-group v-model="form.is_disable">
<el-radio-button :label="0">{{ $t('monitor.click.normal') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('monitor.click.forbidden') }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('monitor.click.request_flag')" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"> {{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('auto.common.true') }}</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible4 = false">{{ $t('auto.common.Cancel') }}</el-button>
<el-button type="primary" @click="dialogSave">{{ $t('auto.common.Confirm') }}</el-button>
</div>
</el-dialog>
<el-dialog :title="$t('monitor.click.device_setup')" :visible.sync="dialogFormVisible5" width="35%">
<el-form :model="form" size="small">
<el-form-item :label="$t('monitor.click.equipment_number')" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item :label="$t('monitor.click.request_flag')" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"> {{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('auto.common.true') }}</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible5 = false">{{ $t('auto.common.Cancel') }}</el-button>
<el-button type="primary" @click="dialogSave">{{ $t('auto.common.Confirm') }}</el-button>
</div>
</el-dialog>
<el-dialog :title="$t('monitor.click.device_setup')" :visible.sync="dialogFormVisible7" width="35%">
<el-form :model="form" size="small">
<el-form-item :label="$t('monitor.click.equipment_number')" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item :label="$t('monitor.click.bar_code')" label-width="120px">
<el-input v-model="form.hand_barcode" :disabled="false" />
</el-form-item>
<el-form-item :label="$t('monitor.click.request_flag')" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"> {{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('auto.common.true') }}</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible7 = false">{{ $t('auto.common.Cancel') }}</el-button>
<el-button type="primary" @click="dialogSave">{{ $t('auto.common.Confirm') }}</el-button>
</div>
</el-dialog>
<el-dialog :title="$t('monitor.click.device_setup')" :visible.sync="dialogFormVisible6" width="35%">
<el-form :model="form" size="small">
<el-form-item :label="$t('monitor.click.equipment_number')" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="申请指令标记" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"> {{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('auto.common.true') }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="请求任务标记" prop="applySucess" label-width="120px">
<el-radio-group v-model="form.applySucess">
<el-radio-button :label="0"> {{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('auto.common.true') }}</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible5 = false">{{ $t('auto.common.Cancel') }}</el-button>
<el-button type="primary" @click="dialogSave">{{ $t('auto.common.Confirm') }}</el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog :title="$t('monitor.click.device_setup')" :visible.sync="dialogFormVisible1" width="35%">
<el-form :model="form" size="small">
<el-form-item :label="$t('monitor.click.equipment_number')" prop="device_code" label-width="80px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item :label="$t('monitor.click.bar_code')" prop="device_code" label-width="80px">
<el-input v-model="form.barcode" :disabled="false" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false">{{ $t('auto.common.Cancel') }}</el-button>
<el-button type="primary" @click="saveBarcode">{{ $t('auto.common.Confirm') }}</el-button>
</div>
</el-dialog>
<!-- 堆垛机弹出框 -->
<el-dialog :title="$t('monitor.click.device_setup')" :visible.sync="dialogFormVisible8" width="35%">
<el-dialog :title="$t('monitor.click.device_setup')" :visible.sync="dialogFormVisible2" width="35%">
<el-form :model="form" size="small">
<el-form-item :label="$t('monitor.click.equipment_number')" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
@ -208,15 +82,21 @@
<el-form-item :label="$t('monitor.click.stop_task')" prop="stopReceiveTask" label-width="120px">
<el-switch v-model="form.stopReceiveTask" />
</el-form-item>
<el-form-item :label="$t('monitor.click.requireSucess')" prop="requireSuccess" label-width="120px">
<el-radio-group v-model="form.requireSuccess">
<el-radio-button :label="0"> {{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('auto.common.true') }}</el-radio-button>
<el-form-item :label="$t('monitor.click.requireSuccess')" prop="requireSuccess" label-width="120px">
<el-radio-group v-model="requireSuccessDisplay">
<el-radio-button :label="false">{{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="true">{{ $t('auto.common.true') }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="异常请求标记" prop="againRequireSuccessDisplay" label-width="120px">
<el-radio-group v-model="againRequireSuccessDisplay">
<el-radio-button :label="false">{{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="true">{{ $t('auto.common.true') }}</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible8 = false">{{ $t('auto.common.Cancel') }}</el-button>
<el-button @click="dialogFormVisible2 = false">{{ $t('auto.common.Cancel') }}</el-button>
<el-button type="primary" @click="dialogSave">{{ $t('auto.common.Confirm') }}</el-button>
</div>
</el-dialog>
@ -248,16 +128,7 @@ export default {
stageSelectList: [],
arr: [], //
dialogFormVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
dialogFormVisible5: false,
dialogFormVisible6: false,
dialogFormVisible7: false,
dialogFormVisible8: false,
dialogFormVisible9: false,
dialogFormVisible10: false,
Stages: [],
stage_code: '',
form: {
@ -265,23 +136,36 @@ export default {
hasGoodStatus: null,
barcode: '',
hand_barcode: '',
suspended: null,
material_type: '',
requireSucess: '',
fullrequireSucess: '',
is_disable: '',
applySucess: '',
toCommand: null,
prohibitInWarehouse: false,
prohibitOutWarehouse: false,
stopReceiveTask: false,
requireSuccess: false
requireSuccess: false,
againRequireSuccess: false
},
allDeviceMsg: [],
msgTop: '200px',
msgLeft: '200px'
}
},
computed: {
requireSuccessDisplay: {
get() {
return this.form.requireSuccess === true
},
set(newValue) {
this.form.requireSuccess = !!newValue
}
},
againRequireSuccessDisplay: {
get() {
return this.form.againRequireSuccess === true
},
set(newValue) {
this.form.againRequireSuccess = !!newValue
}
}
},
created() {
selectStageList().then(data => {
this.Stages = data
@ -393,30 +277,8 @@ export default {
if (clickObj.data.device_type === 'scanner') { //
this.dialogFormVisible1 = true
} else {
console.log(clickObj.data.driver_type)
if (clickObj.data.driver_type === 'standard_ordinary_site') {
this.dialogFormVisible3 = true
} else if (clickObj.data.driver_type === 'hailiang_packer_station') {
this.dialogFormVisible4 = true
} else if (clickObj.data.driver_type === 'hailiang_xj_plc_test') {
this.$refs.child1.setForm(clickObj)
} else if (clickObj.data.driver_type === 'slit_two_manipulator') {
this.dialogFormVisible4 = true
} else if (clickObj.data.driver_type === 'siemens_conveyor') {
// if (clickObj.data.device_name.includes('1016')) {
// this.dialogFormVisible7 = true
// } else {
// this.dialogFormVisible5 = true
// }
this.dialogFormVisible7 = true
} else if (clickObj.data.driver_type === 'siemens_conveyor_ckk') {
this.dialogFormVisible7 = true
} else if (clickObj.data.driver_type === 'standard_conveyor_control_with_scanner') {
this.dialogFormVisible6 = true
} else if (clickObj.data.driver_type === 'standard_stacker_device') {
this.dialogFormVisible8 = true
} else if (clickObj.data.driver_type === 'pull_head_manipulator') {
this.dialogFormVisible9 = true
if (clickObj.data.driver_type === 'standard_stacker_device') {
this.dialogFormVisible2 = true
} else {
this.dialogFormVisible = true
}
@ -424,18 +286,13 @@ export default {
this.form.angle = clickObj.angle
this.form.index = clickObj.index
this.form.device_code = clickObj.device_code
this.form.hasGoodStatus = clickObj.data.hasGoods
this.form.material_type = clickObj.data.material_type
this.form.requireSucess = clickObj.data.requireSucess
this.form.fullrequireSucess = clickObj.data.fullrequireSucess
this.form.is_disable = clickObj.data.is_disable1
this.form.applySucess = clickObj.data.applySucess
this.form.barcode = clickObj.data.barcode
this.form.hand_barcode = clickObj.data.hand_barcode
this.form.hand_barcode = clickObj.data.handBarcode
this.form.prohibitInWarehouse = clickObj.data.prohibitInWarehouse
this.form.prohibitOutWarehouse = clickObj.data.prohibitOutWarehouse
this.form.stopReceiveTask = clickObj.data.stopReceiveTask
this.form.requireSuccess = clickObj.data.requireSuccess
this.form.againRequireSuccess = clickObj.data.againRequireSuccess
this.form.toCommand = null
console.log(this.form)
},
@ -449,7 +306,7 @@ export default {
}
this.arr = [] //
if (item.device_code && item.data) {
// console.log('item', item)
console.log('item', item)
this.arr = [
{ name: i18n.t('monitor.click.equipment_number'), value: item.device_code },
{ name: i18n.t('monitor.click.device_name'), value: item.device_name }
@ -463,7 +320,6 @@ export default {
const obj = { name: i18n.t('monitor.click.device_information'), value: data[val] }
this.arr.push(obj)
}
if (val === 'message' && data.isError === 'false') {
const obj = { name: i18n.t('monitor.click.exception_message'), value: data[val] }
this.arr.push(obj)
@ -481,196 +337,101 @@ export default {
} else if (val === 'ip') {
const obj = { name: 'IP', value: data[val] }
this.arr.push(obj)
} else if (val === 'number') {
const obj = { name: i18n.t('monitor.click.pallet_quantity'), value: data[val] }
this.arr.push(obj)
} else if (val === 'inst_message') {
const obj = { name: i18n.t('monitor.click.instruction_information'), value: data[val] }
this.arr.push(obj)
} else if (val === 'message') {
const obj = { name: i18n.t('monitor.click.note_information'), value: data[val] }
this.arr.push(obj)
} else if (val === 'inst_message') {
const obj = { name: i18n.t('monitor.click.current_instruction_message'), value: data[val] }
this.arr.push(obj)
} else if (val === 'last_inst_message') {
const obj = { name: i18n.t('monitor.click.last_instruction_message'), value: data[val] }
this.arr.push(obj)
} else if (val === 'barcode') {
const obj = { name: i18n.t('monitor.click.barcode'), value: data[val] }
this.arr.push(obj)
} else if (val === 'barcode_length') {
const obj = { name: i18n.t('monitor.click.barcode_length'), value: data[val] }
this.arr.push(obj)
} else if (val === 'last_container') {
const obj = { name: i18n.t('monitor.click.last_container'), value: data[val] }
const obj = { name: i18n.t('monitor.click.barcode') + '(电气)', value: data[val] }
this.arr.push(obj)
} else if (val === 'instruction_code') {
const obj = { name: i18n.t('monitor.click.current_instruction_message'), value: data[val] }
} else if (val === 'inOutMode') {
const obj = { name: '出入库模式', value: data[val] }
this.arr.push(obj)
} else if (val === 'task_code') {
const obj = { name: i18n.t('monitor.click.task_number'), value: data[val] }
this.arr.push(obj)
} else if (val === 'last_instruction_code') {
const obj = { name: i18n.t('monitor.click.last_instruction_message'), value: data[val] }
} else if (val === 'move') {
const obj = { name: '光电信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'action') {
const obj = { name: i18n.t('monitor.click.action_signal'), value: data[val] }
this.arr.push(obj)
} else if (val === 'io_action') {
const obj = { name: i18n.t('monitor.click.clearance_signal'), value: data[val] }
this.arr.push(obj)
} else if (val === 'material') {
const obj = { name: i18n.t('monitor.click.materiel'), value: data[val] }
this.arr.push(obj)
} else if (val === 'batch') {
const obj = { name: i18n.t('monitor.click.lot'), value: data[val] }
this.arr.push(obj)
} else if (val === 'requestSucess') {
const obj = { name: i18n.t('monitor.click.request_task'), value: data[val] }
this.arr.push(obj)
} else if (val === 'applySucess') {
const obj = { name: i18n.t('monitor.click.request_order'), value: data[val] }
this.arr.push(obj)
} else if (val === 'requireApplyLabelingSuccess') {
const obj = { name: i18n.t('monitor.click.apply_labeling'), value: data[val] }
this.arr.push(obj)
} else if (val === 'requireApplyLaStrangulationSuccess') {
const obj = { name: i18n.t('monitor.click.apply_for_bundling'), value: data[val] }
this.arr.push(obj)
} else if (val === 'status') {
const obj = { name: i18n.t('monitor.click.device_status'), value: data[val] }
this.arr.push(obj)
} else if (val === 'weight') {
const obj = { name: i18n.t('monitor.click.weight'), value: data[val] }
this.arr.push(obj)
} else if (val === 'move_1') {
const obj = { name: i18n.t('monitor.click.front_station_photoelectric_signal'), value: data[val] }
this.arr.push(obj)
} else if (val === 'open') {
const obj = { name: i18n.t('monitor.click.open'), value: data[val] }
this.arr.push(obj)
} else if (val === 'close') {
const obj = { name: i18n.t('monitor.click.close'), value: data[val] }
this.arr.push(obj)
} else if (val === 'phase') {
const obj = { name: i18n.t('monitor.click.AGV_phase'), value: data[val] }
this.arr.push(obj)
} else if (val === 'phase_name') {
const obj = { name: i18n.t('monitor.click.description_of_the_AGV_phase'), value: data[val] }
this.arr.push(obj)
} else if (val === 'option') {
const obj = { name: i18n.t('monitor.click.AGV_action'), value: data[val] }
this.arr.push(obj)
} else if (val === 'agv_power') {
const obj = { name: i18n.t('monitor.click.AGV_power'), value: data[val] }
this.arr.push(obj)
} else if (val === 'move_2') {
const obj = { name: i18n.t('monitor.click.station_photoelectric_signal'), value: data[val] }
this.arr.push(obj)
} else if (val === 'action_1') {
const obj = { name: i18n.t('monitor.click.front_station_action_signal'), value: data[val] }
this.arr.push(obj)
} else if (val === 'action_2') {
const obj = { name: i18n.t('monitor.click.back_station_action_signal'), value: data[val] }
this.arr.push(obj)
} else if (val === 'walk_y') {
const obj = { name: i18n.t('monitor.click.walk_y'), value: data[val] }
this.arr.push(obj)
} else if (val === 'task1') {
const obj = { name: i18n.t('monitor.click.previous_station_task'), value: data[val] }
this.arr.push(obj)
} else if (val === 'task2') {
const obj = { name: i18n.t('monitor.click.back_station_task'), value: data[val] }
const obj = { name: '动作信号', value: data[val] }
this.arr.push(obj)
} else if (val === 'task') {
const obj = { name: i18n.t('monitor.click.task_number'), value: data[val] }
this.arr.push(obj)
} else if (val === 'is_disable') {
const obj = { name: i18n.t('monitor.click.disable'), value: data[val] }
this.arr.push(obj)
} else if (val === 'temperature') {
const obj = { name: i18n.t('monitor.click.current_temperature'), value: data[val] }
this.arr.push(obj)
} else if (val === 'finish') {
const obj = { name: i18n.t('monitor.click.oven_finish'), value: data[val] }
const obj = { name: '任务号', value: data[val] }
this.arr.push(obj)
} else if (val === 'countdown_house') {
const obj = { name: i18n.t('monitor.click.house'), value: data[val] }
} else if (val === 'weight') {
const obj = { name: '重量', value: data[val] }
this.arr.push(obj)
} else if (val === 'countdown_min') {
const obj = { name: i18n.t('monitor.click.minutes'), value: data[val] }
} else if (val === 'height') {
const obj = { name: '高度', value: data[val] }
this.arr.push(obj)
} else if (val === 'countdown_sec') {
const obj = { name: i18n.t('monitor.click.seconds'), value: data[val] }
} else if (val === 'prohibitInWarehouse') {
const obj = { name: '禁止入库', value: data[val] }
this.arr.push(obj)
} else if (val === 'door') {
const obj = { name: i18n.t('monitor.click.gate_state'), value: data[val] }
} else if (val === 'prohibitOutWarehouse') {
const obj = { name: '禁止出库', value: data[val] }
this.arr.push(obj)
} else if (val === 'notCreateTaskMessage') {
const obj = { name: i18n.t('monitor.click.task_creation_failure'), value: data[val] }
} else if (val === 'stopReceiveTask') {
const obj = { name: '停止接收任务', value: data[val] }
this.arr.push(obj)
} else if (val === 'notCreateInstMessage') {
const obj = { name: i18n.t('monitor.click.failed_to_create_instruction'), value: data[val] }
} else if (val === 'requireSuccess') {
const obj = { name: '请求标记', value: data[val] }
this.arr.push(obj)
} else if (val === 'feedMessage') {
const obj = { name: i18n.t('monitor.click.no_electrical_signal_feedback_cause'), value: data[val] }
} else if (val === 'againRequireSuccess') {
const obj = { name: '异常请求标记', value: data[val] }
this.arr.push(obj)
} else if (val === 'requireSucess') {
const obj = { name: i18n.t('monitor.click.request_success_flag'), value: data[val] }
} else if (val === 'front_command') {
const obj = { name: '前叉动作命令', value: data[val] }
this.arr.push(obj)
} else if (val === 'applySucess') {
const obj = { name: 'applySucess', value: data[val] }
} else if (val === 'front_task') {
const obj = { name: '前叉任务号', value: data[val] }
this.arr.push(obj)
} else if (val === 'out_finish') {
const obj = { name: i18n.t('monitor.click.delivery_completed'), value: data[val] }
} else if (val === 'front_Zerror') {
const obj = { name: '前叉报警信息', value: data[val] }
this.arr.push(obj)
} else if (val === 'inventory_qty') {
const obj = { name: i18n.t('monitor.click.inventory_quantity'), value: data[val] }
} else if (val === 'front_z') {
const obj = { name: '前叉行走排', value: data[val] }
this.arr.push(obj)
} else if (val === 'hand_barcode') {
const obj = { name: 'barcode', value: data[val] }
} else if (val === 'front_x') {
const obj = { name: '前叉行走列', value: data[val] }
this.arr.push(obj)
} else if (val === 'x') {
const obj = { name: 'X', value: data[val] }
} else if (val === 'front_y') {
const obj = { name: '前叉行走层', value: data[val] }
this.arr.push(obj)
} else if (val === 'y') {
const obj = { name: 'Y', value: data[val] }
} else if (val === 'back_command') {
const obj = { name: '后叉动作命令', value: data[val] }
this.arr.push(obj)
} else if (val === 'angle') {
const obj = { name: i18n.t('monitor.click.angle'), value: data[val] }
} else if (val === 'back_task') {
const obj = { name: '后叉任务号', value: data[val] }
this.arr.push(obj)
} else if (val === 'electricity') {
const obj = { name: i18n.t('monitor.click.electric_quantity'), value: data[val] }
} else if (val === 'back_Zerror') {
const obj = { name: '后叉报警信息', value: data[val] }
this.arr.push(obj)
} else if (val === 'status_name') {
const obj = { name: i18n.t('monitor.click.status'), value: data[val] }
} else if (val === 'back_z') {
const obj = { name: '后叉行走排', value: data[val] }
this.arr.push(obj)
} else if (val === 'fault') {
const obj = { name: i18n.t('monitor.click.abnormal'), value: data[val] }
} else if (val === 'back_x') {
const obj = { name: '后叉行走列', value: data[val] }
this.arr.push(obj)
} else if (val === 'map_id') {
const obj = { name: i18n.t('monitor.click.floor'), value: data[val] }
} else if (val === 'back_y') {
const obj = { name: '后叉行走层', value: data[val] }
this.arr.push(obj)
} else if (val === 'power') {
const obj = { name: i18n.t('monitor.click.electric_quantity'), value: data[val] }
} else if (val === 'strategy') {
const obj = { name: '堆垛机策略', value: data[val] }
this.arr.push(obj)
} else if (val === 'pallet') {
const obj = { name: i18n.t('monitor.click.tray'), value: data[val] }
} else if (val === 'unExecutedMessage') {
const obj = { name: '未执行任务原因', value: data[val] }
this.arr.push(obj)
} else if (val === 'load') {
const obj = { name: i18n.t('monitor.click.loading_or_not'), value: data[val] }
} else if (val === 'inOutMode') {
const obj = { name: '出入库模式', value: data[val] }
this.arr.push(obj)
} else if (val === 'alarm') {
const obj = { name: i18n.t('monitor.click.alarm'), value: data[val] }
} else if (val === 'switchInOut') {
const obj = { name: '允许切换出入模式', value: data[val] }
this.arr.push(obj)
} else if (val === 'task_id') {
const obj = { name: i18n.t('monitor.click.task_number'), value: data[val] }
} else if (val === 'handBarcode') {
const obj = { name: '载具号(补码)', value: data[val] }
this.arr.push(obj)
}
}
}
// console.log('arr:', this.arr)
console.log('11111')
console.log('arr:', this.arr)
},
initStatus() { // id
let resion = {}
@ -711,22 +472,11 @@ export default {
deviceCrud.changeDeviceStatus(this.form).then(res => {
this.$notify({ title: '操作成功', message: '', type: 'success' })
this.dialogFormVisible = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
this.dialogFormVisible5 = false
this.dialogFormVisible6 = false
this.dialogFormVisible7 = false
this.dialogFormVisible8 = false
this.dialogFormVisible9 = false
this.dialogFormVisible2 = false
this.initStageData()
}).catch(err => {
this.dialogFormVisible = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
this.dialogFormVisible5 = false
this.dialogFormVisible7 = false
this.dialogFormVisible8 = false
this.dialogFormVisible9 = false
this.dialogFormVisible2 = false
console.log(err.response.data.message)
})
},
@ -739,6 +489,16 @@ export default {
this.dialogFormVisible1 = false
console.log(err.response.data.message)
})
},
initStageData() {
//
if (this.stage_code !== '') {
crudStage.getNewStageDataByCode(this.stage_code).then(res => { // lf
data = JSON.parse(res.stage_data)
lf.render(data)
this.initStatus() //
})
}
}
}
}
@ -760,12 +520,74 @@ body {
height: 100%;
}
.newDialog /deep/ .el-dialog__header {
/deep/ .el-dialog {
background-color: transparent;
background-color: rgba(2, 11, 47, 0.9);
border: 1px solid #4dbeff;
box-shadow: inset 4px 4px 8px 0px rgba(77, 190, 255, .9), inset -4px -4px 8px 0px rgba(77, 190, 255, .9);
/* background-image: url('../../../../assets/images/kanban.svg'); */
background-repeat: no-repeat;
background-size: 100% 100%;
background-position: top center;
padding: 10px 14px;
}
/deep/ .el-dialog__header {
padding: 1vh 1vw 0 1vw;
border-bottom: 1px solid #395d6f;
background: linear-gradient(to right, #00b3ee 0%, rgba(2, 11, 47, 0.3) 30%, rgba(2, 11, 47, 0) 100%);
}
/deep/ .el-dialog__title {
font-size: 16px;
color: #fff;
}
/deep/ .el-dialog__body {
padding-top: 20px !important;
}
.newDialog /deep/ .el-dialog__body {
padding: 1vh 1vw;
/deep/ .el-form-item__label, /deep/ .el-dialog__headerbtn .el-dialog__close {
color: #fff;
}
/deep/ .el-input.is-disabled .el-input__inner, /deep/ .el-radio-button__inner {
background-color: #00557c;
border-color: #00b3ee;
color: #fff;
}
/deep/ .el-radio-button:first-child .el-radio-button__inner {
border-left-color: #00b3ee;
}
.newDialog /deep/ .el-dialog__body .el-table tr, .newDialog /deep/ .el-dialog__body .el-table .el-table__header-wrapper th, .newDialog /deep/ .el-dialog__body .el-table {
background-color: transparent;
}
.newDialog /deep/ .el-table--border, .newDialog /deep/ .el-table--border .el-table__cell {
border: 0;
color: #00afff;
}
.newDialog /deep/ .el-table::before {
height: 0;
}
.newDialog /deep/ .el-table--border::after {
width: 0;
}
.newDialog /deep/ .el-table_1_column_1, .newDialog /deep/ .el-table_2_column_3 {
color: #fff;
}
.newDialog /deep/ .el-table_1_column_2, .newDialog /deep/ .el-table_2_column_4 {
color: #00b3ee;
}
.newDialog /deep/ .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
background-color: #00557c;
}
.toolbar-sty {
@ -787,6 +609,7 @@ body {
margin-right: 15px;
border-radius: 4px;
}
.el-radio-button__inner {
width: 90px;
height: 30px;
@ -794,6 +617,7 @@ body {
color: #333;
border: 0 !important;
}
.el-radio-button__orig-radio:checked + .el-radio-button__inner {
color: #fff;
background-color: blue;

Loading…
Cancel
Save