rev:优化一楼诺宝取货完成交互

This commit is contained in:
2025-06-12 20:09:52 +08:00
parent 031cc72b49
commit 58663e44df
2 changed files with 54 additions and 30 deletions

View File

@@ -83,6 +83,11 @@ public interface AcsConfig {
*/ */
String pgErrorSendLms = "pgErrorSendLms"; String pgErrorSendLms = "pgErrorSendLms";
/**
* 是否存在wms系统
*/
String isSendLms = "isSendLms";
/** /**
* 是否请求wms系统 * 是否请求wms系统
*/ */

View File

@@ -1,9 +1,12 @@
package org.nl.acs.agv; package org.nl.acs.agv;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver; import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver; import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver;
@@ -15,12 +18,17 @@ import org.nl.acs.task.enums.ActionTypeEnum;
import org.nl.acs.task.enums.AgvActionTypeEnum; import org.nl.acs.task.enums.AgvActionTypeEnum;
import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.acs.task.enums.AgvSystemTypeEnum;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
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.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.LinkedHashMap;
import java.util.Map;
/** /**
* @author zhangjiangwei * @author zhangjiangwei
*/ */
@@ -42,6 +50,8 @@ public class AgvWaitUtil {
@Autowired @Autowired
private LuceneExecuteLogService luceneExecuteLogService; private LuceneExecuteLogService luceneExecuteLogService;
@Autowired
ISysParamService paramService;
//取货前等待 //取货前等待
public JSONObject waitInGet(String startDeviceCode, Instruction inst) { public JSONObject waitInGet(String startDeviceCode, Instruction inst) {
@@ -50,7 +60,7 @@ public class AgvWaitUtil {
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver; BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
//agv诺宝对接位安全信号交互 //agv诺宝对接位安全信号交互
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) { if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) {
manipulatorAgvStationDeviceDriver.writing(2); manipulatorAgvStationDeviceDriver.writing(2);
@@ -130,15 +140,23 @@ public class AgvWaitUtil {
} }
//诺宝agv调lms更新点位 //诺宝agv调lms更新点位
if (inst.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { if (inst.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
if (!AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) {
applyLmsGetOut(inst);
}
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorAgvStationDeviceDriver.getTo_command() != 3) { if (manipulatorAgvStationDeviceDriver.getTo_command() != 3) {
manipulatorAgvStationDeviceDriver.writing(3); manipulatorAgvStationDeviceDriver.writing(3);
} }
if (manipulatorAgvStationDeviceDriver.getAction() != 0) { try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (manipulatorAgvStationDeviceDriver.getAction() == 0 && manipulatorAgvStationDeviceDriver.getMode() == 2) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.isSendLms).getValue(), CommonFinalParam.ONE)){
if (!AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) {
applyLmsGetOut(inst);
}
}
} else {
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) .device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
.content("未给agv离开信号原因是" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0") .content("未给agv离开信号原因是" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0")
@@ -154,38 +172,39 @@ public class AgvWaitUtil {
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取货完成后请求离开返回参数 - {}", map);
log.info("允许仙工AGV取货完成后请求离开设备号 - {}", startDeviceCode); log.info("允许仙工AGV取货完成后请求离开设备号 - {}", startDeviceCode);
return map; return map;
} }
private void applyLmsGetOut(Instruction inst) { private void applyLmsGetOut(Instruction inst) {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("taskCode", inst.getTask_code()); param.put("taskCode", inst.getTask_code());
param.put("actionType", ActionTypeEnum.IN_FINISHING.getCode().toString()); param.put("actionType", ActionTypeEnum.IN_FINISHING.getCode().toString());
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("诺宝取货完成请求lms:" + inst.getTask_code() + "--" + ActionTypeEnum.IN_FINISHING.getStatus())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
String response = acsToWmsService.secondaryAllocationPoint(param);
JSONObject jo = JSON.parseObject(response);
if (jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(inst.getCarno()) .device_code(inst.getCarno())
.content("诺宝取货完成请求lms:" + inst.getTask_code() + "--" + ActionTypeEnum.IN_FINISHING.getStatus()) .content("诺宝取货完成请求lms,参数,接口返回:" + jo)
.build(); .build();
logDto.setLog_level(4); logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto2);
String response = acsToWmsService.secondaryAllocationPoint(param); } else {
JSONObject jo = JSON.parseObject(response); LuceneLogDto logDto2 = LuceneLogDto.builder()
if (jo.getInteger("status") == 200) { .device_code(inst.getCarno())
LuceneLogDto logDto2 = LuceneLogDto.builder() .content("请求lms追加动诺宝作块失败,返回参数:" + jo)
.device_code(inst.getCarno()) .build();
.content("诺宝取货完成请求lms,参数,接口返回:" + jo) logDto2.setLog_level(4);
.build(); luceneExecuteLogService.deviceExecuteLog(logDto2);
logDto2.setLog_level(4); throw new BadRequestException("追加动诺宝作块返回失败");
luceneExecuteLogService.deviceExecuteLog(logDto2); }
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("请求lms追加动诺宝作块失败,返回参数:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
throw new BadRequestException("追加动诺宝作块返回失败");
}
} }
//放货前等待 //放货前等待