Compare commits
17 Commits
agv_twoFlo
...
acs_dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ea04e5a50 | |||
| 80dd7c78c1 | |||
| da5ad00ee5 | |||
| d7a23bbf66 | |||
| 33f9d153a4 | |||
| 0b5d4c1df6 | |||
| 60e61f1d99 | |||
| 04de617a12 | |||
| d1fb8af637 | |||
| 78baf3be4f | |||
| d7cd0bed54 | |||
| 6443056757 | |||
| ee83f434b8 | |||
| 1919e0f5f7 | |||
| 6bb12efd46 | |||
| 1f91405a40 | |||
| 45422b6939 |
@@ -1,5 +1,6 @@
|
||||
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;
|
||||
@@ -15,6 +16,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 二楼AGV状态管理服务
|
||||
* 负责管理和更新AGV状态,通过HTTP接口提供状态查询
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TwoFloorAgvStatusService {
|
||||
|
||||
@@ -110,31 +112,35 @@ public class TwoFloorAgvStatusService {
|
||||
* 清除AGV错误信息
|
||||
*/
|
||||
public void clearAgvError(int carno) {
|
||||
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("空闲");
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,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) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -218,10 +218,10 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
||||
int var18 = itemValues.length;
|
||||
|
||||
for (int var19 = 0; var19 < var18; ++var19) {
|
||||
ItemValue itemValue = var17[var19];
|
||||
String code = itemValue.getItem_code();
|
||||
Object value = itemValue.getItem_value();
|
||||
opcValueAccessor.setValue(code, value);
|
||||
//ItemValue itemValue = var17[var19];
|
||||
//String code = itemValue.getItem_code();
|
||||
//Object value = itemValue.getItem_value();
|
||||
//opcValueAccessor.setValue(code, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,10 +274,10 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
||||
int var18 = itemValues.length;
|
||||
|
||||
for (int var19 = 0; var19 < var18; ++var19) {
|
||||
ItemValue itemValue = var17[var19];
|
||||
String code = itemValue.getItem_code();
|
||||
Object value = itemValue.getItem_value();
|
||||
opcValueAccessor.setValue(code, value);
|
||||
//ItemValue itemValue = var17[var19];
|
||||
//String code = itemValue.getItem_code();
|
||||
//Object value = itemValue.getItem_value();
|
||||
//opcValueAccessor.setValue(code, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -202,7 +202,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
|
||||
//空箱出库开盖位,申请开盖
|
||||
if (mode == 15 && move == 1 && task > 0) {
|
||||
if (mode == 15 && move == 1 && task > 0 && !requireSucess) {
|
||||
Instruction instruction = instructionService.findByCode(String.valueOf(task));
|
||||
//不允许开盖,完成出库任务,自动去扫码位
|
||||
if (instruction == null || StrUtil.isEmpty(instruction.getVehicle_code())) {
|
||||
|
||||
@@ -424,14 +424,16 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
|
||||
BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
|
||||
if (nextDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) {
|
||||
boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
if (boxSubvolumesConveyorDeviceDriver.getMove() != 1) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage2";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//效率提升屏蔽光电判断
|
||||
|
||||
// BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
|
||||
// if (nextDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) {
|
||||
// boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
// if (boxSubvolumesConveyorDeviceDriver.getMove() != 1) {
|
||||
// notCreateInstMessage = "universal_notCreateInstMessage2";
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver;
|
||||
if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) {
|
||||
@@ -553,11 +555,11 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
map12.put("value", interactionJsonDTO.getFrpModel());
|
||||
list.add(map12);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getIsHave())) {
|
||||
map13.put("code", "to_have_or_not");
|
||||
map13.put("value", interactionJsonDTO.getIsHave());
|
||||
list.add(map13);
|
||||
}
|
||||
// if (ObjectUtil.isNotEmpty(interactionJsonDTO.getIsHave())) {
|
||||
// map13.put("code", "to_have_or_not");
|
||||
// map13.put("value", interactionJsonDTO.getIsHave());
|
||||
// list.add(map13);
|
||||
// }
|
||||
}
|
||||
this.writing(list);
|
||||
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -47,9 +47,9 @@ public class OpcUtl {
|
||||
Map<Item, Integer> e = null;
|
||||
try {
|
||||
e = group.write(requests);
|
||||
log.info("Group返回下发信号结果:" + String.valueOf(e));
|
||||
// group.write(requests);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
throw new BadRequestException("下发信号失败:" + e1.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -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'))" />
|
||||
|
||||
@@ -169,6 +169,7 @@ export default {
|
||||
})
|
||||
},
|
||||
updateAgvData(agvDataList) {
|
||||
this.agvList = agvDataList
|
||||
// 更新AGV数据
|
||||
agvDataList.forEach(data => {
|
||||
const agvIndex = this.agvList.findIndex(agv => agv.vehicle_code === data.vehicle_code)
|
||||
|
||||
Reference in New Issue
Block a user