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. 333
      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. 306
      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(); JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject(); JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired"); pro1.put("key", "EntryRequired");
pro1.put("value", "True"); pro1.put("value", "true");
properties.add(pro1); properties.add(pro1);
JSONObject pro2 = new JSONObject(); JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation"); pro2.put("key", "PauseOnStation");
pro2.put("value", "True"); pro2.put("value", "true");
properties.add(pro2); properties.add(pro2);
destinationOrder.put("properties", properties); destinationOrder.put("properties", properties);
//进入等待 离开不等待 //进入等待 离开不等待
@ -132,7 +132,7 @@ public class AgvServiceImpl implements AgvService {
JSONArray properties = new JSONArray(); JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject(); JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired"); pro1.put("key", "EntryRequired");
pro1.put("value", "True"); pro1.put("value", "true");
properties.add(pro1); properties.add(pro1);
JSONObject pro2 = new JSONObject(); JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation"); pro2.put("key", "PauseOnStation");
@ -148,7 +148,7 @@ public class AgvServiceImpl implements AgvService {
properties.add(pro1); properties.add(pro1);
JSONObject pro2 = new JSONObject(); JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation"); pro2.put("key", "PauseOnStation");
pro2.put("value", "True"); pro2.put("value", "true");
properties.add(pro2); properties.add(pro2);
destinationOrder.put("properties", properties); destinationOrder.put("properties", properties);
//不等待 //不等待
@ -274,7 +274,6 @@ public class AgvServiceImpl implements AgvService {
jo.put("deadline", this.getNextDay(1)); jo.put("deadline", this.getNextDay(1));
//判断是否追加任务 //判断是否追加任务
jo.put("complete", "true"); jo.put("complete", "true");
jo.put("task_code", inst.getInstruction_code()); jo.put("task_code", inst.getInstruction_code());
//根据任务,下发指令类型 //根据任务,下发指令类型
com.alibaba.fastjson.JSONArray destinations = new com.alibaba.fastjson.JSONArray(); 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); String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/query"; agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/query";
log.info("请求地址为{}",agvurl);
HttpResponse result = HttpRequest.post(agvurl) HttpResponse result = HttpRequest.post(agvurl)
.body("{}") .body("{}")
.timeout(20000)//超时,毫秒 .timeout(20000)//超时,毫秒
@ -868,7 +867,6 @@ public class AgvServiceImpl implements AgvService {
//取货的进入前等待和离开等待 //取货的进入前等待和离开等待
if (action.equals("Load")) { if (action.equals("Load")) {
if ("EntryRequired".equals(type)) { if ("EntryRequired".equals(type)) {
// //
if (addressdevice.getDeviceDriver() instanceof StandardManipulatorStackingSiteDeviceDriver) { if (addressdevice.getDeviceDriver() instanceof StandardManipulatorStackingSiteDeviceDriver) {
standardManipulatorStackingSiteDeviceDriver = (StandardManipulatorStackingSiteDeviceDriver) addressdevice.getDeviceDriver(); standardManipulatorStackingSiteDeviceDriver = (StandardManipulatorStackingSiteDeviceDriver) addressdevice.getDeviceDriver();
@ -881,12 +879,18 @@ public class AgvServiceImpl implements AgvService {
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
is_feedback = true; 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(); standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
if(standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getAction()==1){
if(standardInspectSiteDeviceDriver.getError()==1){
is_feedback = true; is_feedback = true;
log.info("设备开始请求取货了");
}else { }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) { if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
is_feedback = true; is_feedback = true;
} }
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
is_feedback = true;
log.info("设备开始请求离开");
}
if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
if(standardInspectSiteDeviceDriver.getMove()==0){ // if(standardInspectSiteDeviceDriver.getMove()==0){
is_feedback = true; is_feedback = true;
}else { log.info("设备开始请求离开了");
log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove()); // }else {
} // log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove());
// }
} }
} }
} }
@ -927,12 +936,17 @@ public class AgvServiceImpl implements AgvService {
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
is_feedback = true; is_feedback = true;
} }
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
is_feedback = true;
log.info("设备开始请求放货");
}
if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
if(standardInspectSiteDeviceDriver.getMove()==0&&standardInspectSiteDeviceDriver.getAction()==2){ if(standardInspectSiteDeviceDriver.getTask()==1){
is_feedback = true; is_feedback = true;
log.info("设备开始请求放货了");
}else { }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) { if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
is_feedback = true; is_feedback = true;
} }
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
is_feedback = true;
log.info("设备开始请求离开");
}
if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ if(addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); standardInspectSiteDeviceDriver=(StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
if(standardInspectSiteDeviceDriver.getMove()==1){ // if(standardInspectSiteDeviceDriver.getMove()==1){
is_feedback = true; is_feedback = true;
}else { log.info("设备开始请求离开了");
log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove()); // }else {
} // log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardInspectSiteDeviceDriver.getMove());
// }
} }
} }
} }
@ -974,7 +993,7 @@ public class AgvServiceImpl implements AgvService {
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL); String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT); 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) 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.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -423,4 +425,11 @@ public class DeviceController {
return new ResponseEntity<>(HttpStatus.CREATED); 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.device.service.dto.StorageCellDto;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -285,4 +287,11 @@ public interface DeviceService {
List<Device> findCacheDevice(); List<Device> findCacheDevice();
void updateBarcode(JSONObject json) throws Exception; 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.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray; 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.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.*; import java.util.*;
/** /**
@ -295,7 +300,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
@Override @Override
public void downDeviceDBload(JSONArray jsonarr, HttpServletResponse response) throws IOException { public void downDeviceDBload(JSONArray jsonarr, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
for (int i = 0; i < jsonarr.size(); i++) { for (int i = 0; i < jsonarr.size(); i++) {
JSONObject jo = jsonarr.getJSONObject(i); JSONObject jo = jsonarr.getJSONObject(i);
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
@ -1576,9 +1580,9 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
String extra_code = jo.getString("extra_code"); String extra_code = jo.getString("extra_code");
//校验数据 格式为: RD1.RD1.A1.mode //校验数据 格式为: RD1.RD1.A1.mode
int num = countStr(extra_code, "."); int num = countStr(extra_code, ".");
if (num != 3) { // if (num != 3) {
throw new BadRequestException(extra_code + "数据格式不正确"); // 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());
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 @Override
public List<ItemDto> getReadableItemDtos() { 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 @Override
public List<ItemDto> getWriteableItemDtos() { 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_heartbeat = "heartbeat";
public static String item_mode = "mode"; public static String item_mode = "mode";
public static String item_move = "move"; public static String item_vehicle = "vehicle";
public static String item_action = "action"; public static String item_dry = "dry";
public static String item_ioaction = "ioaction"; public static String item_ioaction = "ioaction";
public static String item_error = "error"; public static String item_take = "take";
public static String item_task = "task"; public static String item_put = "put";
public static String item_to_command = "to_command"; 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_to_task = "to_task";
public static String item_weight = "weight"; public static String item_weight = "weight";
public static String item_to_heartbeat = "to_heartbeat";
private StandardInspectSiteDeviceDriver driver; private StandardInspectSiteDeviceDriver driver;
@ -38,10 +38,10 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_mode); return this.getOpcIntegerValue(item_mode);
} }
public int getAction(){return this.getOpcIntegerValue(item_action);} public int getAction(){return this.getOpcIntegerValue(item_dry);}
public int getMove() { public int getMove() {
return this.getOpcIntegerValue(item_move); return this.getOpcIntegerValue(item_vehicle);
} }
public int getIoaction() { public int getIoaction() {
@ -49,21 +49,21 @@ public class ItemProtocol {
} }
public int getError() { public int getError() {
return this.getOpcIntegerValue(item_error); return this.getOpcIntegerValue(item_take);
} }
public int getTask() { 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() { 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() { public int getToTask() {
return this.getOpcIntegerValue(item_to_task); return this.getOpcIntegerValue(item_to_task);
} }
@ -91,19 +91,19 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() { public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true))); list.add(new ItemDto(item_mode, "工作模式", "DB600.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3")); list.add(new ItemDto(item_vehicle, "底座有车", "DB600.B3"));
list.add(new ItemDto(item_action,"取放信号","DB600,B4")); list.add(new ItemDto(item_dry,"干燥架","DB600,B4"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B5")); list.add(new ItemDto(item_take, "信号", "DB600.B5"));
list.add(new ItemDto(item_task, "任务号", "DB600.D6")); list.add(new ItemDto(item_put, "放信号", "DB600.B6"));
return list; return list;
} }
public static List<ItemDto> getWriteableItemDtos() { public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList(); 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_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4")); list.add(new ItemDto(item_to_command1, "目标站", "DB601.W4"));
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8"));
return list; 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 @Override
public List<ItemDto> getReadableItemDtos() { 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 @Override
public List<ItemDto> getWriteableItemDtos() { 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; int last_task = 0;
Boolean isonline = true; Boolean isonline = true;
int hasGoods = 0; int hasGoods = 0;
int hasshelf=0;
String message = null; String message = null;
Boolean iserror = false; Boolean iserror = false;
@ -142,6 +143,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
move = this.itemProtocol.getMove(); move = this.itemProtocol.getMove();
task = this.itemProtocol.getTask(); task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove(); hasGoods = this.itemProtocol.getMove();
hasshelf=this.itemProtocol.getAction();
if (mode != last_mode) { if (mode != last_mode) {
if (mode == 5){ 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() String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command; + "." + ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_target; + "." + ItemProtocol.item_to_command1;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
if (appendMessage == null) { if (appendMessage == null) {
appendMessage = ""; appendMessage = "";
} }
@ -384,7 +384,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
Server server = ReadUtil.getServer(opcservcerid); Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>(); Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1); itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server); 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() String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command; + "." + ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_target; + "." + ItemProtocol.item_to_command1;
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(); String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid); Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>(); Map<String, Object> itemMap = new HashMap<String, Object>();
@ -419,9 +416,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
itemMap.put(to_command, command); itemMap.put(to_command, command);
} else if (type == 2) { } else if (type == 2) {
itemMap.put(to_target, command); itemMap.put(to_target, command);
} else if (type == 3) {
itemMap.put(to_task, command);
} }
ReadUtil.write(itemMap, server); 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() 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; + "." + 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() 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() 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; + "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_task;
if (appendMessage == null) { 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.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -900,6 +901,17 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
if (flag) { 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 currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now(); String now = DateUtil.now();
entity.setUpdate_time(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 (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) { // if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) {
throw new Exception("任务起点需满足待机有货!"); // throw new Exception("任务起点需满足待机有货!");
} // }
if (!StrUtil.isEmpty(standardInspectSiteDeviceDriver.getMaterial())) { if (!StrUtil.isEmpty(standardInspectSiteDeviceDriver.getMaterial())) {
dto.setMaterial(standardInspectSiteDeviceDriver.getMaterial()); dto.setMaterial(standardInspectSiteDeviceDriver.getMaterial());
} }
@ -532,9 +532,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
} }
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) { // if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) {
throw new Exception("任务终点需满足待机无货!"); // throw new Exception("任务终点需满足待机无货!");
} // }
} }
if (nextdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) { if (nextdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) {
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) nextdevice.getDeviceDriver();

333
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_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver; 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_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_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver; import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
@ -104,104 +105,209 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
} }
//根据value值去查所有的设备 //根据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); JSONArray acs_deviceja = WQLObject.getWQLObject("ACS_DEVICE").query("region='" + value + "' and device_type='conveyor' and is_config='true' ", "seq_num,device_name").getResultJSONArray(0);
for (int i = 0; i < acs_deviceja.size(); i++) { if (acs_deviceja.size() > 0) {
JSONObject devicejo = acs_deviceja.getJSONObject(i); for (int i = 0; i < acs_deviceja.size(); i++) {
String device_code = devicejo.optString("device_code"); JSONObject devicejo = acs_deviceja.getJSONObject(i);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); String device_code = devicejo.optString("device_code");
Device device = appService.findDeviceByCode(device_code); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
//无光电普通站点 Device device = appService.findDeviceByCode(device_code);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; //无光电普通站点
//货架 StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardStorageDeviceDriver standardStorageDeviceDriver; //货架
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { StandardStorageDeviceDriver standardStorageDeviceDriver;
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); //检测站点
if (StrUtil.equals(device.getIslock(), "true")) { StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
status = "3"; if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
move = "有任务"; standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
} else { if (StrUtil.equals(device.getIslock(), "true")) {
if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) { status = "3";
status = "0"; move = "有任务";
move = "无货"; } else {
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) { if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) {
status = "1"; status = "0";
move = "有托盘"; move = "无货";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) { } else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) {
status = "2"; status = "1";
move = "有托盘有货"; move = "有托盘";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) {
status = "2";
move = "有托盘有货";
}
} }
}
material = device.getMaterial_type(); material = device.getMaterial_type();
//material = standardOrdinarySiteDeviceDriver.getMaterial(); //material = standardOrdinarySiteDeviceDriver.getMaterial();
if (StrUtil.isNullOrUndefined(material)) { if (StrUtil.isNullOrUndefined(material)) {
material = ""; material = "";
} }
batch = device.getBatch(); batch = device.getBatch();
//batch = standardOrdinarySiteDeviceDriver.getBatch(); //batch = standardOrdinarySiteDeviceDriver.getBatch();
if (StrUtil.isNullOrUndefined(batch)) { if (StrUtil.isNullOrUndefined(batch)) {
batch = ""; batch = "";
} }
String input_materialflag = (String) device.getExtraValue().get("input_material"); String input_materialflag = (String) device.getExtraValue().get("input_material");
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) { if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) {
input_material = "0"; input_material = "0";
} }
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) { if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) {
input_material = "1"; 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);
// 特殊驱动
} }
jo.put("material_type", material); if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
jo.put("batch", batch); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
jo.put("islock", device.getIslock()); if (StrUtil.equals(device.getIslock(), "true")) {
jo.put("status_name", move); status = "3";
jo.put("status", status); move = "有任务";
jo.put("device_id", devicejo.optString("device_id")); } else {
jo.put("device_code", devicejo.optString("device_code")); if (standardInspectSiteDeviceDriver.getHasshelf() == 0) {
jo.put("device_name", devicejo.optString("device_name")); status = "0";
jo.put("allow_update", "1"); move = "无货";
jo.put("input_material", input_material); } else if (standardInspectSiteDeviceDriver.getHasshelf() == 1) {
// 特殊驱动 status = "1";
} move = "有托盘";
// } else if (standardInspectSiteDeviceDriver.getAction() == 1) {
// status = "2";
// move = "有托盘有货";
}
}
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { material = device.getMaterial_type();
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); //material = standardOrdinarySiteDeviceDriver.getMaterial();
if (StrUtil.equals(device.getIslock(), "true")) { if (StrUtil.isNullOrUndefined(material)) {
status = "3"; material = "";
move = "有任务"; }
} batch = device.getBatch();
material = device.getMaterial_type(); //batch = standardOrdinarySiteDeviceDriver.getBatch();
//material = standardOrdinarySiteDeviceDriver.getMaterial(); if (StrUtil.isNullOrUndefined(batch)) {
if (StrUtil.isNullOrUndefined(material)) { batch = "";
material = ""; }
} String input_materialflag = (String) device.getExtraValue().get("input_material");
batch = device.getBatch(); if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) {
//batch = standardOrdinarySiteDeviceDriver.getBatch(); input_material = "0";
if (StrUtil.isNullOrUndefined(batch)) { }
batch = ""; if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) {
} input_material = "1";
String input_materialflag = (String) device.getExtraValue().get("input_material"); }
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) { jo.put("material_type", material);
input_material = "0"; 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 (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) {
input_material = "1"; 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_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);
// 特殊驱动
} }
jo.put("material_type", material); resultArr.add(jo);
jo.put("batch", batch); // } else {
jo.put("status_name", move); // JSONArray acs_huojia=new JSONArray();
jo.put("status", status); // if(value.equals("14")) {
jo.put("device_id", devicejo.optString("device_id")); // 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);
jo.put("device_code", devicejo.optString("device_code")); // }
jo.put("device_name", devicejo.optString("device_name")); // if(value.equals("15")){
jo.put("allow_update", "1"); // 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);
jo.put("input_material", input_material); // }
// 特殊驱动 // 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);
// }
// }
// }
} }
resultArr.add(jo);
} }
resultJson.put("code", "1"); resultJson.put("code", "1");
resultJson.put("desc", "查询成功"); resultJson.put("desc", "查询成功");
resultJson.put("result", resultArr); resultJson.put("result", resultArr);
return resultJson; return resultJson;
} }
@Override @Override
public Map<String, Object> queryInst(Map<String, String> jsonObject) { public Map<String, Object> queryInst(Map<String, String> jsonObject) {
@ -216,6 +322,8 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
@Override @Override
public Map<String, Object> createTask(Map<String, String> jsonObject) { public Map<String, Object> createTask(Map<String, String> jsonObject) {
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
String start_devicecode = jsonObject.get("start_devicecode"); String start_devicecode = jsonObject.get("start_devicecode");
String next_devicecode = jsonObject.get("next_devicecode"); String next_devicecode = jsonObject.get("next_devicecode");
String material_type = jsonObject.get("material_type"); String material_type = jsonObject.get("material_type");
@ -253,17 +361,42 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
return resultJson; return resultJson;
} }
//判断起点有货,终点为空 //判断起点有货,终点为空
if (ObjectUtil.isEmpty(startDevice.getMaterial_type()) || Integer.parseInt(startDevice.getMaterial_type()) == 0) {
resultJson.put("code", "0"); // if (standardInspectSiteDeviceDriver.getMode()==2&&standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getHasshelf()==1) {
resultJson.put("desc", "起点必须有货"); // resultJson.put("code", "0");
resultJson.put("result", ""); // resultJson.put("desc", "起点必须有货");
return resultJson; // 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")) {
resultJson.put("code", "0"); if(nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
resultJson.put("desc", "终点必须为空"); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
resultJson.put("result", ""); if (standardInspectSiteDeviceDriver.getMode() !=2 || standardInspectSiteDeviceDriver.getMove() !=1 ||
return resultJson; 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); this.execute_log.log("起点设备:" + startdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
continue; continue;
} }
if (standardInspectSiteDeviceDriver.getMove() == 0) { // if (standardInspectSiteDeviceDriver.getHasshelf() == 0) {
log.info("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); // log.info("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
acsTask.setRemark("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); // acsTask.setRemark("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
taskserver.updateByCodeFromCache(acsTask); // taskserver.updateByCodeFromCache(acsTask);
this.execute_log.setResource(startdevice.getDevice_code(), startdevice.getDevice_code()); // this.execute_log.setResource(startdevice.getDevice_code(), startdevice.getDevice_code());
this.execute_log.log("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); // this.execute_log.log("目标设备:" + startdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
continue; // continue;
} // }
} }
if (startdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) { if (startdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) {
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) startdevice.getDeviceDriver(); standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) startdevice.getDeviceDriver();
@ -234,14 +234,14 @@ public class AutoCreateInst {
this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode); this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备未待机,任务号:" + taskcode);
continue; continue;
} }
if (standardInspectSiteDeviceDriver.getMove() != 0) { // if (standardInspectSiteDeviceDriver.getHasshelf() == 0) {
log.info("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); // log.info("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
acsTask.setRemark("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); // acsTask.setRemark("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
taskserver.updateByCodeFromCache(acsTask); // taskserver.updateByCodeFromCache(acsTask);
this.execute_log.setResource(nextdevice.getDevice_code(), nextdevice.getDevice_code()); // this.execute_log.setResource(nextdevice.getDevice_code(), nextdevice.getDevice_code());
this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode); // this.execute_log.log("目标设备:" + nextdevice.getDevice_code() + "设备不满足放货条件,任务号:" + taskcode);
continue; // continue;
} // }
if (startdevice.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver){ if (startdevice.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver){
standardEmptsyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) startdevice.getDeviceDriver(); standardEmptsyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) startdevice.getDeviceDriver();
if (next_device_code.equals("Q1") || next_device_code.equals("P1")){ 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()); JSONArray inst_rows = JSONArray.parseArray(response.body());
for (int i = 0; i < inst_rows.size(); i++) { for (int i = 0; i < inst_rows.size(); i++) {
JSONObject inst_jo = inst_rows.getJSONObject(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); Instruction inst = instructionService.findByCodeFromCache(inst_code);
if (ObjectUtil.isEmpty(inst)) { if (ObjectUtil.isEmpty(inst)) {
continue; continue;
@ -41,7 +41,7 @@ public class QueryAgvTaskStatus {
//反馈结果状态 //反馈结果状态
log.info("instcode:" + inst_code + "," + inst_jo.toString()); log.info("instcode:" + inst_code + "," + inst_jo.toString());
String state = inst_jo.getString("state"); String state = inst_jo.getString("status");
String vehicle = ""; String vehicle = "";
//正在执行指令agv车号 //正在执行指令agv车号
if (!StrUtil.isEmpty(inst_jo.getString("vehicle"))) { if (!StrUtil.isEmpty(inst_jo.getString("vehicle"))) {
@ -58,7 +58,7 @@ public class QueryAgvTaskStatus {
// UNROUTABLE:无法规划该业务订单的执行路线 // UNROUTABLE:无法规划该业务订单的执行路线
//执行中 //执行中
if ("BEING_PROCESSED".equals(state)) { if ("BEING_PROCESSED".equals(state) || "ACTIVE".equals(state)) {
if (inst != null) { if (inst != null) {
inst.setInstruction_status("1"); inst.setInstruction_status("1");
instructionService.update(inst); 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> <maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来--> <!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize> <maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量--> <!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap> <totalSizeCap>2GB</totalSizeCap>
</rollingPolicy> </rollingPolicy>

4
qd/.env.production

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

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

@ -1,217 +1,253 @@
import request from '@/utils/request' import request from '@/utils/request'
export function add(data) { export function add(data) {
return request({ return request({
url: 'api/device', url: 'api/device',
method: 'post', method: 'post',
data data
}) })
} }
export function del(ids) { export function del(ids) {
return request({ return request({
url: 'api/device/', url: 'api/device/',
method: 'delete', method: 'delete',
data: ids data: ids
}) })
} }
export function edit(data) { export function edit(data) {
return request({ return request({
url: 'api/device', url: 'api/device',
method: 'put', method: 'put',
data data
}) })
} }
export function selectDeviceList() { export function selectDeviceList() {
return request({ return request({
url: 'api/device/selectList', url: 'api/device/selectList',
method: 'get' method: 'get'
}) })
} }
export function selectConDeviceList() { export function selectConDeviceList() {
return request({ return request({
url: 'api/device/selectConveyorList', url: 'api/device/selectConveyorList',
method: 'get' method: 'get'
}) })
} }
export function selectDeviceListByRegion(region) { export function selectDeviceListByRegion(region) {
return request({ return request({
url: 'api/device/region/' + region, url: 'api/device/region/' + region,
method: 'get' method: 'get'
}) })
} }
export function selectDeviceListOne() { export function selectDeviceListOne() {
return request({ return request({
url: 'api/device/selectListOne', url: 'api/device/selectListOne',
method: 'get' method: 'get'
}) })
} }
export function selectDeviceListTwo() { export function selectDeviceListTwo() {
return request({ return request({
url: 'api/device/selectListTwo', url: 'api/device/selectListTwo',
method: 'get' method: 'get'
}) })
} }
export function selectDeviceListThree() { export function selectDeviceListThree() {
return request({ return request({
url: 'api/device/selectListThree', url: 'api/device/selectListThree',
method: 'get' method: 'get'
}) })
} }
export function selectDeviceDevicerInfo(status) { export function selectDeviceDevicerInfo(status) {
return request({ return request({
url: 'api/device/selectDeviceDevicerInfo/' + status, url: 'api/device/selectDeviceDevicerInfo/' + status,
method: 'get' method: 'get'
}) })
} }
export function changeDeviceStatus(data) { export function changeDeviceStatus(data) {
return request({ return request({
url: 'api/device/changeDeviceStatus', url: 'api/device/changeDeviceStatus',
method: 'post', method: 'post',
data data
}) })
} }
export function changeFenceStatus(data) { export function changeFenceStatus(data) {
return request({ return request({
url: 'api/device/changeFenceStatus', url: 'api/device/changeFenceStatus',
method: 'post', method: 'post',
data data
}) })
} }
export function saveBarcode(data) { export function saveBarcode(data) {
return request({ return request({
url: 'api/device/updateBarcode', url: 'api/device/updateBarcode',
method: 'post', method: 'post',
data data
}) })
} }
export function callAgv(data) { export function callAgv(data) {
return request({ return request({
url: 'api/device/callAgv', url: 'api/device/callAgv',
method: 'post', method: 'post',
data data
}) })
} }
export function addMaterial(data) { export function addMaterial(data) {
return request({ return request({
url: 'api/device/addMaterial', url: 'api/device/addMaterial',
method: 'post', method: 'post',
data data
}) })
} }
export function responseAgv(data) { export function responseAgv(data) {
return request({ return request({
url: 'api/device/responseAgv', url: 'api/device/responseAgv',
method: 'post', method: 'post',
data data
}) })
} }
export function autoCreateTask(data) { export function autoCreateTask(data) {
return request({ return request({
url: 'api/device/autoCreateTask', url: 'api/device/autoCreateTask',
method: 'post', method: 'post',
data data
}) })
} }
export function cleanTask(data) { export function cleanTask(data) {
return request({ return request({
url: 'api/device/cleanTask', url: 'api/device/cleanTask',
method: 'post', method: 'post',
data data
}) })
} }
export function cleanMaterial(data) { export function cleanMaterial(data) {
return request({ return request({
url: 'api/device/cleanMaterial', url: 'api/device/cleanMaterial',
method: 'post', method: 'post',
data data
}) })
} }
export function queryStorageExtra(storage_code) { export function queryStorageExtra(storage_code) {
return request({ return request({
url: 'api/device/queryStorageExtra/' + storage_code, url: 'api/device/queryStorageExtra/' + storage_code,
method: 'get' method: 'get'
}) })
} }
export function reload() { export function reload() {
return request({ return request({
url: 'api/device/reload', url: 'api/device/reload',
method: 'get' method: 'get'
}) })
} }
export function cleans1(data) { export function cleans1(data) {
return request({ return request({
url: 'api/device/cleans1', url: 'api/device/cleans1',
method: 'post', method: 'post',
data data
}) })
} }
export function cleans2(data) { export function cleans2(data) {
return request({ return request({
url: 'api/device/cleans2', url: 'api/device/cleans2',
method: 'post', method: 'post',
data data
}) })
} }
export function enterSite1(data) { export function enterSite1(data) {
return request({ return request({
url: 'api/device/enterSite1', url: 'api/device/enterSite1',
method: 'post', method: 'post',
data data
}) })
} }
export function enterSite2(data) { export function enterSite2(data) {
return request({ return request({
url: 'api/device/enterSite2', url: 'api/device/enterSite2',
method: 'post', method: 'post',
data data
}) })
} }
export function cleans3(data) { export function cleans3(data) {
return request({ return request({
url: 'api/device/cleans3', url: 'api/device/cleans3',
method: 'post', method: 'post',
data data
}) })
} }
export function selectAGVList() { export function selectAGVList() {
return request({ return request({
url: 'api/device/selectAGVList', url: 'api/device/selectAGVList',
method: 'get' method: 'get'
}) })
} }
export function agvTaskType(data) { export function agvTaskType(data) {
return request({ return request({
url: 'api/device/agvTaskType', url: 'api/device/agvTaskType',
method: 'post', method: 'post',
data data
}) })
} }
export default { add, edit, del, selectDeviceList, selectDeviceListByRegion, callAgv, responseAgv, selectDeviceDevicerInfo, autoCreateTask, export function excelImport(data) {
changeDeviceStatus, cleanTask, queryStorageExtra, selectConDeviceList, saveBarcode, selectDeviceListOne, selectDeviceListTwo, selectDeviceListThree, return request({
addMaterial, cleanMaterial, changeFenceStatus,reload, cleans1, cleans2, enterSite1, enterSite2, cleans3, selectAGVList, agvTaskType} 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-option v-for="item in device_types" :key="item.id" :label="item.label" :value="item.value" />
</el-select> </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 /> <rrOperation />
</div> </div>
<crudOperation :permission="permission"> <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 <el-button
slot="right" slot="right"
class="filter-item" class="filter-item"
@ -40,7 +82,6 @@
同步 同步
</el-button> </el-button>
</crudOperation> </crudOperation>
<!--表单组件--> <!--表单组件-->
<el-dialog <el-dialog
:close-on-click-modal="false" :close-on-click-modal="false"
@ -70,7 +111,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属区域" prop="region"> <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 <el-option
v-for="item in regions" v-for="item in regions"
:key="item.id" :key="item.id"
@ -79,6 +120,16 @@
/> />
</el-select> </el-select>
</el-form-item> </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-form-item label="顺序号" prop="seq_num">
<el-input-number v-model="form.seq_num" value="1" :min="1" label="描述文字" /> <el-input-number v-model="form.seq_num" value="1" :min="1" label="描述文字" />
</el-form-item> </el-form-item>
@ -109,21 +160,21 @@
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="device_id" label="设备标识" /> <el-table-column v-if="false" prop="device_id" label="设备标识" />
<el-table-column sortable prop="device_code" label="设备编码" /> <el-table-column sortable prop="device_code" label="设备编码" />
<af-table-column sortable label="设备名字"> <el-table-column sortable label="设备名字">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.device_name }}</div> <div>{{ scope.row.device_name }}</div>
</template> </template>
</af-table-column> </el-table-column>
<af-table-column label="设备类型"> <el-table-column label="设备类型">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.device_type_name }}</div> <div>{{ scope.row.device_type_name }}</div>
</template> </template>
</af-table-column> </el-table-column>
<af-table-column label="所属区域"> <el-table-column label="所属区域">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.region_name }}</div> <div>{{ scope.row.region_name }}</div>
</template> </template>
</af-table-column> </el-table-column>
<el-table-column sortable prop="seq_num" label="顺序号" /> <el-table-column sortable prop="seq_num" label="顺序号" />
<el-table-column prop="is_config" label="是否配置" width="75px"> <el-table-column prop="is_config" label="是否配置" width="75px">
<template slot-scope="scope"> <template slot-scope="scope">
@ -134,27 +185,25 @@
<!-- <el-table-column prop="manufacturer" label="生产厂家" />--> <!-- <el-table-column prop="manufacturer" label="生产厂家" />-->
<!-- <el-table-column prop="manufacturer_phone" label="厂家电话" />--> <!-- <el-table-column prop="manufacturer_phone" label="厂家电话" />-->
<el-table-column prop="remark" label="备注" /> <el-table-column prop="remark" label="备注" />
<el-table-column label="操作" width="150px" align="center"> <el-table-column v-permission="['admin','device:edit','device:del']" label="操作" width="200px" 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">
<template slot-scope="scope"> <template slot-scope="scope">
<udOperation <udOperation
style="display: inline"
:data="scope.row" :data="scope.row"
:permission="permission" :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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!--分页组件--> <!--分页组件-->
<pagination /> <pagination />
</div> </div>
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="tableChanged3" />
</div> </div>
</template> </template>
@ -166,7 +215,9 @@ import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation' import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
import { get } from '@/api/system/dictDetail' 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 = { const defaultForm = {
manufacturer: null, manufacturer: null,
@ -185,11 +236,12 @@ const defaultForm = {
device_type: null, device_type: null,
region: null, region: null,
is_config: null, is_config: null,
remark: null remark: null,
region: null
} }
export default { export default {
name: 'Device', name: 'Device',
components: { pagination, crudOperation, rrOperation, udOperation }, components: { pagination, crudOperation, rrOperation, udOperation, UploadDialog },
mixins: [presenter(), header(), form(defaultForm), crud()], mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() { cruds() {
return CRUD({ return CRUD({
@ -209,6 +261,10 @@ export default {
}, },
device_types: [], device_types: [],
regions: [], regions: [],
is_configs: [],
uploadShow: false,
device_code: '',
regions: [],
rules: { rules: {
device_code: [ device_code: [
{ required: true, message: '设备编码不能为空', trigger: 'blur' } { required: true, message: '设备编码不能为空', trigger: 'blur' }
@ -218,8 +274,10 @@ export default {
], ],
device_type: [ device_type: [
{ required: true, message: '设备类型不能为空', trigger: 'blur' } { required: true, message: '设备类型不能为空', trigger: 'blur' }
],
region: [
{ required: true, message: '所属区域不能为空', trigger: 'blur' }
] ]
} }
} }
}, },
@ -230,9 +288,13 @@ export default {
this.device_types = data.content this.device_types = data.content
}) })
// //
get('region_type').then(data => { get('region').then(data => {
this.regions = data.content this.regions = data.content
}) })
//
get('is_config').then(data => {
this.is_configs = data.content
})
}) })
}, },
methods: { methods: {
@ -240,12 +302,25 @@ export default {
[CRUD.HOOK.beforeRefresh]() { [CRUD.HOOK.beforeRefresh]() {
return true return true
}, },
tableChanged3() {
this.crud.toQuery()
},
reload() { reload() {
crudDevice.reload().then(res => { crudDevice.reload().then(res => {
this.crud.toQuery() this.crud.toQuery()
}).catch(err => { }).catch(err => {
console.log(err.response.data.message) 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