rev:接口优化

This commit is contained in:
2026-01-16 09:57:37 +08:00
parent e16fa8a789
commit 863094a9fa
11 changed files with 206 additions and 137 deletions

View File

@@ -15,6 +15,7 @@ import org.nl.acs.agv.server.dao.AgvResponse;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.agv.xg_agv_car.XgAgvCarDeviceDriver; import org.nl.acs.device_driver.agv.xg_agv_car.XgAgvCarDeviceDriver;
import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.enums.InstructionStatusEnum;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.domain.Task; import org.nl.acs.task.domain.Task;
@@ -47,8 +48,9 @@ public class QueryAGVStatus {
TaskService taskService = SpringContextHolder.getBean(TaskService.class); TaskService taskService = SpringContextHolder.getBean(TaskService.class);
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
List<Instruction> allInstFromCache = instructionService.findAllInstFromCache(); List<Instruction> allInstFromCache = instructionService.findAllInstFromCache();
List<Instruction> instructionList = allInstFromCache.stream().filter(item -> Integer.parseInt(item.getInstruction_status()) <= Integer.parseInt(InstructionStatusEnum.BUSY.getIndex())).collect(Collectors.toList());
// List<Instruction> agvInstruction = allInstFromCache.stream().filter(item -> AgvSystemTypeEnum.One_NDC_System_Type.getIndex().equals(item.getAgv_system_type()) || AgvSystemTypeEnum.XG_System_Type.getIndex().equals(item.getAgv_system_type())).collect(Collectors.toList()); // List<Instruction> agvInstruction = allInstFromCache.stream().filter(item -> AgvSystemTypeEnum.One_NDC_System_Type.getIndex().equals(item.getAgv_system_type()) || AgvSystemTypeEnum.XG_System_Type.getIndex().equals(item.getAgv_system_type())).collect(Collectors.toList());
if (CollUtil.isEmpty(allInstFromCache) || allInstFromCache.size() < 1) { if (CollUtil.isEmpty(instructionList) || instructionList.size() < 1) {
return; return;
} }
for (Instruction instruction : allInstFromCache) { for (Instruction instruction : allInstFromCache) {
@@ -57,31 +59,38 @@ public class QueryAGVStatus {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
agvurl = agvurl + ":" + agvport + "/api/fms/taskStatus "; agvurl = agvurl + ":" + agvport + "/api/fms/taskStatus ";
param.put("TaskNo", instruction.getInstruction_code()); param.put("TaskNo", instruction.getInstruction_code());
log.info("根据运单号查询运单状态的请求:{}", agvurl); log.info("根据运单号查询运单状态的请求:{}", agvurl+ param);
HttpResponse result = HttpRequest.get(agvurl) HttpResponse result = HttpRequest.get(agvurl)
.body(String.valueOf(param)) .body(String.valueOf(param))
.timeout(20000)//超时,毫秒 .timeout(20000)//超时,毫秒
.execute(); .execute();
log.info("根据运单号查询运单状态的请求反馈:{}", result); log.info("指令号:"+instruction.getInstruction_code()+"根据运单号查询运单状态的请求反馈:{}", result);
if (result == null) {
continue;
}
String body = result.body(); String body = result.body();
JSONObject json = JSONObject.parseObject(body); JSONObject json = JSONObject.parseObject(body);
JSONObject taskStatus = json.getJSONObject("TaskStatus"); JSONObject taskStatus = json.getJSONObject("TaskStatus");
String instructionCode = taskStatus.getString("TaskNo"); String instructionCode = taskStatus.getString("TaskNo");
if (instructionCode == null) {
continue;
}
if ("true".equals(json.getString("Result")) && instructionCode.equals(instruction.getInstruction_code())) { if ("true".equals(json.getString("Result")) && instructionCode.equals(instruction.getInstruction_code())) {
// 正在执行=running // 正在执行=running
// 完成=finish // 完成=finish
// 失败=failed(主动失败) // 失败=failed(主动失败)
// 终止=aborted(被人为终止) // 终止=aborted(被人为终止)
String state = json.getString("Status"); String state = json.getString("Status");
String carNo = json.getString("VehicleNo"); TaskDto task = taskService.findById(instruction.getTask_id());
if ("running".equals(state)) { if (!StrUtil.isEmpty(json.getString("VehicleNo"))) {
TaskDto task = taskService.findById(instruction.getTask_id()); String carNo = json.getString("VehicleNo");
if ("0".equals(instruction.getInstruction_status())&&"1".equals(task.getTask_status())) { instruction.setCarno(carNo);
instruction.setCarno(carNo); task.setCar_no(carNo);
}
if ("running".equals(state)||"idle".equals(state)) {
if ("0".equals(instruction.getInstruction_status())) {
instruction.setInstruction_status("1"); instruction.setInstruction_status("1");
instructionService.update(instruction); instructionService.update(instruction);
instructionService.update(instruction);
task.setCar_no(carNo);
task.setTask_id(instruction.getTask_id()); task.setTask_id(instruction.getTask_id());
taskService.update(task); taskService.update(task);
} }
@@ -96,13 +105,15 @@ public class QueryAGVStatus {
e.printStackTrace(); e.printStackTrace();
} }
} }
} else if ("failed".equals(state) || "aborted".equals(state)) { } else if ("failed".equals(state) || "aborted".equals(state) || "deleted".equals(state)) {
TaskDto task = taskService.findById(instruction.getTask_id()); TaskDto taskDto = taskService.findById(instruction.getTask_id());
List<String> list = Arrays.asList("0", "1"); List<String> list = Arrays.asList("0", "1");
if (list.contains(instruction.getInstruction_status())&&"1".equals(task.getTask_status())) { if (list.contains(instruction.getInstruction_status())) {
instruction.setInstruction_status("1"); instruction.setInstruction_status("3");
instruction.setRemark("调度取消指令"); instruction.setRemark("调度取消指令");
instructionService.update(instruction); instructionService.update(instruction);
taskDto.setRemark("调度取消指令");
taskService.update(taskDto);
} }
} }
} }

View File

@@ -285,7 +285,7 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
//二次分配更新点位 //二次分配更新点位
updataTask(inst, type,jo.getString("data")); updataTask(inst, type, jo.getString("data"));
return jo.getString("data"); return jo.getString("data");
} else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
@@ -318,18 +318,18 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
String vehicleNo = requestParam.getString("VehicleNo"); String vehicleNo = requestParam.getString("VehicleNo");
LuceneLogDto logDto1 = LuceneLogDto.builder() LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(vehicleNo) .device_code(vehicleNo)
.content("agv申请进入或者离开,请求参数:"+ requestParam) .content("agv申请进入或者离开,请求参数:" + requestParam)
.build(); .build();
logDto1.setLog_level(4); logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1); luceneExecuteLogService.deviceExecuteLog(logDto1);
if (resourceID.equals("659") || resourceID.equals("17")) { if (resourceID.equals("10")) {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("code", "200"); json.put("code", "200");
json.put("message", "操作成功"); json.put("message", "操作成功");
log.info("agv申请离开成功返回参数"+ json); log.info("agv申请离开成功返回参数" + json);
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(vehicleNo) .device_code(vehicleNo)
.content("agv申请离开成功返回参数"+ json) .content("agv申请离开成功返回参数" + json)
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
@@ -369,7 +369,7 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
} }
} }
private void updataTask(Instruction instructionDto,String type, String newPoint) { private void updataTask(Instruction instructionDto, String type, String newPoint) {
TaskDto taskUpdate = new TaskDto(); TaskDto taskUpdate = new TaskDto();
if ("1".equals(type)) { if ("1".equals(type)) {
@@ -396,23 +396,26 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
String vehicleNo = requestParam.getString("VehicleNo"); String vehicleNo = requestParam.getString("VehicleNo");
LuceneLogDto logDto1 = LuceneLogDto.builder() LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(vehicleNo) .device_code(vehicleNo)
.content("agv申请离开,请求参数:"+ requestParam) .content("agv申请离开请求参数:" + requestParam)
.build(); .build();
logDto1.setLog_level(4); logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1); luceneExecuteLogService.deviceExecuteLog(logDto1);
Device device = deviceAppService.findDeviceByCode(resourceID); List<StorageCell> storageCells = storageCellMapper.selectList(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getAddress, resourceID).orderByDesc(StorageCell::getUpdate_time));
RasterDeviceDriver rasterDeviceDriver = (RasterDeviceDriver) device.getDeviceDriver(); StorageCell storageCell = storageCells.get(0);
rasterDeviceDriver.setOption(1); if (storageCell == null) {
JSONObject jo = new JSONObject(); throw new BadRequestException("未找到该设备");
jo.put("code", "200"); }
jo.put("message", "请求成功"); JSONObject json = new JSONObject();
json.put("code", "200");
json.put("message", "操作成功");
log.info("agv申请离开成功返回agv参数:" + json);
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(vehicleNo) .device_code(vehicleNo)
.content("agv申请离开成功返回agv参数:" + jo) .content("agv申请离开成功返回agv参数:" + json)
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
return jo; return json;
} }
@Override @Override
@@ -444,7 +447,7 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
.execute(); .execute();
log.info("暂停agv请求反馈:{}", result); log.info("暂停agv请求反馈:{}", result);
return result; return result;
}else { } else {
return null; return null;
} }
} else { } else {
@@ -480,7 +483,7 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
log.info("恢复所有agv请求反馈:{}", result); log.info("恢复所有agv请求反馈:{}", result);
return result; return result;
}else { } else {
return null; return null;
} }
} else { } else {
@@ -495,23 +498,48 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
String vehicleNo = requestParam.getString("VehicleNo"); String vehicleNo = requestParam.getString("VehicleNo");
LuceneLogDto logDto1 = LuceneLogDto.builder() LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(vehicleNo) .device_code(vehicleNo)
.content("agv申请进入,请求参数:"+ requestParam) .content("agv申请进入请求参数:" + requestParam)
.build(); .build();
logDto1.setLog_level(4); logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1); luceneExecuteLogService.deviceExecuteLog(logDto1);
Device device = deviceAppService.findDeviceByCode(resourceID); List<StorageCell> storageCells = storageCellMapper.selectList(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getAddress, resourceID).orderByDesc(StorageCell::getUpdate_time));
RasterDeviceDriver rasterDeviceDriver = (RasterDeviceDriver) device.getDeviceDriver(); StorageCell storageCell = storageCells.get(0);
rasterDeviceDriver.setOption(1); if (storageCell == null) {
JSONObject jo = new JSONObject(); throw new RuntimeException("设备不存在");
jo.put("code", "200"); }
jo.put("message", "请求成功"); String storage_code = storageCell.getStorage_code();
LuceneLogDto logDto2 = LuceneLogDto.builder() Device device = deviceAppService.findDeviceByCode(storage_code);
.device_code(vehicleNo) if (device == null) {
.content("agv申请进入成功返回agv参数:" + jo) throw new RuntimeException("设备不存在");
.build(); }
logDto2.setLog_level(4); String lamd_device = device.getExtraValue().get("link_three_lamp").toString();
luceneExecuteLogService.deviceExecuteLog(logDto2); Device linkDevice = deviceAppService.findDeviceByCode(lamd_device);
return jo; RasterDeviceDriver rasterDeviceDriver = (RasterDeviceDriver) linkDevice.getDeviceDriver();
if (rasterDeviceDriver.getRaster() == 1) {
JSONObject json = new JSONObject();
json.put("code", "200");
json.put("message", "操作成功");
log.info("agv申请进入成功返回agv参数:" + json);
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(vehicleNo)
.content("agv申请进入成功当前光电信号为"+rasterDeviceDriver.getRaster()+",返回agv参数:" + json)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
return json;
} else {
JSONObject json = new JSONObject();
json.put("code", "400");
json.put("message", "申请进入失败光电信号不为1当前信号为" + rasterDeviceDriver.getRaster());
log.info("agv申请进入失败返回agv参数:" + json);
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(vehicleNo)
.content("agv申请进入失败光电信号不为1当前信号为" + rasterDeviceDriver.getRaster()+"返回agv参数:" + json)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
return json;
}
} }
@Override @Override

