|
@ -23,6 +23,7 @@ import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceD |
|
|
import org.nl.acs.device_driver.standard_autodoor.StandardAutodoorDeviceDriver; |
|
|
import org.nl.acs.device_driver.standard_autodoor.StandardAutodoorDeviceDriver; |
|
|
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver; |
|
|
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver; |
|
|
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver; |
|
|
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver; |
|
|
|
|
|
import org.nl.acs.device_driver.standard_manipulator_stacking_site.StandardManipulatorStackingSiteDeviceDriver; |
|
|
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; |
|
|
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; |
|
|
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver; |
|
|
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver; |
|
|
import org.nl.acs.device_driver.weighing_site.WeighingSiteDeviceDriver; |
|
|
import org.nl.acs.device_driver.weighing_site.WeighingSiteDeviceDriver; |
|
@ -38,6 +39,7 @@ import org.nl.acs.opc.DeviceAppService; |
|
|
import org.nl.acs.opc.DeviceAppServiceImpl; |
|
|
import org.nl.acs.opc.DeviceAppServiceImpl; |
|
|
import org.nl.acs.opc.DeviceType; |
|
|
import org.nl.acs.opc.DeviceType; |
|
|
import org.nl.acs.task.service.TaskService; |
|
|
import org.nl.acs.task.service.TaskService; |
|
|
|
|
|
import org.nl.acs.task.service.dto.TaskDto; |
|
|
import org.nl.exception.BadRequestException; |
|
|
import org.nl.exception.BadRequestException; |
|
|
import org.nl.logger.BusinessLogger; |
|
|
import org.nl.logger.BusinessLogger; |
|
|
import org.nl.start.auto.run.NDCSocketConnectionAutoRun; |
|
|
import org.nl.start.auto.run.NDCSocketConnectionAutoRun; |
|
@ -75,22 +77,22 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
|
|
|
|
|
Map<String, AgvDto> AGVDeviceStatus = new HashMap(); |
|
|
Map<String, AgvDto> AGVDeviceStatus = new HashMap(); |
|
|
|
|
|
|
|
|
/** |
|
|
// /**
|
|
|
* 获得之后num个天的时间 |
|
|
// * 获得之后num个天的时间
|
|
|
* |
|
|
// *
|
|
|
* @param num |
|
|
// * @param num
|
|
|
* @return |
|
|
// * @return
|
|
|
*/ |
|
|
// */
|
|
|
public static String getNextDay(int num) { |
|
|
// public static String getNextDay(int num) {
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
// Calendar calendar = Calendar.getInstance();
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, num); |
|
|
// calendar.add(Calendar.DAY_OF_MONTH, num);
|
|
|
Date date = calendar.getTime(); |
|
|
// Date date = calendar.getTime();
|
|
|
TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai"); |
|
|
// TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
|
|
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); |
|
|
// DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
|
|
df.setTimeZone(tz); |
|
|
// df.setTimeZone(tz);
|
|
|
String nowAsISO = df.format(date); |
|
|
// String nowAsISO = df.format(date);
|
|
|
return nowAsISO; |
|
|
// return nowAsISO;
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 返回一个点位操作子任务 |
|
|
* 返回一个点位操作子任务 |
|
@ -258,6 +260,48 @@ public class AgvServiceImpl implements AgvService { |
|
|
return destinationOrder; |
|
|
return destinationOrder; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public HttpResponse sendAgvInstToAgv(Instruction inst) throws Exception { |
|
|
|
|
|
com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); |
|
|
|
|
|
String start_point_code = inst.getStart_point_code(); |
|
|
|
|
|
String next_point_code = inst.getNext_point_code(); |
|
|
|
|
|
//1楼AGV普通任务
|
|
|
|
|
|
//2楼AGV普通任务
|
|
|
|
|
|
//2楼AGV起点追加任务
|
|
|
|
|
|
//2楼AGV终点追加任务
|
|
|
|
|
|
String task_type = inst.getInstruction_type(); |
|
|
|
|
|
jo.put("deadline", this.getNextDay(1)); |
|
|
|
|
|
//判断是否追加任务
|
|
|
|
|
|
jo.put("complete", "true"); |
|
|
|
|
|
|
|
|
|
|
|
jo.put("task_code", inst.getInstruction_code()); |
|
|
|
|
|
//根据任务,下发指令类型
|
|
|
|
|
|
com.alibaba.fastjson.JSONArray destinations = new com.alibaba.fastjson.JSONArray(); |
|
|
|
|
|
destinations.add(destination(start_point_code, "Load", "1", "1")); |
|
|
|
|
|
destinations.add(destination(next_point_code, "Unload", "1", "1")); |
|
|
|
|
|
|
|
|
|
|
|
jo.put("destinations", destinations); |
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) { |
|
|
|
|
|
String agvurl = acsConfigService.findByCode(AcsConfig.AGVURL).getValue(); |
|
|
|
|
|
String agvport = acsConfigService.findByCode(AcsConfig.AGVPORT).getValue(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + inst.getInstruction_code(); |
|
|
|
|
|
log.info("下发agv任务请求:{}", agvurl); |
|
|
|
|
|
log.info("下发agv任务参数:{}", jo.toString()); |
|
|
|
|
|
|
|
|
|
|
|
HttpResponse result = HttpRequest.post(agvurl) |
|
|
|
|
|
.body(String.valueOf(jo))//表单内容
|
|
|
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
|
|
|
.execute(); |
|
|
|
|
|
log.info("下发agv任务请求反馈:{}", result); |
|
|
|
|
|
return result; |
|
|
|
|
|
} else { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public HttpResponse sendAgvInstToMagic(Instruction inst) throws Exception { |
|
|
public HttpResponse sendAgvInstToMagic(Instruction inst) throws Exception { |
|
|
JSONArray ja = new JSONArray(); |
|
|
JSONArray ja = new JSONArray(); |
|
@ -488,11 +532,14 @@ 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 + "/v1/transportOrders/" + instCode; |
|
|
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/query"; |
|
|
|
|
|
|
|
|
HttpResponse result = HttpRequest.get(agvurl) |
|
|
HttpResponse result = HttpRequest.post(agvurl) |
|
|
|
|
|
.body("{}") |
|
|
.timeout(20000)//超时,毫秒
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
.execute(); |
|
|
.execute(); |
|
|
|
|
|
|
|
|
|
|
|
log.info("查询agv指令数据:{}", result.body()); |
|
|
System.out.println("查询agv指令数据:" + result.body()); |
|
|
System.out.println("查询agv指令数据:" + result.body()); |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
@ -791,233 +838,119 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
|
|
|
|
|
//1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
|
|
//1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
|
|
@Override |
|
|
@Override |
|
|
public synchronized String process(String jobno, String type, String address, String action, String processingVehicle) { |
|
|
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); |
|
|
{ |
|
|
boolean is_feedback = false; |
|
|
{ |
|
|
String str = ""; |
|
|
log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action); |
|
|
String backaddress = address; |
|
|
//释放AGV资源,继续后续动作
|
|
|
if (address.indexOf(".") > 0) { |
|
|
boolean is_feedback = false; |
|
|
str = address.substring(address.indexOf("."), address.length()); |
|
|
String str = ""; |
|
|
address = address.substring(0, address.indexOf(".")); |
|
|
String backaddress = address; |
|
|
} else if (address.indexOf("-") > 0) { |
|
|
if (address.indexOf(".") > 0) { |
|
|
address = address.substring(0, address.indexOf("-")); |
|
|
str = address.substring(address.indexOf(".") + 1, address.length()); |
|
|
} |
|
|
address = address.substring(0, address.indexOf(".")); |
|
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); |
|
|
} else if (address.indexOf("-") > 0) { |
|
|
Instruction inst = instructionService.findByCodeFromCache(jobno); |
|
|
address = address.substring(0, address.indexOf("-")); |
|
|
|
|
|
} |
|
|
|
|
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); |
|
|
|
|
|
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl"); |
|
|
|
|
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); |
|
|
|
|
|
|
|
|
|
|
|
Instruction inst = instructionService.findByCodeFromCache(jobno); |
|
|
|
|
|
TaskDto task = taskService.findByCode(inst.getTask_code()); |
|
|
|
|
|
|
|
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); |
|
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); |
|
|
Device addressdevice = appService.findDeviceByCode(address); |
|
|
Device addressdevice = appService.findDeviceByCode(address); |
|
|
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; |
|
|
|
|
|
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; |
|
|
StandardManipulatorStackingSiteDeviceDriver standardManipulatorStackingSiteDeviceDriver; |
|
|
SpecialOrdinarySiteDeviceDriver specialOrdinarySiteDeviceDriver; |
|
|
//取货的进入前等待和离开等待
|
|
|
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver; |
|
|
if (action.equals("Load")) { |
|
|
//请求进入
|
|
|
if ("EntryRequired".equals(type)) { |
|
|
if ("onEntry".equals(type)) { |
|
|
|
|
|
|
|
|
//
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { |
|
|
if (addressdevice.getDeviceDriver() instanceof StandardManipulatorStackingSiteDeviceDriver) { |
|
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
standardManipulatorStackingSiteDeviceDriver = (StandardManipulatorStackingSiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
//请求取货
|
|
|
if(standardManipulatorStackingSiteDeviceDriver.getMove()==1){ |
|
|
if ("Load".equals(action)) { |
|
|
is_feedback = true; |
|
|
if (standardInspectSiteDeviceDriver.getMode() == 2 && standardInspectSiteDeviceDriver.getMove() > 0) { |
|
|
} else { |
|
|
inst.setExecute_status("1"); |
|
|
log.info("设备{} 请求取货,光电信号:{}",addressdevice,standardManipulatorStackingSiteDeviceDriver.getMove()); |
|
|
is_feedback = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
//请求放货
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
} else if ("Unload".equals(action)) { |
|
|
|
|
|
if (standardInspectSiteDeviceDriver.getMode() == 2 && standardInspectSiteDeviceDriver.getMove() == 0) { |
|
|
|
|
|
inst.setExecute_status("3"); |
|
|
|
|
|
is_feedback = true; |
|
|
is_feedback = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if ("PauseOnStation".equals(type)) { |
|
|
if (addressdevice.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) { |
|
|
if (addressdevice.getDeviceDriver() instanceof StandardManipulatorStackingSiteDeviceDriver) { |
|
|
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
standardManipulatorStackingSiteDeviceDriver = (StandardManipulatorStackingSiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
//请求取货
|
|
|
if(standardManipulatorStackingSiteDeviceDriver.getMove()==0){ |
|
|
if ("Load".equals(action)) { |
|
|
is_feedback = true; |
|
|
if (addressdevice.getHas_goods() > 0) { |
|
|
} else { |
|
|
inst.setExecute_status("1"); |
|
|
log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardManipulatorStackingSiteDeviceDriver.getMove()); |
|
|
is_feedback = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
//请求放货
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
} else if ("Unload".equals(action)) { |
|
|
|
|
|
if (addressdevice.getHas_goods() == 0) { |
|
|
|
|
|
inst.setExecute_status("3"); |
|
|
|
|
|
is_feedback = true; |
|
|
is_feedback = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
//放货的进入前等待和离开等待
|
|
|
//请求取货
|
|
|
if (action.equals("Unload")) { |
|
|
if ("Load".equals(action)) { |
|
|
if ("EntryRequired".equals(type)) { |
|
|
if (addressdevice.getHas_goods() > 0) { |
|
|
if (addressdevice.getDeviceDriver() instanceof StandardManipulatorStackingSiteDeviceDriver) { |
|
|
inst.setExecute_status("1"); |
|
|
standardManipulatorStackingSiteDeviceDriver = (StandardManipulatorStackingSiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
is_feedback = true; |
|
|
if(standardManipulatorStackingSiteDeviceDriver.getMove()==0){ |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
} else { |
|
|
|
|
|
log.info("设备{} 请求放货,光电信号:{}",addressdevice,standardManipulatorStackingSiteDeviceDriver.getMove()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
//请求放货
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
} else if ("Unload".equals(action)) { |
|
|
|
|
|
if (addressdevice.getHas_goods() == 0) { |
|
|
|
|
|
inst.setExecute_status("3"); |
|
|
|
|
|
is_feedback = true; |
|
|
is_feedback = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if ("PauseOnStation".equals(type)) { |
|
|
if (addressdevice.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) { |
|
|
if (addressdevice.getDeviceDriver() instanceof StandardManipulatorStackingSiteDeviceDriver) { |
|
|
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
standardManipulatorStackingSiteDeviceDriver = (StandardManipulatorStackingSiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
//是否需要人工确认
|
|
|
if(standardManipulatorStackingSiteDeviceDriver.getMove()==1){ |
|
|
String is_unlock = yzjaSpecialDeviceDriver.getIs_unlock(); |
|
|
|
|
|
|
|
|
|
|
|
//请求取货
|
|
|
|
|
|
if ("Load".equals(action)) { |
|
|
|
|
|
if (is_unlock.equals("true")) { |
|
|
|
|
|
if (addressdevice.getHas_goods() > 0 && yzjaSpecialDeviceDriver.getManua_confirm() == 2) { |
|
|
|
|
|
yzjaSpecialDeviceDriver.setManua_confirm(0); |
|
|
|
|
|
inst.setExecute_status("1"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
} else if (ObjectUtil.isEmpty(inst.getExecute_status()) || !inst.getExecute_status().equals("1")){ |
|
|
|
|
|
yzjaSpecialDeviceDriver.setManua_confirm(1); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
if (addressdevice.getHas_goods() > 0) { |
|
|
|
|
|
inst.setExecute_status("1"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//请求放货
|
|
|
|
|
|
} else if ("Unload".equals(action)) { |
|
|
|
|
|
if (is_unlock.equals("true")) { |
|
|
|
|
|
if (addressdevice.getHas_goods() == 0 && yzjaSpecialDeviceDriver.getManua_confirm() == 2) { |
|
|
|
|
|
yzjaSpecialDeviceDriver.setManua_confirm(0); |
|
|
|
|
|
inst.setExecute_status("3"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
} else if (ObjectUtil.isEmpty(inst.getExecute_status()) || !inst.getExecute_status().equals("3")){ |
|
|
|
|
|
yzjaSpecialDeviceDriver.setManua_confirm(1); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
if (addressdevice.getHas_goods() == 0) { |
|
|
|
|
|
inst.setExecute_status("3"); |
|
|
|
|
|
is_feedback = true; |
|
|
is_feedback = true; |
|
|
|
|
|
} else { |
|
|
|
|
|
log.info("设备{} 请求离开,光电信号:{}",addressdevice,standardManipulatorStackingSiteDeviceDriver.getMove()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
|
|
|
//请求取货
|
|
|
|
|
|
if ("Load".equals(action)) { |
|
|
|
|
|
inst.setExecute_status("1"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
//请求放货
|
|
|
|
|
|
} else if ("Unload".equals(action)) { |
|
|
|
|
|
inst.setExecute_status("3"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//取放货完成
|
|
|
|
|
|
} else if ("onStation".equals(type)) { |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("取放货完成"); |
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { |
|
|
|
|
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
|
|
//取货完成
|
|
|
|
|
|
if ("Load".equals(action)) { |
|
|
|
|
|
if (standardInspectSiteDeviceDriver.getMode() == 2 && standardInspectSiteDeviceDriver.getMove() == 0) { |
|
|
|
|
|
inst.setExecute_device_code(processingVehicle); |
|
|
|
|
|
inst.setExecute_status("2"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
} |
|
|
|
|
|
//放货完成
|
|
|
|
|
|
} else if ("Unload".equals(action)) { |
|
|
|
|
|
if (standardInspectSiteDeviceDriver.getMode() == 2 && standardInspectSiteDeviceDriver.getMove() > 0) { |
|
|
|
|
|
inst.setExecute_device_code(address); |
|
|
|
|
|
inst.setExecute_status("4"); |
|
|
|
|
|
is_feedback = true; |
|
|
is_feedback = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
com.alibaba.fastjson.JSONObject requestjo = new com.alibaba.fastjson.JSONObject(); |
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
if (is_feedback) { |
|
|
//取货完成
|
|
|
requestjo.put("task_code", jobno); |
|
|
if ("Load".equals(action)) { |
|
|
requestjo.put("operation", action); |
|
|
inst.setExecute_device_code(processingVehicle); |
|
|
if (type.equals("entryRequired") || type.equals("EntryRequired")) { |
|
|
inst.setExecute_status("2"); |
|
|
requestjo.put("entryRequired", "true"); |
|
|
is_feedback = true; |
|
|
} else { |
|
|
//放货完成
|
|
|
requestjo.put("pauseOnStation", "true"); |
|
|
} else if ("Unload".equals(action)) { |
|
|
|
|
|
inst.setExecute_device_code(address); |
|
|
|
|
|
inst.setExecute_status("4"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
log.info("反馈AGV请求数据:{}", requestjo); |
|
|
|
|
|
System.out.println("back agv:" + requestjo); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) { |
|
|
|
|
|
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); |
|
|
|
|
|
//取货完成
|
|
|
|
|
|
if ("Load".equals(action)) { |
|
|
|
|
|
inst.setExecute_device_code(processingVehicle); |
|
|
|
|
|
inst.setExecute_status("2"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
//放货完成
|
|
|
|
|
|
} else if ("Unload".equals(action)) { |
|
|
|
|
|
inst.setExecute_device_code(processingVehicle); |
|
|
|
|
|
inst.setExecute_status("4"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
|
|
|
//取货完成
|
|
|
|
|
|
if ("Load".equals(action)) { |
|
|
|
|
|
inst.setExecute_device_code(processingVehicle); |
|
|
|
|
|
inst.setExecute_status("2"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
//放货完成
|
|
|
|
|
|
} else if ("Unload".equals(action)) { |
|
|
|
|
|
inst.setExecute_device_code(processingVehicle); |
|
|
|
|
|
inst.setExecute_status("4"); |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
JSONObject requestjo = new JSONObject(); |
|
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL); |
|
|
JSONArray ja = new JSONArray(); |
|
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT); |
|
|
if (is_feedback) { |
|
|
|
|
|
String param = ""; |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
if (str.length() > 0) { |
|
|
|
|
|
backaddress = backaddress + str; |
|
|
|
|
|
} |
|
|
|
|
|
if ("onEntry".equals(type)) { |
|
|
|
|
|
param = "EntryPermitted-" + backaddress + action; |
|
|
|
|
|
} else if ("onStation".equals(type)) { |
|
|
|
|
|
param = "ContinueOnStation-" + backaddress + action; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
jo.put("key", param); |
|
|
agvurl = agvurl + ":" + agvport + "/api/route/transportOrders/" + jobno + "/interact"; |
|
|
jo.put("value", "False"); |
|
|
|
|
|
ja.add(jo); |
|
|
|
|
|
requestjo.put("properties", ja); |
|
|
|
|
|
log.info("反馈AGV请求数据:{}", requestjo); |
|
|
|
|
|
System.out.println("back agv:" + requestjo); |
|
|
|
|
|
|
|
|
|
|
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL); |
|
|
|
|
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT); |
|
|
|
|
|
|
|
|
|
|
|
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + jobno + "/interact"; |
|
|
HttpResponse result = HttpRequest.post(agvurl) |
|
|
|
|
|
.body(String.valueOf(requestjo)) |
|
|
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
|
|
|
.execute(); |
|
|
|
|
|
} |
|
|
|
|
|
return requestjo.toString(); |
|
|
|
|
|
|
|
|
HttpResponse result = HttpRequest.post(agvurl) |
|
|
|
|
|
.body(String.valueOf(requestjo)) |
|
|
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
|
|
|
.execute(); |
|
|
|
|
|
} |
|
|
} |
|
|
is_feedback = false; |
|
|
|
|
|
|
|
|
|
|
|
return requestjo.toString(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -2002,6 +1935,24 @@ public class AgvServiceImpl implements AgvService { |
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获得之后num个天的时间 |
|
|
|
|
|
* |
|
|
|
|
|
* @param num |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public static String getNextDay(int num) { |
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, num); |
|
|
|
|
|
Date date = calendar.getTime(); |
|
|
|
|
|
TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai"); |
|
|
|
|
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); |
|
|
|
|
|
df.setTimeZone(tz); |
|
|
|
|
|
String nowAsISO = df.format(date); |
|
|
|
|
|
return nowAsISO; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
public static void main(String[] args) { |
|
|
String address = "L1-01-01"; |
|
|
String address = "L1-01-01"; |
|
|
if (address.indexOf("-") > 0) { |
|
|
if (address.indexOf("-") > 0) { |
|
|