This commit is contained in:
USER-20220102CG\noblelift
2023-08-23 09:02:28 +08:00
parent fbb899629c
commit 758423c75a
2622 changed files with 512 additions and 132338 deletions

View File

@@ -489,8 +489,10 @@
<includes>
<include>**/*.*</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>

View File

@@ -29,7 +29,7 @@ public interface ZheDaAgvService {
HttpResponse queryZDAgvDeviceStatus();
String process(String jobno, String type, String address, String action, String processingVehicle,String feedbackStatus);
String process(String jobno, String type, String address, String action, String processingVehicle);
public HttpResponse markComplete(String code);

View File

@@ -27,6 +27,7 @@ import org.nl.acs.opc.DeviceType;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.Arrays;

View File

@@ -19,6 +19,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@@ -28,12 +29,14 @@ import java.util.Map;
@Service
@RequiredArgsConstructor
public class NDCAgvServiceImpl implements NDCAgvService {
private final DeviceAppService deviceAppService;
private final ParamService paramService;
private final AcsToWmsService acsToWmsService;
private final DeviceExecuteLogService logServer;
@Autowired
private DeviceAppService deviceAppService;
@Autowired
private ParamService paramService;
@Autowired
private AcsToWmsService acsToWmsService;
@Autowired
private DeviceExecuteLogService logServer;
Map<String, AgvDto> AGVDeviceStatus = new HashMap();

View File

@@ -21,6 +21,7 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceType;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@@ -32,9 +33,12 @@ import java.util.Map;
@Service
@RequiredArgsConstructor
public class XianGongAgvServiceImpl implements XianGongAgvService {
private final DeviceAppService deviceAppService;
private final ParamService paramService;
private final AcsToWmsService acsToWmsService;
@Autowired
private DeviceAppService deviceAppService;
@Autowired
private ParamService paramService;
@Autowired
private AcsToWmsService acsToWmsService;
Map<String, AgvDto> AGVDeviceStatus = new HashMap();
@LokiLog(type = LokiLogType.AGV)

View File

@@ -1,5 +1,6 @@
package org.nl.acs.agv.server.impl;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
@@ -18,6 +19,7 @@ import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDev
import org.nl.acs.device_driver.basedriver.lubei_conveyor.LubeiConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.paint_conveyor.PaintConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.AcsToWmsZDService;
import org.nl.acs.instruction.service.InstructionService;
@@ -49,6 +51,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
private final ParamService paramService;
@LokiLog(type = LokiLogType.AGV)
@Override
@SaIgnore
public HttpResponse sendAgvInstToAgv(Instruction inst) throws Exception {
JSONObject jo = new JSONObject();
String start_point_code = inst.getStart_point_code();
@@ -68,15 +71,18 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("task_code", inst.getInstruction_code());
//根据任务下发指令类型
JSONArray destinations = new JSONArray();
if (task_type.equals("3")) {
destinations.add(destination(start_point_code, "Wait", "5", "1"));
} else if (task_type.equals("4")) {
destinations.add(destination(start_point_code, "Load", "1", "1"));
destinations.add(destination(next_point_code, "Wait", "5", "1"));
} else {
// if (task_type.equals("3")) {
// destinations.add(destination(start_point_code, "Wait", "5", "1"));
// } else if (task_type.equals("4")) {
// destinations.add(destination(start_point_code, "Load", "1", "1"));
// destinations.add(destination(next_point_code, "Wait", "5", "1"));
// } else {
// destinations.add(destination(start_point_code, "Load", "1", "1"));
// destinations.add(destination(next_point_code, "Unload", "1", "1"));
// }
destinations.add(destination(start_point_code, "Load", "1", "1"));
destinations.add(destination(next_point_code, "Unload", "1", "1"));
}
jo.put("destinations", destinations);
@@ -86,13 +92,14 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
String agvport2 = paramService.findByCode(AcsConfig.AGVPORT2).getValue();
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code();
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + inst.getInstruction_code();
log.info("下发agv任务请求:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl)
.body(String.valueOf(jo))//表单内容
.timeout(20000)//超时毫秒
.execute();
log.info("下发agv任务请求内容:{}", jo);
log.info("下发agv任务请求反馈:{}", result);
return result;
} else {
@@ -107,11 +114,13 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/v1/vehicles";
HttpResponse result = HttpRequest.get(agvurl)
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/query";
HttpResponse result = HttpRequest.post(agvurl)
.body("{}")
.timeout(20000)//超时毫秒
.execute();
System.out.println("查询agv指令数据:" + result.body());
log.info("查询agv指令数据:{}", result.body());
return result;
} else {
@@ -138,10 +147,10 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
@LokiLog(type = LokiLogType.AGV)
@Override
public synchronized String process(String jobno, String type, String address, String action, String processingVehicle,String feedbackStatus)
public synchronized String process(String jobno, String type, String address, String action, String processingVehicle)
{
{
log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action+",feedbackStatus:"+feedbackStatus);
log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action);
//释放AGV资源继续后续动作
boolean is_feedback = false;
String str = "";
@@ -177,7 +186,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus",feedbackStatus);
jo.put("feedbackStatus","applyTake");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
@@ -194,7 +204,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus",feedbackStatus);
jo.put("feedbackStatus","applyTake");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
@@ -203,6 +214,22 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
log.info("请求ZDwcs成功申请取货 请求结果{}",responseCode);
}
}
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
JSONObject jo = new JSONObject();
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus","applyTake");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
if(responseCode == 0) {
is_feedback = true;
log.info("请求ZDwcs成功申请取货 请求结果{}",responseCode);
}
}
}
if ("PauseOnStation".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof LubeiConveyorDeviceDriver) {
@@ -212,14 +239,21 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus",feedbackStatus);
jo.put("feedbackStatus","takeFinish");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
if(responseCode == 0) {
is_feedback = true;
log.info("请求ZDwcs成功取货完成 请求结果{}",responseCode);
}
lubeiConveyorDeviceDriver.writing(2);
if(lubeiConveyorDeviceDriver.getTo_command() == 2){
is_feedback = true;
} else {
lubeiConveyorDeviceDriver.writing(2);
}
} else {
log.info("设备{} 请求离开,光电信号:{}",addressdevice,lubeiConveyorDeviceDriver.getMove());
}
@@ -229,7 +263,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus",feedbackStatus);
jo.put("feedbackStatus","takeFinish");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
@@ -238,6 +273,21 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
log.info("请求ZDwcs成功取货完成 请求结果{}",responseCode);
}
}
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
JSONObject jo = new JSONObject();
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus","takeFinish");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
if(responseCode == 0) {
is_feedback = true;
log.info("请求ZDwcs成功申请取货 请求结果{}",responseCode);
}
}
}
}
@@ -251,7 +301,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus",feedbackStatus);
jo.put("feedbackStatus","applyPut");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
@@ -268,7 +319,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus",feedbackStatus);
jo.put("feedbackStatus","applyPut");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
@@ -277,6 +329,21 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
log.info("请求ZDwcs成功开始放货 请求结果{}",responseCode);
}
}
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
JSONObject jo = new JSONObject();
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus","applyPut");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
if(responseCode == 0) {
is_feedback = true;
log.info("请求ZDwcs成功申请取货 请求结果{}",responseCode);
}
}
}
if ("PauseOnStation".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof LubeiConveyorDeviceDriver) {
@@ -286,14 +353,20 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus",feedbackStatus);
jo.put("feedbackStatus","putFinish");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
if(responseCode == 0) {
is_feedback = true;
log.info("请求ZDwcs成功放货完成 请求结果{}",responseCode);
}
lubeiConveyorDeviceDriver.writing(3);
if(lubeiConveyorDeviceDriver.getTo_command() == 3){
is_feedback = true;
} else {
lubeiConveyorDeviceDriver.writing(3);
}
} else {
log.info("设备{} 请求离开,光电信号:{}",addressdevice,lubeiConveyorDeviceDriver.getMove());
}
@@ -303,7 +376,8 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus",feedbackStatus);
jo.put("feedbackStatus","putFinish");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
@@ -312,6 +386,21 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
log.info("请求ZDwcs成功放货完成 请求结果{}",responseCode);
}
}
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
JSONObject jo = new JSONObject();
jo.put("taskCode",task.getTask_code());
jo.put("carId",processingVehicle);
jo.put("taskType ",type);
jo.put("feedbackStatus","putFinish");
log.info("请求参数:{}",jo);
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
JSONObject response=JSONObject.parseObject(result.body());
int responseCode= response.getInteger("responseCode");
if(responseCode == 0) {
is_feedback = true;
log.info("请求ZDwcs成功申请取货 请求结果{}",responseCode);
}
}
}
}
com.alibaba.fastjson.JSONObject requestjo = new com.alibaba.fastjson.JSONObject();
@@ -330,7 +419,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
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)
@@ -394,11 +483,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
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);
//进入等待 离开不等待
@@ -406,11 +495,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
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", "False");
pro2.put("value", "false");
properties.add(pro2);
destinationOrder.put("properties", properties);
//进入不等待 离开等待
@@ -418,11 +507,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired");
pro1.put("value", "False");
pro1.put("value", "false");
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);
//不等待
@@ -430,11 +519,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "EntryRequired");
pro1.put("value", "False");
pro1.put("value", "false");
properties.add(pro1);
JSONObject pro2 = new JSONObject();
pro2.put("key", "PauseOnStation");
pro2.put("value", "False");
pro2.put("value", "false");
properties.add(pro2);
destinationOrder.put("properties", properties);
}
@@ -472,7 +561,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
JSONArray properties = new JSONArray();
JSONObject pro1 = new JSONObject();
pro1.put("key", "Wait");
pro1.put("value", "True");
pro1.put("value", "true");
properties.add(pro1);
destinationOrder.put("properties", properties);
}

Some files were not shown because too many files have changed in this diff Show More