View File

@@ -127,7 +127,6 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
break; break;
} }
int[] arr = new int[count]; int[] arr = new int[count];
StringBuffer bs = new StringBuffer(); StringBuffer bs = new StringBuffer();

View File

@@ -31,6 +31,10 @@ import org.nl.acs.route.domain.RouteLine;
import org.nl.acs.route.service.mapper.RouteLineMapper; import org.nl.acs.route.service.mapper.RouteLineMapper;
import org.nl.acs.storage_cell.domain.StorageCell; import org.nl.acs.storage_cell.domain.StorageCell;
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper; import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
import org.nl.acs.udw.UnifiedData;
import org.nl.acs.udw.UnifiedDataAccessorFactory;
import org.nl.acs.udw.dto.UdwDto;
import org.nl.acs.udw.service.impl.UnifiedDataUnit;
import org.nl.acs.utils.ConvertUtil; import org.nl.acs.utils.ConvertUtil;
import org.nl.acs.utils.PageUtil; import org.nl.acs.utils.PageUtil;
import org.nl.acs.utils.ReadUtil; import org.nl.acs.utils.ReadUtil;
@@ -390,20 +394,15 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
log.info("设备删除成功!"); log.info("设备删除成功!");
if (deviceByCode != null) { if (deviceByCode != null) {
if (StrUtil.equals("storage", deviceByCode.getDeviceDriverDefination().getFitDeviceTypes().get(0).name())) {
// storageTab.delete("substring_index( storage_code,'-',1)= '" + device_code + "'");
storageCellMapper.deleteByStorageCode(device_code);
} else {
// JSONObject data = storageTab.query("storage_code ='" + device_code + "'").uniqueResult(0); // JSONObject data = storageTab.query("storage_code ='" + device_code + "'").uniqueResult(0);
StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper) StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, device_code) .eq(StorageCell::getStorage_code, device_code)
.one(); .one();
if (storageCell != null) { if (storageCell != null) {
// storageTab.delete("storage_code = '" + device_code + "'"); // storageTab.delete("storage_code = '" + device_code + "'");
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("storage_code", device_code); map.put("storage_code", device_code);
storageCellMapper.deleteByMap(map); storageCellMapper.deleteByMap(map);
}
} }
} }
// wo.delete("device_id = '" + device_id + "'"); // wo.delete("device_id = '" + device_id + "'");
@@ -993,7 +992,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
standardInspectSiteDeviceDriver.setBatch(batch); standardInspectSiteDeviceDriver.setBatch(batch);
device.setMaterial_type(material_type); device.setMaterial_type(material_type);
device.setBatch(batch); device.setBatch(batch);
}else if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { } else if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
BeltConveyorDeviceDriver beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) device.getDeviceDriver(); BeltConveyorDeviceDriver beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) device.getDeviceDriver();
beltConveyorDeviceDriver.setDeviceStatus(form); beltConveyorDeviceDriver.setDeviceStatus(form);
} }
@@ -1262,29 +1261,24 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
@Override @Override
public JSONArray testRead(Map map) { public JSONArray testRead(Map map) {
List dbItems = (List) map.get("dbItems"); List dbItems = (List) map.get("dbItems");
String opc_id = (String) map.get("opc_id"); Object ob = dbItems.get(0);
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
List<String> itemString = new ArrayList<String>(); String code = json.getString("code");
String unified_key = "opc_value";
for (int i = 0; i < dbItems.size(); i++) { UnifiedDataUnit unifiedDataUnit = UnifiedDataAccessorFactory.getUnifiedDataAppService().getUnifiedDataUnit(unified_key);
Object ob = dbItems.get(i); String key;
JSONObject json = (JSONObject) JSONObject.toJSON(ob); Map storage;
itemString.add(json.getString("code")); Iterator var14;
storage = unifiedDataUnit.getStorage();
} var14 = storage.keySet().iterator();
Server server = ReadUtil.getServer(opc_id);
final Map<String, Object> readList = ReadUtil.read(itemString, server);
JSONArray result = new JSONArray(); JSONArray result = new JSONArray();
for (int i = 0; i < dbItems.size(); i++) { JSONObject jo = new JSONObject();
Object ob = dbItems.get(i); while (var14.hasNext()) {
JSONObject json = (JSONObject) JSONObject.toJSON(ob); key = (String) var14.next();
String code = json.getString("code"); if (code.equals(key)) {
if (readList.containsKey(code)) { json.put("dbr_value", ((Boolean) ((UnifiedData) storage.get(key)).getValue()).booleanValue() ? 1 : 0);
json.put("dbr_value", readList.get(code)); result.add(json);
} }
result.add(json);
} }
return result; return result;
} }
@@ -1865,13 +1859,13 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
String in_device_name = null; String in_device_name = null;
String en_device_name = null; String en_device_name = null;
String zh_device_name = null; String zh_device_name = null;
if(list.size() > 6 && ObjectUtil.isNotEmpty(list.get(6))){ if (list.size() > 6 && ObjectUtil.isNotEmpty(list.get(6))) {
in_device_name = list.get(6).toString(); in_device_name = list.get(6).toString();
} }
if(list.size() > 7 && ObjectUtil.isNotEmpty(list.get(7))){ if (list.size() > 7 && ObjectUtil.isNotEmpty(list.get(7))) {
en_device_name = list.get(7).toString(); en_device_name = list.get(7).toString();
} }
if(list.size() > 8 && ObjectUtil.isNotEmpty(list.get(8))){ if (list.size() > 8 && ObjectUtil.isNotEmpty(list.get(8))) {
zh_device_name = list.get(8).toString(); zh_device_name = list.get(8).toString();
} }
@@ -1894,13 +1888,13 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
if (ObjectUtil.isNotEmpty(dto)) { if (ObjectUtil.isNotEmpty(dto)) {
continue; continue;
} }
if(StrUtil.isEmpty(zh_device_name)){ if (StrUtil.isEmpty(zh_device_name)) {
zh_device_name = StrUtil.isNotEmpty(device_name) ? device_name : device_code; zh_device_name = StrUtil.isNotEmpty(device_name) ? device_name : device_code;
} }
if(StrUtil.isEmpty(en_device_name)){ if (StrUtil.isEmpty(en_device_name)) {
en_device_name = StrUtil.isNotEmpty(device_name) ? device_name : device_code; en_device_name = StrUtil.isNotEmpty(device_name) ? device_name : device_code;
} }
if (StrUtil.isEmpty(in_device_name)){ if (StrUtil.isEmpty(in_device_name)) {
in_device_name = StrUtil.isNotEmpty(device_name) ? device_name : device_code; in_device_name = StrUtil.isNotEmpty(device_name) ? device_name : device_code;
} }
//按照列获取 //按照列获取

