add:木箱入库桁架
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -163,8 +163,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
/**
|
/**
|
||||||
* 下发任务号
|
* 下发任务号
|
||||||
*/
|
*/
|
||||||
String to_task = null;
|
int to_task = 0;
|
||||||
String last_to_task = null;
|
int last_to_task = 0;
|
||||||
/**
|
/**
|
||||||
* 下发接纯数字托盘号
|
* 下发接纯数字托盘号
|
||||||
*/
|
*/
|
||||||
@@ -511,9 +511,9 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
this.instruction_require_time = date;
|
this.instruction_require_time = date;
|
||||||
//查找有没有对应的指令
|
//查找有没有对应的指令
|
||||||
Instruction inst;
|
Instruction inst;
|
||||||
if ("RK1032".equals(this.device_code)||"RK1034".equals(this.device_code)||"RK1035".equals(this.device_code)){
|
if ("RK1032".equals(this.device_code) || "RK1034".equals(this.device_code) || "RK1035".equals(this.device_code)) {
|
||||||
inst = instructionService.findByStartCodeAndReady2(this.device_code);
|
inst = instructionService.findByStartCodeAndReady2(this.device_code);
|
||||||
}else {
|
} else {
|
||||||
inst = instructionService.findByStartCodeAndReady(this.device_code);
|
inst = instructionService.findByStartCodeAndReady(this.device_code);
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(inst)) {
|
if (ObjectUtil.isNotNull(inst)) {
|
||||||
@@ -803,8 +803,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
// led_message = getLedMessage(instdto);
|
// led_message = getLedMessage(instdto);
|
||||||
//写完信号to_task写成功后更新指令为执行中
|
//写完信号to_task写成功后更新指令为执行中
|
||||||
inst = checkInst();
|
inst = checkInst();
|
||||||
to_task = this.itemProtocol.getTo_task();
|
to_task = this.itemProtocol.getTo_task();
|
||||||
if (Integer.parseInt(to_task)>0 && to_task.equals(inst.getInstruction_code())) {
|
if (to_task > 0 && to_task == Integer.parseInt(inst.getInstruction_code())) {
|
||||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||||
inst.setExecute_device_code(this.device_code);
|
inst.setExecute_device_code(this.device_code);
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ public class ItemProtocol {
|
|||||||
return this.getOpcIntegerValue(item_task);
|
return this.getOpcIntegerValue(item_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTo_task() {
|
public int getTo_task() {
|
||||||
return this.getOpcStringValue(item_to_task);
|
return this.getOpcIntegerValue(item_to_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public class ItemProtocol {
|
|||||||
} else {
|
} else {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return "";
|
return "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getOpcArrayValue(String protocol) {
|
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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
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.AbstractOpcDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
|
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.ErrorUtil;
|
||||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
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.LuceneExecuteLogService;
|
||||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -72,6 +76,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class);
|
||||||
|
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
int last_mode = 0;
|
int last_mode = 0;
|
||||||
@@ -80,8 +85,11 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
int last_action = 0;
|
int last_action = 0;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
int task = 0;
|
int task = 0;
|
||||||
|
String barcode = null;
|
||||||
|
float weight = 0.0f;
|
||||||
int heartbeat = 0;
|
int heartbeat = 0;
|
||||||
int to_command = 0;
|
int to_command = 0;
|
||||||
|
int last_to_command = 0;
|
||||||
int to_target = 0;
|
int to_target = 0;
|
||||||
int to_onset = 0;
|
int to_onset = 0;
|
||||||
|
|
||||||
@@ -141,6 +149,10 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
mode = this.itemProtocol.getMode();
|
mode = this.itemProtocol.getMode();
|
||||||
move = this.itemProtocol.getMove();
|
move = this.itemProtocol.getMove();
|
||||||
action = this.itemProtocol.getAction();
|
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();
|
error = this.itemProtocol.getError();
|
||||||
task = this.itemProtocol.getTask();
|
task = this.itemProtocol.getTask();
|
||||||
heartbeat = this.itemProtocol.getHeartbeat();
|
heartbeat = this.itemProtocol.getHeartbeat();
|
||||||
@@ -154,9 +166,31 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
if (mode != last_mode) {
|
if (mode != last_mode) {
|
||||||
requireSucess = false;
|
requireSucess = false;
|
||||||
}
|
}
|
||||||
if(action == last_action){
|
if(action != last_action){
|
||||||
requireActionSucess = false;
|
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) {
|
if (mode == 3 && task > 0 && !requireActionSucess) {
|
||||||
updateInstructionStatus();
|
updateInstructionStatus();
|
||||||
@@ -190,7 +224,6 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String remark = "";
|
String remark = "";
|
||||||
;
|
|
||||||
if (mode != 2) {
|
if (mode != 2) {
|
||||||
remark = "universal_remark2";
|
remark = "universal_remark2";
|
||||||
}
|
}
|
||||||
@@ -227,7 +260,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
last_mode =mode;
|
last_mode =mode;
|
||||||
last_action = action;
|
last_action = action;
|
||||||
|
last_to_command = to_command;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateInstructionStatus() {
|
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 (action == 5 && move == 0) {
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
@@ -595,7 +646,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "box_storage_manipulator");
|
jo.put("driver_type", "box_storage_manipulator");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ public class ItemProtocol {
|
|||||||
* 任务号
|
* 任务号
|
||||||
*/
|
*/
|
||||||
public static String item_task = "task";
|
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() {
|
public int getTask() {
|
||||||
return this.getOpcIntegerValue(item_task);
|
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() {
|
public int getWalk_y() {
|
||||||
@@ -220,6 +234,8 @@ public class ItemProtocol {
|
|||||||
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
|
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
|
||||||
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
|
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
|
||||||
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
|
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_walk_y, "行走列", "DB1.B4"));
|
||||||
list.add(new ItemDto(item_x, "行走列号", "DB101.B10"));
|
list.add(new ItemDto(item_x, "行走列号", "DB101.B10"));
|
||||||
list.add(new ItemDto(item_y, "行走层号", "DB101.B11"));
|
list.add(new ItemDto(item_y, "行走层号", "DB101.B11"));
|
||||||
|
|||||||
@@ -611,7 +611,6 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
if (date.getTime() - this.applyPullShaft_time.getTime() < (long) this.applyPullShaft_time_out) {
|
if (date.getTime() - this.applyPullShaft_time.getTime() < (long) this.applyPullShaft_time_out) {
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.applyPullShaft_time_out);
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.applyPullShaft_time_out);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
this.applyPullShaft_time = date;
|
this.applyPullShaft_time = date;
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴");
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴");
|
||||||
|
|||||||
@@ -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.ext.wms.data.one.BaseRequest;
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface AcsToWmsService {
|
public interface AcsToWmsService {
|
||||||
|
|
||||||
|
|
||||||
@@ -225,4 +227,6 @@ public interface AcsToWmsService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param);
|
ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param);
|
||||||
|
|
||||||
|
HttpResponse feedBoxWeight(Map<String, Object> request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -818,6 +818,35 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
return manipulatorApplyPointResponse;
|
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
|
@Override
|
||||||
public void actionFinishRequest2(JSONObject jsonObject) {
|
public void actionFinishRequest2(JSONObject jsonObject) {
|
||||||
HttpResponse execute = null;
|
HttpResponse execute = null;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
<!-- <appender-ref ref="asyncFileAppender"/>-->
|
<!-- <appender-ref ref="asyncFileAppender"/>-->
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="CONSOLE"/>
|
||||||
</root>
|
</root>
|
||||||
<!-- <logger name="jdbc" level="ERROR" additivity="true">
|
<logger name="jdbc" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.springframework" level="ERROR" additivity="true">
|
<logger name="org.springframework" level="ERROR" additivity="true">
|
||||||
@@ -95,7 +95,10 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
</logger>
|
</logger>
|
||||||
<logger name="org.jinterop" level="ERROR" additivity="true">
|
<logger name="org.jinterop" level="ERROR" additivity="true">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
</logger>-->
|
</logger>
|
||||||
|
<logger name="org.openscada" level="ERROR" additivity="true">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
|
|
||||||
<!--测试环境:打印控制台-->
|
<!--测试环境:打印控制台-->
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
ENV = 'development'
|
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'
|
VUE_APP_WS_API = 'ws://localhost:8011'
|
||||||
|
|
||||||
# 是否启用 babel-plugin-dynamic-import-node插件
|
# 是否启用 babel-plugin-dynamic-import-node插件
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ ENV = 'production'
|
|||||||
|
|
||||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
# 接口地址,注意协议,如果你没有配置 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
|
# 如果接口是 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 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 box_manipulator_site from '@/views/acs/device/driver/box_manipulator_site.vue'
|
||||||
import rgv from '@/views/acs/device/driver/rgv.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 dry_manipulator from '@/views/acs/device/driver/dry_manipulator.vue'
|
||||||
import blanking_button from '@/views/acs/device/driver/blanking_button.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'
|
import pull_head_manipulator from '@/views/acs/device/driver/pull_head_manipulator.vue'
|
||||||
@@ -200,7 +201,8 @@ export default {
|
|||||||
paper_tube_pick_size,
|
paper_tube_pick_size,
|
||||||
one_rgv,
|
one_rgv,
|
||||||
die_manipulator,
|
die_manipulator,
|
||||||
raster
|
raster,
|
||||||
|
optoele_docking_station
|
||||||
},
|
},
|
||||||
dicts: ['device_type'],
|
dicts: ['device_type'],
|
||||||
mixins: [crud],
|
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>
|
||||||
Reference in New Issue
Block a user