opt: 货位地址,rgv监控,创建指令优化

This commit is contained in:
yanps
2024-05-22 17:33:39 +08:00
parent 6a4dfd1f22
commit c19dbfe11d
5 changed files with 38 additions and 14 deletions

View File

@@ -363,7 +363,8 @@ public class NDCAgvServiceImpl implements NDCAgvService {
};
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:"
+ hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)+",是否侧移: "+(offset == 1?"侧移":"不测移") + ",偏离量: " + quantity);
System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
return b;

View File

@@ -207,15 +207,15 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
if (mode == 4 && move == 1 && !requireSucess) {
applyTask();
} else {
if (mode == 2) {
if (mode == 4) {
//if (!requireSucess) {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
if (move != 1) {
remark = "universal_no";
}
if (task != 0) {
remark = LangProcess.msg("universal_remark4");
@@ -226,7 +226,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
if (requireSucess) {
remark = LangProcess.msg("universal_remark5");
}
this.setNotCreateTaskMessage(remark);
this.setFeedMessage(remark);
//}
}
}

View File

@@ -68,6 +68,8 @@ import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.mapper.InstructionMapper;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.nl.common.utils.CodeUtil;
import org.nl.config.SpringContextHolder;
@@ -114,6 +116,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
private XianGongAgvService xiangGongAgvService;
@Autowired
private LimitRegionalService limitRegionalService;
@Autowired
private LuceneExecuteLogService luceneExecuteLogService;
private List<Instruction> instructions = new CopyOnWriteArrayList();
@@ -368,7 +372,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override
@Transactional(rollbackFor = Exception.class)
public void create(Instruction dto) {
public void create(Instruction dto) throws Exception {
dto = foramte(dto);
String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code);
@@ -463,10 +467,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
break;
}
}
if (ObjectUtil.isEmpty(route)) {
if (ObjectUtil.isEmpty(route) && (!start_device_code.equals(next_device_code))) {
throw new BadRequestException(LangProcess.msg("error_isNull", "route"));
}
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.TWO)) {
if (shortPathsList.size() > 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.TWO)) {
// 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统
if (!StrUtil.equals(task.getAgv_system_type(), "0")
&& ObjectUtil.isNotEmpty(task.getAgv_system_type())) {
@@ -496,7 +500,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
}
//判断是否是仙工AGV
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.ONE)) {
if (shortPathsList.size() > 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.ONE)) {
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code());
if (StrUtil.equals(task.getRequest_again_success(), "1")) {
//追加订单
@@ -526,8 +530,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
} catch (Exception e) {
dto.setSend_status("2");
e.printStackTrace();
log.error("");
log.error(e.getMessage());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code("创建指令报错")
.content("任务号"+ dto.getTask_code()+ "报错原因:" + e.getMessage())
.build();
logDto.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(logDto);
throw e;
}
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
instructionMapper.insert(entity);
@@ -623,7 +633,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
break;
}
}
if (ObjectUtil.isEmpty(route)) {
if (ObjectUtil.isEmpty(route) && !(start_device_code.equals(next_device_code))) {
throw new BadRequestException(LangProcess.msg("error_isNull", "route"));
}
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {

View File

@@ -14,6 +14,7 @@ import lombok.AllArgsConstructor;
import org.nl.acs.common.base.PageInfo;
import org.nl.acs.common.base.QueryHelpMybatisPlus;
import org.nl.acs.common.base.impl.CommonServiceImpl;
import org.nl.acs.device.service.DeviceService;
import org.nl.common.exception.BadRequestException;
import org.nl.acs.utils.ConvertUtil;
import org.nl.common.utils.FileUtil;
@@ -25,6 +26,7 @@ import org.nl.acs.storage_cell.service.dto.StorageCellQueryParam;
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.language.LangProcess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@@ -50,6 +52,9 @@ public class StorageCellServiceImpl extends CommonServiceImpl<StorageCellMapper,
private final StorageCellMapper storageCellMapper;
@Autowired
private DeviceService deviceServiceImpl;
@Override
public PageInfo<StorageCellDto> queryAll(StorageCellQueryParam query, Pageable pageable) {
IPage<StorageCell> queryPage = PageUtil.toMybatisPage(pageable);
@@ -217,6 +222,13 @@ public class StorageCellServiceImpl extends CommonServiceImpl<StorageCellMapper,
StorageCell storageCell = ConvertUtil.convert(dto, StorageCell.class);
storageCellMapper.updateById(storageCell);
List<StorageCellDto> allStorageCellFromCache = deviceServiceImpl.findAllStorageCellFromCache();
allStorageCellFromCache.forEach(storageCellDto -> {
if(storageCellDto.getStorage_id().equals(storageCell.getStorage_id())){
storageCellDto.setAddress(storageCell.getAddress());
}
});
}
@Override

View File

@@ -120,7 +120,7 @@ public class CreateDDJInst {
StandardStackerDeviceDriver standardStackerDeviceDriver;
if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
standardStackerDeviceDriver = (StandardStackerDeviceDriver) deviceByCode.getDeviceDriver();
if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getMove() == 1 || standardStackerDeviceDriver.getCommand() != 0) {
if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0) {
log.error("堆垛机,{}未联机或者在执行中", deviceByCode.getDevice_code());
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中");
return;
@@ -285,7 +285,8 @@ public class CreateDDJInst {
instructionService.create(instdto);
} catch (Exception e) {
taskDto.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(taskDto);
taskserver.update(taskDto);
return;
}
//创建指令后修改任务状态
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());