fix: 诺宝修改

This commit is contained in:
2024-06-25 14:55:40 +08:00
parent 8134ecbe96
commit 036f38c00e
4 changed files with 56 additions and 15 deletions

View File

@@ -94,11 +94,17 @@ public class AgvWaitUtil {
instructionService.update(inst);
//如果是叉车,取货完成给输送线完成信号
Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode);
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
if (inst.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())){
BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) startDevice.getDeviceDriver();
boxSubvolumesConveyorDeviceDriver.writing(3);
}
if(inst.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())){
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(3);
}
JSONObject map = new JSONObject();
map.put("status", 200);
map.put("message", "允许离开!");
@@ -113,7 +119,7 @@ public class AgvWaitUtil {
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
if(endDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver){
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) endDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(2);
manipulatorAgvStationDeviceDriver.writing(4);
if(manipulatorAgvStationDeviceDriver.getAction() != 1){
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(inst.getCarno())
@@ -135,6 +141,13 @@ public class AgvWaitUtil {
//放货完成等待
public JSONObject waitOutPut(String endDeviceCode, Instruction inst) {
Device nextDevice = deviceAppService.findDeviceByCode(inst.getNext_device_code());
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
if(inst.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())){
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(5);
}
log.info("仙工AGV放货完成后请求离开设备号 - {}", endDeviceCode);
inst.setExecute_status("2");
instructionService.update(inst);

View File

@@ -695,8 +695,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
if (StrUtil.isBlank(address)) {
throw new BadRequestException("请求失败,地址为空!");
}
if (address.contains("IN")) {
if (address.contains("IN") || address.contains("WAITE")) {
String task_code = instructionDto.getTask_code();
String instructionCode = instructionDto.getInstruction_code();
String deviceCodeNow = address.substring(0, address.length() - 5);
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!");
@@ -707,19 +708,45 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
Integer actionType = ActionTypeEnum.IN_STOCK.getCode();
deviceCodeNow = applyXGAgvTask(task_code, actionType, instructionDto);
if (StrUtil.isNotEmpty(deviceCodeNow)) {
return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.content("取货分配新的点位为空")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException("取货分配新的点位为空");
}
}
}
return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto);
} else if (address.contains("PUT")) {
} else if (address.contains("PUT") || address.contains("WAITE")) {
if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
//如果是放货二次分配,取放货二次分配需要重新追加动作块
if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
Integer actionType = ActionTypeEnum.OUT_STOCK.getCode();
deviceCodeNow = applyXGAgvTask(task_code, actionType, instructionDto);
if (StrUtil.isNotEmpty(deviceCodeNow)) {
return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.content("防货分配新的点位为空")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException("防货分配新的点位为空");
}
}
} else if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) {
deviceCodeNow = applyCCAgvTask(task_code, instructionDto);
if (ObjectUtil.isEmpty(deviceCodeNow)) {
JSONObject map = new JSONObject();
map.put("status", 200);
map.put("message", "允许放货!");
log.info("允许仙工AGV放货设备号 - {}", deviceCodeNow);
return map;
}
}
return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto);
}
@@ -746,7 +773,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
param.put("task_code", task_code);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(instructionDto.getCarno())
.content("追加动叉车作块,参数:" + task_code )
.content("追加动叉车作块,参数:" + task_code)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
@@ -760,7 +787,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
//请求成功调用叉车追加动作块
sendAddSequencesToCCAgv(task_code, jo.getString("data"), instructionDto);
sendAddSequencesToCCAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto);
return jo.getString("data");
} else {
@@ -792,7 +819,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
log.info("任务号:{},指令号{},追加诺宝运单:{}", instructionCode, instructionCode, jo);
log.info("任务号:{},指令号{},追加诺宝叉车运单:{}", instructionCode, instructionCode, jo);
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
@@ -808,8 +835,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
.timeout(20000)
.execute();
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code("叉车运单响应")
.content("指令号:" + instructionCode + ",下发追加诺宝运单反馈参数:" + jo)
.device_code("叉车追加运单响应")
.content("指令号:" + instructionCode + ",下发追加诺宝叉车运单反馈参数:" + jo)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
@@ -901,7 +928,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject();
jo.put("id", inst.getInstruction_code());
//运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块
//运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块
if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) {
jo.put("complete", true);
} else {
@@ -1343,16 +1369,16 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
JSONObject jo9 = new JSONObject();
jo9.put("blockId", IdUtil.simpleUUID());
jo9.put("location", inst.getNext_device_code());
jo9.put("location", inst.getNext_device_code() + "WAITE");
jo9.put("operation", "script");
jo9.put("id", inst.getNext_device_code());
jo9.put("id", inst.getNext_device_code() + "WAITE");
jo9.put("script_name", "userpy/interact.py");
JSONObject script_args5 = new JSONObject();
script_args5.put("addr", addr);
JSONObject data3 = new JSONObject();
JSONObject reach3 = new JSONObject();
reach3.put("task_code", inst.getInstruction_code());
reach3.put("address", inst.getNext_device_code());
reach3.put("address", inst.getNext_device_code() + "WAITE");
data3.put("reach", reach3);
script_args5.put("data", data3);
script_args5.put("protocol", "HTTP");

View File

@@ -362,7 +362,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
} else {
List<TaskDto> taskDtos = taskserver.findByTrappedManipulatorReady();
List<TaskDto> taskDtosReady = new ArrayList<>();
TaskDto taskDto = new TaskDto();
TaskDto taskDto = null;
if (CollUtil.isNotEmpty(taskDtos)) {
for (TaskDto taskDto1 : taskDtos) {
if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) {

View File

@@ -691,7 +691,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
Instruction instruction = instructionService.findByDeviceCodeRunFromCache(String.valueOf(task));
Instruction instruction = checkInst();
if (ObjectUtil.isEmpty(instruction)) {
message = "one_message9";
return;
@@ -718,6 +718,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
this.message = "申请更新点位,参数,接口返回:" + jo;
String poinCode = jo.getString("point_code");
String vehicleCode = jo.getString("vehicle_code");
if (StrUtil.isNotEmpty(poinCode)) {
@@ -761,6 +762,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
this.message = "申请更新点位,参数,接口返回:" + jo;
}
}
}