Browse Source

更新

master
gengby 2 years ago
parent
commit
a2920e0b49
  1. 0
      hd/logPath_IS_UNDEFINED/2022-08-22.0.log
  2. 0
      hd/logPath_IS_UNDEFINED/ACS请求ERP/2022-08-22.0.log
  3. 0
      hd/logPath_IS_UNDEFINED/ACS请求WMS/2022-08-22.0.log
  4. 0
      hd/logPath_IS_UNDEFINED/AGV请求离开/2022-08-22.0.log
  5. 0
      hd/logPath_IS_UNDEFINED/NDC/2022-08-22.0.log
  6. 0
      hd/logPath_IS_UNDEFINED/WMS下发ACS/2022-08-22.0.log
  7. 2080
      hd/logPath_IS_UNDEFINED/反馈AGV请求/2022-08-22.0.log
  8. 0
      hd/logPath_IS_UNDEFINED/扫码记录/2022-08-22.0.log
  9. 0
      hd/logPath_IS_UNDEFINED/查询AGV指令状态/2022-08-22.0.log
  10. 0
      hd/logPath_IS_UNDEFINED/查询仙知AGV指令状态/2022-08-22.0.log
  11. 0
      hd/logPath_IS_UNDEFINED/自动创建指令/2022-08-22.0.log
  12. 25
      hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java
  13. 2
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java
  14. 6
      hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AgvToAcsController.java
  15. 160
      hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AgvToAcsServiceImpl.java
  16. 2
      hd/nladmin-system/src/main/resources/config/application-dev.yml

0
hd/logPath_IS_UNDEFINED/2022-08-22.0.log

0
hd/logPath_IS_UNDEFINED/ACS请求ERP/2022-08-22.0.log

0
hd/logPath_IS_UNDEFINED/ACS请求WMS/2022-08-22.0.log

0
hd/logPath_IS_UNDEFINED/AGV请求离开/2022-08-22.0.log

0
hd/logPath_IS_UNDEFINED/NDC/2022-08-22.0.log

0
hd/logPath_IS_UNDEFINED/WMS下发ACS/2022-08-22.0.log

2080
hd/logPath_IS_UNDEFINED/反馈AGV请求/2022-08-22.0.log

File diff suppressed because it is too large

0
hd/logPath_IS_UNDEFINED/扫码记录/2022-08-22.0.log

0
hd/logPath_IS_UNDEFINED/查询AGV指令状态/2022-08-22.0.log

0
hd/logPath_IS_UNDEFINED/查询仙知AGV指令状态/2022-08-22.0.log

0
hd/logPath_IS_UNDEFINED/自动创建指令/2022-08-22.0.log

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

