rev:优化一楼诺宝取货完成交互
This commit is contained in:
@@ -83,6 +83,11 @@ public interface AcsConfig {
|
||||
*/
|
||||
String pgErrorSendLms = "pgErrorSendLms";
|
||||
|
||||
/**
|
||||
* 是否存在wms系统
|
||||
*/
|
||||
String isSendLms = "isSendLms";
|
||||
|
||||
/**
|
||||
* 是否请求wms系统
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package org.nl.acs.agv;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
|
||||
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.AgvSystemTypeEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
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.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhangjiangwei
|
||||
*/
|
||||
@@ -42,6 +50,8 @@ public class AgvWaitUtil {
|
||||
|
||||
@Autowired
|
||||
private LuceneExecuteLogService luceneExecuteLogService;
|
||||
@Autowired
|
||||
ISysParamService paramService;
|
||||
|
||||
//取货前等待
|
||||
public JSONObject waitInGet(String startDeviceCode, Instruction inst) {
|
||||
@@ -50,7 +60,7 @@ public class AgvWaitUtil {
|
||||
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
|
||||
BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
|
||||
//agv诺宝对接位安全信号交互
|
||||
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) {
|
||||
manipulatorAgvStationDeviceDriver.writing(2);
|
||||
@@ -130,15 +140,23 @@ public class AgvWaitUtil {
|
||||
}
|
||||
//诺宝agv调lms更新点位
|
||||
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) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (manipulatorAgvStationDeviceDriver.getTo_command() != 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()
|
||||
.device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
|
||||
.content("未给agv离开信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0")
|
||||
@@ -154,38 +172,39 @@ public class AgvWaitUtil {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 200);
|
||||
map.put("message", "允许离开!");
|
||||
log.info("允许仙工AGV取货完成后请求离开,返回参数 - {}", map);
|
||||
log.info("允许仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
||||
return map;
|
||||
}
|
||||
|
||||
private void applyLmsGetOut(Instruction inst) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("taskCode", inst.getTask_code());
|
||||
param.put("actionType", ActionTypeEnum.IN_FINISHING.getCode().toString());
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("taskCode", inst.getTask_code());
|
||||
param.put("actionType", ActionTypeEnum.IN_FINISHING.getCode().toString());
|
||||
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())
|
||||
.content("诺宝取货完成请求lms:" + inst.getTask_code() + "--" + ActionTypeEnum.IN_FINISHING.getStatus())
|
||||
.content("诺宝取货完成请求lms,参数,接口返回:" + jo)
|
||||
.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())
|
||||
.content("诺宝取货完成请求lms,参数,接口返回:" + jo)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
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("追加动诺宝作块返回失败");
|
||||
}
|
||||
logDto2.setLog_level(4);
|
||||
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("追加动诺宝作块返回失败");
|
||||
}
|
||||
}
|
||||
|
||||
//放货前等待
|
||||
|
||||
Reference in New Issue
Block a user