Browse Source

rev 更新

master
周俊杰 3 weeks ago
parent
commit
5d29bf7041
  1. 61
      hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java
  2. 9
      hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java
  3. 9
      hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java
  4. 78
      hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
  5. 11
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/machines_site/MachinesSiteDefination.java
  6. 42
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/ItemProtocol.java
  7. 13
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDefination.java
  8. 14
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
  9. 2
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_photoelectric_inspect_site/StandardPhotoelectricInspectSiteDeviceDriver.java
  10. 12
      hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  11. 12
      hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  12. 137
      hd/nladmin-system/src/main/java/org/nl/hand/azglny/service/impl/ZglnyHandServiceImpl.java
  13. 32
      hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java
  14. 6
      hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryAgvTaskStatus.java
  15. 36
      hd/nladmin-system/src/main/java/org/nl/modules/system/service/dto/ParamDto.java
  16. 2
      hd/nladmin-system/src/main/resources/log/AcsToWms.xml
  17. 4
      qd/.env.production
  18. 42
      qd/src/api/acs/device/device.js
  19. 121
      qd/src/views/acs/device/index.vue

61
hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java

@ -120,11 +120,11 @@ public class AgvServiceImpl implements AgvService {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired");
pro1.put("value", "True");
pro1.put("value", "true");
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation");
pro2.put("value", "True");
pro2.put("value", "true");
properties.add(pro2);
destinationOrder.put("properties", properties);
//进入等待 离开不等待
@ -132,7 +132,7 @@ public class AgvServiceImpl implements AgvService {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired");
pro1.put("value", "True");
pro1.put("value", "true");
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation");
@ -148,7 +148,7 @@ public class AgvServiceImpl implements AgvService {
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation");
pro2.put("value", "True");
pro2.put("value", "true");
properties.add(pro2);
destinationOrder.put("properties", properties);
//不等待
@ -274,7 +274,6 @@ public class AgvServiceImpl implements AgvService {
jo.put("deadline", this.getNextDay(1));
//判断是否追加任务
jo.put("complete", "true");
jo.put("task_code", inst.getInstruction_code());
//根据任务,下发指令类型
com.alibaba.fastjson.JSONArray destinations = new com.alibaba.fastjson.JSONArray();
@ -534,7 +533,7 @@ public class AgvServiceImpl implements AgvService {
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/query";
log.info("请求地址为{}",agvurl);
HttpResponse result = HttpRequest.post(agvurl)
.body("{}")
.timeout(20000)//超时,毫秒
@ -868,7 +867,6 @@ public class AgvServiceImpl implements AgvService {
//取货的进入前等待和离开等待
if (action.equals("Load")) {
if ("EntryRequired".equals(type)) {
//
if (addressdevice.getDeviceDriver() instanceof StandardManipulatorStackingSiteDeviceDriver) {
standardManipulatorStackingSiteDeviceDriver = (StandardManipulatorStackingSiteDeviceDriver) addressdevice.getDeviceDriver();
@ -881,12 +879,18 @@ public class AgvServiceImpl implements AgvService {
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
is_feedback = true;
}
if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteSmartDeviceDriver){
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
is_feedback = true;
log.info("设备开始请求取货");
}
if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
if(standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getAction()==1){
if(standardInspectSiteDeviceDriver.getError()==1){
is_feedback = true;
log.info("设备开始请求取货了");
}else {
log.info("设备{} 请求取货,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove());
log.info("设备{} 请求取货,信号:{}",addressdevice,standardInspectSiteDeviceDriver.getError());
}
}
}
@ -902,13 +906,18 @@ public class AgvServiceImpl implements AgvService {
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
is_feedback = true;
log.info("设备开始请求离开");
}
if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
if(standardInspectSiteDeviceDriver.getMove()==0){
// if(standardInspectSiteDeviceDriver.getMove()==0){
is_feedback = true;
}else {
log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove());
}
log.info("设备开始请求离开了");
// }else {
// log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove());
// }
}
}
}
@ -927,12 +936,17 @@ public class AgvServiceImpl implements AgvService {
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
is_feedback = true;
log.info("设备开始请求放货");
}
if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
if(standardInspectSiteDeviceDriver.getMove()==0&&standardInspectSiteDeviceDriver.getAction()==2){
if(standardInspectSiteDeviceDriver.getTask()==1){
is_feedback = true;
log.info("设备开始请求放货了");
}else {
log.info("设备{} 请求放货,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove());
log.info("设备{} 请求放货,信号:{}",addressdevice,standardInspectSiteDeviceDriver.getTask());
}
}
}
@ -948,13 +962,18 @@ public class AgvServiceImpl implements AgvService {
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
is_feedback = true;
log.info("设备开始请求离开");
}
if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
if(standardInspectSiteDeviceDriver.getMove()==1){
// if(standardInspectSiteDeviceDriver.getMove()==1){
is_feedback = true;
}else {
log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove());
}
log.info("设备开始请求离开了");
// }else {
// log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove());
// }
}
}
}
@ -974,7 +993,7 @@ public class AgvServiceImpl implements AgvService {
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
agvurl = agvurl + ":" + agvport + "/api/route/transportOrders/" + jobno + "/interact";
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + jobno + "/interact";
HttpResponse result = HttpRequest.post(agvurl)

9
hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java

@ -21,7 +21,9 @@ import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@ -423,4 +425,11 @@ public class DeviceController {
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/excelImport")
@Log("excel导入")
@ApiOperation("excel导入")
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
deviceService.excelImport(file, request);
return new ResponseEntity<>(HttpStatus.OK);
}
}