@ -1,5 +1,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;
@ -1573,9 +1574,11 @@ public class AgvServiceImpl implements AgvService {
public JSONArray createBlocksData(Instruction inst) {
JSONArray ja = new JSONArray();
JSONObject jo = new JSONObject();
jo.put("blockId", IdUtil.simpleUUID());
jo.put("location",inst.getStart_point_code() + "IN");
jo.put("operation","script");
jo.put("id",inst.getStart_point_code() + "IN");
jo.put("script_name","interact.py");
jo.put("script_name","userpy/interact.py");
JSONObject script_args = new JSONObject();
script_args.put("addr",addr);
JSONObject data = new JSONObject();
@ -1589,15 +1592,17 @@ public class AgvServiceImpl implements AgvService {
ja.add(jo);
JSONObject jo1 = new JSONObject();
jo1.put("blockId",String.valueOf(ja.size()+1));
jo1.put("blockId", IdUtil.simpleUUID());
jo1.put("location",inst.getStart_point_code());
jo1.put("operation","Jackload");
ja.add(jo1);
JSONObject jo2 = new JSONObject();
jo2.put("blockId", IdUtil.simpleUUID());
jo2.put("location",inst.getStart_point_code() + "OUT");
jo2.put("operation","script");
jo2.put("id",inst.getStart_point_code() + "OUT");
jo2.put("script_name","interact.py");
jo2.put("script_name","userpy/interact.py");
JSONObject script_args2 = new JSONObject();
script_args2.put("addr",addr);
JSONObject data2 = new JSONObject();
@ -1611,9 +1616,11 @@ public class AgvServiceImpl implements AgvService {
ja.add(jo2);
JSONObject jo3 = new JSONObject();
jo3.put("blockId", IdUtil.simpleUUID());
jo3.put("location",inst.getNext_point_code() + "IN");
jo3.put("operation","script");
jo3.put("id",inst.getNext_point_code() + "IN");
jo3.put("script_name","interact.py");
jo3.put("script_name","userpy/interact.py");
JSONObject script_args3 = new JSONObject();
script_args3.put("addr",addr);
JSONObject data3 = new JSONObject();
@ -1626,20 +1633,22 @@ public class AgvServiceImpl implements AgvService {
jo3.put("script_args",script_args3);
ja.add(jo3);
JSONObject jo4 = new JSONObject();
jo4.put("blockId",String.valueOf(ja.size()+1));
jo4.put("blockId",IdUtil.simpleUUID());
jo4.put("location",inst.getNext_point_code());
jo4.put("operation","JackUnload");
ja.add(jo4);
JSONObject jo5 = new JSONObject();
jo5.put("blockId", IdUtil.simpleUUID());
jo5.put("location",inst.getNext_point_code() + "OUT");
jo5.put("operation","script");
jo5.put("id",inst.getStart_point_code() + "OUT");
jo5.put("script_name","interact.py");
jo5.put("id",inst.getNext_point_code() + "OUT");
jo5.put("script_name","userpy/interact.py");
JSONObject script_args5 = new JSONObject();
script_args5.put("addr",addr);
JSONObject data5 = new JSONObject();
JSONObject reach5 = new JSONObject();
reach5.put("task_code",inst.getInstruction_code());
reach5.put("address",inst.getStart_point_code() + "OUT");
reach5.put("address",inst.getNext_point_code() + "OUT");
data5.put("reach",reach5);
script_args5.put("data",data5);
script_args5.put("protocol","HTTP");

2
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java

@ -120,6 +120,8 @@ public class AbstractOpcDeviceDriver<T> extends AbstractDeviceDriver implements
}
//sonDriverClass.getMethod(methodName).invoke(sonDriver);
}
}
//赋值last_属性
Field[] declaredFields = sonDriverClass.getDeclaredFields();

6
hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AgvToAcsController.java

@ -12,10 +12,7 @@ import org.nl.acs.ext.wms.service.WmsToAcsService;
import org.nl.annotation.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@ -27,6 +24,7 @@ import java.util.Map;
@Api(tags = "wms接口")
@RequestMapping("api/agv")
@Slf4j
@CrossOrigin
public class AgvToAcsController {
private final AgvToAcsService agvToAcsService;

160
hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AgvToAcsServiceImpl.java

@ -5,7 +5,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.nl.acs.device_driver.standard_conveyor_line.StandardConveyorLineDeviceDriver;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.ext.wms.service.AgvToAcsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
@ -13,6 +12,7 @@ import org.nl.acs.log.service.LogServer;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.exception.BadRequestException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -39,17 +39,18 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
String address = param.getString("address");
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
Instruction instructionDto = instructionService.findByCode(inst_code);
String task_code = instructionDto.getTask_code();
Map<String, Object> map = new HashMap<>();
Map<String, Object> feedMap = new HashMap();
feedMap.put("taskCode", task_code);
feedMap.put("taskType", instructionDto.getInstruction_type());
if (ObjectUtil.isEmpty(instructionDto)) {
map.put("status", 400);
map.put("message", "请求失败,指令为空!");
logServer.log(task_code, "waitpointRequest", "erro", param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
return map;
logServer.log("", "waitpointRequest", "erro", param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", "");
// return map;
throw new BadRequestException("请求失败,指令为空!");
}
String task_code = instructionDto.getTask_code();
Map<String, Object> feedMap = new HashMap();
feedMap.put("taskCode", task_code);
feedMap.put("taskType", instructionDto.getInstruction_type());
String type = "";
String start_device_code = instructionDto.getStart_device_code();
String next_device_code = instructionDto.getNext_device_code();
@ -60,28 +61,30 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) deviceNow.getDeviceDriver();
if (start_device_code.equals(deviceCodeNow)) {
if (standardConveyorLineDeviceDriver.getMove() == 1) {
// feedMap.put("feedbackStatus", "applyTake");
//Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
//int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
//String responseMessage = (String) feedback.get("responseMessage");
//if (responseCode == 0) {
// feedback.put("feedbackStatus","“taking");
// acsToWmsZDService.taskFeedback(feedMap);
map.put("status", 200);
map.put("message", "请求成功");
type = "info";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
//} else {
// map.put("status", 400);
// map.put("message", "操作失败");
// type = "erro";
// logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
//}
feedMap.put("feedbackStatus", "applyTake");
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
String responseMessage = (String) feedback.get("responseMessage");
if (responseCode == 0) {
feedback.put("feedbackStatus", "“taking");
acsToWmsZDService.taskFeedback(feedMap);
map.put("status", 200);
map.put("message", "请求成功");
type = "info";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
} else {
map.put("status", 400);
map.put("message", "操作失败");
type = "erro";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
throw new BadRequestException("请求失败!");
}
} else {
map.put("status", 400);
map.put("message", "请求失败,起点位置无货!");
type = "erro";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
throw new BadRequestException("请求失败,起点位置无货!");
}
} else if (deviceCodeNow.equals(next_device_code)) {
if (standardConveyorLineDeviceDriver.getMove() != 0) {
@ -89,26 +92,26 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
map.put("message", "请求失败,终点位置有货!");
type = "erro";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
throw new BadRequestException("请求失败,终点位置有货!");
} else {
//feedMap.put("feedbackStatus", "applyPut");
//Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
// int responseCode = Integer.parseInt((String) feedback.get("responseCode")) ;
// String responseMessage = (String) feedback.get("responseMessage");
// if (responseCode == 0) {
//feedback.put("feedbackStatus","puting");
//acsToWmsZDService.taskFeedback(feedMap);
map.put("status", 200);
map.put("message", "请求成功");
type = "info";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
// } else {
//logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", "");
// map.put("status", 400);
// map.put("message", "操作失败");
// type = "erro";
// }
//}
feedMap.put("feedbackStatus", "applyPut");
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
String responseMessage = (String) feedback.get("responseMessage");
if (responseCode == 0) {
feedback.put("feedbackStatus", "puting");
acsToWmsZDService.taskFeedback(feedMap);
map.put("status", 200);
map.put("message", "请求成功");
type = "info";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
} else {
logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", "");
map.put("status", 400);
map.put("message", "操作失败");
type = "erro";
throw new BadRequestException("请求失败!");
}
}
}
}
@ -121,27 +124,29 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) deviceNow.getDeviceDriver();
if (start_device_code.equals(deviceCodeNow)) {
if (standardConveyorLineDeviceDriver.getMove() == 0) {
//standardConveyorLineDeviceDriver.writing(1,2);
//feedMap.put("feedbackStatus", "takeFinish");
// Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
//int responseCode = (int) feedback.get("responseCode");
// String responseMessage = (String) feedback.get("responseMessage");
// if (responseCode == 0) {
map.put("status", 200);
map.put("message", "请求成功");
type = "info";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
// } else {
// logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", "");
// map.put("status", 400);
// map.put("message", "操作失败");
// type = "erro";
// }
standardConveyorLineDeviceDriver.writing(1, 2);
feedMap.put("feedbackStatus", "takeFinish");
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
int responseCode = (int) feedback.get("responseCode");
String responseMessage = (String) feedback.get("responseMessage");
if (responseCode == 0) {
map.put("status", 200);
map.put("message", "请求成功");
type = "info";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
} else {
map.put("status", 400);
map.put("message", "操作失败");
type = "erro";
logServer.log(task_code, "waitpointRequest", type, param.toString(), feedback.toString(), responseCode + "", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
throw new BadRequestException("请求失败!");
}
} else {
map.put("status", 400);
map.put("message", "请求失败,起点位置有货!");
type = "erro";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
throw new BadRequestException("请求失败,起点位置有货!");
}
} else if (next_device_code.equals(deviceCodeNow)) {
if (standardConveyorLineDeviceDriver.getMove() == 0) {
@ -149,23 +154,25 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
map.put("message", "请求失败,终点位置无货!");
type = "erro";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
throw new BadRequestException("请求失败,终点位置无货!");
} else {
// standardConveyorLineDeviceDriver.writing(1,2);
// feedMap.put("feedbackStatus", "putFinish");
// Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
// int responseCode = (int) feedback.get("responseCode");
// String responseMessage = (String) feedback.get("responseMessage");
// if (responseCode == 0) {
map.put("status", 200);
map.put("message", "请求成功");
type = "info";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
// } else{
// map.put("status", 400);
// map.put("message", "操作失败");
// type = "erro";
// logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
// }
standardConveyorLineDeviceDriver.writing(1, 2);
feedMap.put("feedbackStatus", "putFinish");
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
int responseCode = (int) feedback.get("responseCode");
String responseMessage = (String) feedback.get("responseMessage");
if (responseCode == 0) {
map.put("status", 200);
map.put("message", "请求成功");
type = "info";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
} else {
map.put("status", 400);
map.put("message", "操作失败");
type = "erro";
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
throw new BadRequestException("请求失败");
}
}
}
}
@ -174,6 +181,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
map.put("status", 400);
map.put("message", "请求失败,IN OUT 站点错误!");
logServer.log(task_code, "waitpointRequest", "erro", param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
return map;
throw new BadRequestException("请求失败,终点位置无货!");
//return map;
}
}

2
hd/nladmin-system/src/main/resources/config/application-dev.yml

@ -135,6 +135,6 @@ file:
avatarMaxSize: 5
agvToAcs:
addr: http://127.0.0.1:8010/api/agv/waitpointRequest
addr: http://127.0.0.1:8010

Loading…
Cancel
Save