rev:更新
This commit is contained in:
@@ -3,8 +3,6 @@ package org.nl.acs.agv.server.impl;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -14,6 +12,7 @@ import org.nl.acs.agv.server.AgvWaitUtil;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.ext.UnifiedResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.xg.XgHttpUtil;
|
||||
@@ -90,7 +89,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
|
||||
@Override
|
||||
public <T> UnifiedResponse<T> queryXZAgvDeviceStatus(String vehicles, Class<T> type) {
|
||||
String path = "/robotsStatus" + vehicles == null ? "" : "?vehicles = " + vehicles;
|
||||
String path = "/robotsStatus" + (vehicles == null ? "" : "?vehicles = " + vehicles);
|
||||
return xgHttpUtil.sendGetRequest(path, type);
|
||||
}
|
||||
|
||||
@@ -585,10 +584,10 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
JSONObject block = new JSONObject();
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getStart_point_code());
|
||||
block.put("operation", "JackLoad");
|
||||
block.put("operationArgs", new JSONObject() {{
|
||||
put("recognize", true);
|
||||
}});
|
||||
block.put("binTask", "ForkLoad");
|
||||
// block.put("operationArgs", new JSONObject() {{
|
||||
// put("recognize", true);
|
||||
// }});
|
||||
blocks.add(block);
|
||||
|
||||
if ("true".equals(device1.getExtraValue().get("ignore_pickup_check"))) {
|
||||
@@ -610,6 +609,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
scriptArgs.put("protocol", "HTTP");
|
||||
block.put("script_args", scriptArgs);
|
||||
blocks.add(block);
|
||||
} else {
|
||||
if (device1.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
block = new JSONObject();
|
||||
block.put("binTask", "ForkHeight");
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getStart_point_code() + "OUTGET");
|
||||
blocks.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
// 终点1
|
||||
@@ -638,7 +645,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
block = new JSONObject();
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getNext_point_code());
|
||||
block.put("operation", "JackUnload");
|
||||
block.put("binTask", "ForkUnload");
|
||||
blocks.add(block);
|
||||
|
||||
if ("true".equals(device2.getExtraValue().get("ignore_release_check"))) {
|
||||
@@ -660,6 +667,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
scriptArgs.put("protocol", "HTTP");
|
||||
block.put("script_args", scriptArgs);
|
||||
blocks.add(block);
|
||||
} else {
|
||||
if (device2.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
block = new JSONObject();
|
||||
block.put("binTask", "ForkHeight");
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getNext_point_code() + "OUTPUT");
|
||||
blocks.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
// 起点2
|
||||
@@ -689,10 +704,10 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
block = new JSONObject();
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getStart_point_code2());
|
||||
block.put("operation", "JackLoad");
|
||||
block.put("operationArgs", new JSONObject() {{
|
||||
put("recognize", true);
|
||||
}});
|
||||
block.put("binTask", "ForkLoad");
|
||||
// block.put("operationArgs", new JSONObject() {{
|
||||
// put("recognize", true);
|
||||
// }});
|
||||
blocks.add(block);
|
||||
|
||||
if ("true".equals(device3.getExtraValue().get("ignore_pickup_check"))) {
|
||||
@@ -714,6 +729,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
scriptArgs.put("protocol", "HTTP");
|
||||
block.put("script_args", scriptArgs);
|
||||
blocks.add(block);
|
||||
} else {
|
||||
if (device3.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
block = new JSONObject();
|
||||
block.put("binTask", "ForkHeight");
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getStart_point_code2() + "OUTGET");
|
||||
blocks.add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -744,7 +767,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
block = new JSONObject();
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getNext_point_code2());
|
||||
block.put("operation", "JackUnload");
|
||||
block.put("binTask", "ForkUnload");
|
||||
blocks.add(block);
|
||||
|
||||
if ("true".equals(device4.getExtraValue().get("ignore_release_check"))) {
|
||||
@@ -766,6 +789,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
scriptArgs.put("protocol", "HTTP");
|
||||
block.put("script_args", scriptArgs);
|
||||
blocks.add(block);
|
||||
} else {
|
||||
if (device4.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
block = new JSONObject();
|
||||
block.put("binTask", "ForkHeight");
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getNext_point_code2() + "OUTPUT");
|
||||
blocks.add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -930,16 +961,16 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
//忽略放货校验
|
||||
if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) {
|
||||
//放货完成等待
|
||||
com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject();
|
||||
JSONObject jo5 = new JSONObject();
|
||||
jo5.put("blockId", IdUtil.simpleUUID());
|
||||
jo5.put("location", inst.getNext_point_code() + "OUTPUT");
|
||||
jo5.put("operation", "script");
|
||||
jo5.put("id", inst.getNext_point_code() + "OUTPUT");
|
||||
jo5.put("script_name", "userpy/interact.py");
|
||||
com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject();
|
||||
JSONObject script_args5 = new JSONObject();
|
||||
// script_args5.put("addr", addr);
|
||||
com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject();
|
||||
com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject();
|
||||
JSONObject data5 = new JSONObject();
|
||||
JSONObject reach5 = new JSONObject();
|
||||
reach5.put("task_code", inst.getInstruction_code());
|
||||
reach5.put("address", inst.getNext_point_code() + "OUTPUT");
|
||||
data5.put("reach", reach5);
|
||||
|
||||
@@ -97,6 +97,8 @@ public class XianGongAgvDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
*/
|
||||
private Integer monthTaskNum = 0;
|
||||
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
@@ -129,6 +131,7 @@ public class XianGongAgvDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
//jo.put("status_name", this.statusName);
|
||||
jo.put("todayTaskNum", this.todayTaskNum);
|
||||
jo.put("monthTaskNum", this.monthTaskNum);
|
||||
jo.put("message", this.message == null ? "运行正常" : "运行异常");
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* @author zhangjiangwei
|
||||
@@ -176,14 +177,15 @@ public class RGVDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
jo.put("error", this.error);
|
||||
jo.put("battery_level", (this.energyLevel * 100) + "%");
|
||||
jo.put("task_code", this.taskCode);
|
||||
jo.put("startDeviceCode", this.startDeviceCode);
|
||||
jo.put("nextDeviceCode", this.nextDeviceCode);
|
||||
jo.put("current_loc", ObjectUtils.isEmpty(this.startDeviceCode) ? "0" : this.startDeviceCode);
|
||||
jo.put("target_loc", ObjectUtils.isEmpty(this.nextDeviceCode) ? "0" : this.nextDeviceCode);
|
||||
jo.put("vehicleCode", this.vehicleCode);
|
||||
jo.put("x", this.x);
|
||||
jo.put("y", this.y);
|
||||
jo.put("action", this.action);
|
||||
jo.put("todayTaskNum", this.todayTaskNum);
|
||||
jo.put("allTaskNum", this.allTaskNum);
|
||||
jo.put("message", this.message == null ? "运行正常" : "运行异常");
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,10 +47,22 @@ public class WmsToAcsController {
|
||||
return new ResponseEntity<>(wmstoacsService.cancelFromWms(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/获取AGV和RGV数据")
|
||||
@PostMapping("/agvInfo")
|
||||
@OthersToInterfaceLog("LMS->ACS")
|
||||
public ResponseEntity<Object> getAGVAndRGVInfo() {
|
||||
return new ResponseEntity<>(wmstoacsService.getAGVAndRGVInfo(), HttpStatus.OK);
|
||||
public ResponseEntity<Object> agvInfo(@RequestBody JSONObject req) {
|
||||
return new ResponseEntity<>(wmstoacsService.agvInfo(req), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/rgvInfo")
|
||||
@OthersToInterfaceLog("LMS->ACS")
|
||||
public ResponseEntity<Object> rgvInfo(@RequestBody JSONObject req) {
|
||||
return new ResponseEntity<>(wmstoacsService.rgvInfo(req), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/todayTask")
|
||||
@OthersToInterfaceLog("LMS->ACS")
|
||||
public ResponseEntity<Object> todayTask(@RequestBody JSONObject req) {
|
||||
return new ResponseEntity<>(wmstoacsService.todayTask(req), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/test")
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.nl.acs.ext.wms.service;
|
||||
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -24,5 +23,9 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
Map<String, Object> cancelFromWms(String jsonObject) throws Exception;
|
||||
|
||||
JSONObject getAGVAndRGVInfo();
|
||||
JSONObject agvInfo(JSONObject req);
|
||||
|
||||
JSONObject rgvInfo(JSONObject req);
|
||||
|
||||
JSONObject todayTask(JSONObject req);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.AgvUtil;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.wmsToAcsData.createTask.CreateTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.wmsToAcsData.createTask.CreateTaskResponse;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
@@ -30,6 +29,7 @@ import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.quartz.task.DeviceStatusMonitor;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.exception.WDKException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -38,6 +38,7 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -313,26 +314,49 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public JSONObject getAGVAndRGVInfo() {
|
||||
public JSONObject agvInfo(JSONObject req) {
|
||||
JSONObject resp = new JSONObject();
|
||||
List<Device> agvs = deviceAppService.findDevice(DeviceType.agv);
|
||||
List<JSONObject> agvInfos = new ArrayList<>();
|
||||
for (Device agv : agvs) {
|
||||
if (agv != null && agv.getDeviceDriver() instanceof DeviceStatusMonitor) {
|
||||
if (agv != null && agv.getDeviceDriver() instanceof DeviceStageMonitor) {
|
||||
DeviceStageMonitor deviceStageMonitor = (DeviceStageMonitor) agv.getDeviceDriver();
|
||||
agvInfos.add(deviceStageMonitor.getDeviceStatusName());
|
||||
}
|
||||
}
|
||||
resp.put("agv", agvInfos);
|
||||
resp.put("status", 0);
|
||||
resp.put("message", "查询成功");
|
||||
resp.put("data", agvInfos);
|
||||
return resp;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public JSONObject rgvInfo(JSONObject req) {
|
||||
JSONObject resp = new JSONObject();
|
||||
List<Device> rgvs = deviceAppService.findDevice(DeviceType.rgv);
|
||||
List<JSONObject> rgvInfos = new ArrayList<>();
|
||||
for (Device rgv : rgvs) {
|
||||
if (rgv != null && rgv.getDeviceDriver() instanceof DeviceStatusMonitor) {
|
||||
if (rgv != null && rgv.getDeviceDriver() instanceof DeviceStageMonitor) {
|
||||
DeviceStageMonitor deviceStageMonitor = (DeviceStageMonitor) rgv.getDeviceDriver();
|
||||
rgvInfos.add(deviceStageMonitor.getDeviceStatusName());
|
||||
}
|
||||
}
|
||||
resp.put("rgv", rgvInfos);
|
||||
resp.put("status", 0);
|
||||
resp.put("message", "查询成功");
|
||||
resp.put("data", rgvInfos);
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject todayTask(JSONObject req) {
|
||||
JSONObject resp = new JSONObject();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
JSONArray data = WQL.getWO("EXT_QUERY001").addParamMap(map).process().getResultJSONArray(0);
|
||||
resp.put("status",0);
|
||||
resp.put("message","查询成功");
|
||||
resp.put("data",data);
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
[交易说明]
|
||||
交易名: WMS接口查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
inst.task_code,
|
||||
inst.start_point_code,
|
||||
inst.next_point_code,
|
||||
CASE
|
||||
WHEN inst.instruction_status = '0' THEN '就绪'
|
||||
WHEN inst.instruction_status = '1' THEN '执行中'
|
||||
WHEN inst.instruction_status = '2' THEN '完成'
|
||||
ELSE '未知状态'
|
||||
END AS task_status,
|
||||
inst.carno,
|
||||
inst.create_time
|
||||
FROM
|
||||
acs_instruction inst
|
||||
WHERE
|
||||
inst.`instruction_status` in ('0','1','2') and inst.task_code NOT LIKE '-%' and DATE(inst.create_time) = CURDATE()
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -1,28 +1,16 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.acs.ext.UnifiedResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 查询AGV任务状态
|
||||
@@ -41,6 +29,9 @@ public class QueryXGTaskStatus {
|
||||
try {
|
||||
List<Instruction> allInstFromCache = instructionService.findAllInstFromCache();
|
||||
for (Instruction instruction : allInstFromCache) {
|
||||
if (!instruction.getSend_status().equals("1")) {
|
||||
continue;
|
||||
}
|
||||
UnifiedResponse<JSONObject> resp = agvService.queryXZAgvInstStatusByCode(instruction.getInstruction_code(), JSONObject.class);
|
||||
if (resp.isSuccess()) {
|
||||
// 已创建=CREATED,
|
||||
|
||||
Reference in New Issue
Block a user