rev 更新

This commit is contained in:
周俊杰
2024-10-31 15:21:01 +08:00
parent 97165bc085
commit 5d29bf7041
19 changed files with 739 additions and 364 deletions

View File

@@ -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)

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}
}

View File

@@ -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() {

View File

@@ -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;
}

View File

@@ -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() {

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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();

View File

@@ -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,104 +105,209 @@ 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);
for (int i = 0; i < acs_deviceja.size(); i++) {
JSONObject devicejo = acs_deviceja.getJSONObject(i);
String device_code = devicejo.optString("device_code");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device device = appService.findDeviceByCode(device_code);
//无光电普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//货架
StandardStorageDeviceDriver standardStorageDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals(device.getIslock(), "true")) {
status = "3";
move = "有任务";
} else {
if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) {
status = "0";
move = "无货";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) {
status = "1";
move = "有托盘";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) {
status = "2";
move = "有托盘有货";
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");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device device = appService.findDeviceByCode(device_code);
//无光电普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//货架
StandardStorageDeviceDriver standardStorageDeviceDriver;
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals(device.getIslock(), "true")) {
status = "3";
move = "有任务";
} else {
if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) {
status = "0";
move = "无货";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) {
status = "1";
move = "有托盘";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) {
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 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);
// 特殊驱动
}
material = device.getMaterial_type();
//material = standardOrdinarySiteDeviceDriver.getMaterial();
if (StrUtil.isNullOrUndefined(material)) {
material = "";
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);
// 特殊驱动
}
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);
// 特殊驱动
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);
// }
// }
// }
}
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);
// 特殊驱动
}
resultArr.add(jo);
}
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", resultArr);
return resultJson;
}
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", resultArr);
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,17 +361,42 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
return resultJson;
}
//判断起点有货,终点为空
if (ObjectUtil.isEmpty(startDevice.getMaterial_type()) || Integer.parseInt(startDevice.getMaterial_type()) == 0) {
resultJson.put("code", "0");
resultJson.put("desc", "起点必须有货");
resultJson.put("result", "");
return resultJson;
// 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")) {
resultJson.put("code", "0");
resultJson.put("desc", "终点必须为空");
resultJson.put("result", "");
return resultJson;
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;
}
}
//判断有无这个任务

View File

@@ -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")){

View File

@@ -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);

View File

@@ -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;
}

View File

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