View File

@@ -116,6 +116,12 @@ public interface OpcDeviceDriver extends DeviceDriver {
return ((Short) value).intValue(); return ((Short) value).intValue();
} else if (value instanceof Number) { } else if (value instanceof Number) {
return ((Number) value).intValue(); return ((Number) value).intValue();
} else if (value instanceof Boolean) {
if (((Boolean) value).booleanValue()) {
return Integer.valueOf(1);
} else {
return Integer.valueOf(0);
}
} }
throw new ClassCastException("Cannot cast " + value.getClass().getName() + " to Integer"); throw new ClassCastException("Cannot cast " + value.getClass().getName() + " to Integer");
} }

View File

@@ -61,13 +61,6 @@ public class RasterDeviceDriver extends AbstractOpcDeviceDriver implements Devic
if (this.raster != this.last_raster) { if (this.raster != this.last_raster) {
logService.deviceExecuteLog(new LuceneLogDto(this.device_code, "自动线程读取信号: 光栅信号,由" + this.last_raster + "->" + this.raster)); logService.deviceExecuteLog(new LuceneLogDto(this.device_code, "自动线程读取信号: 光栅信号,由" + this.last_raster + "->" + this.raster));
} }
if (this.raster == 1) {
keCongAgvService.pause(device_code);
}
if (this.raster == 0) {
keCongAgvService.resume(device_code);
}
last_raster = raster; last_raster = raster;
} }

