更新
This commit is contained in:
@@ -84,6 +84,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
System.out.println("1楼NDCAgv链接成功");
|
||||
log.info("1楼NDCAgv链接成功");
|
||||
while (bConnected) {
|
||||
int count = dis.read(b);
|
||||
|
||||
@@ -187,10 +188,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
||||
agvNdcOneDeviceDriver.processSocket(arr);
|
||||
if(ObjectUtil.isNotEmpty(device)){
|
||||
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
||||
agvNdcOneDeviceDriver.processSocket(arr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
write(data);
|
||||
@@ -203,6 +207,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("OneAgv链接异常");
|
||||
log.info("OneAgv链接异常");
|
||||
if(ObjectUtil.isNotEmpty(s)){
|
||||
s.close();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ public enum DriverTypeEnum {
|
||||
|
||||
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"),
|
||||
|
||||
PLUG_PULL_DEVICE_SITE(15, "plug_pull_device_site", "插拔轴站点", "conveyor");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -79,13 +79,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
int carno = arr[20];
|
||||
Instruction link_inst = null;
|
||||
List<Instruction> insts = null;
|
||||
Instruction inst = null;
|
||||
boolean link_flag = false;
|
||||
Device agv_device = null;
|
||||
if (carno != 0) {
|
||||
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
|
||||
}
|
||||
if (ikey != 0) {
|
||||
insts = instructionService.findByLinkNum(String.valueOf(ikey));
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
@@ -114,10 +115,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//分配 车id
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x02) {
|
||||
for (Instruction inst : insts) {
|
||||
inst.setCarno(String.valueOf(carno));
|
||||
instructionService.update(inst);
|
||||
}
|
||||
inst.setCarno(String.valueOf(carno));
|
||||
instructionService.update(inst);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data);
|
||||
|
||||
//到达取货点
|
||||
@@ -151,33 +150,34 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
for (Instruction inst : insts) {
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
break;
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if(siemensConveyorDeviceDriver.getMove() == 1 && siemensConveyorDeviceDriver.getMode() == 2 ){
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if(siemensConveyorDeviceDriver.getMove() == 1 ){
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("请求取货条件不满足待机有货");
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
//取货完毕
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x05) {
|
||||
@@ -208,34 +208,33 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code);
|
||||
return;
|
||||
}
|
||||
for (Instruction inst : insts) {
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
break;
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
siemensConveyorDeviceDriver.writing(2);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
siemensConveyorDeviceDriver.writing(2);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
@@ -267,27 +266,26 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
for (Instruction inst : insts) {
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
break;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
// standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
// standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
@@ -320,27 +318,26 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
for (Instruction inst : insts) {
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
break;
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
// standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
// standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
package org.nl.acs.device_driver.basedriver.plug_pull_device_site;
|
||||
|
||||
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 {
|
||||
|
||||
//1/0 手动/自动
|
||||
public static String item_mode = "mode";
|
||||
//0/1 半自动/全自动
|
||||
public static String item_action = "action";
|
||||
//0/1 远程/本地控制
|
||||
public static String item_control = "control";
|
||||
//2 运行中
|
||||
//1 急停/故障
|
||||
//0 待机中
|
||||
public static String item_status = "status";
|
||||
//1 机头上有轴
|
||||
public static String item_move = "move";
|
||||
//1/0 穿轴中/穿轴完成
|
||||
public static String item_plug_finish = "plug_finish";
|
||||
//1/0 把轴中/拔轴完成
|
||||
public static String item_pull_finish = "pull_finish";
|
||||
//3寸轴穿轴次数
|
||||
public static String item_3plug_times = "3plug_times";
|
||||
//6寸轴穿轴次数
|
||||
public static String item_6plug_times = "6plug_times";
|
||||
//3寸轴拔轴次数
|
||||
public static String item_3pull_times = "3pull_times";
|
||||
//6寸轴拔轴次数
|
||||
public static String item_6pull_times = "6pull_times";
|
||||
//穿轴总次数
|
||||
public static String item_plug_alltimes = "plug_alltimes";
|
||||
//拔轴总次数
|
||||
public static String item_pull_alltimes = "pull_alltimes";
|
||||
|
||||
|
||||
//1 全自动启动
|
||||
public static String item_to_command = "to_command";
|
||||
//0/1 穿轴/拔轴
|
||||
public static String item_to_type = "to_type";
|
||||
//3/6 轴尺寸
|
||||
public static String item_to_size = "to_size";
|
||||
|
||||
|
||||
private PlugPullDeviceSiteDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(PlugPullDeviceSiteDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getItem_mode(){
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
} ;
|
||||
public int getItem_move(){
|
||||
return this.getOpcIntegerValue(item_move);
|
||||
} ;
|
||||
public int getItem_action(){
|
||||
return this.getOpcIntegerValue(item_action);
|
||||
};
|
||||
public int getItem_control(){
|
||||
return this.getOpcIntegerValue(item_control);
|
||||
} ;
|
||||
public int getItem_status(){
|
||||
return this.getOpcIntegerValue(item_status);
|
||||
} ;
|
||||
public int getItem_plug_finish(){
|
||||
return this.getOpcIntegerValue(item_plug_finish);
|
||||
} ;
|
||||
public int getItem_pull_finish(){
|
||||
return this.getOpcIntegerValue(item_pull_finish);
|
||||
} ;
|
||||
public int getItem_3plug_times(){
|
||||
return this.getOpcIntegerValue(item_3plug_times);
|
||||
} ;
|
||||
public int getItem_6plug_times(){
|
||||
return this.getOpcIntegerValue(item_6plug_times);
|
||||
} ;
|
||||
public int getItem_3pull_times(){
|
||||
return this.getOpcIntegerValue(item_3pull_times);
|
||||
} ;
|
||||
public int getItem_6pull_times(){
|
||||
return this.getOpcIntegerValue(item_6pull_times);
|
||||
} ;
|
||||
public int getItem_plug_alltimes(){
|
||||
return this.getOpcIntegerValue(item_plug_alltimes);
|
||||
} ;
|
||||
public int getItem_pull_alltimes(){
|
||||
return this.getOpcIntegerValue(item_pull_alltimes);
|
||||
} ;
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public float getOpcFloatValue(String protocol) {
|
||||
Float value = this.driver.getDoubleValue(protocol);
|
||||
if (value == null) {
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_mode, "工作模式", "30243"));
|
||||
list.add(new ItemDto(item_action, "半自动/全自动", "30245"));
|
||||
list.add(new ItemDto(item_control, "远程控制", "30254"));
|
||||
list.add(new ItemDto(item_status, "状态", "30181"));
|
||||
list.add(new ItemDto(item_move, "机头上有轴", "30252"));
|
||||
list.add(new ItemDto(item_plug_finish, "穿轴完成", "30249"));
|
||||
list.add(new ItemDto(item_pull_finish, "拔轴完成", "30250"));
|
||||
list.add(new ItemDto(item_3plug_times, "3寸轴穿轴次数", "30231"));
|
||||
list.add(new ItemDto(item_6plug_times, "6寸轴穿轴次数", "30235"));
|
||||
list.add(new ItemDto(item_3pull_times, "3寸轴拔轴次数", "30233"));
|
||||
list.add(new ItemDto(item_6pull_times, "6寸轴拔轴次数", "30237"));
|
||||
list.add(new ItemDto(item_plug_alltimes, "穿轴总次数", "30239"));
|
||||
list.add(new ItemDto(item_pull_alltimes, "拔轴总次数", "30241"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "40246"));
|
||||
list.add(new ItemDto(item_to_type, "类型", "40244"));
|
||||
list.add(new ItemDto(item_to_size, "尺寸", "40247"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.nl.acs.device_driver.basedriver.plug_pull_device_site;
|
||||
|
||||
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 PlugPullDeviceSiteDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "plug_pull_device_site";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "插拔轴工位";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "插拔轴工位";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new PlugPullDeviceSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return PlugPullDeviceSiteDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.conveyor);
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package org.nl.acs.device_driver.basedriver.plug_pull_device_site;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 插拔轴工位
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
@Autowired
|
||||
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
|
||||
@Autowired
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
@Autowired
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
|
||||
@Autowired
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
@Autowired
|
||||
AgvService agvService = SpringContextHolder.getBean(AgvService.class);
|
||||
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
private Date instruction_apply_time = new Date();
|
||||
private int instruction_require_time_out = 3000;
|
||||
|
||||
public int mode = 0;
|
||||
public int move = 0;
|
||||
public int action = 0;
|
||||
public int status = 0;
|
||||
public int control = 0;
|
||||
public int plug_finish = 0;
|
||||
public int pull_finish = 0;
|
||||
public int plug3_times = 0;
|
||||
public int plug6_times = 0;
|
||||
public int pull3_times = 0;
|
||||
public int pull6_times = 0;
|
||||
public int plug_alltimes = 0;
|
||||
public int pull_alltimes = 0;
|
||||
|
||||
public int last_mode = 0;
|
||||
public int last_move = 0;
|
||||
public int last_action = 0;
|
||||
public int last_status = 0;
|
||||
public int last_control = 0;
|
||||
public int last_plug_finish = 0;
|
||||
public int last_pull_finish = 0;
|
||||
|
||||
|
||||
Boolean isonline = true;
|
||||
|
||||
Boolean iserror = false;
|
||||
|
||||
//1-执行任务;2-取货完成;3-放货完成;
|
||||
int flag;
|
||||
|
||||
String device_code;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
//请求成功标记
|
||||
Boolean requireSucess = false;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getItem_mode();
|
||||
move = this.itemProtocol.getItem_move();
|
||||
action = this.itemProtocol.getItem_action();
|
||||
status = this.itemProtocol.getItem_status();
|
||||
control = this.itemProtocol.getItem_control();
|
||||
plug_finish = this.itemProtocol.getItem_plug_finish();
|
||||
pull_finish = this.itemProtocol.getItem_pull_finish();
|
||||
plug3_times = this.itemProtocol.getItem_3plug_times();
|
||||
plug6_times = this.itemProtocol.getItem_6plug_times();
|
||||
pull3_times = this.itemProtocol.getItem_3pull_times();
|
||||
pull6_times = this.itemProtocol.getItem_6pull_times();
|
||||
plug_alltimes = this.itemProtocol.getItem_plug_alltimes();
|
||||
pull_alltimes = this.itemProtocol.getItem_pull_alltimes();
|
||||
|
||||
|
||||
|
||||
|
||||
if (status != 1) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "有报警";
|
||||
//无报警
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
|
||||
last_mode = mode;
|
||||
last_move = move;
|
||||
last_action = action;
|
||||
}
|
||||
|
||||
|
||||
protected void thingToNothing() {
|
||||
//this.setRequireSucess(false);
|
||||
}
|
||||
|
||||
public void writing(List list) {
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object ob = list.get(i);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
|
||||
if (!StrUtil.isEmpty(json.getString("value"))) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + json.getString("code");
|
||||
itemMap.put(to_param, json.getString("value"));
|
||||
}
|
||||
}
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
//将扩展表中的字符串数据转换成集合
|
||||
public List<String> getExtraDeviceCodes(String extraName) {
|
||||
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
|
||||
if (StrUtil.isEmpty(extraValue)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
String devicesString = extraValue.substring(1, extraValue.length() - 1);
|
||||
List<String> devicesList = new ArrayList<>();
|
||||
String[] devices = devicesString.split(",");
|
||||
for (int i = 0; i < devices.length; i++) {
|
||||
String s = devices[i].replace("\"", "").replace("\"", "");
|
||||
devicesList.add(s);
|
||||
}
|
||||
return devicesList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String mode = "";
|
||||
String action = "";
|
||||
String move = "";
|
||||
if (this.getMode() == 0) {
|
||||
mode = "未联机";
|
||||
} else if (this.getMode() == 1) {
|
||||
mode = "单机";
|
||||
} else if (this.getMode() == 2) {
|
||||
mode = "联机";
|
||||
} else if (this.getMode() == 3) {
|
||||
mode = "运行中";
|
||||
}
|
||||
|
||||
if (this.getMove() == 0) {
|
||||
move = "无货";
|
||||
jo.put("hasGoods", false);
|
||||
} else if (this.getMove() == 1) {
|
||||
move = "有货";
|
||||
jo.put("hasGoods", true);
|
||||
} else if (this.getMove() == 2) {
|
||||
move = "有托盘有货";
|
||||
jo.put("hasGoods", true);
|
||||
}
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("action", action);
|
||||
jo.put("isOnline", this.getIsonline());
|
||||
jo.put("isError", this.getIserror());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -134,45 +134,43 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
mode = this.itemProtocol.getMode();move = this.itemProtocol.getMove();
|
||||
carrier_direction = this.itemProtocol.getCarrier_direction();
|
||||
error = this.itemProtocol.getError();
|
||||
task = this.itemProtocol.getTask();
|
||||
if (mode != last_mode) {
|
||||
requireSucess = false;
|
||||
requireApplyLabelingSuccess = false;
|
||||
requireApplyLaStrangulationSuccess =false;
|
||||
requireEmptyInSuccess =false;
|
||||
requireEmptyOutSuccess =false;
|
||||
if (mode == 2) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireSucess:" + requireSucess);
|
||||
requireSucess = false;
|
||||
requireApplyLabelingSuccess = false;
|
||||
requireApplyLaStrangulationSuccess =false;
|
||||
requireEmptyInSuccess =false;
|
||||
requireEmptyOutSuccess =false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireSucess:" + requireSucess);
|
||||
}
|
||||
if (mode == 4) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireApplyLabelingSuccess:" + requireApplyLabelingSuccess);
|
||||
requireApplyLaStrangulationSuccess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireApplyLabelingSuccess:" + requireApplyLabelingSuccess);
|
||||
}
|
||||
if (mode == 5) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireApplyLaStrangulationSuccess:" + requireApplyLaStrangulationSuccess);
|
||||
requireApplyLabelingSuccess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireApplyLaStrangulationSuccess:" + requireApplyLaStrangulationSuccess);
|
||||
}
|
||||
if (mode == 6) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireEmptyInSuccess:" + requireEmptyInSuccess);
|
||||
requireEmptyInSuccess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireEmptyInSuccess:" + requireEmptyInSuccess);
|
||||
}
|
||||
if (mode == 7) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireEmptyOutSuccess:" + requireEmptyOutSuccess);
|
||||
requireEmptyOutSuccess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireEmptyOutSuccess:" + requireEmptyOutSuccess);
|
||||
}
|
||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
if (move != last_move) {
|
||||
if(move == 0 ){
|
||||
this.clearWrite();
|
||||
}
|
||||
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||
}
|
||||
@@ -225,68 +223,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (agvphase == 0x03) {
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
inst.setExecute_status("1");
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
||||
agvphase = 0;
|
||||
index = 0;
|
||||
inst = null;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
|
||||
} else {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (agvphase == 0x05) {
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
inst.setExecute_status("2");
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
||||
// OneNDCSocketConnectionAutoRun.write(data);
|
||||
agvphase = 0;
|
||||
index = 0;
|
||||
inst = null;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
|
||||
} else {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (agvphase == 0x07) {
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
inst.setExecute_status("5");
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
||||
// OneNDCSocketConnectionAutoRun.write(data);
|
||||
agvphase = 0;
|
||||
index = 0;
|
||||
inst = null;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
|
||||
} else {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
|
||||
}
|
||||
}
|
||||
|
||||
if (agvphase == 0x09) {
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
inst.setExecute_status("6");
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
||||
// OneNDCSocketConnectionAutoRun.write(data);
|
||||
agvphase = 0;
|
||||
index = 0;
|
||||
inst = null;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "反馈成功");
|
||||
} else {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + agvphase + "等待反馈");
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception var17) {
|
||||
inst_message = var17.getMessage();
|
||||
@@ -366,8 +303,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
//空托盘满垛出库申请
|
||||
if (move > 0 && !requireEmptyOutSuccess) {
|
||||
//空盘出库申请
|
||||
if (move == 0 && !requireEmptyOutSuccess) {
|
||||
emptyOut();
|
||||
}
|
||||
break;
|
||||
@@ -392,13 +329,38 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
|
||||
public void clearWrite() {
|
||||
this.writing("to_command", "0");
|
||||
this.writing("to_target", "0");
|
||||
this.writing("to_container_type", "0");
|
||||
this.writing("to_strap_times", "0");
|
||||
this.writing("to_length", "0");
|
||||
this.writing("to_weight", "0");
|
||||
this.writing("to_height", "0");
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code","to_target");
|
||||
map.put("value","0");
|
||||
list.add(map);
|
||||
// Map map2 = new HashMap();
|
||||
// map2.put("code","to_task");
|
||||
// map2.put("value","0");
|
||||
// list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","0");
|
||||
list.add(map3);
|
||||
Map map4 = new HashMap();
|
||||
map4.put("code","to_strap_times");
|
||||
map4.put("value","0");
|
||||
list.add(map4);
|
||||
Map map5 = new HashMap();
|
||||
map5.put("code","to_length");
|
||||
map5.put("value","0");
|
||||
list.add(map5);
|
||||
Map map6 = new HashMap();
|
||||
map6.put("code","to_weight");
|
||||
map6.put("value","0");
|
||||
list.add(map6);
|
||||
Map map7 = new HashMap();
|
||||
map7.put("code","to_height");
|
||||
map7.put("value","0");
|
||||
list.add(map7);
|
||||
this.writing(list);
|
||||
|
||||
}
|
||||
|
||||
public boolean exe_business() {
|
||||
@@ -813,7 +775,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
message = "申请任务中...";
|
||||
JSONObject apply = new JSONObject();
|
||||
apply.put("device_code", device_code);
|
||||
apply.put("type","2");
|
||||
apply.put("type","3");
|
||||
String str = acsToWmsService.applyTaskToWms(apply);
|
||||
JSONObject jo = JSON.parseObject(str);
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
|
||||
@@ -270,6 +270,37 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
this.setApplySucess(false);
|
||||
clearBarcode();
|
||||
this.set_last_container(container);
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code","to_target");
|
||||
map.put("value","0");
|
||||
list.add(map);
|
||||
// Map map2 = new HashMap();
|
||||
// map2.put("code","to_task");
|
||||
// map2.put("value","0");
|
||||
// list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","0");
|
||||
list.add(map3);
|
||||
Map map4 = new HashMap();
|
||||
map4.put("code","to_strap_times");
|
||||
map4.put("value","0");
|
||||
list.add(map4);
|
||||
Map map5 = new HashMap();
|
||||
map5.put("code","to_length");
|
||||
map5.put("value","0");
|
||||
list.add(map5);
|
||||
Map map6 = new HashMap();
|
||||
map6.put("code","to_weight");
|
||||
map6.put("value","0");
|
||||
list.add(map6);
|
||||
Map map7 = new HashMap();
|
||||
map7.put("code","to_height");
|
||||
map7.put("value","0");
|
||||
list.add(map7);
|
||||
this.writing(list);
|
||||
|
||||
}
|
||||
|
||||
public void set_last_container(String barcode) {
|
||||
@@ -617,6 +648,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
JSONObject apply = new JSONObject();
|
||||
apply.put("vehicle_code", container_code);
|
||||
apply.put("device_code", device_code);
|
||||
apply.put("type","1");
|
||||
String str = acsToWmsService.applyTaskToWms(apply);
|
||||
JSONObject jo = JSON.parseObject(str);
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
@@ -716,6 +748,12 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
jo.put("message", this.getMessage());
|
||||
jo.put("task", this.getTask());
|
||||
jo.put("barcode", this.getBarcode());
|
||||
String requireSucess = "0";
|
||||
if (this.requireSucess) {
|
||||
requireSucess = "1";
|
||||
}
|
||||
jo.put("requireSucess", requireSucess);
|
||||
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@@ -1138,9 +1138,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
|
||||
while (var3.hasNext()) {
|
||||
TaskDto task = (TaskDto) var3.next();
|
||||
if (!StrUtil.equals(task.getTask_type(), "5")) {
|
||||
continue;
|
||||
}
|
||||
// if (!StrUtil.equals(task.getTask_type(), "5")) {
|
||||
// continue;
|
||||
// }
|
||||
if (StrUtil.equals(task.getStart_device_code(), device_code) && StrUtil.equals(task.getTask_status(), "0")) {
|
||||
return task;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:P@ssw0rd}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
@@ -131,7 +131,7 @@ file:
|
||||
avatarMaxSize: 5
|
||||
logging:
|
||||
file:
|
||||
path: C:\log\wms
|
||||
path: C:\log\acs
|
||||
config: classpath:logback-spring.xml
|
||||
|
||||
# Sa-Token配置
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
server:
|
||||
port: 8010
|
||||
port: 8011
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
@@ -53,7 +53,7 @@ spring:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:15}
|
||||
database: ${REDIS_DB:9}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
@@ -44,7 +44,7 @@ rsa:
|
||||
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
|
||||
logging:
|
||||
file:
|
||||
path: C:\log\wms
|
||||
path: C:\log\acs
|
||||
config: classpath:logback-spring.xml
|
||||
# sa-token白名单配置
|
||||
security:
|
||||
|
||||
32
acs/nladmin-system/src/main/resources/log/AcsToLk.xml
Normal file
32
acs/nladmin-system/src/main/resources/log/AcsToLk.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE14" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/ACS请求立库/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.ext.wms.service.impl.AcsToLiKuServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE14"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -3,7 +3,7 @@
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE8" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<appender name="FILE12" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/ACS请求WMS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
@@ -27,6 +27,6 @@
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE8"/>
|
||||
<appender-ref ref="FILE12"/>
|
||||
</logger>
|
||||
</included>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE11" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/AgvNdcOneDeviceDriver/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver" level="info" additivity="false">
|
||||
<appender-ref ref="FILE11"/>
|
||||
</logger>
|
||||
</included>
|
||||
32
acs/nladmin-system/src/main/resources/log/LkToAcs.xml
Normal file
32
acs/nladmin-system/src/main/resources/log/LkToAcs.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE15" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/立库请求ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.ext.wms.service.impl.AcsToLiKuServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE15"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -3,7 +3,7 @@
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE9" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<appender name="FILE13" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/WMS下发ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
@@ -27,6 +27,6 @@
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE9"/>
|
||||
<appender-ref ref="FILE13"/>
|
||||
</logger>
|
||||
</included>
|
||||
|
||||
@@ -31,7 +31,15 @@ https://juejin.cn/post/6844903775631572999
|
||||
<include resource="log/QueryXZAgvTaskStatus.xml"/>
|
||||
-->
|
||||
<!-- <include resource="log/QueryMagicAgvDeviceStatus.xml"/>-->
|
||||
<!--FILE 10开始+1-->
|
||||
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
|
||||
<include resource="log/AgvNdcOneDeviceDriver.xml"/>
|
||||
<include resource="log/AcsToLk.xml"/>
|
||||
<include resource="log/LkToAcs.xml"/>
|
||||
<include resource="log/AcsToWms.xml"/>
|
||||
<include resource="log/WmsToAcs.xml"/>
|
||||
|
||||
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
@@ -138,9 +146,10 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--生产环境:打印控制台和输出到文件-->
|
||||
<springProfile name="prod">
|
||||
<root level="off">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</root>
|
||||
<logger name="org.nl.acs.log.service.impl.DeviceExecuteLogServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
|
||||
@@ -92,7 +92,7 @@ import siemens_conveyor from '@/views/acs/device/driver/siemens_conveyor'
|
||||
import slit_two_manipulator from '@/views/acs/device/driver/slit_two_manipulator'
|
||||
import hongxiang_device from '@/views/acs/device/driver/hongxiang_device'
|
||||
import hongxiang_conveyor from '@/views/acs/device/driver/hongxiang_conveyor'
|
||||
|
||||
import plug_pull_device_site from '@/views/acs/device/driver/plug_pull_device_site'
|
||||
|
||||
export default {
|
||||
name: 'DeviceConfig',
|
||||
@@ -115,7 +115,8 @@ export default {
|
||||
box_palletizing_manipulator,
|
||||
oven_manipulator,
|
||||
siemens_conveyor,
|
||||
slit_two_manipulator
|
||||
slit_two_manipulator,
|
||||
plug_pull_device_site
|
||||
},
|
||||
dicts: ['device_type'],
|
||||
mixins: [crud],
|
||||
|
||||
@@ -0,0 +1,490 @@
|
||||
<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
|
||||
filterable
|
||||
@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-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="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: 'Plug_pull_device_site',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
require: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
device_code: '',
|
||||
device_id: '',
|
||||
plc_id: '',
|
||||
plc_code: '',
|
||||
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: [],
|
||||
address: ''
|
||||
},
|
||||
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) {
|
||||
debugger
|
||||
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('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
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
|
||||
}
|
||||
for (const val in this.data2) {
|
||||
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_task') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
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
|
||||
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)
|
||||
})
|
||||
},
|
||||
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