rev:代码优化
This commit is contained in:
@@ -12,6 +12,7 @@ import org.nl.acs.log.service.LogServer;
|
|||||||
import org.nl.exception.BadRequestException;
|
import org.nl.exception.BadRequestException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,7 +60,15 @@ public class AgvWaitUtil {
|
|||||||
//取货完成等待
|
//取货完成等待
|
||||||
public JSONObject waitOutGet(String startDeviceCode, Instruction inst) {
|
public JSONObject waitOutGet(String startDeviceCode, Instruction inst) {
|
||||||
log.info("仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
log.info("仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
||||||
|
if (startDeviceCode.length() == 4) {
|
||||||
|
JSONObject requestWMSParam = new JSONObject();
|
||||||
|
requestWMSParam.put("device_code", startDeviceCode);
|
||||||
|
requestWMSParam.put("device_status", "close");
|
||||||
|
JSONObject wmsResult = acsToWmsService.gccControlDoorSwitch(requestWMSParam);
|
||||||
|
if (HttpStatus.OK.value() == wmsResult.optInt("status")) {
|
||||||
|
JSONObject responseBody = acsToWmsService.gccQueryDoorStatus(startDeviceCode);
|
||||||
|
log.info("当前设备" + startDeviceCode + "门的状态:" + responseBody.get("device_status") + ",门的状态应为关闭状态!");
|
||||||
|
if (ObjectUtil.isNotEmpty(responseBody) && "close".equals(responseBody.get("device_status"))) {
|
||||||
inst.setExecute_status("2");
|
inst.setExecute_status("2");
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
|
|
||||||
@@ -68,6 +77,22 @@ public class AgvWaitUtil {
|
|||||||
map.put("message", "允许离开!");
|
map.put("message", "允许离开!");
|
||||||
log.info("允许仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
log.info("允许仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
||||||
return map;
|
return map;
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("请求失败!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("请求失败!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
inst.setExecute_status("2");
|
||||||
|
instructionService.update(inst);
|
||||||
|
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("status", 200);
|
||||||
|
map.put("message", "允许离开!");
|
||||||
|
log.info("允许仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//放货前等待
|
//放货前等待
|
||||||
@@ -99,10 +124,32 @@ public class AgvWaitUtil {
|
|||||||
public JSONObject waitOutPut(String endDeviceCode, Instruction inst) {
|
public JSONObject waitOutPut(String endDeviceCode, Instruction inst) {
|
||||||
log.info("仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
log.info("仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
||||||
|
|
||||||
|
if (endDeviceCode.length() == 4) {
|
||||||
|
JSONObject requestWMSParam = new JSONObject();
|
||||||
|
requestWMSParam.put("device_code", endDeviceCode);
|
||||||
|
requestWMSParam.put("device_status", "close");
|
||||||
|
JSONObject wmsResult = acsToWmsService.gccControlDoorSwitch(requestWMSParam);
|
||||||
|
if (HttpStatus.OK.value() == wmsResult.optInt("status")) {
|
||||||
|
JSONObject responseBody = acsToWmsService.gccQueryDoorStatus(endDeviceCode);
|
||||||
|
log.info("当前设备" + endDeviceCode + "门的状态:" + responseBody.get("device_status") + ",门的状态应为关闭状态!");
|
||||||
|
if (ObjectUtil.isNotEmpty(responseBody) && "close".equals(responseBody.get("device_status"))) {
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("status", 200);
|
||||||
|
map.put("message", "允许离开!");
|
||||||
|
log.info("允许仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
||||||
|
return map;
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("请求失败!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("请求失败!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许离开!");
|
map.put("message", "允许离开!");
|
||||||
log.info("允许仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
log.info("允许仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,14 +54,9 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@@ -231,7 +226,7 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
* demo:destination("cz14", "JackUnload", "3", "")
|
* demo:destination("cz14", "JackUnload", "3", "")
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSONObject destination2(String locationName, String operation, String propertiesType, String pro,Instruction dto) {
|
public JSONObject destination2(String locationName, String operation, String propertiesType, String pro, Instruction dto) {
|
||||||
//新增业务订单
|
//新增业务订单
|
||||||
JSONObject destinationOrder = new JSONObject();
|
JSONObject destinationOrder = new JSONObject();
|
||||||
//目标工作站
|
//目标工作站
|
||||||
@@ -247,7 +242,7 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
destinationOrder.put("properties", properties);
|
destinationOrder.put("properties", properties);
|
||||||
} else if (propertiesType.equals("2")) {//Spin转动
|
} else if (propertiesType.equals("2")) {//Spin转动
|
||||||
AcsPointAngleDto acsPointAngleDto = getAcsPointAngleDto(dto);
|
AcsPointAngleDto acsPointAngleDto = getAcsPointAngleDto(dto);
|
||||||
if (ObjectUtil.isEmpty(acsPointAngleDto)){
|
if (ObjectUtil.isEmpty(acsPointAngleDto)) {
|
||||||
throw new RuntimeException("沒有找到内容,无法下发");
|
throw new RuntimeException("沒有找到内容,无法下发");
|
||||||
}
|
}
|
||||||
JSONArray properties = new JSONArray();
|
JSONArray properties = new JSONArray();
|
||||||
@@ -287,7 +282,6 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private AcsPointAngleDto getAcsPointAngleDto(Instruction dto) {
|
private AcsPointAngleDto getAcsPointAngleDto(Instruction dto) {
|
||||||
List<AcsPointAngleDto> list = acsPointAngleService.queryAll(new HashMap());
|
List<AcsPointAngleDto> list = acsPointAngleService.queryAll(new HashMap());
|
||||||
AcsPointAngleDto acsPointAngleDto = new AcsPointAngleDto();
|
AcsPointAngleDto acsPointAngleDto = new AcsPointAngleDto();
|
||||||
@@ -664,7 +658,7 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
com.alibaba.fastjson.JSONObject current_order = jo.getJSONObject("current_order");
|
com.alibaba.fastjson.JSONObject current_order = jo.getJSONObject("current_order");
|
||||||
Integer connectionStatus = jo.getInteger("connection_status");
|
Integer connectionStatus = jo.getInteger("connection_status");
|
||||||
String inst_code = current_order.getString("id");
|
String inst_code = current_order.getString("id");
|
||||||
String taskNo= "0";
|
String taskNo = "0";
|
||||||
if (StrUtil.isNotEmpty(inst_code)) {
|
if (StrUtil.isNotEmpty(inst_code)) {
|
||||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
if (ObjectUtil.isNotEmpty(inst)) {
|
||||||
@@ -704,7 +698,7 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
||||||
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
||||||
|
|
||||||
agvurl = agvurl + ":" + agvport + "/orders?page=1&size=9999";
|
agvurl = agvurl + ":" + agvport + "/orders?page=1&size=100&orderBy=createTime";
|
||||||
List<Instruction> insts = instructionService.findAllInstFromCache();
|
List<Instruction> insts = instructionService.findAllInstFromCache();
|
||||||
if (!insts.isEmpty()) {
|
if (!insts.isEmpty()) {
|
||||||
JSONObject where = new JSONObject();
|
JSONObject where = new JSONObject();
|
||||||
@@ -718,7 +712,7 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
row.add(instruction.getInstruction_code());
|
row.add(instruction.getInstruction_code());
|
||||||
predicates.add(row);
|
predicates.add(row);
|
||||||
}
|
}
|
||||||
agvurl = agvurl+ "&where=" + where;
|
agvurl = agvurl + "&where=" + where;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse result = HttpRequest.get(agvurl)
|
HttpResponse result = HttpRequest.get(agvurl)
|
||||||
@@ -1815,18 +1809,18 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
MachinesSiteDeviceDriver machinesSiteDeviceDriver;
|
MachinesSiteDeviceDriver machinesSiteDeviceDriver;
|
||||||
if (device.getDeviceDriver() instanceof MachinesSiteDeviceDriver) {
|
if (device.getDeviceDriver() instanceof MachinesSiteDeviceDriver) {
|
||||||
ja.add(destination2(device_code + "IN", "Wait", "1", device_code + "IN"
|
ja.add(destination2(device_code + "IN", "Wait", "1", device_code + "IN"
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(device_code, "Wait", "1", device_code
|
ja.add(destination2(device_code, "Wait", "1", device_code
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(device_code + "OUT", "Wait", "1", device_code + "OUT"
|
ja.add(destination2(device_code + "OUT", "Wait", "1", device_code + "OUT"
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ja.add(destination2(device_code, "Wait", "1", device_code + "-" + inst_code + "-" + "01",inst));
|
ja.add(destination2(device_code, "Wait", "1", device_code + "-" + inst_code + "-" + "01", inst));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ja.add(destination2(inst.getNext_point_code(), "Wait", "1", inst.getNext_point_code() + "-" + inst_code + "-" + "01",inst));
|
ja.add(destination2(inst.getNext_point_code(), "Wait", "1", inst.getNext_point_code() + "-" + inst_code + "-" + "01", inst));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String startAddress = inst.getStart_device_code();
|
String startAddress = inst.getStart_device_code();
|
||||||
@@ -1837,25 +1831,25 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
MachinesSiteDeviceDriver machinesSiteDeviceDriver;
|
MachinesSiteDeviceDriver machinesSiteDeviceDriver;
|
||||||
if (device.getDeviceDriver() instanceof MachinesSiteDeviceDriver) {
|
if (device.getDeviceDriver() instanceof MachinesSiteDeviceDriver) {
|
||||||
ja.add(destination2(startAddress, "Wait", "5", startAddress
|
ja.add(destination2(startAddress, "Wait", "5", startAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN"
|
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN"
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT"
|
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT"
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
} else {
|
} else {
|
||||||
ja.add(destination2(startAddress, "Wait", "1", startAddress
|
ja.add(destination2(startAddress, "Wait", "1", startAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ja.add(destination2(startAddress, "Wait", "1", startAddress
|
ja.add(destination2(startAddress, "Wait", "1", startAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1872,33 +1866,33 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
if (ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_pickup_spin"), "true") &&
|
if (ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_pickup_spin"), "true") &&
|
||||||
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin"))) {
|
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin"))) {
|
||||||
ja.add(destination2(startAddress + "IQ", "Spin", "2",
|
ja.add(destination2(startAddress + "IQ", "Spin", "2",
|
||||||
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin").toString(),inst));
|
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin").toString(), inst));
|
||||||
}
|
}
|
||||||
ja.add(destination2(startAddress + "IQ", "Wait", "1", startAddress + "IQ"
|
ja.add(destination2(startAddress + "IQ", "Wait", "1", startAddress + "IQ"
|
||||||
+ "-" + inst_code + "-" + "07",inst));
|
+ "-" + inst_code + "-" + "07", inst));
|
||||||
ja.add(destination2(startAddress + "IN", "Wait", "1", startAddress + "IN"
|
ja.add(destination2(startAddress + "IN", "Wait", "1", startAddress + "IN"
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(startAddress, "JackLoad", "3", startAddress
|
ja.add(destination2(startAddress, "JackLoad", "3", startAddress
|
||||||
+ "-" + inst_code + "-" + "02",inst));
|
+ "-" + inst_code + "-" + "02", inst));
|
||||||
ja.add(destination2(startAddress + "OUT", "Wait", "1", startAddress + "OUT"
|
ja.add(destination2(startAddress + "OUT", "Wait", "1", startAddress + "OUT"
|
||||||
+ "-" + inst_code + "-" + "05",inst));
|
+ "-" + inst_code + "-" + "05", inst));
|
||||||
ja.add(destination2(startAddress + "OQ", "Wait", "1", startAddress + "OQ"
|
ja.add(destination2(startAddress + "OQ", "Wait", "1", startAddress + "OQ"
|
||||||
+ "-" + inst_code + "-" + "08",inst));
|
+ "-" + inst_code + "-" + "08", inst));
|
||||||
|
|
||||||
} else if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
} else if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
|
|
||||||
ja.add(destination2(startAddress + "IN", "Wait", "1", startAddress + "IN"
|
ja.add(destination2(startAddress + "IN", "Wait", "1", startAddress + "IN"
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(startAddress, "JackLoad", "3", startAddress
|
ja.add(destination2(startAddress, "JackLoad", "3", startAddress
|
||||||
+ "-" + inst_code + "-" + "02",inst));
|
+ "-" + inst_code + "-" + "02", inst));
|
||||||
ja.add(destination2(startAddress + "OUT", "Wait", "1", startAddress + "OUT"
|
ja.add(destination2(startAddress + "OUT", "Wait", "1", startAddress + "OUT"
|
||||||
+ "-" + inst_code + "-" + "05",inst));
|
+ "-" + inst_code + "-" + "05", inst));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ja.add(destination2(nextAddress, "Wait", "1", startAddress
|
ja.add(destination2(nextAddress, "Wait", "1", startAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(startAddress, "JackLoad", "3", startAddress
|
ja.add(destination2(startAddress, "JackLoad", "3", startAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
}
|
}
|
||||||
|
|
||||||
//终点
|
//终点
|
||||||
@@ -1907,31 +1901,31 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
if (ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_release_spin"), "true") &&
|
if (ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_release_spin"), "true") &&
|
||||||
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin"))) {
|
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin"))) {
|
||||||
ja.add(destination2(nextAddress + "IQ", "Spin", "2",
|
ja.add(destination2(nextAddress + "IQ", "Spin", "2",
|
||||||
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin").toString(),inst));
|
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin").toString(), inst));
|
||||||
}
|
}
|
||||||
ja.add(destination2(nextAddress + "IQ", "Wait", "1", nextAddress + "IQ"
|
ja.add(destination2(nextAddress + "IQ", "Wait", "1", nextAddress + "IQ"
|
||||||
+ "-" + inst_code + "-" + "07",inst));
|
+ "-" + inst_code + "-" + "07", inst));
|
||||||
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN"
|
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN"
|
||||||
+ "-" + inst_code + "-" + "03",inst));
|
+ "-" + inst_code + "-" + "03", inst));
|
||||||
|
|
||||||
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress
|
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress
|
||||||
+ "-" + inst_code + "-" + "04",inst));
|
+ "-" + inst_code + "-" + "04", inst));
|
||||||
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT"
|
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT"
|
||||||
+ "-" + inst_code + "-" + "06",inst));
|
+ "-" + inst_code + "-" + "06", inst));
|
||||||
ja.add(destination2(nextAddress + "OQ", "Wait", "1", nextAddress + "OQ"
|
ja.add(destination2(nextAddress + "OQ", "Wait", "1", nextAddress + "OQ"
|
||||||
+ "-" + inst_code + "-" + "08",inst));
|
+ "-" + inst_code + "-" + "08", inst));
|
||||||
} else if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
} else if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN"
|
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN"
|
||||||
+ "-" + inst_code + "-" + "03",inst));
|
+ "-" + inst_code + "-" + "03", inst));
|
||||||
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress
|
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress
|
||||||
+ "-" + inst_code + "-" + "04",inst));
|
+ "-" + inst_code + "-" + "04", inst));
|
||||||
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT"
|
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT"
|
||||||
+ "-" + inst_code + "-" + "06",inst));
|
+ "-" + inst_code + "-" + "06", inst));
|
||||||
} else {
|
} else {
|
||||||
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress
|
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress
|
||||||
+ "-" + inst_code + "-" + "01",inst));
|
+ "-" + inst_code + "-" + "01", inst));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2232,16 +2226,16 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
|
|
||||||
//放货前下发旋转角度
|
//放货前下发旋转角度
|
||||||
com.alibaba.fastjson.JSONObject json1 = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject json1 = new com.alibaba.fastjson.JSONObject();
|
||||||
AcsPointAngleDto acsPointAngleDto = acsPointAngleService.findByCode(inst.getStart_device_code(),inst.getNext_device_code());
|
AcsPointAngleDto acsPointAngleDto = acsPointAngleService.findByCode(inst.getStart_device_code(), inst.getNext_device_code());
|
||||||
if (ObjectUtil.isNotEmpty(acsPointAngleDto)){
|
if (ObjectUtil.isNotEmpty(acsPointAngleDto)) {
|
||||||
log.info("acsPointAngleDto----參數,{}", acsPointAngleDto.toString());
|
log.info("acsPointAngleDto----參數,{}", acsPointAngleDto.toString());
|
||||||
com.alibaba.fastjson.JSONObject operation_args = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject operation_args = new com.alibaba.fastjson.JSONObject();
|
||||||
BigDecimal next_point_angle = acsPointAngleDto.getNext_point_angle();
|
BigDecimal next_point_angle = acsPointAngleDto.getNext_point_angle();
|
||||||
operation_args.put("increase_spin_angle",next_point_angle);//弧度值,如3.14
|
operation_args.put("increase_spin_angle", next_point_angle);//弧度值,如3.14
|
||||||
operation_args.put("skill_name","GoByOdometer");
|
operation_args.put("skill_name", "GoByOdometer");
|
||||||
json1.put("blockId", IdUtil.simpleUUID());
|
json1.put("blockId", IdUtil.simpleUUID());
|
||||||
json1.put("location", inst.getNext_point_code() + "INPUT");
|
json1.put("location", inst.getNext_point_code() + "INPUT");
|
||||||
json1.put("operation_args",operation_args);
|
json1.put("operation_args", operation_args);
|
||||||
ja.add(json1);
|
ja.add(json1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2271,6 +2265,16 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
jo5.put("script_args", script_args5);
|
jo5.put("script_args", script_args5);
|
||||||
ja.add(jo5);
|
ja.add(jo5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
com.alibaba.fastjson.JSONObject jo6 = new com.alibaba.fastjson.JSONObject();
|
||||||
|
com.alibaba.fastjson.JSONObject operation_args = new com.alibaba.fastjson.JSONObject();
|
||||||
|
operation_args.put("robot_spin_angle", 0);
|
||||||
|
operation_args.put("spin_direction", 0);
|
||||||
|
jo6.put("blockId", IdUtil.simpleUUID());
|
||||||
|
jo6.put("location", inst.getNext_point_code() + "OUTPUT");
|
||||||
|
jo6.put("operation_args", operation_args);
|
||||||
|
ja.add(jo6);
|
||||||
|
|
||||||
return ja;
|
return ja;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2315,4 +2319,5 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
|
|
||||||
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import org.openscada.opc.lib.da.Server;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -86,6 +87,8 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
AcsConfigService acsConfigService;
|
AcsConfigService acsConfigService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
TaskService taskService;
|
TaskService taskService;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -137,6 +137,7 @@ public class LogServerImpl implements LogServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log(String task_code, String method, String type, String requestParam, String responseParam, String status_code, String requesturl, String vehicle_code) {
|
public void log(String task_code, String method, String type, String requestParam, String responseParam, String status_code, String requesturl, String vehicle_code) {
|
||||||
|
try {
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
@@ -159,5 +160,8 @@ public class LogServerImpl implements LogServer {
|
|||||||
WQLObject wo = WQLObject.getWQLObject("acs_log");
|
WQLObject wo = WQLObject.getWQLObject("acs_log");
|
||||||
JSONObject json = JSONObject.fromObject(logDto);
|
JSONObject json = JSONObject.fromObject(logDto);
|
||||||
wo.insert(json);
|
wo.insert(json);
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,4 +217,9 @@ public class TaskDto implements Serializable {
|
|||||||
* 外部系统标识
|
* 外部系统标识
|
||||||
*/
|
*/
|
||||||
private String ext_task_uuid;
|
private String ext_task_uuid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* agv车号
|
||||||
|
*/
|
||||||
|
private String carno;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -834,8 +834,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(TaskDto dto) {
|
public void update(TaskDto dto) {
|
||||||
TaskDto entity = this.findById(dto.getTask_id());
|
TaskDto entity = this.findById(dto.getTask_id());
|
||||||
Instruction instruction = instructionService.findByTaskcode(dto.getTask_code());
|
|
||||||
|
|
||||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
@@ -859,13 +857,13 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
}
|
}
|
||||||
//判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
//判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||||
String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS);
|
String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS);
|
||||||
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")&&ObjectUtil.isNotEmpty(dto.getCarno())) {
|
||||||
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
|
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
|
||||||
JSONObject feed_jo = new JSONObject();
|
JSONObject feed_jo = new JSONObject();
|
||||||
feed_jo.put("task_code", dto.getTask_code());
|
feed_jo.put("task_code", dto.getTask_code());
|
||||||
feed_jo.put("ext_task_uuid", entity.getExt_task_uuid());
|
feed_jo.put("ext_task_uuid", entity.getExt_task_uuid());
|
||||||
feed_jo.put("task_status", dto.getTask_status());
|
feed_jo.put("task_status", dto.getTask_status());
|
||||||
feed_jo.put("agv_code",instruction.getCarno());
|
feed_jo.put("agv_code",dto.getCarno());
|
||||||
JSONArray ja = new JSONArray();
|
JSONArray ja = new JSONArray();
|
||||||
ja.add(feed_jo);
|
ja.add(feed_jo);
|
||||||
String message = null;
|
String message = null;
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ public class QueryXZAgvTaskStatus {
|
|||||||
String carno = one.getString("vehicle");
|
String carno = one.getString("vehicle");
|
||||||
if (ObjectUtil.isEmpty(inst.getCarno())) {
|
if (ObjectUtil.isEmpty(inst.getCarno())) {
|
||||||
inst.setCarno(carno);
|
inst.setCarno(carno);
|
||||||
instructionService.update(inst);
|
|
||||||
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||||
|
taskDto.setCarno(carno);
|
||||||
taskService.update(taskDto);
|
taskService.update(taskDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,14 +74,20 @@ public class QueryXZAgvTaskStatus {
|
|||||||
|
|
||||||
//执行中
|
//执行中
|
||||||
if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
|
if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
|
||||||
|
log.info("queryXZAgvTaskStatus--当前inst_code:{},agv_status:{}", inst.getInstruction_code(), state);
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
inst.setInstruction_status("1");
|
inst.setInstruction_status("1");
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
|
}else {
|
||||||
|
log.info("queryXZAgvTaskStatus--指令为空");
|
||||||
}
|
}
|
||||||
} else if ("FINISHED".equals(state)) {
|
} else if ("FINISHED".equals(state)) {
|
||||||
|
log.info("queryXZAgvTaskStatus--当前inst_code:{},agv_status:{}", inst.getInstruction_code(), state);
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
inst.setInstruction_status("2");
|
inst.setInstruction_status("2");
|
||||||
instructionService.finish(inst);
|
instructionService.finish(inst);
|
||||||
|
}else {
|
||||||
|
log.info("queryXZAgvTaskStatus--指令为空");
|
||||||
}
|
}
|
||||||
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
|
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ spring:
|
|||||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:gcc_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:gcc_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:gcc_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:gcc_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||||
username: ${DB_USER:root}
|
username: ${DB_USER:root}
|
||||||
password: ${DB_PWD:root}
|
password: ${DB_PWD:123456}
|
||||||
# password: ${DB_PWD:Root.123456}
|
# password: ${DB_PWD:Root.123456}
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
|
|||||||
32
hd/nladmin-system/src/main/resources/log/AgvWaitUtil.xml
Normal file
32
hd/nladmin-system/src/main/resources/log/AgvWaitUtil.xml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<included>
|
||||||
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||||
|
<property name="LOG_HOME" value="${logPath}"/>
|
||||||
|
<!-- 按照每天生成日志文件 -->
|
||||||
|
<appender name="FILE9" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--日志文件输出的文件名-->
|
||||||
|
<FileNamePattern>${LOG_HOME}/反馈仙工取放货状态/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||||
|
<!--日志文件保留天数-->
|
||||||
|
<maxHistory>15</maxHistory>
|
||||||
|
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||||
|
<maxFileSize>200MB</maxFileSize>
|
||||||
|
<!--所有日志最多占多大容量-->
|
||||||
|
<totalSizeCap>2GB</totalSizeCap>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||||
|
<appender-ref ref="FILE3"/>
|
||||||
|
</logger>-->
|
||||||
|
|
||||||
|
<!-- 打印sql -->
|
||||||
|
<logger name="org.nl.acs.agv.service.AgvWaitUtil" level="info" additivity="false">
|
||||||
|
<appender-ref ref="FILE9"/>
|
||||||
|
</logger>
|
||||||
|
</included>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
window.g = {
|
window.g = {
|
||||||
dev: {
|
dev: {
|
||||||
VUE_APP_BASE_API: '/'
|
VUE_APP_BASE_API: 'http://10.118.33.115:8010'
|
||||||
},
|
},
|
||||||
prod: {
|
prod: {
|
||||||
VUE_APP_BASE_API: 'http://127.0.0.1:8010'
|
VUE_APP_BASE_API: 'http://10.118.33.115:8010'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ module.exports = {
|
|||||||
lintOnSave: process.env.NODE_ENV === 'development',
|
lintOnSave: process.env.NODE_ENV === 'development',
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
devServer: {
|
devServer: {
|
||||||
|
allowedHosts: ['all'],
|
||||||
|
disableHostCheck: true,
|
||||||
port: port,
|
port: port,
|
||||||
open: true,
|
open: true,
|
||||||
overlay: {
|
overlay: {
|
||||||
|
|||||||
Reference in New Issue
Block a user