View File

@@ -227,4 +227,6 @@ public interface AcsToWmsService {
ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param); ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param);
String applyIn(JSONObject ja); String applyIn(JSONObject ja);
String applyOut(JSONObject ja);
} }

View File

@@ -770,6 +770,42 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
} }
@Override
public String applyOut(JSONObject param) {
try {
MDC.put(log_file_type, log_type);
log.info("applyOut-----agv申请进入,请求lms参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyOut");
String url = wmsurl + addressDto.getMethods_url();
HttpResponse result2 = null;
try {
result2 = HttpRequest.post(url)
.addInterceptor(tLogHutoolhttpInterceptor)
.header(Header.USER_AGENT, "Hutool http")
.header("Authorization", token)
.body(String.valueOf(param))
.execute();
} catch (Exception e) {
String msg = e.getMessage();
log.info("applyOut-----输出参数{}", msg);
//网络不通
}
if (ObjectUtil.isEmpty(result2)) {
log.info("applyOut-----输出参数{}", "返回结果为空");
return null;
}
log.info("applyOut-----agv申请离开,lms返回参数{}", result2.body());
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyOut", String.valueOf(result2.getStatus()),
JSON.toJSONString(param), String.valueOf(result2.body()), "agv申请离开");
luceneLogService.interfaceExecuteLog(luceneLogDto);
return result2.body();
} finally {
MDC.remove(log_file_type);
}
}
@Override @Override
public String forceMove(JSONObject param) { public String forceMove(JSONObject param) {

View File

@@ -504,10 +504,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
throw new BadRequestException(LangProcess.msg("error_regional_max")); throw new BadRequestException(LangProcess.msg("error_regional_max"));
} }
//判断是否存在到同一个等待点的任务 //判断是否存在到同一个等待点的任务
List<Instruction> byCodeAndExcute = this.findByNextCode(task_code,dto.getNext_device_code()); // List<Instruction> byCodeAndExcute = this.findByNextCode(task_code,dto.getNext_device_code());
if (CollUtil.isNotEmpty(byCodeAndExcute)) { // if (CollUtil.isNotEmpty(byCodeAndExcute)) {
throw new BadRequestException("存在相同终点的任务,无法生成指令"); // throw new BadRequestException("存在相同终点的任务,无法生成指令");
} // }
String start_device_code = dto.getStart_device_code(); String start_device_code = dto.getStart_device_code();
// if (StrUtil.isNotEmpty(dto.getTask_code())) { // if (StrUtil.isNotEmpty(dto.getTask_code())) {

