NDC调度接口更新

This commit is contained in:
loujf
2022-11-22 16:56:56 +08:00
parent a7cdfc6fcf
commit b8bcdd7dce
9 changed files with 3019 additions and 42 deletions

View File

@@ -66,4 +66,6 @@ public interface NDCAgvService {
*/
public byte[] sendAgvOneModeInst(int phase, int index, int result);
void updateAgvFromCache(AgvDto dto);
}

View File

@@ -439,7 +439,8 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
//请求放货
} else if ("Unload".equals(action)) {
if (standardInspectSiteDeviceDriver.getMode() == 2 && standardInspectSiteDeviceDriver.getMove() == 0) {
if (standardInspectSiteDeviceDriver.getMode() == 2
&& standardInspectSiteDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
@@ -856,7 +857,8 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
//放货完成离开
if (lnshStationDeviceDriver.getFlag() == 3) {
if (lnshStationDeviceDriver.getMove() == 1 && (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 2)) {
if (lnshStationDeviceDriver.getMove() == 1
&& (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 2)) {
flag = true;
lnshStationDeviceDriver.setFlag(0);
lnshStationDeviceDriver.writing(3);

View File

@@ -130,6 +130,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getInstruction_type());
int priority = Integer.parseInt(inst.getPriority()) + 128;
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
@@ -382,4 +383,12 @@ public class NDCAgvServiceImpl implements NDCAgvService {
return AGVDeviceStatus;
}
@Override
public void updateAgvFromCache(AgvDto dto) {
if (AGVDeviceStatus.containsKey(dto.getName())) {
AGVDeviceStatus.remove(dto.getName());
}
AGVDeviceStatus.put(dto.getName(), dto);
}
}

View File

@@ -158,5 +158,12 @@ public interface AcsToWmsService {
*/
HttpResponse queryDoorsStatus();
/**
* 向WMS反馈动作状态
*
* @return Map<String, Object>
*/
public HttpResponse feedbackActionStatusToWms(JSONArray arr);
}

View File

@@ -1,8 +1,10 @@
package org.nl.acs.ext.wms.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -912,4 +914,49 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
@Override
public HttpResponse feedbackActionStatusToWms(JSONArray data) {
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String task_code = "";
for (int i = 0; i < data.size(); i++) {
net.sf.json.JSONObject json = (net.sf.json.JSONObject) data.get(i);
task_code = json.optString("task_code");
}
TaskDto taskDto = taskService.findByCode(task_code);
String vehicle_code = taskDto.getVehicle_code();
HttpResponse result2 = null;
log.info("feedbackActionStatusToWms-----请求参数{}", data.toString());
AddressDto addressDto = addressService.findByCode("feedbackActionStatusToWms");
String methods_url = addressDto.getMethods_url();
try {
result2 = HttpRequest.post(wmsurl + methods_url)
// .header("Authorization", token)
.body(String.valueOf(data))
.execute();
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
log.info("feedbackActionStatusToWms-----异常返回参数{}", msg);
}
String type = "";
if(!ObjectUtil.isEmpty(result2)){
if (result2.getStatus() == 200) {
type = "info";
} else {
type = "error";
}
} else {
type = "error";
}
JSONObject jo = (JSONObject) JSON.toJSON(result2.body());
log.info("feedbackActionStatusToWms-----输出参数{}", jo.toString());
return result2;
}
}

View File

@@ -36,7 +36,7 @@ public class InstructionDto implements Serializable {
/**
* 执行状态
*/
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 9到达等待点
private String execute_status;
/**

View File

@@ -889,28 +889,28 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String next_device_code = acsTask.getNext_device_code();
String maxInstnumber = acsConfigService.findConfigFromCache().get(AcsConfig.MAXINSTNUMBER);
/**
* 开始平均分解校验
*/
String this_device_code = this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code());
if (StrUtil.isEmpty(this_device_code)) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, acsTask.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) {
index = m + 1;
break;
}
}
next_device_code = pathlist.get(index);
} else {
next_device_code = this_device_code;
}
// /**
// * 开始平均分解校验
// */
// String this_device_code = this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code());
// if (StrUtil.isEmpty(this_device_code)) {
// List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, acsTask.getNext_device_code(), route_plan_code);
// RouteLineDto routeLineDto = shortPathsList.get(0);
// String path = routeLineDto.getPath();
// String type = routeLineDto.getType();
// String[] str = path.split("->");
// List<String> pathlist = Arrays.asList(str);
// int index = 0;
// for (int m = 0; m < pathlist.size(); m++) {
// if (pathlist.get(m).equals(start_device_code)) {
// index = m + 1;
// break;
// }
// }
// next_device_code = pathlist.get(index);
// } else {
// next_device_code = this_device_code;
// }
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();