|
|
@ -54,14 +54,9 @@ import org.springframework.http.HttpStatus; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.text.DateFormat; |
|
|
|
import java.text.DecimalFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
@ -231,7 +226,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
* demo:destination("cz14", "JackUnload", "3", "") |
|
|
|
* @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(); |
|
|
|
//目标工作站
|
|
|
@ -247,7 +242,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
destinationOrder.put("properties", properties); |
|
|
|
} else if (propertiesType.equals("2")) {//Spin转动
|
|
|
|
AcsPointAngleDto acsPointAngleDto = getAcsPointAngleDto(dto); |
|
|
|
if (ObjectUtil.isEmpty(acsPointAngleDto)){ |
|
|
|
if (ObjectUtil.isEmpty(acsPointAngleDto)) { |
|
|
|
throw new RuntimeException("沒有找到内容,无法下发"); |
|
|
|
} |
|
|
|
JSONArray properties = new JSONArray(); |
|
|
@ -287,8 +282,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private AcsPointAngleDto getAcsPointAngleDto(Instruction dto) { |
|
|
|
private AcsPointAngleDto getAcsPointAngleDto(Instruction dto) { |
|
|
|
List<AcsPointAngleDto> list = acsPointAngleService.queryAll(new HashMap()); |
|
|
|
AcsPointAngleDto acsPointAngleDto = new AcsPointAngleDto(); |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
@ -664,12 +658,12 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
com.alibaba.fastjson.JSONObject current_order = jo.getJSONObject("current_order"); |
|
|
|
Integer connectionStatus = jo.getInteger("connection_status"); |
|
|
|
String inst_code = current_order.getString("id"); |
|
|
|
String taskNo= "0"; |
|
|
|
String taskNo = "0"; |
|
|
|
if (StrUtil.isNotEmpty(inst_code)) { |
|
|
|
Instruction inst = instructionService.findByCodeFromCache(inst_code); |
|
|
|
if (ObjectUtil.isNotEmpty(inst)) { |
|
|
|
//任务号
|
|
|
|
taskNo = inst.getTask_code(); |
|
|
|
taskNo = inst.getTask_code(); |
|
|
|
} |
|
|
|
} |
|
|
|
//x坐标
|
|
|
@ -704,7 +698,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL); |
|
|
|
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(); |
|
|
|
if (!insts.isEmpty()) { |
|
|
|
JSONObject where = new JSONObject(); |
|
|
@ -718,7 +712,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
row.add(instruction.getInstruction_code()); |
|
|
|
predicates.add(row); |
|
|
|
} |
|
|
|
agvurl = agvurl+ "&where=" + where; |
|
|
|
agvurl = agvurl + "&where=" + where; |
|
|
|
} |
|
|
|
|
|
|
|
HttpResponse result = HttpRequest.get(agvurl) |
|
|
@ -1815,18 +1809,18 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
MachinesSiteDeviceDriver machinesSiteDeviceDriver; |
|
|
|
if (device.getDeviceDriver() instanceof MachinesSiteDeviceDriver) { |
|
|
|
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 |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
ja.add(destination2(device_code + "OUT", "Wait", "1", device_code + "OUT" |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
|
|
|
|
} 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 { |
|
|
|
String startAddress = inst.getStart_device_code(); |
|
|
@ -1837,25 +1831,25 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
MachinesSiteDeviceDriver machinesSiteDeviceDriver; |
|
|
|
if (device.getDeviceDriver() instanceof MachinesSiteDeviceDriver) { |
|
|
|
ja.add(destination2(startAddress, "Wait", "5", startAddress |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN" |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
ja.add(destination2(nextAddress, "Wait", "1", nextAddress |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT" |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
} else { |
|
|
|
ja.add(destination2(startAddress, "Wait", "1", startAddress |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
ja.add(destination2(nextAddress, "Wait", "1", nextAddress |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
ja.add(destination2(startAddress, "Wait", "1", startAddress |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
ja.add(destination2(nextAddress, "Wait", "1", nextAddress |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
@ -1872,33 +1866,33 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
if (ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_pickup_spin"), "true") && |
|
|
|
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin"))) { |
|
|
|
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" |
|
|
|
+ "-" + inst_code + "-" + "07",inst)); |
|
|
|
+ "-" + inst_code + "-" + "07", inst)); |
|
|
|
ja.add(destination2(startAddress + "IN", "Wait", "1", startAddress + "IN" |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
ja.add(destination2(startAddress, "JackLoad", "3", startAddress |
|
|
|
+ "-" + inst_code + "-" + "02",inst)); |
|
|
|
+ "-" + inst_code + "-" + "02", inst)); |
|
|
|
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" |
|
|
|
+ "-" + inst_code + "-" + "08",inst)); |
|
|
|
+ "-" + inst_code + "-" + "08", inst)); |
|
|
|
|
|
|
|
} else if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { |
|
|
|
|
|
|
|
ja.add(destination2(startAddress + "IN", "Wait", "1", startAddress + "IN" |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
ja.add(destination2(startAddress, "JackLoad", "3", startAddress |
|
|
|
+ "-" + inst_code + "-" + "02",inst)); |
|
|
|
+ "-" + inst_code + "-" + "02", inst)); |
|
|
|
ja.add(destination2(startAddress + "OUT", "Wait", "1", startAddress + "OUT" |
|
|
|
+ "-" + inst_code + "-" + "05",inst)); |
|
|
|
+ "-" + inst_code + "-" + "05", inst)); |
|
|
|
|
|
|
|
} else { |
|
|
|
ja.add(destination2(nextAddress, "Wait", "1", startAddress |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
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") && |
|
|
|
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin"))) { |
|
|
|
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" |
|
|
|
+ "-" + inst_code + "-" + "07",inst)); |
|
|
|
+ "-" + inst_code + "-" + "07", inst)); |
|
|
|
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN" |
|
|
|
+ "-" + inst_code + "-" + "03",inst)); |
|
|
|
+ "-" + inst_code + "-" + "03", inst)); |
|
|
|
|
|
|
|
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress |
|
|
|
+ "-" + inst_code + "-" + "04",inst)); |
|
|
|
+ "-" + inst_code + "-" + "04", inst)); |
|
|
|
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" |
|
|
|
+ "-" + inst_code + "-" + "08",inst)); |
|
|
|
+ "-" + inst_code + "-" + "08", inst)); |
|
|
|
} else if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { |
|
|
|
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN" |
|
|
|
+ "-" + inst_code + "-" + "03",inst)); |
|
|
|
+ "-" + inst_code + "-" + "03", inst)); |
|
|
|
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress |
|
|
|
+ "-" + inst_code + "-" + "04",inst)); |
|
|
|
+ "-" + inst_code + "-" + "04", inst)); |
|
|
|
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT" |
|
|
|
+ "-" + inst_code + "-" + "06",inst)); |
|
|
|
+ "-" + inst_code + "-" + "06", inst)); |
|
|
|
} else { |
|
|
|
ja.add(destination2(nextAddress, "Wait", "1", nextAddress |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress |
|
|
|
+ "-" + inst_code + "-" + "01",inst)); |
|
|
|
+ "-" + inst_code + "-" + "01", inst)); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
@ -2232,16 +2226,16 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
|
|
|
|
//放货前下发旋转角度
|
|
|
|
com.alibaba.fastjson.JSONObject json1 = new com.alibaba.fastjson.JSONObject(); |
|
|
|
AcsPointAngleDto acsPointAngleDto = acsPointAngleService.findByCode(inst.getStart_device_code(),inst.getNext_device_code()); |
|
|
|
if (ObjectUtil.isNotEmpty(acsPointAngleDto)){ |
|
|
|
AcsPointAngleDto acsPointAngleDto = acsPointAngleService.findByCode(inst.getStart_device_code(), inst.getNext_device_code()); |
|
|
|
if (ObjectUtil.isNotEmpty(acsPointAngleDto)) { |
|
|
|
log.info("acsPointAngleDto----參數,{}", acsPointAngleDto.toString()); |
|
|
|
com.alibaba.fastjson.JSONObject operation_args = new com.alibaba.fastjson.JSONObject(); |
|
|
|
BigDecimal next_point_angle = acsPointAngleDto.getNext_point_angle(); |
|
|
|
operation_args.put("increase_spin_angle",next_point_angle);//弧度值,如3.14
|
|
|
|
operation_args.put("skill_name","GoByOdometer"); |
|
|
|
operation_args.put("increase_spin_angle", next_point_angle);//弧度值,如3.14
|
|
|
|
operation_args.put("skill_name", "GoByOdometer"); |
|
|
|
json1.put("blockId", IdUtil.simpleUUID()); |
|
|
|
json1.put("location", inst.getNext_point_code() + "INPUT"); |
|
|
|
json1.put("operation_args",operation_args); |
|
|
|
json1.put("operation_args", operation_args); |
|
|
|
ja.add(json1); |
|
|
|
} |
|
|
|
|
|
|
@ -2271,6 +2265,16 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
jo5.put("script_args", script_args5); |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
@ -2315,4 +2319,5 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
|
|
|
|
throw new BadRequestException("请求失败,IN OUT 站点错误!"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|