Browse Source

更新

master
gengby 2 years ago
parent
commit
2f09039803
  1. 2
      hd/nladmin-system/src/main/java/org/nl/AppRun.java
  2. 72
      hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java
  3. 6
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_line/StandardConveyorLineDeviceDriver.java
  4. 10
      hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AgvToAcsServiceImpl.java

2
hd/nladmin-system/src/main/java/org/nl/AppRun.java

@ -9,6 +9,7 @@ import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactor
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
@ServletComponentScan
@EnableTransactionManagement
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
@EnableAspectJAutoProxy(exposeProxy=true,proxyTargetClass=true)
public class AppRun {
public static void main(String[] args) {

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

@ -39,6 +39,7 @@ import org.nl.logger.BusinessLogger;
import org.nl.start.auto.run.NDCSocketConnectionAutoRun;
import org.nl.utils.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
@ -52,6 +53,9 @@ public class AgvServiceImpl implements AgvService {
protected BusinessLogger execute_log;
@Value("${agvToAcs.addr}")
private String addr;
@Autowired
DeviceAppService deviceAppService;
@Autowired
@ -1570,24 +1574,57 @@ public class AgvServiceImpl implements AgvService {
public JSONArray createBlocksData(Instruction inst) {
JSONArray ja = new JSONArray();
JSONObject jo = new JSONObject();
jo.put("blockId",String.valueOf(ja.size()+1));
jo.put("location",inst.getStart_point_code() + "IN");
jo.put("operation","Wait");
jo.put("operation","script");
jo.put("id",inst.getStart_point_code() + "IN");
jo.put("script_name","interact.py");
JSONObject script_args = new JSONObject();
script_args.put("addr",addr);
JSONObject data = new JSONObject();
JSONObject reach = new JSONObject();
reach.put("task_code",inst.getInstruction_code());
reach.put("address",inst.getStart_point_code() + "IN");
data.put("reach",reach);
script_args.put("data",data);
script_args.put("protocol","HTTP");
jo.put("script_args",script_args);
ja.add(jo);
JSONObject jo1 = new JSONObject();
jo1.put("blockId",String.valueOf(ja.size()+1));
jo1.put("location",inst.getStart_point_code());
jo1.put("operation","Jackload");
ja.add(jo1);
JSONObject jo2 = new JSONObject();
jo2.put("blockId",String.valueOf(ja.size()+1));
jo2.put("location",inst.getStart_point_code() + "OUT");
jo2.put("operation","Wait");
jo2.put("operation","script");
jo2.put("id",inst.getStart_point_code() + "OUT");
jo2.put("script_name","interact.py");
JSONObject script_args2 = new JSONObject();
script_args2.put("addr",addr);
JSONObject data2 = new JSONObject();
JSONObject reach2 = new JSONObject();
reach2.put("task_code",inst.getInstruction_code());
reach2.put("address",inst.getStart_point_code() + "OUT");
data2.put("reach",reach2);
script_args2.put("data",data2);
script_args2.put("protocol","HTTP");
jo2.put("script_args",script_args2);
ja.add(jo2);
JSONObject jo3 = new JSONObject();
jo3.put("blockId",String.valueOf(ja.size()+1));
jo3.put("location",inst.getNext_point_code() + "IN");
jo3.put("operation","Wait");
jo3.put("operation","script");
jo3.put("id",inst.getNext_point_code() + "IN");
jo3.put("script_name","interact.py");
JSONObject script_args3 = new JSONObject();
script_args3.put("addr",addr);
JSONObject data3 = new JSONObject();
JSONObject reach3 = new JSONObject();
reach3.put("task_code",inst.getInstruction_code());
reach3.put("address",inst.getNext_point_code() + "IN");
data3.put("reach",reach3);
script_args3.put("data",data3);
script_args3.put("protocol","HTTP");
jo3.put("script_args",script_args3);
ja.add(jo3);
JSONObject jo4 = new JSONObject();
jo4.put("blockId",String.valueOf(ja.size()+1));
@ -1595,10 +1632,21 @@ public class AgvServiceImpl implements AgvService {
jo4.put("operation","JackUnload");
ja.add(jo4);
JSONObject jo5 = new JSONObject();
jo5.put("blockId",String.valueOf(ja.size()+1));
jo5.put("location",inst.getNext_point_code() + "OUT");
jo5.put("operation","Wait");
jo5.put("operation","script");
jo5.put("id",inst.getStart_point_code() + "OUT");
jo5.put("script_name","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");
data5.put("reach",reach5);
script_args5.put("data",data5);
script_args5.put("protocol","HTTP");
jo5.put("script_args",script_args5);
ja.add(jo5);
System.out.println(ja);
return ja;
}

6
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_line/StandardConveyorLineDeviceDriver.java

@ -4,14 +4,12 @@ import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.common.aspect.TaskAnnotation;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.driver.OpcDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.opc.Device;
@ -19,11 +17,7 @@ import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.utils.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;

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

@ -73,7 +73,6 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
public Map<String, Object> waitpointRequest(JSONObject param) {
// TODO 待定
String inst_code = param.getString("task_code");
String car_id = param.getString("device_code");
String address = param.getString("address");
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
@ -82,7 +81,6 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
Map<String, Object> map = new HashMap<>();
Map<String, Object> feedMap = new HashMap();
feedMap.put("taskCode", task_code);
feedMap.put("carId", car_id);
feedMap.put("taskType", instructionDto.getInstruction_type());
if (ObjectUtil.isEmpty(instructionDto)) {
map.put("status", 400);
@ -110,7 +108,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
map.put("message", "操作成功");
type = "info";
} else {
logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id);
logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", "");
map.put("status", 400);
map.put("message", "操作失败");
type = "erro";
@ -137,7 +135,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
map.put("message", "操作成功");
type = "info";
} else {
logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id);
logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", "");
map.put("status", 400);
map.put("message", "操作失败");
type = "erro";
@ -165,7 +163,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
map.put("message", "操作成功");
type = "info";
} else {
logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id);
logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", "");
map.put("status", 400);
map.put("message", "操作失败");
type = "erro";
@ -180,7 +178,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
map.put("status", 400);
map.put("message", "操作失败");
type = "info";
logServer.log(inst_code, "waitpointRequest", type, param.toString(), "取货完成时,光电信号为0", "400", "waitpointRequest", car_id);
logServer.log(inst_code, "waitpointRequest", type, param.toString(), "取货完成时,光电信号为0", "400", "waitpointRequest", "");
} else {
//standardConveyorLineDeviceDriver.writing(1,2);
feedMap.put("feedbackStatus", "putFinish");

Loading…
Cancel
Save