Compare commits
13 Commits
1919e0f5f7
...
acs_dev
| Author | SHA1 | Date | |
|---|---|---|---|
| da5ad00ee5 | |||
| d7a23bbf66 | |||
| 33f9d153a4 | |||
| 0b5d4c1df6 | |||
| 60e61f1d99 | |||
| 04de617a12 | |||
| d1fb8af637 | |||
| 78baf3be4f | |||
| d7cd0bed54 | |||
| 6443056757 | |||
| ee83f434b8 | |||
| 01a23d21e0 | |||
| 07998cecbb |
@@ -0,0 +1,38 @@
|
||||
package org.nl.acs.agv.contorller;
|
||||
|
||||
import org.nl.acs.agv.service.impl.TwoFloorAgvStatusService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 二楼AGV状态控制器
|
||||
* 提供HTTP接口获取AGV状态信息
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/agv/two-floor")
|
||||
public class TwoFloorAgvController {
|
||||
|
||||
@Autowired
|
||||
private TwoFloorAgvStatusService agvStatusService;
|
||||
|
||||
/**
|
||||
* 获取所有二楼AGV状态
|
||||
* @return 所有AGV状态列表
|
||||
*/
|
||||
@GetMapping("/status")
|
||||
public Object getAllAgvStatus() {
|
||||
return agvStatusService.getAllAgvStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个AGV状态
|
||||
* @param vehicleCode AGV车辆代码
|
||||
* @return AGV状态信息
|
||||
*/
|
||||
@GetMapping("/status/{vehicleCode}")
|
||||
public Object getAgvStatus(String vehicleCode) {
|
||||
return agvStatusService.getAgvStatus(vehicleCode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package org.nl.acs.agv.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 二楼AGV状态数据模型
|
||||
* 用于存储和传输AGV的实时状态信息
|
||||
*/
|
||||
@Data
|
||||
public class TwoFloorAgvStatus {
|
||||
|
||||
/**
|
||||
* AGV车辆代码
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* AGV状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* AGV状态文本描述
|
||||
*/
|
||||
private String status_text;
|
||||
|
||||
/**
|
||||
* 当前任务代码
|
||||
*/
|
||||
private String task_code;
|
||||
|
||||
/**
|
||||
* 当前指令代码
|
||||
*/
|
||||
private String inst_code;
|
||||
|
||||
/**
|
||||
* 当前阶段值
|
||||
*/
|
||||
private Integer phase;
|
||||
|
||||
/**
|
||||
* 当前阶段名称
|
||||
*/
|
||||
private String phase_name;
|
||||
|
||||
/**
|
||||
* 当前位置
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 物料类型
|
||||
*/
|
||||
private String material_type;
|
||||
|
||||
/**
|
||||
* 物料数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 开始设备代码
|
||||
*/
|
||||
private String start_device_code;
|
||||
|
||||
/**
|
||||
* 下一个设备代码
|
||||
*/
|
||||
private String next_device_code;
|
||||
|
||||
/**
|
||||
* 是否有错误
|
||||
*/
|
||||
private Boolean is_error;
|
||||
|
||||
/**
|
||||
* 错误代码
|
||||
*/
|
||||
private String error_code;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
private String error_message;
|
||||
|
||||
/**
|
||||
* 卡住的Action
|
||||
*/
|
||||
private String error_action;
|
||||
|
||||
/**
|
||||
* 卡住的Mode
|
||||
*/
|
||||
private String error_mode;
|
||||
/**
|
||||
* 卡住的move
|
||||
*/
|
||||
private String error_move;
|
||||
/**
|
||||
* 卡住的error
|
||||
*/
|
||||
private String error_error;
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
private String device_code;
|
||||
/**
|
||||
* 期望的Action
|
||||
*/
|
||||
private String exp_action;
|
||||
|
||||
/**
|
||||
* 卡住的Mode
|
||||
*/
|
||||
private String exp_mode;
|
||||
/**
|
||||
* 卡住的move
|
||||
*/
|
||||
private String exp_move;
|
||||
/**
|
||||
* 卡住的error
|
||||
*/
|
||||
private String exp_error;
|
||||
|
||||
/**
|
||||
* 实际Action
|
||||
*/
|
||||
private String action;
|
||||
|
||||
/**
|
||||
* 实际Mode
|
||||
*/
|
||||
private String mode;
|
||||
/**
|
||||
* 实际move
|
||||
*/
|
||||
private String move;
|
||||
/**
|
||||
* 实际error
|
||||
*/
|
||||
private String error;
|
||||
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
private Integer electric_qty;
|
||||
|
||||
private String driver;
|
||||
|
||||
/**
|
||||
* X坐标
|
||||
*/
|
||||
private Integer x;
|
||||
|
||||
/**
|
||||
* Y坐标
|
||||
*/
|
||||
private Integer y;
|
||||
|
||||
/**
|
||||
* 角度
|
||||
*/
|
||||
private Integer angle;
|
||||
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private Integer region;
|
||||
|
||||
/**
|
||||
* 是否在线
|
||||
*/
|
||||
private Boolean is_online;
|
||||
|
||||
/**
|
||||
* 三色灯状态
|
||||
*/
|
||||
private Integer status_light;
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package org.nl.acs.agv.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.domain.TwoFloorAgvStatus;
|
||||
import org.nl.acs.device_driver.agv.utils.TwoAgvPhase;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 二楼AGV状态管理服务
|
||||
* 负责管理和更新AGV状态,通过HTTP接口提供状态查询
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TwoFloorAgvStatusService {
|
||||
|
||||
@Autowired
|
||||
private TwoAgvPhase twoAgvPhase;
|
||||
|
||||
/**
|
||||
* 存储AGV状态信息,key为AGV车辆代码
|
||||
*/
|
||||
private ConcurrentHashMap<String, TwoFloorAgvStatus> agvStatusMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 初始化AGV状态
|
||||
*/
|
||||
public TwoFloorAgvStatusService() {
|
||||
// 初始化二楼的4台AGV
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
TwoFloorAgvStatus agvStatus = new TwoFloorAgvStatus();
|
||||
String vehicleCode = String.format("AGV%02d", i);
|
||||
agvStatus.setVehicle_code(vehicleCode);
|
||||
agvStatus.setStatus("idle");
|
||||
agvStatus.setStatus_text("空闲");
|
||||
agvStatus.setIs_error(false);
|
||||
agvStatus.setIs_online(true);
|
||||
agvStatusMap.put(vehicleCode, agvStatus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新AGV状态
|
||||
* @param agvStatus AGV状态信息
|
||||
*/
|
||||
public synchronized void updateAgvStatus(TwoFloorAgvStatus agvStatus) {
|
||||
if (agvStatus == null || agvStatus.getVehicle_code() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理阶段名称
|
||||
if (agvStatus.getPhase() != null) {
|
||||
String phaseName = twoAgvPhase.getPhaseName(agvStatus.getPhase());
|
||||
agvStatus.setPhase_name(phaseName);
|
||||
}
|
||||
|
||||
// 处理状态文本
|
||||
this.handleStatusText(agvStatus);
|
||||
|
||||
// 更新状态
|
||||
agvStatusMap.put(agvStatus.getVehicle_code(), agvStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理AGV状态文本
|
||||
*/
|
||||
private void handleStatusText(TwoFloorAgvStatus agvStatus) {
|
||||
switch (agvStatus.getStatus()) {
|
||||
case "running":
|
||||
agvStatus.setStatus_text("运行中");
|
||||
break;
|
||||
case "idle":
|
||||
agvStatus.setStatus_text("空闲");
|
||||
break;
|
||||
case "error":
|
||||
agvStatus.setStatus_text("异常");
|
||||
agvStatus.setIs_error(true);
|
||||
break;
|
||||
case "charging":
|
||||
agvStatus.setStatus_text("充电中");
|
||||
break;
|
||||
default:
|
||||
agvStatus.setStatus_text("未知");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个AGV状态
|
||||
* @param vehicleCode AGV车辆代码
|
||||
* @return AGV状态信息
|
||||
*/
|
||||
public TwoFloorAgvStatus getAgvStatus(String vehicleCode) {
|
||||
return agvStatusMap.get(vehicleCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有AGV状态
|
||||
* @return 所有AGV状态列表
|
||||
*/
|
||||
public List<TwoFloorAgvStatus> getAllAgvStatus() {
|
||||
return new ArrayList<>(agvStatusMap.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除AGV错误信息
|
||||
*/
|
||||
public void clearAgvError(int carno) {
|
||||
try {
|
||||
String vehicleCode = String.format("AGV%02d", carno);
|
||||
TwoFloorAgvStatus agvStatus = agvStatusMap.get(vehicleCode);
|
||||
if (agvStatus != null) {
|
||||
agvStatus.setIs_error(false);
|
||||
agvStatus.setError_code(null);
|
||||
agvStatus.setError_message(null);
|
||||
agvStatus.setError_action(null);
|
||||
agvStatus.setError_mode(null);
|
||||
// 设置错误信息
|
||||
agvStatus.setDriver(null);
|
||||
agvStatus.setIs_error(false);
|
||||
agvStatus.setError_message(null);
|
||||
agvStatus.setDevice_code(null);
|
||||
agvStatus.setError_action(null);
|
||||
agvStatus.setError_mode(null);
|
||||
agvStatus.setError_move(null);
|
||||
agvStatus.setError_error(null);
|
||||
agvStatus.setExp_action(null);
|
||||
agvStatus.setExp_mode(null);
|
||||
agvStatus.setExp_move(null);
|
||||
agvStatus.setExp_error(null);
|
||||
if ("error".equals(agvStatus.getStatus())) {
|
||||
agvStatus.setStatus("idle");
|
||||
agvStatus.setStatus_text("空闲");
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
log.error("清空agv异常状态有异常,异常原因={}",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.domain.TwoFloorAgvStatus;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
@@ -17,6 +18,7 @@ import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.agv.service.impl.TwoFloorAgvStatusService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
@@ -33,10 +35,7 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -80,6 +79,10 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
AutoRunService autoRunService;
|
||||
@Autowired
|
||||
LuceneExecuteLogService luceneExecuteLogService;
|
||||
/**
|
||||
* 二楼AGV状态管理服务
|
||||
*/
|
||||
private TwoFloorAgvStatusService agvStatusService;
|
||||
@Autowired
|
||||
ISysDictService dictService;
|
||||
|
||||
@@ -106,7 +109,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
|
||||
// 初始化AGV状态管理服务
|
||||
agvStatusService = SpringContextHolder.getBean(TwoFloorAgvStatusService.class);
|
||||
try {
|
||||
log.info("2楼1区域AGV系统链接开始");
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
@@ -341,29 +345,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} else {
|
||||
log.info(device_code + "对应设备号为空!");
|
||||
}
|
||||
} else if (phase == 0x64) {
|
||||
log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}", agvaddr, station);
|
||||
Dict dict = dictService.getDictByName3("station", String.valueOf(agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
dict.setValue("1");
|
||||
dict.setPara2(String.valueOf(agvaddr));
|
||||
dict.setPara3("下发成功");
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
//充电成功
|
||||
} else if (phase == 0x65) {
|
||||
log.info("AGV车号{}反馈充电中,充电桩{}", agvaddr, station);
|
||||
//充电取消上报
|
||||
} else if (phase == 0x66) {
|
||||
log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}", agvaddr, station);
|
||||
Dict dict = dictService.getDictByName3("station", String.valueOf(agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
dict.setValue("0");
|
||||
dict.setPara2("");
|
||||
dict.setPara3("充电桩空闲");
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -163,8 +163,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
/**
|
||||
* 下发任务号
|
||||
*/
|
||||
String to_task = null;
|
||||
String last_to_task = null;
|
||||
int to_task = 0;
|
||||
int last_to_task = 0;
|
||||
/**
|
||||
* 下发接纯数字托盘号
|
||||
*/
|
||||
@@ -510,7 +510,12 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
//查找有没有对应的指令
|
||||
Instruction inst = instructionService.findByStartCodeAndReady(this.device_code);
|
||||
Instruction inst;
|
||||
if ("RK1032".equals(this.device_code) || "RK1034".equals(this.device_code) || "RK1035".equals(this.device_code)) {
|
||||
inst = instructionService.findByStartCodeAndReady2(this.device_code);
|
||||
} else {
|
||||
inst = instructionService.findByStartCodeAndReady(this.device_code);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(inst)) {
|
||||
List<RouteLineDto> routeLineDtos = routeLineService.selectDeviceCodeList(this.device_code);
|
||||
if (routeLineDtos.size() < 1) {
|
||||
@@ -796,7 +801,15 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
List list = new ArrayList();
|
||||
writeData(next_addr, list, instdto, containerType);
|
||||
// led_message = getLedMessage(instdto);
|
||||
requireSucess = true;
|
||||
//写完信号to_task写成功后更新指令为执行中
|
||||
inst = checkInst();
|
||||
to_task = this.itemProtocol.getTo_task();
|
||||
if (to_task > 0 && to_task == Integer.parseInt(inst.getInstruction_code())) {
|
||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
requireSucess = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,8 +110,8 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
|
||||
public String getTo_task() {
|
||||
return this.getOpcStringValue(item_to_task);
|
||||
public int getTo_task() {
|
||||
return this.getOpcIntegerValue(item_to_task);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public class ItemProtocol {
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return "";
|
||||
return "0";
|
||||
}
|
||||
|
||||
public int[] getOpcArrayValue(String protocol) {
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.nl.acs.device_driver.conveyor.optoele_docking_station;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Setter
|
||||
public class ItemProtocol {
|
||||
|
||||
public static String item_heartbeat = "heartbeat";
|
||||
public static String item_mode = "mode";
|
||||
public static String item_move = "move";
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
private OptoeleDockingStationDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(OptoeleDockingStationDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getMove() {
|
||||
return this.getOpcIntegerValue(item_move);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有货
|
||||
* @param move
|
||||
* @return
|
||||
*/
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
}
|
||||
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (StrUtil.isBlank(value)) {
|
||||
// log.error("读取错误!");
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB81.B10"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB81.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB81.B2"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.nl.acs.device_driver.conveyor.optoele_docking_station;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 普通光电对接点
|
||||
*/
|
||||
@Service
|
||||
public class OptoeleDockingStationDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "optoele_docking_station";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "标准版-普通光电对接点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "标准版-普通光电对接点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new OptoeleDockingStationDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return OptoeleDockingStationDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.station);
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.nl.acs.device_driver.conveyor.optoele_docking_station;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.StandardRequestMethod;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
|
||||
|
||||
/**
|
||||
* 标准版-普通光电对接点
|
||||
*/
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public class OptoeleDockingStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod {
|
||||
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
String device_code;
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
int move = 0;
|
||||
int last_move = 0;
|
||||
|
||||
Boolean isonline = true;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
|
||||
last_mode = mode;
|
||||
last_move = move;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() throws Exception {
|
||||
JSONObject jo = new JSONObject();
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -178,6 +178,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
private Date require_apply_zjrk_time = new Date();
|
||||
//退货入库申请时间
|
||||
private Date require_apply_thrk_time = new Date();
|
||||
//入库申请时间
|
||||
private Date require_apply_in_time = new Date();
|
||||
|
||||
private int instruction_update_time_out = 1000;
|
||||
Integer heartbeat_tag;
|
||||
private Date instruction_require_time = new Date();
|
||||
@@ -187,6 +190,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
private int require_apply_tprk_time_out = 4000;
|
||||
private int require_apply_zjrk_time_out = 4000;
|
||||
private int require_apply_thrk_time_out = 4000;
|
||||
private int require_apply_in_time_out = 4000;
|
||||
//行架机械手申请任务成功标识
|
||||
boolean requireSucess = false;
|
||||
|
||||
@@ -694,6 +698,13 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
}
|
||||
|
||||
private void applyIn(String type, int mode) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_in_time.getTime()
|
||||
< (long) this.require_apply_in_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.require_apply_in_time_out);
|
||||
return;
|
||||
}
|
||||
this.require_apply_in_time = date;
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
@@ -22,6 +23,7 @@ import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceD
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
@@ -45,6 +47,8 @@ import org.nl.config.language.LangProcess;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -72,6 +76,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class);
|
||||
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -80,8 +85,11 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
int last_action = 0;
|
||||
int error = 0;
|
||||
int task = 0;
|
||||
String barcode = null;
|
||||
float weight = 0.0f;
|
||||
int heartbeat = 0;
|
||||
int to_command = 0;
|
||||
int last_to_command = 0;
|
||||
int to_target = 0;
|
||||
int to_onset = 0;
|
||||
|
||||
@@ -141,6 +149,10 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
action = this.itemProtocol.getAction();
|
||||
weight = new BigDecimal(Float.toString(this.itemProtocol.getWeight()))
|
||||
.setScale(1, RoundingMode.HALF_UP)
|
||||
.floatValue();
|
||||
barcode = this.itemProtocol.getBarcode();
|
||||
error = this.itemProtocol.getError();
|
||||
task = this.itemProtocol.getTask();
|
||||
heartbeat = this.itemProtocol.getHeartbeat();
|
||||
@@ -154,9 +166,31 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (mode != last_mode) {
|
||||
requireSucess = false;
|
||||
}
|
||||
if(action == last_action){
|
||||
if(action != last_action){
|
||||
requireActionSucess = false;
|
||||
}
|
||||
|
||||
//以防出现未知问题,桁架称重完成变成6后,给桁架反馈6
|
||||
if (action == 6 && !this.requireActionSucess){
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 6);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
this.requireActionSucess = true;
|
||||
}
|
||||
|
||||
//清除下发桁架的6
|
||||
if (to_command != last_to_command && to_command == 6){
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 0);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
}
|
||||
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0 && !requireActionSucess) {
|
||||
updateInstructionStatus();
|
||||
@@ -190,7 +224,6 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
} else {
|
||||
String remark = "";
|
||||
;
|
||||
if (mode != 2) {
|
||||
remark = "universal_remark2";
|
||||
}
|
||||
@@ -227,7 +260,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
last_mode =mode;
|
||||
last_action = action;
|
||||
|
||||
last_to_command = to_command;
|
||||
}
|
||||
|
||||
private void updateInstructionStatus() {
|
||||
@@ -248,6 +281,24 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
}
|
||||
|
||||
if (action == 2 && move == 1 && weight > 0){
|
||||
Map<String,Object> request = new HashMap<>();
|
||||
request.put("task_code",inst.getTask_code());
|
||||
request.put("barcode",barcode);
|
||||
// request.put("weight",weight);
|
||||
request.put("weight", String.format("%.1f", weight));
|
||||
HttpResponse resp = acsToWmsService.feedBoxWeight(request);
|
||||
if (resp != null && resp.getStatus() == 200){
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 2);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
this.requireActionSucess = true;
|
||||
}
|
||||
}
|
||||
|
||||
//任务完成
|
||||
if (action == 5 && move == 0) {
|
||||
if (inst != null) {
|
||||
@@ -595,7 +646,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
jo.put("isError", this.getIserror());
|
||||
jo.put("message", LangProcess.msg(message));
|
||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||
jo.put("driver_type", "box_storage_manipulator");
|
||||
jo.put("is_click", true);
|
||||
|
||||
@@ -32,6 +32,14 @@ public class ItemProtocol {
|
||||
* 任务号
|
||||
*/
|
||||
public static String item_task = "task";
|
||||
/**
|
||||
* 木箱重量
|
||||
*/
|
||||
public static String item_weight = "weight";
|
||||
/**
|
||||
* 条码
|
||||
*/
|
||||
public static String item_barcode = "barcode";
|
||||
/**
|
||||
* 报警
|
||||
*/
|
||||
@@ -146,6 +154,12 @@ public class ItemProtocol {
|
||||
public int getTask() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
public Float getWeight() {
|
||||
return this.getOpcFloatValue(item_weight);
|
||||
}
|
||||
public String getBarcode() {
|
||||
return this.getOpcStringValue(item_barcode);
|
||||
}
|
||||
|
||||
|
||||
public int getWalk_y() {
|
||||
@@ -220,6 +234,8 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
|
||||
list.add(new ItemDto(item_weight, "重量", "DB1.D6"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB1.D6"));
|
||||
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
|
||||
list.add(new ItemDto(item_x, "行走列号", "DB101.B10"));
|
||||
list.add(new ItemDto(item_y, "行走层号", "DB101.B11"));
|
||||
|
||||
@@ -611,7 +611,6 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.applyPullShaft_time.getTime() < (long) this.applyPullShaft_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.applyPullShaft_time_out);
|
||||
return;
|
||||
} else {
|
||||
this.applyPullShaft_time = date;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴");
|
||||
|
||||
@@ -132,8 +132,11 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
private int instruction_update_time_out = 1000;
|
||||
Integer heartbeat_tag;
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date apply_feedback_require_time = new Date();
|
||||
|
||||
private int instruction_require_time_out = 3000;
|
||||
private int apply_feedback_require_time_out = 3000;
|
||||
|
||||
//行架机械手申请任务成功标识
|
||||
boolean requireSucess = false;
|
||||
|
||||
@@ -230,6 +233,12 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
//反馈重量
|
||||
if (mode == 3 && action == 5 && move == 0 && weight > 0 && StrUtil.isNotEmpty(sub_volume_no) && !requireSucess) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.apply_feedback_require_time.getTime() < (long) this.apply_feedback_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.apply_feedback_require_time_out);
|
||||
return ;
|
||||
}
|
||||
this.apply_feedback_require_time = date;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈重量");
|
||||
ApplyfeedbackSubVolumeWeightRequest applyfeedbackSubVolumeWeightRequest = new ApplyfeedbackSubVolumeWeightRequest();
|
||||
ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeightResponse;
|
||||
|
||||
@@ -10,6 +10,8 @@ import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.data.one.BaseRequest;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface AcsToWmsService {
|
||||
|
||||
|
||||
@@ -225,4 +227,6 @@ public interface AcsToWmsService {
|
||||
* @return
|
||||
*/
|
||||
ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param);
|
||||
|
||||
HttpResponse feedBoxWeight(Map<String, Object> request);
|
||||
}
|
||||
|
||||
@@ -818,6 +818,35 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return manipulatorApplyPointResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse feedBoxWeight(Map<String, Object> request) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
HttpResponse result = null;
|
||||
log.info("feedBoxWeight反馈LMS机械手重量-----请求参数{}", request.toString());
|
||||
AddressDto addressDto = addressService.findByCode("feedBoxWeight");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
try {
|
||||
result = HttpRequest.post(wmsurl + methods_url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token)
|
||||
.body(JSON.toJSONString(request))
|
||||
.execute();
|
||||
log.info("feedBoxWeight反馈LMS机械手重量-----输出参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
// //System.out.println(msg);
|
||||
log.info("feedBoxWeight反馈LMS机械手重量-----输出参数{}", msg);
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionFinishRequest2(JSONObject jsonObject) {
|
||||
HttpResponse execute = null;
|
||||
|
||||
@@ -348,6 +348,14 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
Instruction findByStartCodeAndReady(String device_code);
|
||||
|
||||
|
||||
/**
|
||||
* 找最新的指令
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
Instruction findByStartCodeAndReady2(String device_code);
|
||||
|
||||
/**
|
||||
* 根据起点设备编号查询当前是否有运行的指令
|
||||
*
|
||||
|
||||
@@ -1935,6 +1935,15 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Instruction findByStartCodeAndReady2(String device_code) {
|
||||
Optional<Instruction> optionalInstruction = instructions.stream()
|
||||
.filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), device_code)
|
||||
&& StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && !instruction.getInstruction_type().equals(TaskTypeEnum.Mxddhj_Task.getIndex())).max(Comparator.comparing(Instruction::getCreate_time));
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay) {
|
||||
List<Instruction> instructionList = new ArrayList<>();
|
||||
|
||||
@@ -301,7 +301,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
|
||||
String error_message = "设备信息同步异常";
|
||||
if (!StrUtil.equals(this.message, error_message)) {
|
||||
log.warn(error_message, var27);
|
||||
log.warn(error_message, Arrays.toString(var27.getStackTrace()));
|
||||
}
|
||||
|
||||
ThreadUtl.sleep((long) (OpcConfig.synchronized_exception_wait_second * 1000));
|
||||
|
||||
@@ -29,10 +29,7 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -116,6 +113,30 @@ public class CreateDDJInst {
|
||||
|
||||
String start_height = taskDto.getStart_height();
|
||||
String next_height = taskDto.getNext_height();
|
||||
|
||||
//如果是换标任务判断终点1003,和1002点位的有无货判断
|
||||
if (StrUtil.isNotEmpty(taskDto.getStorage_task_type())&& Objects.equals(taskDto.getStorage_task_type(), "1")){
|
||||
//关联站点判断
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
//判断对接位和关联站点光电信号
|
||||
List<String> getDeviceCodeList = beltConveyorDeviceDriver.getExtraDeviceCodes("link_device_code");
|
||||
if (CollUtil.isNotEmpty(getDeviceCodeList)) {
|
||||
String linkDeviceCode = getDeviceCodeList.get(0);
|
||||
Device linkDevice = appService.findDeviceByCode(linkDeviceCode);
|
||||
BeltConveyorDeviceDriver linkDeviceDriver;
|
||||
if (linkDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
linkDeviceDriver = (BeltConveyorDeviceDriver) linkDevice.getDeviceDriver();
|
||||
if ((beltConveyorDeviceDriver.getMode() == 0 || beltConveyorDeviceDriver.getMove() == 1) || (linkDeviceDriver.getMode() == 0 || linkDeviceDriver.getMove() == 1)) {
|
||||
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("无法创建堆垛机指令的原因:换标位" + next_device_code + "条件不满足!");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//同排的货位移库任务
|
||||
if (StrUtil.equals(taskDto.getStart_device_code(), taskDto.getNext_device_code())) {
|
||||
//通过起点找路由
|
||||
@@ -385,33 +406,6 @@ public class CreateDDJInst {
|
||||
instdto.setTo_z(taskDto.getTo_z());
|
||||
instdto.setTo_y(taskDto.getTo_y());
|
||||
}
|
||||
//判断agv系统
|
||||
//1、1楼叉车系统
|
||||
//2、2楼1区域AGV系统
|
||||
//3、2楼2区域AGV系统 -已废弃
|
||||
if (!StrUtil.equals(agv_system_type, CommonFinalParam.ONE)) {
|
||||
// task_type
|
||||
//1、生箔; Itype=1:取空,取满,放空,放满;
|
||||
//2、分切 Itype=3取满、取空、放满、放空;
|
||||
//3、普通任务 Itype=2:取货、放货;
|
||||
//4、叉车任务
|
||||
//5、输送任务
|
||||
//6、行架
|
||||
//7、立库
|
||||
if (StrUtil.equals(task_type, CommonFinalParam.ONE)) {
|
||||
instdto.setAgv_inst_type(CommonFinalParam.ONE);
|
||||
} else if (StrUtil.equals(task_type, "3")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else if (StrUtil.equals(task_type, "2")) {
|
||||
instdto.setAgv_inst_type("3");
|
||||
} else if (StrUtil.equals(task_type, "8")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else {
|
||||
log.info("未找到对应的AGV指令类型,任务号:" + taskDto.getTask_code() + ",task_type:" + taskDto.getTask_type());
|
||||
}
|
||||
} else {
|
||||
instdto.setAgv_inst_type("4");
|
||||
}
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -72,7 +72,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!-- <appender-ref ref="asyncFileAppender"/>-->
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
<!-- <logger name="jdbc" level="ERROR" additivity="true">
|
||||
<logger name="jdbc" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="org.springframework" level="ERROR" additivity="true">
|
||||
@@ -95,7 +95,10 @@ https://juejin.cn/post/6844903775631572999
|
||||
</logger>
|
||||
<logger name="org.jinterop" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>-->
|
||||
</logger>
|
||||
<logger name="org.openscada" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
</springProfile>
|
||||
|
||||
<!--测试环境:打印控制台-->
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
ENV = 'development'
|
||||
|
||||
# 接口地址
|
||||
VUE_APP_BASE_API = 'http://localhost:8011'
|
||||
VUE_APP_BASE_API = 'http://127.0.0.1:8011'
|
||||
VUE_APP_WS_API = 'ws://localhost:8011'
|
||||
|
||||
# 是否启用 babel-plugin-dynamic-import-node插件
|
||||
|
||||
@@ -2,6 +2,6 @@ ENV = 'production'
|
||||
|
||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||
VUE_APP_BASE_API = 'http://10.1.3.97:8011'
|
||||
VUE_APP_BASE_API = 'http://10.1.3.96:8011'
|
||||
# 如果接口是 http 形式, wss 需要改为 ws
|
||||
VUE_APP_WS_API = 'ws://10.1.3.97:8011'
|
||||
VUE_APP_WS_API = 'ws://10.1.3.96:8011'
|
||||
|
||||
@@ -108,6 +108,7 @@ import box_manipulator from '@/views/acs/device/driver/box_manipulator.vue'
|
||||
import conveyor_with_scanner_weight from '@/views/acs/device/driver/conveyor_with_scanner_weight.vue'
|
||||
import box_manipulator_site from '@/views/acs/device/driver/box_manipulator_site.vue'
|
||||
import rgv from '@/views/acs/device/driver/rgv.vue'
|
||||
import optoele_docking_station from '@/views/acs/device/driver/optoele_docking_station.vue'
|
||||
import dry_manipulator from '@/views/acs/device/driver/dry_manipulator.vue'
|
||||
import blanking_button from '@/views/acs/device/driver/blanking_button.vue'
|
||||
import pull_head_manipulator from '@/views/acs/device/driver/pull_head_manipulator.vue'
|
||||
@@ -200,7 +201,8 @@ export default {
|
||||
paper_tube_pick_size,
|
||||
one_rgv,
|
||||
die_manipulator,
|
||||
raster
|
||||
raster,
|
||||
optoele_docking_station
|
||||
},
|
||||
dicts: ['device_type'],
|
||||
mixins: [crud],
|
||||
|
||||
@@ -0,0 +1,539 @@
|
||||
<template>
|
||||
<!--标准版-输送机-控制点-->
|
||||
<div>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">设备协议:</span>
|
||||
</div>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
OpcServer:
|
||||
<el-select
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcservers"
|
||||
:key="item.opc_id"
|
||||
:label="item.opc_name"
|
||||
:value="item.opc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
PLC:
|
||||
<el-select
|
||||
v-model="plc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
@change="changePlc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcPlcs"
|
||||
:key="item.plc_id"
|
||||
:label="item.plc_name"
|
||||
:value="item.plc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">输送系统:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="电气调度号" label-width="150px">
|
||||
<el-input v-model="form.address" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">指令相关:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="检验有货">
|
||||
<el-switch v-model="form.inspect_in_stocck" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="取货校验" label-width="150px">
|
||||
<el-switch v-model="form.ignore_pickup_check" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="放货校验" label-width="150px">
|
||||
<el-switch v-model="form.ignore_release_check" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="呼叫">
|
||||
<el-switch v-model="form.apply_task" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="响应" label-width="150px">
|
||||
<el-switch v-model="form.manual_create_task" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="关联设备" prop="device_code">
|
||||
<el-select
|
||||
v-model="form.link_device_code"
|
||||
filterable
|
||||
multiple
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_name"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
|
||||
<el-select
|
||||
v-model="form.link_three_lamp"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_name"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否输入物料" label-width="150px">
|
||||
<el-switch v-model="form.input_material" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否需要反馈光电" label-width="150px">
|
||||
<el-switch v-model="form.ship_device_update" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">AGV相关:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="取货">
|
||||
<el-switch v-model="form.is_pickup" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="放货">
|
||||
<el-switch v-model="form.is_release" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC读取字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data1"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data1[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishReadEdit(data1[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC写入字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data2"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data2[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishWriteEdit(data2[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value2">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbw_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span" />
|
||||
<el-button
|
||||
:loading="false"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
style="float: right; padding: 6px 9px"
|
||||
type="primary"
|
||||
@click="doSubmit"
|
||||
>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
queryDriverConfig,
|
||||
updateConfig,
|
||||
testRead,
|
||||
testwrite
|
||||
} from '@/api/acs/device/driverConfig'
|
||||
import { selectOpcList } from '@/api/acs/device/opc'
|
||||
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||
|
||||
import crud from '@/mixins/crud'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
|
||||
export default {
|
||||
name: 'StandardConveyorControl',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
device_code: '',
|
||||
device_id: '',
|
||||
plc_id: '',
|
||||
plc_code: '',
|
||||
address: '',
|
||||
opc_id: '',
|
||||
opc_code: '',
|
||||
configLoading: false,
|
||||
dataOpcservers: [],
|
||||
dataOpcPlcs: [],
|
||||
deviceList: [],
|
||||
data1: [],
|
||||
data2: [],
|
||||
form: {
|
||||
inspect_in_stocck: true,
|
||||
ignore_pickup_check: true,
|
||||
ignore_release_check: true,
|
||||
apply_task: true,
|
||||
link_three_lamp: '',
|
||||
manual_create_task: true,
|
||||
is_pickup: true,
|
||||
is_release: true,
|
||||
link_device_code: [],
|
||||
ship_device_update: true
|
||||
},
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
// 从父表单获取设备编码
|
||||
this.device_id = this.$props.parentForm.device_id
|
||||
this.device_code = this.$props.parentForm.device_code
|
||||
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.form) {
|
||||
const arr = Object.keys(data.form)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.form = data.form
|
||||
}
|
||||
}
|
||||
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.parentForm) {
|
||||
const arr = Object.keys(data.parentForm)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.opc_code = data.parentForm.opc_code
|
||||
this.plc_code = data.parentForm.plc_code
|
||||
}
|
||||
}
|
||||
this.data1 = data.rs
|
||||
this.data2 = data.ws
|
||||
this.sliceItem()
|
||||
})
|
||||
selectPlcList().then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = this.$props.parentForm.opc_plc_id
|
||||
})
|
||||
selectOpcList().then(data => {
|
||||
this.dataOpcservers = data
|
||||
this.opc_id = this.$props.parentForm.opc_server_id
|
||||
})
|
||||
deviceCrud.selectDeviceList().then(data => {
|
||||
this.deviceList = data
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
finishReadEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('mode') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('mode') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 0)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('carrier_direction') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
finishWriteEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('to_command') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
console.log(endNumber)
|
||||
for (const val in this.data2) {
|
||||
if (this.data2[val].code.indexOf('to_command') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 0)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_container_type') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_strap_times') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 10)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_length') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 12)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_weight') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 14)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_height') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeOpc(val) {
|
||||
this.dataOpcservers.forEach(item => {
|
||||
if (item.opc_id === val) {
|
||||
this.opc_code = item.opc_code
|
||||
}
|
||||
})
|
||||
|
||||
selectListByOpcID(val).then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = ''
|
||||
this.plc_code = ''
|
||||
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
|
||||
this.plc_id = this.dataOpcPlcs[0].plc_id
|
||||
this.plc_code = this.dataOpcPlcs[0].plc_code
|
||||
}
|
||||
this.sliceItem()
|
||||
})
|
||||
},
|
||||
changePlc(val) {
|
||||
this.dataOpcPlcs.forEach(item => {
|
||||
if (item.plc_id === val) {
|
||||
this.plc_code = item.plc_code
|
||||
this.sliceItem()
|
||||
return
|
||||
}
|
||||
})
|
||||
},
|
||||
test_read1() {
|
||||
testRead(this.data1, this.opc_id).then(data => {
|
||||
this.data1 = data
|
||||
console.log(this.data1)
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_write1() {
|
||||
testwrite(this.data2, this.opc_id).then(data => {
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_read2() {
|
||||
testRead(this.data2, this.opc_id).then(data => {
|
||||
this.data2 = data
|
||||
console.log(this.data2)
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.configLoading = true
|
||||
// 根据驱动类型判断是否为路由设备
|
||||
const parentForm = this.parentForm
|
||||
parentForm.is_route = true
|
||||
parentForm.plc_id = this.plc_id
|
||||
parentForm.opc_id = this.opc_id
|
||||
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||
this.notify('保存成功', 'success')
|
||||
this.configLoading = false
|
||||
}).catch(err => {
|
||||
this.configLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
sliceItem() { // 拼接DB的Item值
|
||||
this.data1.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
this.data2.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -172,6 +172,7 @@
|
||||
<el-table-column prop="start_point_code" :label="$t('task.select.Start_point')" :min-width="flexWidth('start_point_code',crud.data,$t('task.select.Start_point'))" />
|
||||
<el-table-column prop="next_point_code" :label="$t('task.select.Destination')" :min-width="flexWidth('next_point_code',crud.data,$t('task.select.Destination'))" />
|
||||
<el-table-column prop="matarial" :label="$t('TaskRecord.table.Material')" :min-width="flexWidth('matarial',crud.data,$t('TaskRecord.table.Material'))" />
|
||||
<el-table-column prop="carno" :label="$t('Inst.table.carno')" :min-width="flexWidth('carno',crud.data,$t('Inst.table.carno'))"/>
|
||||
<el-table-column prop="quantity" :label="$t('TaskRecord.table.Quantity')" :min-width="flexWidth('quantity',crud.data,$t('TaskRecord.table.Quantity'))" />
|
||||
<el-table-column prop="weight" label="重量" :min-width="flexWidth('weight',crud.data,'重量')" />
|
||||
<el-table-column prop="remark" :label="$t('task.select.Remark')" :min-width="flexWidth('remark',crud.data,$t('task.select.Remark'))" />
|
||||
|
||||
395
acs2/nladmin-ui/src/views/screen/twoFloorAgvScreen.vue
Normal file
395
acs2/nladmin-ui/src/views/screen/twoFloorAgvScreen.vue
Normal file
@@ -0,0 +1,395 @@
|
||||
<template>
|
||||
<div class="two-floor-agv-screen">
|
||||
<div class="header">
|
||||
<h1>二楼AGV监控看板</h1>
|
||||
<div class="time-info">
|
||||
<span>{{ getTime }}</span>
|
||||
<span>{{ getDate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="agv-list">
|
||||
<div
|
||||
v-for="agv in agvList"
|
||||
:key="agv.vehicle_code"
|
||||
class="agv-item"
|
||||
:class="{ 'agv-error': agv.is_error }"
|
||||
@click="showAgvDetail(agv)"
|
||||
>
|
||||
<div class="agv-header">
|
||||
<div class="agv-basic-info">
|
||||
<h3>{{ agv.vehicle_code }}</h3>
|
||||
<span class="status" :class="agv.status">{{ agv.status_text }}</span>
|
||||
</div>
|
||||
<div class="agv-phase">
|
||||
<span class="label">当前阶段:</span>
|
||||
<span class="phase-value">{{ agv.phase_name || '无' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="agv-task-info">
|
||||
<div class="task-item">
|
||||
<span class="label">任务代码:</span>
|
||||
<span>{{ agv.task_code || '无' }}</span>
|
||||
</div>
|
||||
<div class="task-item">
|
||||
<span class="label">指令代码:</span>
|
||||
<span>{{ agv.inst_code || '无' }}</span>
|
||||
</div>
|
||||
<div class="task-item">
|
||||
<span class="label">当前位置:</span>
|
||||
<span>{{ agv.address || '未知' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="agv.is_error" class="agv-error-info">
|
||||
<h4>任务卡住原因:</h4>
|
||||
<div v-if="agv.error_action" class="error-item">
|
||||
<span class="label">Action不满足:</span>
|
||||
<span>{{ agv.error_action }}</span>
|
||||
</div>
|
||||
<div v-if="agv.error_mode" class="error-item">
|
||||
<span class="label">Mode不满足:</span>
|
||||
<span>{{ agv.error_mode }}</span>
|
||||
</div>
|
||||
<div v-if="agv.error_error" class="error-item">
|
||||
<span class="label">Error不满足:</span>
|
||||
<span>{{ agv.error_error }}</span>
|
||||
</div>
|
||||
<div v-if="agv.error_move" class="error-item">
|
||||
<span class="label">Move不满足:</span>
|
||||
<span>{{ agv.error_move }}</span>
|
||||
</div>
|
||||
<div v-if="agv.error_message" class="error-item">
|
||||
<span class="label">错误信息:</span>
|
||||
<span>{{ agv.error_message }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="agv.phase_name" class="agv-normal-info">
|
||||
<h4>当前任务进度:</h4>
|
||||
<div v-for="(step, index) in agv.phase_steps" :key="index" class="progress-item">
|
||||
<span class="step-name">{{ step.name }}</span>
|
||||
<el-progress
|
||||
:percentage="step.completed ? 100 : 0"
|
||||
:color="step.completed ? '#67C23A' : '#E6A23C'"
|
||||
:stroke-width="6"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- AGV详情弹窗 -->
|
||||
<el-dialog
|
||||
title="AGV详情"
|
||||
:visible.sync="dialogVisible"
|
||||
width="50%"
|
||||
>
|
||||
<div v-if="currentAgv" class="agv-detail">
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="AGV编号">{{ currentAgv.vehicle_code }}</el-descriptions-item>
|
||||
<el-descriptions-item label="当前状态">{{ currentAgv.status_text }}</el-descriptions-item>
|
||||
<el-descriptions-item label="当前阶段">{{ currentAgv.phase_name || '无' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="任务代码">{{ currentAgv.task_code || '无' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="指令代码">{{ currentAgv.inst_code || '无' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="当前位置">{{ currentAgv.address || '未知' }}</el-descriptions-item>
|
||||
<el-descriptions-item v-if="currentAgv.is_error" label="错误信息">
|
||||
<div v-if="currentAgv.error_action">Action不满足:{{ currentAgv.error_action }}</div>
|
||||
<div v-if="currentAgv.error_mode">Mode不满足:{{ currentAgv.error_mode }}</div>
|
||||
<div v-if="currentAgv.error_action">Move不满足:{{ currentAgv.error_move }}</div>
|
||||
<div v-if="currentAgv.error_error">Error不满足:{{ currentAgv.error_error }}</div>
|
||||
<div v-if="currentAgv.error_message">{{ currentAgv.error_message }}</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Background from '@/assets/images/bigScreen.png'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Background: Background,
|
||||
agvList: [
|
||||
{ vehicle_code: 'AGV01', status: 'running', status_text: '运行中', is_error: false },
|
||||
{ vehicle_code: 'AGV02', status: 'idle', status_text: '空闲', is_error: false },
|
||||
{ vehicle_code: 'AGV03', status: 'error', status_text: '异常', is_error: true },
|
||||
{ vehicle_code: 'AGV04', status: 'charging', status_text: '充电中', is_error: false }
|
||||
],
|
||||
getTime: '',
|
||||
getDate: '',
|
||||
dialogVisible: false,
|
||||
currentAgv: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
// 定时器,每秒更新一次数据
|
||||
const timer = setInterval(() => {
|
||||
this.settime()
|
||||
this.getMessage()
|
||||
}, 1000)
|
||||
|
||||
// 销毁定时器
|
||||
this.$once('hook:beforeDestroy', () => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
// 初始化数据
|
||||
this.settime()
|
||||
// 获取AGV状态数据
|
||||
this.getMessage()
|
||||
},
|
||||
settime() {
|
||||
const yy = new Date().getFullYear()
|
||||
const mm = new Date().getMonth() + 1
|
||||
const dd = new Date().getDate()
|
||||
const hh = new Date().getHours()
|
||||
const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
|
||||
const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
|
||||
this.getDate = yy + '年' + mm + '月' + dd + '日 ' + '星期' + '日一二三四五六'.charAt(new Date().getDay())
|
||||
this.getTime = hh + ':' + mf + ':' + ss
|
||||
},
|
||||
getMessage() {
|
||||
// 通过HTTP接口获取AGV状态数据
|
||||
this.$axios.get('/api/agv/two-floor/status')
|
||||
.then(response => {
|
||||
if (response) {
|
||||
this.updateAgvData(response)
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('获取AGV状态数据失败:', error)
|
||||
})
|
||||
},
|
||||
updateAgvData(agvDataList) {
|
||||
// 更新AGV数据
|
||||
agvDataList.forEach(data => {
|
||||
const agvIndex = this.agvList.findIndex(agv => agv.vehicle_code === data.vehicle_code)
|
||||
if (agvIndex !== -1) {
|
||||
// 处理AGV状态
|
||||
const statusMap = {
|
||||
'running': { text: '运行中', class: 'running' },
|
||||
'idle': { text: '空闲', class: 'idle' },
|
||||
'error': { text: '异常', class: 'error' },
|
||||
'charging': { text: '充电中', class: 'charging' }
|
||||
}
|
||||
|
||||
// 根据数据状态判断AGV是否处于错误状态
|
||||
const isError = !!(data.is_error || (data.error_action || data.error_mode || data.error_error || data.error_move || data.error_message))
|
||||
|
||||
// 设置状态信息
|
||||
const statusInfo = statusMap[data.status] || { text: '未知', class: 'unknown' }
|
||||
if (isError) {
|
||||
statusInfo.text = '异常'
|
||||
statusInfo.class = 'error'
|
||||
}
|
||||
|
||||
// 更新AGV数据
|
||||
this.agvList[agvIndex] = {
|
||||
...this.agvList[agvIndex],
|
||||
...data,
|
||||
status_text: statusInfo.text,
|
||||
status: statusInfo.class,
|
||||
is_error: isError,
|
||||
phase_name: data.phase_name,
|
||||
error_action: data.error_action,
|
||||
error_mode: data.error_mode,
|
||||
error_move: data.error_move,
|
||||
error_error: data.error_error,
|
||||
error_message: data.error_message
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
showAgvDetail(agv) {
|
||||
this.currentAgv = agv
|
||||
this.dialogVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.two-floor-agv-screen {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background-color: #f0f2f5;
|
||||
font-family: Arial, sans-serif;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.header {
|
||||
background-color: #2c3e50;
|
||||
color: white;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
margin: 0;
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.time-info {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.time-info span {
|
||||
display: block;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.agv-list {
|
||||
padding: 20px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.agv-item {
|
||||
background-color: white;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
border-left: 5px solid #409eff;
|
||||
}
|
||||
|
||||
.agv-item:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.agv-item.agv-error {
|
||||
border-left-color: #f56c6c;
|
||||
}
|
||||
|
||||
.agv-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.agv-basic-info h3 {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.status.running {
|
||||
background-color: #67c23a;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.status.idle {
|
||||
background-color: #909399;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.status.error {
|
||||
background-color: #f56c6c;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.status.charging {
|
||||
background-color: #e6a23c;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.status.unknown {
|
||||
background-color: #909399;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.agv-phase {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
color: #666;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.phase-value {
|
||||
font-size: 16px;
|
||||
color: #409eff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.agv-task-info {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.task-item {
|
||||
margin: 8px 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.agv-error-info {
|
||||
background-color: #fef0f0;
|
||||
border: 1px solid #fbc4ab;
|
||||
border-radius: 4px;
|
||||
padding: 15px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.agv-error-info h4 {
|
||||
margin-top: 0;
|
||||
color: #f56c6c;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.error-item {
|
||||
margin: 8px 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.agv-normal-info {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.agv-normal-info h4 {
|
||||
margin-top: 0;
|
||||
color: #67c23a;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.progress-item {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.step-name {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.agv-detail {
|
||||
padding: 10px 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user