9
hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java

@ -7,7 +7,9 @@ import org.nl.acs.device.service.dto.DeviceDto;
import org.nl.acs.device.service.dto.StorageCellDto;
import org.nl.acs.opc.Device;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@ -285,4 +287,11 @@ public interface DeviceService {
List<Device> findCacheDevice();
void updateBarcode(JSONObject json) throws Exception;
/**
* excel导入
* @param file
* @param request
*/
void excelImport(MultipartFile file, HttpServletRequest request);
}

78
hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java

@ -7,6 +7,8 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
@ -52,9 +54,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
/**
@ -295,7 +300,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
@Override
public void downDeviceDBload(JSONArray jsonarr, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 0; i < jsonarr.size(); i++) {
JSONObject jo = jsonarr.getJSONObject(i);
Map<String, Object> map = new LinkedHashMap<>();
@ -1576,9 +1580,9 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
String extra_code = jo.getString("extra_code");
//校验数据 格式为: RD1.RD1.A1.mode
int num = countStr(extra_code, ".");
if (num != 3) {
throw new BadRequestException(extra_code + "数据格式不正确");
}
// if (num != 3) {
// throw new BadRequestException(extra_code + "数据格式不正确");
// }
extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length());
extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length());
@ -1818,4 +1822,70 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void excelImport(MultipartFile file, HttpServletRequest request) {
if (file.isEmpty()) {
throw new BadRequestException("文件为空,请添加数据后重新导入");
}
Long currentUserId = SecurityUtils.getCurrentUserId();
String now = DateUtil.now();
// 1.获取上传文件输入流
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (Exception e) {
e.printStackTrace();
}
WQLObject wo = WQLObject.getWQLObject("acs_device");
// 调用用 hutool 方法读取数据 默认调用第一个sheet
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
// 从第二行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列
List<List<Object>> read = excelReader.read(1, excelReader.getRowCount());
// 循环获取的数据
for (int i = 0; i < read.size(); i++) {
List list = read.get(i);
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
String device_code = list.get(0).toString();
String device_name = list.get(1).toString();
String device_type = list.get(2).toString();
String is_config = list.get(3).toString();
String is_route = list.get(4).toString();
String region = list.get(5).toString();
if (StrUtil.isEmpty(device_code)) {
throw new BadRequestException("设备编号为空!");
}
if (StrUtil.isEmpty(device_name)) {
device_name = device_code;
}
if (StrUtil.isEmpty(device_type)) {
device_type = "conveyor";
}
if (StrUtil.isEmpty(is_config)) {
is_config = "FALSE";
}
if (StrUtil.isEmpty(is_route)) {
is_route = "false";
}
DeviceDto dto = this.findByCode(device_code);
if (ObjectUtil.isNotEmpty(dto)) {
continue;
}
//按照列获取
param.put("device_id", IdUtil.getSnowflake(1, 1).nextId());
param.put("device_code", device_code);
param.put("device_name", device_name);
param.put("device_type", device_type);
param.put("is_config", is_config);
param.put("is_route", is_route);
param.put("create_by", "admin");
param.put("create_time", now);
param.put("update_by", "admin");
param.put("update_time", now);
param.put("region", region);
wo.insert(param);
}
}
}

11
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/machines_site/MachinesSiteDefination.java

@ -53,18 +53,9 @@ public class MachinesSiteDefination implements OpcDeviceDriverDefination {
@Override
public List<ItemDto> getReadableItemDtos() {
return getReadableItemDtos2();
return ItemProtocol.getReadableItemDtos();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_ioaction, "取放信号", "DB600.B3"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D8"));
return list;
}
@Override
public List<ItemDto> getWriteableItemDtos() {

42
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/ItemProtocol.java

@ -13,16 +13,16 @@ 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_vehicle = "vehicle";
public static String item_dry = "dry";
public static String item_ioaction = "ioaction";
public static String item_error = "error";
public static String item_task = "task";
public static String item_take = "take";
public static String item_put = "put";
public static String item_to_command = "to_command";
public static String item_to_target = "to_target";
public static String item_to_command1 = "to_command1";
public static String item_to_task = "to_task";
public static String item_weight = "weight";
public static String item_to_heartbeat = "to_heartbeat";
private StandardInspectSiteDeviceDriver driver;
@ -38,10 +38,10 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_mode);
}
public int getAction(){return this.getOpcIntegerValue(item_action);}
public int getAction(){return this.getOpcIntegerValue(item_dry);}
public int getMove() {
return this.getOpcIntegerValue(item_move);
return this.getOpcIntegerValue(item_vehicle);
}
public int getIoaction() {
@ -49,21 +49,21 @@ public class ItemProtocol {
}
public int getError() {
return this.getOpcIntegerValue(item_error);
return this.getOpcIntegerValue(item_take);
}
public int getTask() {
return this.getOpcIntegerValue(item_task);
return this.getOpcIntegerValue(item_put);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
public int getToTarget() {
return this.getOpcIntegerValue(item_to_target);
return this.getOpcIntegerValue(item_to_command1);
}
public int getToHeartbet() {
return this.getOpcIntegerValue(item_to_heartbeat);
}
public int getToTask() {
return this.getOpcIntegerValue(item_to_task);
}
@ -91,19 +91,19 @@ public class ItemProtocol {
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_error, "报警信号", "DB600.B5"));
list.add(new ItemDto(item_task, "任务号", "DB600.D6"));
list.add(new ItemDto(item_mode, "工作模式", "DB600.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_vehicle, "底座有车", "DB600.B3"));
list.add(new ItemDto(item_dry,"干燥架","DB600,B4"));
list.add(new ItemDto(item_take, "信号", "DB600.B5"));
list.add(new ItemDto(item_put, "放信号", "DB600.B6"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_heartbeat, "心跳", "DB601.B0"));
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4"));
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8"));
list.add(new ItemDto(item_to_command1, "目标站", "DB601.W4"));
return list;
}

13
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDefination.java

@ -52,19 +52,10 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
@Override
public List<ItemDto> getReadableItemDtos() {
return getReadableItemDtos2();
return ItemProtocol.getReadableItemDtos();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B2", true));
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(ItemProtocol.item_action,"取放信号","DB600,B4"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B5"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D6"));
return list;
}
@Override
public List<ItemDto> getWriteableItemDtos() {

14
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -74,6 +74,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
int last_task = 0;
Boolean isonline = true;
int hasGoods = 0;
int hasshelf=0;
String message = null;
Boolean iserror = false;
@ -142,6 +143,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
move = this.itemProtocol.getMove();
task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove();
hasshelf=this.itemProtocol.getAction();
if (mode != last_mode) {
if (mode == 5){
@ -371,9 +373,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
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;
+ "." + ItemProtocol.item_to_command1;
if (appendMessage == null) {
appendMessage = "";
}
@ -384,7 +384,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
}
@ -409,9 +408,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
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;
+ "." + ItemProtocol.item_to_command1;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
@ -419,9 +416,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
itemMap.put(to_command, command);
} else if (type == 2) {
itemMap.put(to_target, command);
} else if (type == 3) {
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);

2
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_photoelectric_inspect_site/StandardPhotoelectricInspectSiteDeviceDriver.java

@ -239,7 +239,7 @@ public class StandardPhotoelectricInspectSiteDeviceDriver extends AbstractOpcDev
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_target;
+ "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_command1;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_task;
if (appendMessage == null) {

12
hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -5,6 +5,7 @@ package org.nl.acs.instruction.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -900,6 +901,17 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
}
if (flag) {
com.alibaba.fastjson.JSONObject requestjo = new com.alibaba.fastjson.JSONObject();
requestjo.put("task_code", entity.getInstruction_code());
String agvurl = acsConfigService.findByCode(AcsConfig.AGVURL).getValue();
String agvport = acsConfigService.findByCode(AcsConfig.AGVPORT).getValue();
String taskcode=entity.getInstruction_code();
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + taskcode + "/withdrawal";
HttpResponse result = HttpRequest.post(agvurl)
.body(String.valueOf(requestjo))
.timeout(20000)//超时,毫秒
.execute();
log.info("请求地址agvurl{},请求结果{}",agvurl,result.body());
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
entity.setUpdate_time(now);

12
hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -488,9 +488,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) {
throw new Exception("任务起点需满足待机有货!");
}
// if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) {
// throw new Exception("任务起点需满足待机有货!");
// }
if (!StrUtil.isEmpty(standardInspectSiteDeviceDriver.getMaterial())) {
dto.setMaterial(standardInspectSiteDeviceDriver.getMaterial());
}
@ -532,9 +532,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
}
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) {
throw new Exception("任务终点需满足待机无货!");
}
// if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) {
// throw new Exception("任务终点需满足待机无货!");
// }
}
if (nextdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) {
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) nextdevice.getDeviceDriver();

137
hd/nladmin-system/src/main/java/org/nl/hand/azglny/service/impl/ZglnyHandServiceImpl.java

@ -18,6 +18,7 @@ import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceD
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_manipulator_stacking_site.StandardManipulatorStackingSiteDeviceDriver;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
@ -104,6 +105,7 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
}
//根据value值去查所有的设备
JSONArray acs_deviceja = WQLObject.getWQLObject("ACS_DEVICE").query("region='" + value + "' and device_type='conveyor' and is_config='true' ", "seq_num,device_name").getResultJSONArray(0);
if (acs_deviceja.size() > 0) {
for (int i = 0; i < acs_deviceja.size(); i++) {
JSONObject devicejo = acs_deviceja.getJSONObject(i);
String device_code = devicejo.optString("device_code");
@ -113,6 +115,8 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//货架
StandardStorageDeviceDriver standardStorageDeviceDriver;
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals(device.getIslock(), "true")) {
@ -160,6 +164,53 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
jo.put("input_material", input_material);
// 特殊驱动
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals(device.getIslock(), "true")) {
status = "3";
move = "有任务";
} else {
if (standardInspectSiteDeviceDriver.getHasshelf() == 0) {
status = "0";
move = "无货";
} else if (standardInspectSiteDeviceDriver.getHasshelf() == 1) {
status = "1";
move = "有托盘";
// } else if (standardInspectSiteDeviceDriver.getAction() == 1) {
// status = "2";
// move = "有托盘有货";
}
}
material = device.getMaterial_type();
//material = standardOrdinarySiteDeviceDriver.getMaterial();
if (StrUtil.isNullOrUndefined(material)) {
material = "";
}
batch = device.getBatch();
//batch = standardOrdinarySiteDeviceDriver.getBatch();
if (StrUtil.isNullOrUndefined(batch)) {
batch = "";
}
String input_materialflag = (String) device.getExtraValue().get("input_material");
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) {
input_material = "0";
}
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) {
input_material = "1";
}
jo.put("material_type", material);
jo.put("batch", batch);
jo.put("islock", device.getIslock());
jo.put("status_name", move);
jo.put("status", status);
jo.put("device_id", devicejo.optString("device_id"));
jo.put("device_code", devicejo.optString("device_code"));
jo.put("device_name", devicejo.optString("device_name"));
jo.put("allow_update", "1");
jo.put("input_material", input_material);
// 特殊驱动
}
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
@ -196,6 +247,60 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
// 特殊驱动
}
resultArr.add(jo);
// } else {
// JSONArray acs_huojia=new JSONArray();
// if(value.equals("14")) {
// acs_huojia = WQLObject.getWQLObject("ACS_STORAGE_CELL").query("(storage_code LIKE 'DHC01%') OR (storage_code LIKE 'DHC02%') OR (storage_code LIKE 'DHC03%')", "storage_code").getResultJSONArray(0);
// }
// if(value.equals("15")){
// acs_huojia = WQLObject.getWQLObject("ACS_STORAGE_CELL").query("(storage_code LIKE 'DHC04%') OR (storage_code LIKE 'DHC05%') OR (storage_code LIKE 'DHC06%')", "storage_code").getResultJSONArray(0);
// }
// if (acs_huojia.size() > 0) {
// for (int i = 0; i < acs_huojia.size(); i++) {
// JSONObject devicejia = acs_huojia.getJSONObject(i);
// String device_code = devicejia.optString("storage_code");
//// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
//// Device device = appService.findDeviceByCode(device_code);
//// //货架
//// StandardStorageDeviceDriver standardStorageDeviceDriver;
//// if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
//// standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
//// if (StrUtil.equals(device.getIslock(), "true")) {
//// status = "3";
//// move = "有任务";
//// }
//// material = device.getMaterial_type();
//// //material = standardOrdinarySiteDeviceDriver.getMaterial();
//// if (StrUtil.isNullOrUndefined(material)) {
//// material = "";
//// }
//// batch = device.getBatch();
//// //batch = standardOrdinarySiteDeviceDriver.getBatch();
//// if (StrUtil.isNullOrUndefined(batch)) {
//// batch = "";
//// }
//// String input_materialflag = (String) device.getExtraValue().get("input_material");
//// if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) {
//// input_material = "0";
//// }
//// if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) {
//// input_material = "1";
//// }
// jo.put("material_type", material);
// jo.put("batch", batch);
// jo.put("status_name", move);
// jo.put("status", status);
// jo.put("device_code", devicejia.optString("storage_code"));
// jo.put("device_name", devicejia.optString("storage_code"));
// jo.put("allow_update", "1");
// jo.put("input_material", input_material);
// // 特殊驱动
//// }
// resultArr.add(jo);
// }
// }
// }
}
}
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
@ -203,6 +308,7 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
return resultJson;
}
@Override
public Map<String, Object> queryInst(Map<String, String> jsonObject) {
//查询位完成的指令
@ -216,6 +322,8 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
@Override
public Map<String, Object> createTask(Map<String, String> jsonObject) {
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
String start_devicecode = jsonObject.get("start_devicecode");
String next_devicecode = jsonObject.get("next_devicecode");
String material_type = jsonObject.get("material_type");
@ -253,18 +361,43 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
return resultJson;
}
//判断起点有货,终点为空
if (ObjectUtil.isEmpty(startDevice.getMaterial_type()) || Integer.parseInt(startDevice.getMaterial_type()) == 0) {
// if (standardInspectSiteDeviceDriver.getMode()==2&&standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getHasshelf()==1) {
// resultJson.put("code", "0");
// resultJson.put("desc", "起点必须有货");
// resultJson.put("result", "");
// return resultJson;
// }
//
// if (standardInspectSiteDeviceDriver.getMode()==2&&standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getHasshelf()==0) {
// resultJson.put("code", "0");
// resultJson.put("desc", "终点必须为空");
// resultJson.put("result", "");
// return resultJson;
// }
if(startDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startDevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMode() !=2 || standardInspectSiteDeviceDriver.getMove() !=1 ||
standardInspectSiteDeviceDriver.getHasshelf() !=1) {
resultJson.put("code", "0");
resultJson.put("desc", "起点必须有货");
resultJson.put("result", "");
return resultJson;
}
if (!ObjectUtil.isEmpty(nextDevice.getMaterial_type()) && !StrUtil.equals(nextDevice.getMaterial_type(), "0")) {
}
if(nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMode() !=2 || standardInspectSiteDeviceDriver.getMove() !=1 ||
standardInspectSiteDeviceDriver.getHasshelf() !=0) {
resultJson.put("code", "0");
resultJson.put("desc", "终点必须为空");
resultJson.put("result", "");
return resultJson;
}
}
//判断有无这个任务

32
hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

@ -178,14 +178,14 @@ public class AutoCreateInst {
this.execute_log.log("起点设备:" + startdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
continue;
}
if (standardInspectSiteDeviceDriver.getMove() == 0) {
log.info("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
acsTask.setRemark("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
taskserver.updateByCodeFromCache(acsTask);
this.execute_log.setResource(startdevice.getDevice_code(), startdevice.getDevice_code());
this.execute_log.log("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
continue;
}
// if (standardInspectSiteDeviceDriver.getHasshelf() == 0) {
// log.info("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
// acsTask.setRemark("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
// taskserver.updateByCodeFromCache(acsTask);
// this.execute_log.setResource(startdevice.getDevice_code(), startdevice.getDevice_code());
// this.execute_log.log("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
// continue;
// }
}
if (startdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) {
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) startdevice.getDeviceDriver();
@ -234,14 +234,14 @@ public class AutoCreateInst {
this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
continue;
}
if (standardInspectSiteDeviceDriver.getMove() != 0) {
log.info("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
acsTask.setRemark("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
taskserver.updateByCodeFromCache(acsTask);
this.execute_log.setResource(nextdevice.getDevice_code(), nextdevice.getDevice_code());
this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
continue;
}
// if (standardInspectSiteDeviceDriver.getHasshelf() == 0) {
// log.info("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
// acsTask.setRemark("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
// taskserver.updateByCodeFromCache(acsTask);
// this.execute_log.setResource(nextdevice.getDevice_code(), nextdevice.getDevice_code());
// this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
// continue;
// }
if (startdevice.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver){
standardEmptsyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) startdevice.getDeviceDriver();
if (next_device_code.equals("Q1") || next_device_code.equals("P1")){

6
hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryAgvTaskStatus.java

@ -33,7 +33,7 @@ public class QueryAgvTaskStatus {
JSONArray inst_rows = JSONArray.parseArray(response.body());
for (int i = 0; i < inst_rows.size(); i++) {
JSONObject inst_jo = inst_rows.getJSONObject(i);
String inst_code = inst_jo.getString("taskCode");
String inst_code = inst_jo.getString("task_code");
Instruction inst = instructionService.findByCodeFromCache(inst_code);
if (ObjectUtil.isEmpty(inst)) {
continue;
@ -41,7 +41,7 @@ public class QueryAgvTaskStatus {
//反馈结果状态
log.info("instcode:" + inst_code + "," + inst_jo.toString());
String state = inst_jo.getString("state");
String state = inst_jo.getString("status");
String vehicle = "";
//正在执行指令agv车号
if (!StrUtil.isEmpty(inst_jo.getString("vehicle"))) {
@ -58,7 +58,7 @@ public class QueryAgvTaskStatus {
// UNROUTABLE:无法规划该业务订单的执行路线
//执行中
if ("BEING_PROCESSED".equals(state)) {
if ("BEING_PROCESSED".equals(state) || "ACTIVE".equals(state)) {
if (inst != null) {
inst.setInstruction_status("1");
instructionService.update(inst);

36
hd/nladmin-system/src/main/java/org/nl/modules/system/service/dto/ParamDto.java

@ -0,0 +1,36 @@
package org.nl.modules.system.service.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @description /
* @author ldjun
* @date 2021-01-14
**/
@Data
public class ParamDto implements Serializable {
private String id;
private String code;
private String name;
private String value;
private String remark;
private Long create_id;
private Long update_optid;
private String create_name;
private String create_time;
private String update_optname;
private String update_time;
}