View File

@@ -55,41 +55,41 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable {
@Override @Override
public void autoRun() throws Exception { public void autoRun() throws Exception {
{ // {
//Thread.sleep(10000L); // //Thread.sleep(10000L);
isRun = true; // isRun = true;
//
Map<String, OpcServerManageDto> servers = this.opcServerManageService.queryAllServerMap(); // Map<String, OpcServerManageDto> servers = this.opcServerManageService.queryAllServerMap();
Map<String, List<List<OpcItemDto>>> pros; // Map<String, List<List<OpcItemDto>>> pros;
do { // do {
Thread.sleep(1000L); // Thread.sleep(1000L);
pros = this.deviceAppService.findAllFormatProtocolFromDriver(); // pros = this.deviceAppService.findAllFormatProtocolFromDriver();
} while (ObjectUtil.isEmpty(pros)); // } while (ObjectUtil.isEmpty(pros));
Set<String> keys = pros.keySet(); // Set<String> keys = pros.keySet();
Iterator var4 = keys.iterator(); // Iterator var4 = keys.iterator();
//代码执行一次 // //代码执行一次
while (var4.hasNext()) { // while (var4.hasNext()) {
String key = (String) var4.next(); // String key = (String) var4.next();
List<List<OpcItemDto>> list = (List) pros.get(key); // List<List<OpcItemDto>> list = (List) pros.get(key);
OpcServerManageDto opcServer = (OpcServerManageDto) servers.get(key); // OpcServerManageDto opcServer = (OpcServerManageDto) servers.get(key);
Iterator var8 = list.iterator(); // Iterator var8 = list.iterator();
while (var8.hasNext()) { // while (var8.hasNext()) {
List<OpcItemDto> groupProtols = (List) var8.next(); // List<OpcItemDto> groupProtols = (List) var8.next();
DeviceOpcProtocolRunable runable = new DeviceOpcProtocolRunable(); // DeviceOpcProtocolRunable runable = new DeviceOpcProtocolRunable();
runable.setProtocols(groupProtols); // runable.setProtocols(groupProtols);
runable.setOpcServer(opcServer); // runable.setOpcServer(opcServer);
this.executorService.submit(runable); // this.executorService.submit(runable);
} // }
} // }
//
// 同步无光电设备信号 // // 同步无光电设备信号
//Map<String, List<List<OpcItemDto>>> pros1 = this.deviceAppService.findAllFormatProtocolFromDriver(); // //Map<String, List<List<OpcItemDto>>> pros1 = this.deviceAppService.findAllFormatProtocolFromDriver();
//List<DeviceDriver> opcDrivers = this.deviceAppService.findDeviceDriver(DeviceDriver.class); // //List<DeviceDriver> opcDrivers = this.deviceAppService.findDeviceDriver(DeviceDriver.class);
//
while (true) { // while (true) {
Thread.sleep(3000L); // Thread.sleep(3000L);
} // }
} // }
} }
@Override @Override

View File

@@ -105,11 +105,11 @@ public class AutoCreateInst {
continue; continue;
} }
//判断是否存在到同一个等待点的任务 //判断是否存在到同一个等待点的任务
List<Instruction> byCodeAndExcute = instructionService.findByNextCode(taskcode,next_device_code); // List<Instruction> byCodeAndExcute = instructionService.findByNextCode(taskcode,next_device_code);
if (CollUtil.isNotEmpty(byCodeAndExcute)) { // if (CollUtil.isNotEmpty(byCodeAndExcute)) {
log.info("存在相同等待点的任务,无法生成指令"); // log.info("存在相同等待点的任务,无法生成指令");
continue; // continue;
} // }
// RouteLineDto routeLineDto = shortPathsList.get(0); // RouteLineDto routeLineDto = shortPathsList.get(0);
// String path = routeLineDto.getPath(); // String path = routeLineDto.getPath();