opt: 立库输送机写入信号判断优化,添加输送机称重驱动
This commit is contained in:
@@ -35,6 +35,8 @@ public enum DriverTypeEnum {
|
|||||||
|
|
||||||
SIEMENS_CONVEYOR(13, "siemens_conveyor", "西门子-输送机驱动", "conveyor"),
|
SIEMENS_CONVEYOR(13, "siemens_conveyor", "西门子-输送机驱动", "conveyor"),
|
||||||
|
|
||||||
|
SIEMENS_WEIGHT_CONVEYOR(29, "siemens_weight_conveyor", "西门子-输送机驱动-称重", "conveyor"),
|
||||||
|
|
||||||
HONGXIANG_CONVEYOR(13, "hongxiang_conveyor", "烘箱对接位", "conveyor"),
|
HONGXIANG_CONVEYOR(13, "hongxiang_conveyor", "烘箱对接位", "conveyor"),
|
||||||
|
|
||||||
INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(14, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "conveyor"),
|
INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(14, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "conveyor"),
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
action = this.itemProtocol.getAction();
|
action = this.itemProtocol.getAction();
|
||||||
walk_y = this.itemProtocol.getWalk_y();
|
walk_y = this.itemProtocol.getWalk_y();
|
||||||
error = this.itemProtocol.getError();
|
error = this.itemProtocol.getError();
|
||||||
task = this.itemProtocol.getTask();
|
/*task = this.itemProtocol.getTask();*/
|
||||||
iserror = this.itemProtocol.deviceStatus;
|
iserror = this.itemProtocol.deviceStatus;
|
||||||
if (mode != last_mode) {
|
if (mode != last_mode) {
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||||
@@ -132,10 +132,10 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
|
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y:" + last_walk_y + "->" + walk_y);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y:" + last_walk_y + "->" + walk_y);
|
||||||
}
|
}
|
||||||
if (task != last_task) {
|
/*if (task != last_task) {
|
||||||
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
|
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ public class ItemProtocol {
|
|||||||
public static String item_walk_y = "walk_y";
|
public static String item_walk_y = "walk_y";
|
||||||
//报警
|
//报警
|
||||||
public static String item_error = "error";
|
public static String item_error = "error";
|
||||||
//任务号
|
/*//任务号
|
||||||
public static String item_task = "task";
|
public static String item_task = "task";*/
|
||||||
|
|
||||||
|
|
||||||
private BoxPalletizingManipulatorDeviceDriver driver;
|
private BoxPalletizingManipulatorDeviceDriver driver;
|
||||||
@@ -59,9 +59,9 @@ public class ItemProtocol {
|
|||||||
return this.getOpcIntegerValue(item_error);
|
return this.getOpcIntegerValue(item_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTask() {
|
/*public int getTask() {
|
||||||
return this.getOpcIntegerValue(item_task);
|
return this.getOpcIntegerValue(item_task);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
Boolean isonline;
|
Boolean isonline;
|
||||||
@@ -103,7 +103,7 @@ public class ItemProtocol {
|
|||||||
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
|
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
|
||||||
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
|
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
|
||||||
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"));*/
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -747,9 +747,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
map3.put("code", "to_command");
|
map3.put("code", "to_command");
|
||||||
map3.put("value", "1");
|
map3.put("value", "1");
|
||||||
list.add(map3);
|
list.add(map3);
|
||||||
this.writing(list);
|
try {
|
||||||
requireSucess = true;
|
this.writing(list);
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
} catch (Exception e) {
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + inst.getInstruction_code()
|
||||||
|
+ ",指令起点:" + inst.getStart_device_code()
|
||||||
|
+ ",指令终点:" + inst.getNext_device_code() + ",根据指令下发信号失败" + e.getMessage());
|
||||||
|
if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) {
|
||||||
|
requireSucess = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||||
, inst.getInstruction_code())) {
|
, inst.getInstruction_code())) {
|
||||||
this.writing(list);
|
this.writing(list);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
|
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
|
||||||
@@ -762,18 +771,11 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
requireSucess = false;
|
requireSucess = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// if (task != Integer.parseInt(inst.getInstruction_code())) {
|
|
||||||
// this.writing(list);
|
|
||||||
// message = "重新下发电气信号";
|
|
||||||
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
|
||||||
// }
|
|
||||||
message = "下发电气任务号成功";
|
message = "下发电气任务号成功";
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// type 5 输送任务
|
// type 5 输送任务
|
||||||
if (!StrUtil.equals(taskdto.getTask_type(), "5")) {
|
if (!StrUtil.equals(taskdto.getTask_type(), "5")) {
|
||||||
return false;
|
return false;
|
||||||
@@ -870,9 +872,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
map3.put("code", "to_command");
|
map3.put("code", "to_command");
|
||||||
map3.put("value", "1");
|
map3.put("value", "1");
|
||||||
list.add(map3);
|
list.add(map3);
|
||||||
this.writing(list);
|
try {
|
||||||
requireSucess = true;
|
this.writing(list);
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
} catch (Exception e) {
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + instdto.getInstruction_code()
|
||||||
|
+ ",指令起点:" + instdto.getStart_device_code()
|
||||||
|
+ ",指令终点:" + instdto.getNext_device_code() + ",根据指令下发信号失败" + e.getMessage());
|
||||||
|
if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) {
|
||||||
|
requireSucess = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||||
, instdto.getInstruction_code())) {
|
, instdto.getInstruction_code())) {
|
||||||
this.writing(list);
|
this.writing(list);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
||||||
@@ -885,14 +896,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
requireSucess = false;
|
requireSucess = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// if (task != Integer.parseInt(inst.getInstruction_code())) {
|
|
||||||
// this.writing(list);
|
|
||||||
// message = "重新下发电气信号";
|
|
||||||
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
//如果不存在则直接找对应指令
|
//如果不存在则直接找对应指令
|
||||||
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
|
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
|
||||||
@@ -929,9 +933,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
map3.put("code", "to_command");
|
map3.put("code", "to_command");
|
||||||
map3.put("value", "1");
|
map3.put("value", "1");
|
||||||
list.add(map3);
|
list.add(map3);
|
||||||
this.writing(list);
|
try {
|
||||||
requireSucess = true;
|
this.writing(list);
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
} catch (Exception e) {
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + inst.getInstruction_code()
|
||||||
|
+ ",指令起点:" + inst.getStart_device_code()
|
||||||
|
+ ",指令终点:" + inst.getNext_device_code() + ",根据指令下发信号失败" + e.getMessage());
|
||||||
|
if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) {
|
||||||
|
requireSucess = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||||
, inst.getInstruction_code())) {
|
, inst.getInstruction_code())) {
|
||||||
this.writing(list);
|
this.writing(list);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
||||||
@@ -944,11 +957,13 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
requireSucess = false;
|
requireSucess = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
// if (task != Integer.parseInt(inst.getInstruction_code())) {
|
// if (task != Integer.parseInt(inst.getInstruction_code())) {
|
||||||
// this.writing(list);
|
// this.writing(list);
|
||||||
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
// logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
||||||
// }
|
// }
|
||||||
|
requireSucess = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1116,7 +1131,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
if (jo.getInteger("status") == 200) {
|
if (jo.getInteger("status") == 200) {
|
||||||
message = "申请补码AGV搬运任务成功";
|
message = "申请补码AGV搬运任务成功";
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString()
|
Map map = new HashMap();
|
||||||
|
map.put("code", "to_command");
|
||||||
|
map.put("value", "8");
|
||||||
|
list.add(map);
|
||||||
|
try {
|
||||||
|
this.writing(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "申请补码AGV搬运任务下发信号失败" + e.getMessage());
|
||||||
|
requireSucess = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString()
|
||||||
, "8")) {
|
, "8")) {
|
||||||
this.writing(list);
|
this.writing(list);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", "再次下发mode信号");
|
logServer.deviceExecuteLog(device_code, "", "", "再次下发mode信号");
|
||||||
@@ -1125,7 +1151,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请补码AGV任务,返回参数:" + jo);
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请补码AGV任务,返回参数:" + jo);
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -1166,8 +1192,14 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
map.put("code", "to_command");
|
map.put("code", "to_command");
|
||||||
map.put("value", "8");
|
map.put("value", "8");
|
||||||
list.add(map);
|
list.add(map);
|
||||||
this.writing(list);
|
try {
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString()
|
this.writing(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "申请AGV搬运任务下发信号失败" + e.getMessage());
|
||||||
|
requireSucess = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString()
|
||||||
, "8")) {
|
, "8")) {
|
||||||
this.writing(list);
|
this.writing(list);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发mode信号");
|
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发mode信号");
|
||||||
@@ -1176,7 +1208,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo);
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo);
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.siemens_weigh_conveyor;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
public class ItemProtocol {
|
||||||
|
|
||||||
|
//心跳
|
||||||
|
public static String item_heartbeat = "heartbeat";
|
||||||
|
//工作模式
|
||||||
|
public static String item_mode = "mode";
|
||||||
|
//光电信号
|
||||||
|
public static String item_move = "move";
|
||||||
|
//托盘方向
|
||||||
|
public static String item_carrier_direction = "carrier_direction";
|
||||||
|
//报警
|
||||||
|
public static String item_error = "error";
|
||||||
|
//任务号
|
||||||
|
public static String item_task = "task";
|
||||||
|
//重量
|
||||||
|
public static String item_weight = "weight";
|
||||||
|
|
||||||
|
//下发命令
|
||||||
|
public static String item_to_command = "to_command";
|
||||||
|
//下发目标站
|
||||||
|
public static String item_to_target = "to_target";
|
||||||
|
//下发托盘类型
|
||||||
|
public static String item_to_container_type = "to_container_type";
|
||||||
|
//下发任务号
|
||||||
|
public static String item_to_task = "to_task";
|
||||||
|
//困扎次数
|
||||||
|
public static String item_to_strap_times = "to_strap_times";
|
||||||
|
//木箱长度
|
||||||
|
public static String item_to_length = "to_length";
|
||||||
|
//木箱宽度
|
||||||
|
public static String item_to_weight = "to_weight";
|
||||||
|
//木箱高度
|
||||||
|
public static String item_to_height = "to_height";
|
||||||
|
|
||||||
|
|
||||||
|
private SiemensWeightConveyorDeviceDriver driver;
|
||||||
|
|
||||||
|
public ItemProtocol(SiemensWeightConveyorDeviceDriver 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCarrier_direction() {
|
||||||
|
return this.getOpcIntegerValue(item_carrier_direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getError() {
|
||||||
|
return this.getOpcIntegerValue(item_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTask() {
|
||||||
|
return this.getOpcIntegerValue(item_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_command() {
|
||||||
|
return this.getOpcIntegerValue(item_to_command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_target() {
|
||||||
|
return this.getOpcIntegerValue(item_to_target);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_task() {
|
||||||
|
return this.getOpcIntegerValue(item_to_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_strap_times() {
|
||||||
|
return this.getOpcIntegerValue(item_to_strap_times);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_length() {
|
||||||
|
return this.getOpcIntegerValue(item_to_length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_weight() {
|
||||||
|
return this.getOpcIntegerValue(item_to_weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTo_height() {
|
||||||
|
return this.getOpcIntegerValue(item_to_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWeight() {
|
||||||
|
return this.getOpcIntegerValue(item_weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Boolean isonline;
|
||||||
|
Boolean deviceStatus = false;
|
||||||
|
|
||||||
|
public int getOpcIntegerValue(String protocol) {
|
||||||
|
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||||
|
if(ObjectUtil.isEmpty(value)){
|
||||||
|
deviceStatus = true;
|
||||||
|
}else if (item_heartbeat.equals(protocol)){
|
||||||
|
deviceStatus = false;
|
||||||
|
}
|
||||||
|
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.isEmpty(value)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||||
|
list.add(new ItemDto(item_mode, "工作模式", "DB600.B2"));
|
||||||
|
list.add(new ItemDto(item_move, "光电信号", "DB600.B3"));
|
||||||
|
list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB600.B4"));
|
||||||
|
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
|
||||||
|
list.add(new ItemDto(item_task, "任务号", "DB600.D10"));
|
||||||
|
list.add(new ItemDto(item_weight, "重量", "DB600.D12"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getWriteableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_to_command, "下发命令", "DB601.W2"));
|
||||||
|
list.add(new ItemDto(item_to_target, "下发目标站", "DB601.W4"));
|
||||||
|
list.add(new ItemDto(item_to_container_type, "下发托盘类型", "DB601.W6"));
|
||||||
|
list.add(new ItemDto(item_to_task, "下发任务号", "DB601.D8"));
|
||||||
|
list.add(new ItemDto(item_to_strap_times, "困扎次数", "DB601.W12"));
|
||||||
|
list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W14"));
|
||||||
|
list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W16"));
|
||||||
|
list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W18"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.siemens_weigh_conveyor;
|
||||||
|
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||||
|
import org.nl.acs.opc.Device;
|
||||||
|
import org.nl.acs.opc.DeviceType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 西门子-输送机驱动
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SiemensWeightConveyorDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "siemens_weight_conveyor";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "西门子-输送机驱动-称重";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "西门子-输送机驱动-称重";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new SiemensWeightConveyorDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return SiemensWeightConveyorDeviceDriver.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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -39,6 +39,7 @@ import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDevic
|
|||||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor.SiemensOneFloorAGVConveyorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor.SiemensOneFloorAGVConveyorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.siemens_weigh_conveyor.SiemensWeightConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.slit_two_manipulator.SlitTwoManipulatorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.slit_two_manipulator.SlitTwoManipulatorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDefination;
|
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDefination;
|
||||||
@@ -265,6 +266,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
CasingStationConveyorDeviceDriver casingStationConveyorDeviceDriver;
|
CasingStationConveyorDeviceDriver casingStationConveyorDeviceDriver;
|
||||||
//RGV
|
//RGV
|
||||||
RgvDeviceDriver rgvDeviceDriver;
|
RgvDeviceDriver rgvDeviceDriver;
|
||||||
|
//西门子-输送机称重驱动
|
||||||
|
SiemensWeightConveyorDeviceDriver siemensWeightConveyorDeviceDriver;
|
||||||
|
|
||||||
|
|
||||||
if (datas.size() == 0) {
|
if (datas.size() == 0) {
|
||||||
throw new BadRequestException("缺少输入参数!");
|
throw new BadRequestException("缺少输入参数!");
|
||||||
@@ -498,6 +502,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
// jo.put("task2", driver.getTask2());
|
// jo.put("task2", driver.getTask2());
|
||||||
jo.put("error", driver.getError());
|
jo.put("error", driver.getError());
|
||||||
jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(driver.getError())));
|
jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(driver.getError())));
|
||||||
|
}else if (device.getDeviceDriver() instanceof SiemensWeightConveyorDeviceDriver) {
|
||||||
|
siemensWeightConveyorDeviceDriver = (SiemensWeightConveyorDeviceDriver) device.getDeviceDriver();
|
||||||
|
jo.put("device_code", siemensWeightConveyorDeviceDriver.getDevice().getDevice_code());
|
||||||
|
jo.put("device_name", siemensWeightConveyorDeviceDriver.getDevice().getDevice_name());
|
||||||
|
jo.put("mode", siemensWeightConveyorDeviceDriver.getMode());
|
||||||
|
jo.put("move", siemensWeightConveyorDeviceDriver.getMove());
|
||||||
|
jo.put("error", siemensWeightConveyorDeviceDriver.getError());
|
||||||
|
jo.put("weight", siemensWeightConveyorDeviceDriver.getWeight());
|
||||||
} else {
|
} else {
|
||||||
jo.put("device_code", parent_device_code);
|
jo.put("device_code", parent_device_code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ import agv_ndc_two from '@/views/acs/device/driver/agv/agv_ndc_two'
|
|||||||
import box_palletizing_manipulator from '@/views/acs/device/driver/box_palletizing_manipulator'
|
import box_palletizing_manipulator from '@/views/acs/device/driver/box_palletizing_manipulator'
|
||||||
import oven_manipulator from '@/views/acs/device/driver/oven_manipulator'
|
import oven_manipulator from '@/views/acs/device/driver/oven_manipulator'
|
||||||
import siemens_conveyor from '@/views/acs/device/driver/siemens_conveyor'
|
import siemens_conveyor from '@/views/acs/device/driver/siemens_conveyor'
|
||||||
|
import siemens_weight_conveyor from '@/views/acs/device/driver/siemens_weight_conveyor'
|
||||||
import slit_two_manipulator from '@/views/acs/device/driver/slit_two_manipulator'
|
import slit_two_manipulator from '@/views/acs/device/driver/slit_two_manipulator'
|
||||||
import hongxiang_device from '@/views/acs/device/driver/hongxiang_device'
|
import hongxiang_device from '@/views/acs/device/driver/hongxiang_device'
|
||||||
import hongxiang_conveyor from '@/views/acs/device/driver/hongxiang_conveyor'
|
import hongxiang_conveyor from '@/views/acs/device/driver/hongxiang_conveyor'
|
||||||
@@ -126,6 +127,7 @@ export default {
|
|||||||
hongxiang_device,
|
hongxiang_device,
|
||||||
hongxiang_conveyor,
|
hongxiang_conveyor,
|
||||||
box_palletizing_manipulator,
|
box_palletizing_manipulator,
|
||||||
|
siemens_weight_conveyor,
|
||||||
oven_manipulator,
|
oven_manipulator,
|
||||||
siemens_conveyor,
|
siemens_conveyor,
|
||||||
slit_two_manipulator,
|
slit_two_manipulator,
|
||||||
|
|||||||
@@ -0,0 +1,559 @@
|
|||||||
|
<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_stock" />
|
||||||
|
</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.noIdleRequest" />
|
||||||
|
</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-col :span="8">
|
||||||
|
<el-form-item label="特殊请求标记复位" label-width="150px">
|
||||||
|
<el-switch v-model="form.special_flag" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="反馈设备状态" label-width="150px">
|
||||||
|
<el-switch v-model="form.sendDeviceStatus" />
|
||||||
|
</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.task_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,
|
||||||
|
require: 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_stock: 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,
|
||||||
|
special_flag: true,
|
||||||
|
sendDeviceStatus: true,
|
||||||
|
task_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