2
hd/nladmin-system/src/main/resources/log/AcsToWms.xml

@ -10,7 +10,7 @@
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize>
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>

4
qd/.env.production

@ -2,8 +2,8 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
VUE_APP_BASE_API = 'http://192.168.81.122:8010'
VUE_APP_BASE_API = 'http://127.0.0.1:8010'
#VUE_APP_BASE_API = 'http://127.0.0.1:8010'
# 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'ws://192.168.81.122:8010'
VUE_APP_WS_API = 'ws://127.0.0.1:8010'
#VUE_APP_WS_API = 'ws://127.0.0.1:8010'

42
qd/src/api/acs/device/device.js

@ -212,6 +212,42 @@ export function agvTaskType(data) {
})
}
export default { add, edit, del, selectDeviceList, selectDeviceListByRegion, callAgv, responseAgv, selectDeviceDevicerInfo, autoCreateTask,
changeDeviceStatus, cleanTask, queryStorageExtra, selectConDeviceList, saveBarcode, selectDeviceListOne, selectDeviceListTwo, selectDeviceListThree,
addMaterial, cleanMaterial, changeFenceStatus,reload, cleans1, cleans2, enterSite1, enterSite2, cleans3, selectAGVList, agvTaskType}
export function excelImport(data) {
return request({
url: 'api/device/excelImport',
method: 'post',
data
})
}
export default {
add,
edit,
del,
selectDeviceList,
selectDeviceListByRegion,
callAgv,
responseAgv,
selectDeviceDevicerInfo,
autoCreateTask,
changeDeviceStatus,
cleanTask,
queryStorageExtra,
selectConDeviceList,
saveBarcode,
selectDeviceListOne,
selectDeviceListTwo,
selectDeviceListThree,
addMaterial,
cleanMaterial,
changeFenceStatus,
reload,
cleans1,
cleans2,
enterSite1,
enterSite2,
cleans3,
selectAGVList,
agvTaskType,
excelImport
}

