Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -242,16 +242,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
standardInspectSiteDeviceDriver.writing("to_command", "1");
|
standardInspectSiteDeviceDriver.writing("to_command", "1");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1) || standardInspectSiteDeviceDriver.getIs_force() == 1) {
|
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)
|
||||||
|
|| standardInspectSiteDeviceDriver.getIs_force() == 1 ) {
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||||
} else {
|
} else {
|
||||||
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件";
|
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction()+ "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||||
log.info("设备{}当前光电信号{},动作信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction(), ikey);
|
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
|
||||||
|
,standardInspectSiteDeviceDriver.getError(), ikey);
|
||||||
}
|
}
|
||||||
standardInspectSiteDeviceDriver.setIs_force(0);
|
standardInspectSiteDeviceDriver.setIs_force(0);
|
||||||
} else {
|
} else {
|
||||||
@@ -518,8 +521,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||||
standardInspectSiteDeviceDriver.writing("to_command", "1");
|
standardInspectSiteDeviceDriver.writing("to_command", "1");
|
||||||
if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1) || standardInspectSiteDeviceDriver.getIs_force() == 1) {
|
if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)
|
||||||
|
|| standardInspectSiteDeviceDriver.getIs_force() == 1) {
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||||
|
}else {
|
||||||
|
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction()+ "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足放货条件";
|
||||||
|
log.info("设备{}当前光电信号{},动作信号{} ,报警信号{},不满足放货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
|
||||||
|
,standardInspectSiteDeviceDriver.getError(), ikey);
|
||||||
}
|
}
|
||||||
standardInspectSiteDeviceDriver.setIs_force(0);
|
standardInspectSiteDeviceDriver.setIs_force(0);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
<crudOperation :permission="permission">
|
<crudOperation :permission="permission">
|
||||||
<el-button
|
<el-button
|
||||||
slot="left"
|
slot="left"
|
||||||
|
v-permission="['admin','task:add']"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
|
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.BoxStorageManipulatorDeviceDriver;
|
import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.BoxStorageManipulatorDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
@@ -39,20 +40,18 @@ public class AgvWaitUtil {
|
|||||||
//取货前等待
|
//取货前等待
|
||||||
public JSONObject waitInGet(String startDeviceCode, Instruction inst) {
|
public JSONObject waitInGet(String startDeviceCode, Instruction inst) {
|
||||||
log.info("仙工AGV请求取货,设备号 - {}", startDeviceCode);
|
log.info("仙工AGV请求取货,设备号 - {}", startDeviceCode);
|
||||||
|
Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode);
|
||||||
/*JSONObject responseBody = acsToWmsService.queryStationState(inst);
|
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||||
|
if(startDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
if (ObjectUtil.isNotEmpty(responseBody) && "200".equals(responseBody.getString("status"))) {
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startDevice.getDeviceDriver();
|
||||||
JSONArray data = JSON.parseArray(responseBody.getString("data"));
|
if(standardInspectSiteDeviceDriver.getError() != 0){
|
||||||
for (int i = 0; i < data.size(); i++) {
|
JSONObject map = new JSONObject();
|
||||||
JSONObject datum = data.getJSONObject(i);
|
map.put("status", 500);
|
||||||
if (startDeviceCode.equals(datum.getString("Station_Code")) && !datum.getBooleanValue("IsHasGoods")) {
|
map.put("message", "不允许取货!");
|
||||||
|
log.info("不允许仙工AGV取货,烘箱对接位有报警,设备号 - {}", startDeviceCode);
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
throw new BadRequestException("请求失败!");*/
|
|
||||||
|
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许取货!");
|
map.put("message", "允许取货!");
|
||||||
@@ -63,10 +62,8 @@ public class AgvWaitUtil {
|
|||||||
//取货完成等待
|
//取货完成等待
|
||||||
public JSONObject waitOutGet(String startDeviceCode, Instruction inst) {
|
public JSONObject waitOutGet(String startDeviceCode, Instruction inst) {
|
||||||
log.info("仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
log.info("仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
||||||
|
|
||||||
inst.setExecute_status("2");
|
inst.setExecute_status("2");
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
|
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许离开!");
|
map.put("message", "允许离开!");
|
||||||
@@ -77,13 +74,16 @@ public class AgvWaitUtil {
|
|||||||
//放货前等待
|
//放货前等待
|
||||||
public JSONObject waitInPut(String endDeviceCode, Instruction inst) {
|
public JSONObject waitInPut(String endDeviceCode, Instruction inst) {
|
||||||
log.info("仙工AGV请求放货,设备号 - {}", endDeviceCode);
|
log.info("仙工AGV请求放货,设备号 - {}", endDeviceCode);
|
||||||
|
Device endDevice = deviceAppService.findDeviceByCode(endDeviceCode);
|
||||||
Device doordevice = deviceAppService.findDeviceByCode(endDeviceCode);
|
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||||
BoxStorageManipulatorDeviceDriver boxStorageManipulatorDeviceDriver;
|
if(endDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
if(doordevice.getDeviceDriver() instanceof BoxStorageManipulatorDeviceDriver){
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) endDevice.getDeviceDriver();
|
||||||
boxStorageManipulatorDeviceDriver = (BoxStorageManipulatorDeviceDriver) doordevice.getDeviceDriver();
|
if(standardInspectSiteDeviceDriver.getError() != 0){
|
||||||
if(boxStorageManipulatorDeviceDriver.getMode() != 2 && boxStorageManipulatorDeviceDriver.getMove() != 0){
|
JSONObject map = new JSONObject();
|
||||||
throw new BadRequestException("请求失败!");
|
map.put("status", 500);
|
||||||
|
map.put("message", "不允许放货!");
|
||||||
|
log.info("不允许仙工AGV放货,烘箱对接位有报警,设备号 - {}", endDeviceCode);
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
@@ -97,6 +97,8 @@ public class AgvWaitUtil {
|
|||||||
//放货完成等待
|
//放货完成等待
|
||||||
public JSONObject waitOutPut(String endDeviceCode, Instruction inst) {
|
public JSONObject waitOutPut(String endDeviceCode, Instruction inst) {
|
||||||
log.info("仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
log.info("仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
||||||
|
inst.setExecute_status("2");
|
||||||
|
instructionService.update(inst);
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许离开!");
|
map.put("message", "允许离开!");
|
||||||
|
|||||||
@@ -683,8 +683,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
if (StrUtil.isBlank(address)) {
|
if (StrUtil.isBlank(address)) {
|
||||||
throw new BadRequestException("请求失败,地址为空!");
|
throw new BadRequestException("请求失败,地址为空!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (address.contains("IN")) {
|
if (address.contains("IN")) {
|
||||||
String deviceCodeNow = address.substring(0, address.length() - 5);
|
String deviceCodeNow = address.substring(0, address.length() - 5);
|
||||||
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
|
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package org.nl.acs.device_driver.conveyor.oven_inspection_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 {
|
||||||
|
|
||||||
|
public static String item_heartbeat = "heartbeat";
|
||||||
|
public static String item_mode = "mode";
|
||||||
|
public static String item_move = "move";
|
||||||
|
public static String item_action = "action";
|
||||||
|
public static String item_error = "error";
|
||||||
|
public static String item_to_command = "to_command";
|
||||||
|
public static String item_to_target = "to_target";
|
||||||
|
public static String item_to_task = "to_task";
|
||||||
|
public static String item_weight = "weight";
|
||||||
|
public static String item_material_type = "material_type";
|
||||||
|
public static String item_barcode = "barcode";
|
||||||
|
|
||||||
|
private OvenInspectSiteDeviceDriver driver;
|
||||||
|
|
||||||
|
public ItemProtocol(OvenInspectSiteDeviceDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeartbeat() {
|
||||||
|
return this.getOpcIntegerValue(item_heartbeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMode() {
|
||||||
|
return this.getOpcIntegerValue(item_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMove() {
|
||||||
|
return this.getOpcIntegerValue(item_move);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAction() {
|
||||||
|
return this.getOpcIntegerValue(item_action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getError() {
|
||||||
|
return this.getOpcIntegerValue(item_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getMaterialType() {
|
||||||
|
return this.getOpcIntegerValue(item_material_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBarcode() {
|
||||||
|
return this.getOpcIntegerValue(item_barcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getToCommand() {
|
||||||
|
return this.getOpcIntegerValue(item_to_command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getToTarget() {
|
||||||
|
return this.getOpcIntegerValue(item_to_target);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getToTask() {
|
||||||
|
return this.getOpcIntegerValue(item_to_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*是否有货
|
||||||
|
*/
|
||||||
|
public int hasGoods(int move) {
|
||||||
|
return move;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean isonline;
|
||||||
|
|
||||||
|
public int getOpcIntegerValue(String protocol) {
|
||||||
|
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||||
|
if (value == null) {
|
||||||
|
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||||
|
setIsonline(false);
|
||||||
|
} else {
|
||||||
|
setIsonline(true);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||||
|
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true)));
|
||||||
|
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
|
||||||
|
list.add(new ItemDto(item_action, "取放信号", "DB600.B4"));
|
||||||
|
list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6"));
|
||||||
|
list.add(new ItemDto(item_error, "报警信号", "DB600.B7"));
|
||||||
|
list.add(new ItemDto(item_barcode, "条码", "DB600.D8"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getWriteableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package org.nl.acs.device_driver.conveyor.oven_inspection_site;
|
||||||
|
|
||||||
|
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 OvenInspectSiteDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "oven_inspect_site";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "标准版-烘箱检测站点";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "标准版-烘箱检测站点";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new OvenInspectSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return OvenInspectSiteDeviceDriver.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,464 @@
|
|||||||
|
package org.nl.acs.device_driver.conveyor.oven_inspection_site;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
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.device.domain.Device;
|
||||||
|
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.service.AcsToWmsService;
|
||||||
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
|
import org.nl.acs.opc.WcsConfig;
|
||||||
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||||
|
import org.nl.acs.task.domain.Task;
|
||||||
|
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||||
|
import org.nl.acs.utils.ConvertUtil;
|
||||||
|
import org.nl.common.utils.CodeUtil;
|
||||||
|
import org.nl.config.SpringContextHolder;
|
||||||
|
import org.openscada.opc.lib.da.Server;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 烘箱检测站点
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OvenInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||||
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
|
|
||||||
|
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||||
|
|
||||||
|
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||||
|
|
||||||
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
|
||||||
|
TaskMapper taskMapper;
|
||||||
|
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||||
|
|
||||||
|
String container;
|
||||||
|
String container_type_desc;
|
||||||
|
String last_container_type_desc;
|
||||||
|
String last_container;
|
||||||
|
/**
|
||||||
|
* 放货准备锁
|
||||||
|
*/
|
||||||
|
String putReadyLock = null;
|
||||||
|
/**
|
||||||
|
* 有货标记
|
||||||
|
*/
|
||||||
|
protected boolean has_goods_tag = false;
|
||||||
|
|
||||||
|
private Date time = new Date();
|
||||||
|
|
||||||
|
int mode = 0;
|
||||||
|
int error = 0;
|
||||||
|
int move = 0;
|
||||||
|
int task = 0;
|
||||||
|
int action = 0;
|
||||||
|
int last_mode = 0;
|
||||||
|
int last_error = 0;
|
||||||
|
int last_move = 0;
|
||||||
|
int last_task = 0;
|
||||||
|
Boolean isonline = true;
|
||||||
|
int hasGoods = 0;
|
||||||
|
String message = null;
|
||||||
|
Boolean iserror = false;
|
||||||
|
|
||||||
|
int io_action = 0;
|
||||||
|
int last_io_action = 0;
|
||||||
|
int material_type = 0;
|
||||||
|
int last_material_type = 0;
|
||||||
|
int barcode = 0;
|
||||||
|
int last_barcode = 0;
|
||||||
|
|
||||||
|
|
||||||
|
boolean hasVehicle = false;
|
||||||
|
boolean isReady = false;
|
||||||
|
protected int instruction_num = 0;
|
||||||
|
protected int instruction_num_truth = 0;
|
||||||
|
boolean isFold = false;
|
||||||
|
private String assemble_check_tag;
|
||||||
|
|
||||||
|
protected String current_stage_instruction_message;
|
||||||
|
protected String last_stage_instruction_message;
|
||||||
|
Integer heartbeat_tag;
|
||||||
|
private Date instruction_require_time = new Date();
|
||||||
|
private Date instruction_finished_time = new Date();
|
||||||
|
|
||||||
|
private int instruction_require_time_out;
|
||||||
|
boolean requireSucess = false;
|
||||||
|
|
||||||
|
private int instruction_finished_time_out;
|
||||||
|
|
||||||
|
int branchProtocol = 0;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
String remark;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
String qty;
|
||||||
|
/**
|
||||||
|
* 物料
|
||||||
|
*/
|
||||||
|
String material;
|
||||||
|
/**
|
||||||
|
* 批次
|
||||||
|
*/
|
||||||
|
String batch;
|
||||||
|
/**
|
||||||
|
* 当前指令
|
||||||
|
*/
|
||||||
|
Instruction inst = null;
|
||||||
|
/**
|
||||||
|
* 上次指令
|
||||||
|
*/
|
||||||
|
Instruction last_inst = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 触摸屏手动触发任务
|
||||||
|
*/
|
||||||
|
private Boolean is_has_task = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满盅入库请求标记
|
||||||
|
*/
|
||||||
|
boolean Sucess = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||||
|
*/
|
||||||
|
int flag;
|
||||||
|
|
||||||
|
String devicecode;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice() {
|
||||||
|
return this.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
String message = null;
|
||||||
|
try {
|
||||||
|
devicecode = this.getDeviceCode();
|
||||||
|
mode = this.itemProtocol.getMode();
|
||||||
|
error = this.itemProtocol.getError();
|
||||||
|
move = this.itemProtocol.getMove();
|
||||||
|
hasGoods = this.itemProtocol.getMove();
|
||||||
|
action = this.itemProtocol.getAction();
|
||||||
|
material_type = this.itemProtocol.getMaterialType();
|
||||||
|
barcode = this.itemProtocol.getBarcode();
|
||||||
|
if (mode != last_mode) {
|
||||||
|
this.setRequireSucess(false);
|
||||||
|
if (mode == 2) {
|
||||||
|
this.writing(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (move != last_move) {
|
||||||
|
}
|
||||||
|
if (error != last_error) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} 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 if (error != 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 4:
|
||||||
|
//叫料
|
||||||
|
if (move == 0 && !requireSucess) {
|
||||||
|
apply(4);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
//满料出库
|
||||||
|
if (move == 1 && !requireSucess) {
|
||||||
|
apply(5);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
//申请空盘
|
||||||
|
if (move == 0 && !requireSucess) {
|
||||||
|
apply(6);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
//空托盘出库
|
||||||
|
if (move == 1 && !requireSucess) {
|
||||||
|
apply(7);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (flag) {
|
||||||
|
//取货完成
|
||||||
|
case 1:
|
||||||
|
writing(2);
|
||||||
|
return;
|
||||||
|
//放货完成
|
||||||
|
case 2:
|
||||||
|
writing(3);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
last_mode = mode;
|
||||||
|
last_error = error;
|
||||||
|
last_move = move;
|
||||||
|
last_task = task;
|
||||||
|
last_material_type = material_type;
|
||||||
|
last_barcode = barcode;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean exe_error() {
|
||||||
|
if (this.error == 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
log.debug("设备报警");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void thingToNothing() {
|
||||||
|
log.debug("从有货到无货 清理数据");
|
||||||
|
this.set_last_container(container, container_type_desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_last_container(String barcode, String type_desc) {
|
||||||
|
this.set_last_container(barcode);
|
||||||
|
this.set_last_container_type_desc(type_desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_last_container(String barcode) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_last_container_type_desc(String type) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean exe_business() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void executing(Instruction instruction) {
|
||||||
|
this.executing(1, instruction, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void executing(int command, Instruction instruction, String appendMessage) {
|
||||||
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + ItemProtocol.item_to_command;
|
||||||
|
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + ItemProtocol.item_to_target;
|
||||||
|
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + ItemProtocol.item_to_task;
|
||||||
|
if (appendMessage == null) {
|
||||||
|
appendMessage = "";
|
||||||
|
}
|
||||||
|
if (instruction != null) {
|
||||||
|
instruction_num = Integer.parseInt(instruction.getInstruction_code());
|
||||||
|
}
|
||||||
|
//String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
|
//Server server = ReadUtil.getServer(opcservcerid);
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
itemMap.put(to_command, 1);
|
||||||
|
itemMap.put(to_task, instruction_num);
|
||||||
|
this.control(itemMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void executing(Server server, Map<String, Object> itemMap) {
|
||||||
|
this.control(itemMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writing(int command) {
|
||||||
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writing(int type, int command) {
|
||||||
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + ItemProtocol.item_to_command;
|
||||||
|
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + ItemProtocol.item_to_target;
|
||||||
|
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + ItemProtocol.item_to_task;
|
||||||
|
//String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
|
//Server server = ReadUtil.getServer(opcservcerid);
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
if (type == 1) {
|
||||||
|
itemMap.put(to_command, command);
|
||||||
|
} else if (type == 2) {
|
||||||
|
itemMap.put(to_target, command);
|
||||||
|
|
||||||
|
} else if (type == 3) {
|
||||||
|
itemMap.put(to_task, command);
|
||||||
|
}
|
||||||
|
this.control(itemMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean instruction_require(String container_code) {
|
||||||
|
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求指令
|
||||||
|
*
|
||||||
|
* @param container_code
|
||||||
|
* @param container_type
|
||||||
|
*/
|
||||||
|
public synchronized boolean instruction_require(String container_code, String container_type) {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
this.instruction_require_time = date;
|
||||||
|
TaskDto dto = new TaskDto();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
dto.setTask_id(IdUtil.simpleUUID());
|
||||||
|
dto.setCreate_by(this.getDevice().getDevice_code());
|
||||||
|
dto.setUpdate_by(this.getDevice().getDevice_code());
|
||||||
|
dto.setStart_point_code(this.getDevice().getDevice_code());
|
||||||
|
dto.setVehicle_code(container_code);
|
||||||
|
dto.setVehicle_type(container_type);
|
||||||
|
|
||||||
|
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||||
|
dto.setTask_code("-" + taskcode);
|
||||||
|
dto.setTask_status(TaskStatusEnum.READY.getIndex());
|
||||||
|
dto.setPriority("101");
|
||||||
|
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
||||||
|
String next_device_codecode = jo.getNext_device_code();
|
||||||
|
if (StrUtil.isEmpty(next_device_codecode)) {
|
||||||
|
throw new RuntimeException("该设备未找到对应路由");
|
||||||
|
}
|
||||||
|
dto.setNext_point_code(next_device_codecode);
|
||||||
|
dto.setUpdate_time(now);
|
||||||
|
dto.setCreate_time(now);
|
||||||
|
|
||||||
|
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||||
|
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||||
|
//
|
||||||
|
// wo.insert(json);
|
||||||
|
|
||||||
|
Task entity = ConvertUtil.convert(dto, Task.class);
|
||||||
|
taskMapper.insert(entity);
|
||||||
|
requireSucess = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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("error", this.getError());
|
||||||
|
jo.put("isError", this.getIserror());
|
||||||
|
jo.put("task", this.getTask());
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceStatus(JSONObject data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lms申请任务
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
public synchronized boolean apply(Integer type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ import org.nl.acs.device.service.DeviceService;
|
|||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.conveyor.oven_inspection_site.OvenInspectSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
@@ -143,6 +144,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
List<String> getDeviceCodeList = null;
|
List<String> getDeviceCodeList = null;
|
||||||
|
|
||||||
|
|
||||||
List<String> putDeviceCodeList = null;
|
List<String> putDeviceCodeList = null;
|
||||||
|
|
||||||
|
|
||||||
@@ -349,6 +351,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
//PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
|
//PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
|
||||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||||
|
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
|
||||||
// if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
|
// if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
|
||||||
// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
|
// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
// if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
|
// if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
|
||||||
@@ -356,6 +359,36 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
|
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
|
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){
|
||||||
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
|
||||||
|
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!指令号:" + instruction.getInstruction_code();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//判断经过的烘箱是否关门
|
||||||
|
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(start_device_code, next_device_code);
|
||||||
|
if(!hongxiangCloseDoor){
|
||||||
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
|
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
|
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){
|
||||||
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
|
||||||
|
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!指令号:" + instruction.getInstruction_code();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//判断经过的烘箱是否关门
|
||||||
|
boolean hongxiangCloseDoor = this.hongxiangCloseDoor( next_device_code, start_device_code);
|
||||||
|
if(!hongxiangCloseDoor){
|
||||||
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
if (standardInspectSiteDeviceDriver.getMove() != 1) {
|
if (standardInspectSiteDeviceDriver.getMove() != 1) {
|
||||||
@@ -449,9 +482,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
if (!ObjectUtil.isEmpty(task)) {
|
if (!ObjectUtil.isEmpty(task)) {
|
||||||
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
|
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
|
||||||
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
|
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
|
||||||
// PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
|
|
||||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||||
|
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
|
||||||
// if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
|
// if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
|
||||||
// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
|
// photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
// if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
|
// if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
|
||||||
@@ -459,6 +492,36 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
|
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
|
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){
|
||||||
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
|
||||||
|
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!任务号:" + task.getTask_code();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//判断经过的烘箱是否关门
|
||||||
|
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(task.getStart_device_code(), task.getNext_device_code());
|
||||||
|
if(!hongxiangCloseDoor){
|
||||||
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + task.getStart_device_code() + ",放货位:" + task.getNext_device_code() + ",存在关联的同一列烘箱设备未关门!任务号:" + task.getTask_code();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||||
|
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
|
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){
|
||||||
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
|
||||||
|
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!任务号:" + task.getTask_code();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//判断经过的烘箱是否关门
|
||||||
|
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(task.getStart_device_code(), task.getNext_device_code());
|
||||||
|
if(!hongxiangCloseDoor){
|
||||||
|
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + task.getStart_device_code() + ",放货位:" + task.getNext_device_code() + ",存在关联的同一列烘箱设备未关门!任务号:" + task.getTask_code();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||||
if (standardInspectSiteDeviceDriver.getMove() != 1) {
|
if (standardInspectSiteDeviceDriver.getMove() != 1) {
|
||||||
@@ -495,6 +558,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String taskid = task.getTask_id();
|
String taskid = task.getTask_id();
|
||||||
String taskcode = task.getTask_code();
|
String taskcode = task.getTask_code();
|
||||||
String vehiclecode = task.getVehicle_code();
|
String vehiclecode = task.getVehicle_code();
|
||||||
@@ -600,6 +664,41 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断经过的烘箱是否关门
|
||||||
|
*/
|
||||||
|
private boolean hongxiangCloseDoor(String start_device_code,String next_device_code) {
|
||||||
|
boolean flag = true;
|
||||||
|
List<String> ovenDeviceCodeList = null;
|
||||||
|
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||||
|
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||||
|
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
|
||||||
|
if (ObjectUtil.isEmpty(ovenDeviceCodeList) && startDevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver) {
|
||||||
|
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startDevice.getDeviceDriver();
|
||||||
|
ovenDeviceCodeList = ovenInspectSiteDeviceDriver.getExtraDeviceCodes("link_device_code");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(ovenDeviceCodeList) && nextDevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver) {
|
||||||
|
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
ovenDeviceCodeList = ovenInspectSiteDeviceDriver.getExtraDeviceCodes("link_device_code");
|
||||||
|
}
|
||||||
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
|
if(CollUtil.isNotEmpty(ovenDeviceCodeList)){
|
||||||
|
for (String s : ovenDeviceCodeList) {
|
||||||
|
Device device = deviceAppService.findDeviceByCode(s);
|
||||||
|
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
|
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
||||||
|
//判断关联设备是否开门
|
||||||
|
if (hongXiangConveyorDeviceDriver.getDoor() == 1) {
|
||||||
|
notCreateInstMessage = "关联设备->" + device + "烘箱门未关闭!";
|
||||||
|
flag = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
//判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门
|
//判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门
|
||||||
public boolean judgeCloseDoor(String start_device_code, String next_device_code) {
|
public boolean judgeCloseDoor(String start_device_code, String next_device_code) {
|
||||||
Boolean isClose = false;
|
Boolean isClose = false;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.acs.task.rest;
|
package org.nl.acs.task.rest;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -60,8 +61,7 @@ public class TaskController {
|
|||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增任务")
|
@Log("新增任务")
|
||||||
|
//@SaCheckPermission("task:add")
|
||||||
//@PreAuthorize("@el.check('task:add')")
|
|
||||||
public ResponseEntity<Object> create(@Validated @RequestBody TaskDto dto) throws Exception {
|
public ResponseEntity<Object> create(@Validated @RequestBody TaskDto dto) throws Exception {
|
||||||
taskService.create(dto);
|
taskService.create(dto);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ public class SysMenuController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Log("删除菜单")
|
@Log("删除菜单")
|
||||||
|
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@SaCheckPermission("menu:del")
|
@SaCheckPermission("menu:del")
|
||||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ import fold_disc_site from '@/views/acs/device/driver/one_conveyor/fold_disc_sit
|
|||||||
import scanner_weight_conveyor from '@/views/acs/device/driver/one_conveyor/scanner_weight_conveyor.vue'
|
import scanner_weight_conveyor from '@/views/acs/device/driver/one_conveyor/scanner_weight_conveyor.vue'
|
||||||
import un_box_lable_conveyor from '@/views/acs/device/driver/one_conveyor/un_box_lable_conveyor.vue'
|
import un_box_lable_conveyor from '@/views/acs/device/driver/one_conveyor/un_box_lable_conveyor.vue'
|
||||||
import xg_agv_car from '@/views/acs/device/driver/agv/xg_agv_car.vue'
|
import xg_agv_car from '@/views/acs/device/driver/agv/xg_agv_car.vue'
|
||||||
|
import oven_inspect_site from '@/views/acs/device/driver/oven_inspect_site.vue'
|
||||||
export default {
|
export default {
|
||||||
name: 'DeviceConfig',
|
name: 'DeviceConfig',
|
||||||
components: {
|
components: {
|
||||||
@@ -182,7 +183,8 @@ export default {
|
|||||||
pull_tail_manipulator,
|
pull_tail_manipulator,
|
||||||
inflatable_shaft_library,
|
inflatable_shaft_library,
|
||||||
green_foil_machine_button,
|
green_foil_machine_button,
|
||||||
xg_agv_car
|
xg_agv_car,
|
||||||
|
oven_inspect_site
|
||||||
},
|
},
|
||||||
dicts: ['device_type'],
|
dicts: ['device_type'],
|
||||||
mixins: [crud],
|
mixins: [crud],
|
||||||
|
|||||||
@@ -0,0 +1,489 @@
|
|||||||
|
<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.oven_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: 'StandardInspectSite',
|
||||||
|
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