rev:logo、浪潮采集接口
This commit is contained in:
@@ -120,7 +120,8 @@ public class StandardWeightSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (this.reqAgvTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqAgvTakeInstCode)) {
|
||||
}
|
||||
if (this.reqAgvTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqAgvTakeInstCode)) {
|
||||
Instruction instruction = instructionService.findByCodeFromCache(this.reqAgvTakeInstCode);
|
||||
//判断是否是取货还是放货
|
||||
//如果是取货直接允许
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.acs.ext.lc.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.lc.service.LcToAcsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author Gengby
|
||||
* @Date 2025/12/10
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/lc")
|
||||
@Slf4j
|
||||
public class LcToAcsController {
|
||||
|
||||
@Autowired
|
||||
private LcToAcsService lcToAcsService;
|
||||
|
||||
@PostMapping("/pointDataQuery")
|
||||
@SaIgnore
|
||||
public Map<String, Object> pointDataQuery() {
|
||||
return lcToAcsService.pointDataQuery();
|
||||
}
|
||||
|
||||
@PostMapping("/agvDataQuery")
|
||||
@SaIgnore
|
||||
public Map<String, Object> agvDataQuery() {
|
||||
return lcToAcsService.agvDataQuery();
|
||||
}
|
||||
|
||||
@PostMapping("/ctuDataQuery")
|
||||
@SaIgnore
|
||||
public Map<String, Object> ctuDataQuery() {
|
||||
return lcToAcsService.ctuDataQuery();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.acs.ext.lc.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author Gengby
|
||||
* @Date 2025/12/10
|
||||
*/
|
||||
public interface LcToAcsService {
|
||||
|
||||
/**
|
||||
* 获取称重信息
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> pointDataQuery();
|
||||
|
||||
/**
|
||||
* 获取AGV信息
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> agvDataQuery();
|
||||
|
||||
/**
|
||||
* 获取CTU信息
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> ctuDataQuery();
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
package org.nl.acs.ext.lc.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.conveyor.standard_weight.StandardWeightSiteDeviceDriver;
|
||||
import org.nl.acs.ext.hk.UnifiedResponse;
|
||||
import org.nl.acs.ext.hk.log.OthersToInterfaceLog;
|
||||
import org.nl.acs.ext.hk.service.AcsToHkService;
|
||||
import org.nl.acs.ext.hk.service.data.QueryAgvStatusReq;
|
||||
import org.nl.acs.ext.hk.service.data.QueryTaskStatusReq;
|
||||
import org.nl.acs.ext.hk.service.data.dto.QueryAgvStatusDto;
|
||||
import org.nl.acs.ext.hk.service.data.dto.QueryTaskStatusDto;
|
||||
import org.nl.acs.ext.hk.utils.TypeCastingUtil;
|
||||
import org.nl.acs.ext.lc.service.LcToAcsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author Gengby
|
||||
* @Date 2025/12/10
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class LcToAcsServiceImpl implements LcToAcsService {
|
||||
|
||||
@Autowired
|
||||
private AcsToHkService acsToHkService;
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
|
||||
/**
|
||||
* key 报警状态码
|
||||
* value 描述
|
||||
*/
|
||||
private static final Map<String, String> STATUS_MAP = new HashMap<>();
|
||||
|
||||
/**
|
||||
* key 设备状态码
|
||||
* value 描述
|
||||
*/
|
||||
private static final Map<String, String> DEVICE_STATUS_MAP = new HashMap<>();
|
||||
/**
|
||||
* key 车号
|
||||
* value 报警时间
|
||||
*/
|
||||
private static final Map<String, Object> ERROR_TIME_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
//AGV状态
|
||||
DEVICE_STATUS_MAP.put("0", "机器人故障");
|
||||
DEVICE_STATUS_MAP.put("1", "任务完成");
|
||||
DEVICE_STATUS_MAP.put("2", "任务执行中");
|
||||
DEVICE_STATUS_MAP.put("4", "任务空闲");
|
||||
DEVICE_STATUS_MAP.put("5", "机器人暂停");
|
||||
DEVICE_STATUS_MAP.put("6", "举升货架状态");
|
||||
DEVICE_STATUS_MAP.put("7", "充电状态");
|
||||
DEVICE_STATUS_MAP.put("8", "弧线行走中");
|
||||
DEVICE_STATUS_MAP.put("9", "充满维护");
|
||||
|
||||
//异常状态
|
||||
STATUS_MAP.put("3", "任务异常");
|
||||
STATUS_MAP.put("11", "背货未识别");
|
||||
STATUS_MAP.put("12", "货架偏角过大");
|
||||
STATUS_MAP.put("13", "运动库异常");
|
||||
STATUS_MAP.put("14", "货码无法识别");
|
||||
STATUS_MAP.put("15", "货码不匹配");
|
||||
STATUS_MAP.put("16", "举升异常");
|
||||
STATUS_MAP.put("17", "充电桩异常");
|
||||
STATUS_MAP.put("18", "电量无增加");
|
||||
STATUS_MAP.put("20", "充电指令角度错误");
|
||||
STATUS_MAP.put("21", "平台下发指令错误");
|
||||
STATUS_MAP.put("23", "外力下放");
|
||||
STATUS_MAP.put("24", "货架位置偏移");
|
||||
STATUS_MAP.put("25", "小车不在锁定区");
|
||||
STATUS_MAP.put("26", "下放重试失败");
|
||||
STATUS_MAP.put("27", "货架摆歪");
|
||||
STATUS_MAP.put("28", "举升电池电量太低");
|
||||
STATUS_MAP.put("29", "后退角度偏大");
|
||||
STATUS_MAP.put("30", "未背货架举升");
|
||||
STATUS_MAP.put("31", "区域锁定失败");
|
||||
STATUS_MAP.put("33", "旋转申请暂时失败");
|
||||
STATUS_MAP.put("34", "地图切换点地码未识别");
|
||||
}
|
||||
|
||||
@OthersToInterfaceLog("HR->ACS")
|
||||
@Override
|
||||
public Map<String, Object> pointDataQuery() {
|
||||
Map<String, Object> resultData = new HashMap<>();
|
||||
Device device = deviceAppService.findDeviceByCode("CZW01");
|
||||
if (device != null && device.getDeviceDriver() instanceof StandardWeightSiteDeviceDriver) {
|
||||
StandardWeightSiteDeviceDriver standardWeightSiteDeviceDriver = (StandardWeightSiteDeviceDriver) device.getDeviceDriver();
|
||||
resultData.put("device_code", device.getDevice_code());
|
||||
resultData.put("weight", standardWeightSiteDeviceDriver.getWeight());
|
||||
}
|
||||
Map<String, Object> resp = new HashMap<>();
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "success");
|
||||
resp.put("data", resultData);
|
||||
return resp;
|
||||
}
|
||||
|
||||
@OthersToInterfaceLog("HR->ACS")
|
||||
@Override
|
||||
public Map<String, Object> ctuDataQuery() {
|
||||
Map<String, Object> resp = new HashMap<>();
|
||||
QueryAgvStatusReq qasReq = QueryAgvStatusReq.builder()
|
||||
.mapCode("AA")
|
||||
.build();
|
||||
UnifiedResponse<List> unifiedResponse = acsToHkService.queryAgvStatus(qasReq, List.class);
|
||||
List<QueryAgvStatusDto> data = TypeCastingUtil.convertToList(unifiedResponse.getData(), QueryAgvStatusDto.class);
|
||||
List<Map<String, Object>> resultData = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(data)) {
|
||||
for (QueryAgvStatusDto queryAgvStatusDto : data) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
//车号
|
||||
String robotCode = queryAgvStatusDto.getRobotCode();
|
||||
if (!"11752".equals(robotCode)) {
|
||||
continue;
|
||||
}
|
||||
QueryTaskStatusReq req = QueryTaskStatusReq.builder()
|
||||
.agvCode(robotCode)
|
||||
.build();
|
||||
UnifiedResponse<List> unifiedResponseTask = acsToHkService.queryTaskStatus(req, List.class);
|
||||
List<QueryTaskStatusDto> taskData = TypeCastingUtil.convertToList(unifiedResponseTask.getData(), QueryTaskStatusDto.class);
|
||||
|
||||
String taskCode = Optional.ofNullable(taskData)
|
||||
.orElse(new ArrayList<>())
|
||||
.stream()
|
||||
.filter(dto -> "2".equals(dto.getTaskStatus()))
|
||||
.map(dto -> dto.getTaskCode())
|
||||
.filter(str -> !str.contains("null"))
|
||||
.collect(Collectors.joining(","));
|
||||
//角度
|
||||
String robotDir = queryAgvStatusDto.getRobotDir();
|
||||
//x
|
||||
String posX = queryAgvStatusDto.getPosX();
|
||||
//y
|
||||
String posY = queryAgvStatusDto.getPosY();
|
||||
String battery = queryAgvStatusDto.getBattery() + "%";
|
||||
//状态
|
||||
String status = queryAgvStatusDto.getStatus();
|
||||
resultMap.put("device_code", robotCode);
|
||||
resultMap.put("device_status", DEVICE_STATUS_MAP.containsKey(status) ? status : "0");
|
||||
resultMap.put("battery_power", battery);
|
||||
resultMap.put("error_message", STATUS_MAP.containsKey(status) ? status : "0");
|
||||
resultMap.put("real_location", "[" + posX + "," + posY + "]");
|
||||
resultMap.put("stee_angle", robotDir);
|
||||
resultMap.put("task_code", taskCode);
|
||||
//如果AGV报警,但是报警的MAP中不包含当前AGV,则添加到MAP中,并记录报警时间
|
||||
if (STATUS_MAP.containsKey(status) && !ERROR_TIME_MAP.containsKey(robotCode)) {
|
||||
ERROR_TIME_MAP.put(robotCode, DateUtil.now());
|
||||
}
|
||||
//如果AGV正常,但是报警的MAP中包含当前AGV,则删除MAP中的记录
|
||||
if (!STATUS_MAP.containsKey(status) && ERROR_TIME_MAP.containsKey(robotCode)) {
|
||||
ERROR_TIME_MAP.remove(robotCode);
|
||||
}
|
||||
resultMap.put("error_time", ERROR_TIME_MAP.containsKey(robotCode) ? ERROR_TIME_MAP.get(robotCode) : "");
|
||||
Instruction instruction = instructionService.findByCodeFromCache(taskCode);
|
||||
if (instruction != null) {
|
||||
resultMap.put("task_status", instruction.getInstruction_status().equals("0") ? "就绪" : "执行中");
|
||||
resultMap.put("get_row", instruction.getFrom_x());
|
||||
resultMap.put("get_col", instruction.getFrom_y());
|
||||
resultMap.put("get_layer", instruction.getFrom_z());
|
||||
resultMap.put("put_row", instruction.getTo_x());
|
||||
resultMap.put("put_col", instruction.getTo_y());
|
||||
resultMap.put("put_layer", instruction.getTo_z());
|
||||
} else {
|
||||
resultMap.put("task_status", "");
|
||||
resultMap.put("get_row", "");
|
||||
resultMap.put("get_col", "");
|
||||
resultMap.put("get_layer", "");
|
||||
resultMap.put("put_row", "");
|
||||
resultMap.put("put_col", "");
|
||||
resultMap.put("put_layer", "");
|
||||
}
|
||||
resultData.add(resultMap);
|
||||
}
|
||||
}
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "success");
|
||||
resp.put("data", resultData);
|
||||
return resp;
|
||||
}
|
||||
|
||||
@OthersToInterfaceLog("HR->ACS")
|
||||
@Override
|
||||
public Map<String, Object> agvDataQuery() {
|
||||
Map<String, Object> resp = new HashMap<>();
|
||||
QueryAgvStatusReq qasReq = QueryAgvStatusReq.builder()
|
||||
.mapCode("AA")
|
||||
.build();
|
||||
UnifiedResponse<List> unifiedResponse = acsToHkService.queryAgvStatus(qasReq, List.class);
|
||||
List<QueryAgvStatusDto> data = TypeCastingUtil.convertToList(unifiedResponse.getData(), QueryAgvStatusDto.class);
|
||||
List<Map<String, Object>> resultData = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(data)) {
|
||||
for (QueryAgvStatusDto queryAgvStatusDto : data) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
//车号
|
||||
String robotCode = queryAgvStatusDto.getRobotCode();
|
||||
if ("11752".equals(robotCode)) {
|
||||
continue;
|
||||
}
|
||||
QueryTaskStatusReq req = QueryTaskStatusReq.builder()
|
||||
.agvCode(robotCode)
|
||||
.build();
|
||||
UnifiedResponse<List> unifiedResponseTask = acsToHkService.queryTaskStatus(req, List.class);
|
||||
List<QueryTaskStatusDto> taskData = TypeCastingUtil.convertToList(unifiedResponseTask.getData(), QueryTaskStatusDto.class);
|
||||
List<String> taskCodeList = Optional.ofNullable(taskData)
|
||||
.orElse(new ArrayList<>())
|
||||
.stream()
|
||||
.filter(dto -> "2".equals(dto.getTaskStatus()))
|
||||
.map(dto -> dto.getTaskCode())
|
||||
.collect(Collectors.toList());
|
||||
String taskCode = "";
|
||||
if (CollectionUtils.isNotEmpty(taskCodeList)) {
|
||||
taskCode = taskCodeList.get(0);
|
||||
}
|
||||
//角度
|
||||
String robotDir = queryAgvStatusDto.getRobotDir();
|
||||
//地图编号
|
||||
String mapCode = queryAgvStatusDto.getMapCode();
|
||||
//x
|
||||
String posX = queryAgvStatusDto.getPosX();
|
||||
//y
|
||||
String posY = queryAgvStatusDto.getPosY();
|
||||
String battery = queryAgvStatusDto.getBattery() + "%";
|
||||
//状态
|
||||
String status = queryAgvStatusDto.getStatus();
|
||||
resultMap.put("device_code", robotCode);
|
||||
resultMap.put("map_id", mapCode);
|
||||
resultMap.put("task_code", taskCode);
|
||||
resultMap.put("map_x", posX);
|
||||
resultMap.put("map_y", posY);
|
||||
resultMap.put("stee_angle", robotDir);
|
||||
resultMap.put("device_status", DEVICE_STATUS_MAP.containsKey(status) ? status : "0");
|
||||
resultMap.put("battery_power", battery);
|
||||
//如果AGV报警,但是报警的MAP中不包含当前AGV,则添加到MAP中,并记录报警时间
|
||||
if (STATUS_MAP.containsKey(status) && !ERROR_TIME_MAP.containsKey(robotCode)) {
|
||||
ERROR_TIME_MAP.put(robotCode, DateUtil.now());
|
||||
}
|
||||
//如果AGV正常,但是报警的MAP中包含当前AGV,则删除MAP中的记录
|
||||
if (!STATUS_MAP.containsKey(status) && ERROR_TIME_MAP.containsKey(robotCode)) {
|
||||
ERROR_TIME_MAP.remove(robotCode);
|
||||
}
|
||||
resultMap.put("error_code", STATUS_MAP.containsKey(status) ? status : "0");
|
||||
resultMap.put("error_time", ERROR_TIME_MAP.containsKey(robotCode) ? ERROR_TIME_MAP.get(robotCode) : "");
|
||||
resultData.add(resultMap);
|
||||
}
|
||||
}
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "success");
|
||||
resp.put("data", resultData);
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@@ -170,6 +170,10 @@ public class AutoCreateInst {
|
||||
taskService.update(acsTask);
|
||||
});
|
||||
} else {
|
||||
int ctuOutCount = instructionService.findInstCountByInstType(Arrays.asList(InstTypeEnum.CTU_OUT_TASK.getCode()));
|
||||
if (ctuOutCount > 1){
|
||||
return;
|
||||
}
|
||||
//查询到称重点的AGV指令数量,如果说指令数量大于1则return
|
||||
int count = instructionService.findInstCountByInstType(Arrays.asList(InstTypeEnum.AGV_TWO3_TASK.getCode(), InstTypeEnum.AGV_THREE_TASK.getCode()));
|
||||
if (count > 1) {
|
||||
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
title: '诺力开发平台',
|
||||
logo: Logo,
|
||||
logo: '',
|
||||
title_param: 'platform'
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user