121
qd/src/views/acs/device/index.vue

@ -26,9 +26,51 @@
>
<el-option v-for="item in device_types" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
<el-select
v-model="query.region"
clearable
filterable
size="small"
placeholder="区域名称"
class="filter-item"
style="width: 190px"
@change="crud.toQuery"
>
<el-option v-for="item in regions" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
<el-select
v-model="query.is_config"
clearable
filterable
size="small"
placeholder="是否配置"
class="filter-item"
style="width: 190px"
@change="crud.toQuery"
>
<el-option v-for="item in is_configs" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
<rrOperation />
</div>
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
size="mini"
type="warning"
icon="el-icon-download"
@click="crud.doExport"
>导出模型</el-button>
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-upload2"
size="mini"
@click="uploadShow = true"
>
导入
</el-button>
<el-button
slot="right"
class="filter-item"
@ -40,7 +82,6 @@
同步
</el-button>
</crudOperation>
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
@ -70,7 +111,7 @@
</el-select>
</el-form-item>
<el-form-item label="所属区域" prop="region">
<el-select v-model="form.region" style="width: 370px" clearable placeholder="请选择">
<el-select v-model="form.region" style="width: 370px" placeholder="请选择">
<el-option
v-for="item in regions"
:key="item.id"
@ -79,6 +120,16 @@
/>
</el-select>
</el-form-item>
<el-form-item label="是否配置" prop="is_config">
<el-select v-model="form.is_config" style="width: 370px" placeholder="请选择">
<el-option
v-for="item in is_configs"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="顺序号" prop="seq_num">
<el-input-number v-model="form.seq_num" value="1" :min="1" label="描述文字" />
</el-form-item>
@ -109,21 +160,21 @@
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="device_id" label="设备标识" />
<el-table-column sortable prop="device_code" label="设备编码" />
<af-table-column sortable label="设备名字">
<el-table-column sortable label="设备名字">
<template slot-scope="scope">
<div>{{ scope.row.device_name }}</div>
</template>
</af-table-column>
<af-table-column label="设备类型">
</el-table-column>
<el-table-column label="设备类型">
<template slot-scope="scope">
<div>{{ scope.row.device_type_name }}</div>
</template>
</af-table-column>
<af-table-column label="所属区域">
</el-table-column>
<el-table-column label="所属区域">
<template slot-scope="scope">
<div>{{ scope.row.region_name }}</div>
</template>
</af-table-column>
</el-table-column>
<el-table-column sortable prop="seq_num" label="顺序号" />
<el-table-column prop="is_config" label="是否配置" width="75px">
<template slot-scope="scope">
@ -134,27 +185,25 @@
<!-- <el-table-column prop="manufacturer" label="生产厂家" />-->
<!-- <el-table-column prop="manufacturer_phone" label="厂家电话" />-->
<el-table-column prop="remark" label="备注" />
<el-table-column label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button size="mini" style="margin-left: -1px;margin-right: 2px" type="text">
<router-link :to="'/devices/device/config/' + scope.row.device_code ">
驱动配置
</router-link>
</el-button>
</template>
</el-table-column>
<el-table-column v-permission="['admin','device:edit','device:del']" label="操作" width="150px" align="center">
<el-table-column v-permission="['admin','device:edit','device:del']" label="操作" width="200px" align="center">
<template slot-scope="scope">
<udOperation
style="display: inline"
:data="scope.row"
:permission="permission"
/>
<el-button slot="right" size="mini" style="margin-left: -1px;margin-right: 2px" type="text">
<router-link :to="'/devices/device/config/' + scope.row.device_code ">
驱动配置
</router-link>
</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="tableChanged3" />
</div>
</template>
@ -166,7 +215,9 @@ import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import { get } from '@/api/system/dictDetail'
import crudRouteLine from '@/api/acs/route/routeLine'
import UploadDialog from '@/views/acs/device/UploadDialog'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
const defaultForm = {
manufacturer: null,
@ -185,11 +236,12 @@ const defaultForm = {
device_type: null,
region: null,
is_config: null,
remark: null
remark: null,
region: null
}
export default {
name: 'Device',
components: { pagination, crudOperation, rrOperation, udOperation },
components: { pagination, crudOperation, rrOperation, udOperation, UploadDialog },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
@ -209,6 +261,10 @@ export default {
},
device_types: [],
regions: [],
is_configs: [],
uploadShow: false,
device_code: '',
regions: [],
rules: {
device_code: [
{ required: true, message: '设备编码不能为空', trigger: 'blur' }
@ -218,8 +274,10 @@ export default {
],
device_type: [
{ required: true, message: '设备类型不能为空', trigger: 'blur' }
],
region: [
{ required: true, message: '所属区域不能为空', trigger: 'blur' }
]
}
}
},
@ -230,9 +288,13 @@ export default {
this.device_types = data.content
})
//
get('region_type').then(data => {
get('region').then(data => {
this.regions = data.content
})
//
get('is_config').then(data => {
this.is_configs = data.content
})
})
},
methods: {
@ -240,12 +302,25 @@ export default {
[CRUD.HOOK.beforeRefresh]() {
return true
},
tableChanged3() {
this.crud.toQuery()
},
reload() {
crudDevice.reload().then(res => {
this.crud.toQuery()
}).catch(err => {
console.log(err.response.data.message)
})
},
downloadMethod() {
this.beforeInit()
this.downloadLoading = true
download(this.url + 'api/device/download', this.params).then(result => {
downloadFile(result, this.title + '数据', 'xlsx')
this.downloadLoading = false
}).catch(() => {
this.downloadLoading = false
})
}
}
}

Loading…
Cancel
Save