add:新增行架-agv对接位驱动
This commit is contained in:
@@ -16,6 +16,7 @@ import org.nl.acs.device_driver.paper_tube_pick_site.PaperTubePickSiteDeviceDriv
|
||||
import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
@@ -131,7 +132,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
//烘箱对接位
|
||||
HongXiangStationDeviceDriver hongXiangStationDeviceDriver;
|
||||
|
||||
//行架-agv对接位
|
||||
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
|
||||
|
||||
if (phase == 0x02) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
@@ -239,6 +241,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
, standardInspectSiteDeviceDriver.getError(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
try {
|
||||
manipulatorAgvStationDeviceDriver.writing(2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
@@ -358,6 +375,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
try {
|
||||
manipulatorAgvStationDeviceDriver.writing(3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
@@ -485,14 +517,30 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
try {
|
||||
paperTubePickSiteDeviceDriver.writing(4);
|
||||
manipulatorAgvStationDeviceDriver.writing(2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (paperTubePickSiteDeviceDriver.getMove() == 0) {
|
||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
paperTubePickSiteDeviceDriver.writing(2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (paperTubePickSiteDeviceDriver.getMove() == 1) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
@@ -503,7 +551,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
hongXiangStationDeviceDriver.writing(0);
|
||||
hongXiangStationDeviceDriver.writing(1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -608,29 +656,41 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
} else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
hongXiangStationDeviceDriver.writing(0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hongXiangStationDeviceDriver.getMove() > 0) {
|
||||
if (hongXiangStationDeviceDriver.getMove() == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
|
||||
, hongXiangStationDeviceDriver.getError(), ikey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
try {
|
||||
manipulatorAgvStationDeviceDriver.writing(3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey);
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
paperTubePickSiteDeviceDriver.writing(5);
|
||||
paperTubePickSiteDeviceDriver.writing(3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -641,7 +701,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
|
||||
, paperTubePickSiteDeviceDriver.getError(), ikey);
|
||||
}
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
@@ -665,7 +724,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//(Itype=1,上传称重数据)
|
||||
else if (phase == 0x64) {
|
||||
@@ -737,17 +796,42 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
if (paperTubePickSiteDeviceDriver.getMove() == 0)
|
||||
try {
|
||||
paperTubePickSiteDeviceDriver.writing(4);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (paperTubePickSiteDeviceDriver.getMove() == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
|
||||
, paperTubePickSiteDeviceDriver.getError(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
try {
|
||||
manipulatorAgvStationDeviceDriver.writing(4);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
hongXiangStationDeviceDriver.writing(0);
|
||||
hongXiangStationDeviceDriver.writing(1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hongXiangStationDeviceDriver.getMove() > 0) {
|
||||
if (hongXiangStationDeviceDriver.getMove() == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
@@ -826,6 +910,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
this.setPhase(phase);
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
try {
|
||||
manipulatorAgvStationDeviceDriver.writing(5);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
@@ -841,6 +940,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
, hongXiangStationDeviceDriver.getError(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
paperTubePickSiteDeviceDriver.writing(5);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (paperTubePickSiteDeviceDriver.getMove() > 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
|
||||
, paperTubePickSiteDeviceDriver.getError(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
standardInspectSiteDeviceDriver.writing(0);
|
||||
@@ -911,14 +1025,29 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
this.setPhase(phase);
|
||||
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
try {
|
||||
hongXiangStationDeviceDriver.writing(0);
|
||||
manipulatorAgvStationDeviceDriver.writing(4);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hongXiangStationDeviceDriver.getMove() > 0) {
|
||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
hongXiangStationDeviceDriver.writing(1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hongXiangStationDeviceDriver.getMove() == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
@@ -926,6 +1055,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
, hongXiangStationDeviceDriver.getError(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
paperTubePickSiteDeviceDriver.writing(4);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (paperTubePickSiteDeviceDriver.getMove() == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
|
||||
, paperTubePickSiteDeviceDriver.getError(), ikey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
@@ -991,10 +1135,25 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
this.setPhase(phase);
|
||||
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
|
||||
try {
|
||||
manipulatorAgvStationDeviceDriver.writing(5);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件";
|
||||
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey);
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
paperTubePickSiteDeviceDriver.writing(0);
|
||||
paperTubePickSiteDeviceDriver.writing(5);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* 纸管抓取位
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.manipulator_agv_station;
|
||||
|
||||
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_action = "action";
|
||||
|
||||
public static String item_to_command = "to_command";
|
||||
|
||||
private ManipulatorAgvStationDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(ManipulatorAgvStationDeviceDriver driver){
|
||||
this.driver=driver;
|
||||
}
|
||||
|
||||
public int getItem_heartbeat(){
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
} ;
|
||||
public int getItem_mode(){
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
public int getItem_action(){
|
||||
return this.getOpcIntegerValue(item_action);
|
||||
}
|
||||
|
||||
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 static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB19.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB19.B1"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB19.B3"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB20.W0"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.manipulator_agv_station;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ManipulatorAgvStationDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "manipulator_agv_station";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "行架-agv对接位";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "行架-agv对接位";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new ManipulatorAgvStationDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return ManipulatorAgvStationDeviceDriver.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,198 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.manipulator_agv_station;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceExtraService;
|
||||
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
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.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
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.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
/**
|
||||
* 行架-agv对接位
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
@Autowired
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||
@Autowired
|
||||
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
|
||||
@Autowired
|
||||
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.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;
|
||||
|
||||
//工作模式
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
//动作信号
|
||||
int action = 0;
|
||||
int last_action = 0;
|
||||
int heartbeat = 0;
|
||||
int last_heartbeat = 0;
|
||||
|
||||
|
||||
int to_command = 0;
|
||||
int last_to_command = 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;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getItem_mode();
|
||||
action = this.itemProtocol.getItem_action();
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
if (mode == 2) {
|
||||
this.writing(0);
|
||||
}
|
||||
}
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
return;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
//取货完成
|
||||
case 1:
|
||||
writing(3);
|
||||
return;
|
||||
//放货完成
|
||||
case 2:
|
||||
writing(5);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
last_action = action;
|
||||
last_heartbeat = heartbeat;
|
||||
last_to_command = to_command;
|
||||
|
||||
}
|
||||
|
||||
protected void thingToNothing() {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
|
||||
public void writing(int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.ItemProtocol.item_to_command;
|
||||
//String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
//Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
this.control(itemMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String mode = "";
|
||||
String action = "";
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", "联机");
|
||||
jo.put("action", action);
|
||||
jo.put("isOnline", true);
|
||||
jo.put("isError", this.getIserror());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,11 @@ spring:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_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_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_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_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
password: ${DB_PWD:root}
|
||||
password: ${DB_PWD:p@ssw0rd}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
||||
@@ -114,6 +114,7 @@ import pull_head_manipulator from '@/views/acs/device/driver/pull_head_manipulat
|
||||
import pull_tail_manipulator from '@/views/acs/device/driver/pull_tail_manipulator.vue'
|
||||
import green_foil_machine_button from '@/views/acs/device/driver/green_foil_machine_button.vue'
|
||||
import inflatable_shaft_library from '@/views/acs/device/driver/inflatable_shaft_library.vue'
|
||||
import manipulator_agv_station from '@/views/acs/device/driver/manipulator_agv_station.vue'
|
||||
import subvolume_weighing_station from '@/views/acs/device/driver/subvolume_weighing_station.vue'
|
||||
import waste_foil_weighing_station from '@/views/acs/device/driver/waste_foil_weighing_station.vue'
|
||||
import blank_manipulator from '@/views/acs/device/driver/blank_manipulator.vue'
|
||||
@@ -184,7 +185,8 @@ export default {
|
||||
inflatable_shaft_library,
|
||||
green_foil_machine_button,
|
||||
xg_agv_car,
|
||||
oven_inspect_site
|
||||
oven_inspect_site,
|
||||
manipulator_agv_station
|
||||
},
|
||||
dicts: ['device_type'],
|
||||
mixins: [crud],
|
||||
|
||||
@@ -0,0 +1,539 @@
|
||||
<template>
|
||||
<!--标准版-输送机-控制点-->
|
||||
<div>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">设备协议:</span>
|
||||
</div>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
OpcServer:
|
||||
<el-select
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcservers"
|
||||
:key="item.opc_id"
|
||||
:label="item.opc_name"
|
||||
:value="item.opc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
PLC:
|
||||
<el-select
|
||||
v-model="plc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
@change="changePlc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcPlcs"
|
||||
:key="item.plc_id"
|
||||
:label="item.plc_name"
|
||||
:value="item.plc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">输送系统:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="电气调度号" label-width="150px">
|
||||
<el-input v-model="form.address" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">指令相关:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="检验有货">
|
||||
<el-switch v-model="form.inspect_in_stocck" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="忽视取货校验" label-width="150px">
|
||||
<el-switch v-model="form.ignore_pickup_check" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="忽视放货校验" label-width="150px">
|
||||
<el-switch v-model="form.ignore_release_check" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="呼叫">
|
||||
<el-switch v-model="form.apply_task" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="响应" label-width="150px">
|
||||
<el-switch v-model="form.manual_create_task" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="关联设备" prop="device_code">
|
||||
<el-select
|
||||
v-model="form.link_device_code"
|
||||
filterable
|
||||
multiple
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_name"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
|
||||
<el-select
|
||||
v-model="form.link_three_lamp"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_name"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否输入物料" label-width="150px">
|
||||
<el-switch v-model="form.input_material" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否需要反馈光电" label-width="150px">
|
||||
<el-switch v-model="form.ship_device_update" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">AGV相关:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="取货">
|
||||
<el-switch v-model="form.is_pickup" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="放货">
|
||||
<el-switch v-model="form.is_release" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC读取字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data1"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data1[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishReadEdit(data1[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC写入字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data2"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data2[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishWriteEdit(data2[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value2">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbw_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span" />
|
||||
<el-button
|
||||
:loading="false"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
style="float: right; padding: 6px 9px"
|
||||
type="primary"
|
||||
@click="doSubmit"
|
||||
>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
queryDriverConfig,
|
||||
updateConfig,
|
||||
testRead,
|
||||
testwrite
|
||||
} from '@/api/acs/device/driverConfig'
|
||||
import { selectOpcList } from '@/api/acs/device/opc'
|
||||
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||
|
||||
import crud from '@/mixins/crud'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
|
||||
export default {
|
||||
name: 'ManipulatorAgvStation',
|
||||
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_stocck: true,
|
||||
ignore_pickup_check: true,
|
||||
ignore_release_check: true,
|
||||
apply_task: true,
|
||||
link_three_lamp: '',
|
||||
manual_create_task: true,
|
||||
is_pickup: true,
|
||||
is_release: true,
|
||||
link_device_code: [],
|
||||
ship_device_update: true
|
||||
},
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
// 从父表单获取设备编码
|
||||
this.device_id = this.$props.parentForm.device_id
|
||||
this.device_code = this.$props.parentForm.device_code
|
||||
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.form) {
|
||||
const arr = Object.keys(data.form)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.form = data.form
|
||||
}
|
||||
}
|
||||
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.parentForm) {
|
||||
const arr = Object.keys(data.parentForm)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.opc_code = data.parentForm.opc_code
|
||||
this.plc_code = data.parentForm.plc_code
|
||||
}
|
||||
}
|
||||
this.data1 = data.rs
|
||||
this.data2 = data.ws
|
||||
this.sliceItem()
|
||||
})
|
||||
selectPlcList().then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = this.$props.parentForm.opc_plc_id
|
||||
})
|
||||
selectOpcList().then(data => {
|
||||
this.dataOpcservers = data
|
||||
this.opc_id = this.$props.parentForm.opc_server_id
|
||||
})
|
||||
deviceCrud.selectDeviceList().then(data => {
|
||||
this.deviceList = data
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
finishReadEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('mode') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('mode') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 0)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('carrier_direction') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
finishWriteEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('to_command') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
console.log(endNumber)
|
||||
for (const val in this.data2) {
|
||||
if (this.data2[val].code.indexOf('to_command') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 0)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_container_type') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_strap_times') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 10)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_length') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 12)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_weight') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 14)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_height') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeOpc(val) {
|
||||
this.dataOpcservers.forEach(item => {
|
||||
if (item.opc_id === val) {
|
||||
this.opc_code = item.opc_code
|
||||
}
|
||||
})
|
||||
|
||||
selectListByOpcID(val).then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = ''
|
||||
this.plc_code = ''
|
||||
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
|
||||
this.plc_id = this.dataOpcPlcs[0].plc_id
|
||||
this.plc_code = this.dataOpcPlcs[0].plc_code
|
||||
}
|
||||
this.sliceItem()
|
||||
})
|
||||
},
|
||||
changePlc(val) {
|
||||
this.dataOpcPlcs.forEach(item => {
|
||||
if (item.plc_id === val) {
|
||||
this.plc_code = item.plc_code
|
||||
this.sliceItem()
|
||||
return
|
||||
}
|
||||
})
|
||||
},
|
||||
test_read1() {
|
||||
testRead(this.data1, this.opc_id).then(data => {
|
||||
this.data1 = data
|
||||
console.log(this.data1)
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_write1() {
|
||||
testwrite(this.data2, this.opc_id).then(data => {
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_read2() {
|
||||
testRead(this.data2, this.opc_id).then(data => {
|
||||
this.data2 = data
|
||||
console.log(this.data2)
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.configLoading = true
|
||||
// 根据驱动类型判断是否为路由设备
|
||||
const parentForm = this.parentForm
|
||||
parentForm.is_route = true
|
||||
parentForm.plc_id = this.plc_id
|
||||
parentForm.opc_id = this.opc_id
|
||||
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||
this.notify('保存成功', 'success')
|
||||
this.configLoading = false
|
||||
}).catch(err => {
|
||||
this.configLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
sliceItem() { // 拼接DB的Item值
|
||||
this.data1.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
this.data2.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user