add: 添加二次分配顶点任务

This commit is contained in:
2024-06-27 09:32:39 +08:00
parent a0a7240975
commit 5b1c96f39f
10 changed files with 126 additions and 63 deletions

View File

@@ -52,7 +52,19 @@ public class AgvWaitUtil {
if(startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver){
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(2);
if(manipulatorAgvStationDeviceDriver.getAction() != 1){
if(manipulatorAgvStationDeviceDriver.getAction() == 1){
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("诺宝agv允许取货"+"点位"+startDeviceCode)
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
JSONObject map = new JSONObject();
map.put("status", 200);
map.put("message", "允许取货!");
log.info("允许仙工AGV取货设备号 - {}", startDeviceCode);
return map;
}else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("agv诺宝对接位行架不允许取货:" + inst.getCarno()+ "点位号"+ manipulatorAgvStationDeviceDriver.getDevice_code())
@@ -66,7 +78,19 @@ public class AgvWaitUtil {
//agv叉车对接位安全信号交互
if(startDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver){
boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) startDevice.getDeviceDriver();
if(boxSubvolumesConveyorDeviceDriver.getMode() != 2){
if(boxSubvolumesConveyorDeviceDriver.getMode() == 2){
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("叉车允许取货")
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
JSONObject map = new JSONObject();
map.put("status", 200);
map.put("message", "允许取货!");
log.info("允许仙工AGV取货设备号 - {}", startDeviceCode);
return map;
}else {
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("agv叉车对接位输送线不允许取货:" + inst.getCarno()+ "点位号"+ boxSubvolumesConveyorDeviceDriver.getDevice_code())
@@ -76,15 +100,9 @@ public class AgvWaitUtil {
throw new BadRequestException("上位系统不允许取货");
}
}
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("200:允许取货")
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
JSONObject map = new JSONObject();
map.put("status", 200);
map.put("message", "允许取货!");
map.put("status", 400);
map.put("message", "取货点位信息不对");
log.info("允许仙工AGV取货设备号 - {}", startDeviceCode);
return map;
}
@@ -98,14 +116,19 @@ public class AgvWaitUtil {
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(startDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) {
BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) startDevice.getDeviceDriver();
boxSubvolumesConveyorDeviceDriver.writing(3);
}
}
//诺宝agv调lms更新点位
if(inst.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())){
applyLmsGetOut(inst);
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(3);
if(startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(3);
}
}
JSONObject map = new JSONObject();
@@ -181,8 +204,10 @@ public class AgvWaitUtil {
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);
if(nextDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(5);
}
}
log.info("仙工AGV放货完成后请求离开设备号 - {}", endDeviceCode);

View File

@@ -18,6 +18,8 @@ import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.angle.service.IAcsPointAngleService;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
@@ -28,6 +30,7 @@ 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.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
@@ -58,6 +61,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
@Autowired
private LuceneExecuteLogService luceneExecuteLogService;
// DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@Autowired
private AgvWaitUtil agvWaitUtil;
@@ -373,6 +378,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
jo1.put("blockId", IdUtil.simpleUUID());
jo1.put("location", pointCode);
jo1.put("operation", "JackLoad");
// Device device = deviceAppservice.findDeviceByCode(pointCode);
// StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver() ;
jo1.put("operationArgs", new JSONObject() {{
put("recognize", true);
}});
@@ -730,60 +738,52 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!");
}
if (address.contains("GET") || address.contains("WAIT")) {
if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
//一楼诺宝agv
if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
if (address.contains("GET") || address.contains("WAIT")) {
//如果是取货二次分配,取放货二次分配需要重新追加动作块
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("取货分配新的点位为空");
}
String newPointCode = applyXGAgvTask(task_code, actionType, instructionDto);
return agvWaitUtil.waitInGet(newPointCode, instructionDto);
}
}
return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto);
} else if (address.contains("PUT") || address.contains("WAIT")) {
if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto);
} else if (address.contains("PUT") || address.contains("WAIT")) {
//如果是放货二次分配,取放货二次分配需要重新追加动作块
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("防货分配新的点位为空");
}
// deviceCodeNow = applyXGAgvTask(task_code, actionType, instructionDto);
deviceCodeNow = "ZXQ_05";
return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto);
}
} else if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) {
deviceCodeNow = applyCCAgvTask(task_code, instructionDto);
if (StrUtil.isNotEmpty(deviceCodeNow)) {
JSONObject map = new JSONObject();
map.put("status", 200);
map.put("message", "允许放货!");
log.info("允许仙工AGV放货设备号 - {}", deviceCodeNow);
return map;
} else {
return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto);
}
}
//一楼叉车
if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) {
if (address.contains("GET")) {
//取货前等待
return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto);
} else {
//放货前二次分配
if (address.contains("WAIT")) {
String newPointCode = applyCCAgvTask(task_code, instructionDto);
LuceneLogDto logDto = LuceneLogDto.builder()
.content("防货分配新的点位为空")
.content("叉车允许放货"+"新点位:"+newPointCode)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException("防货分配新的点位为空");
JSONObject map = new JSONObject();
map.put("status", 200);
map.put("message", "允许叉车放货!"+"点位"+newPointCode);
log.info("允许仙工AGV放货设备号 - {}", newPointCode);
return map;
}
//放货前等待
if (address.contains("PUT")) {
return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto);
}
}
return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto);
}
}
if (address.contains("OUT")) {
@@ -793,8 +793,10 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
if (address.contains("GET")) {
//取货完成
return agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto);
} else if (address.contains("PUT")) {
//放货完成
return agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto);
}
}
@@ -849,8 +851,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
jo.put("blocks", createBlocksDataTowCCStart(nextPoint));
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code("追加诺宝运单")
.content("指令号:" + instructionCode + ",追加诺宝运单参数:" + jo)
.device_code("追加叉车运单")
.content("指令号:" + instructionCode + ",追加叉车运单参数:" + jo)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
@@ -873,9 +875,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
.device_code("叉车追加运单响应")
.content("指令号:" + instructionCode + ",下发追加诺宝叉车运单反馈参数:" + jo)
.build();
logDto.setLog_level(4);
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
log.info("指令号{},状态{},下发追加诺宝运单序列反馈:{}", instructionCode, result.getStatus(), result.body());
log.info("指令号{},状态{},下发追加叉车运单序列反馈:{}", instructionCode, result.getStatus(), result.body());
}

View File

@@ -113,6 +113,11 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
* 申请搬运任务
*/
private Boolean apply_handling = false;
/**
* 忽略校验
*/
private Boolean standard_ordinary_site = false;
/**
* 申请物料
*/

View File

@@ -184,6 +184,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
to_task = this.itemProtocol.getTo_task();
heartbeat = this.itemProtocol.getHeartbeat();
material_barcode = this.itemProtocol.getMaterialBarCode();
// 更新指令状态
if (mode != last_mode) {
JSONObject param = new JSONObject();
@@ -463,7 +464,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
jo.put("isError", this.getIserror());
jo.put("message", message);
jo.put("hand_barcode", hand_barcode);
jo.put("barcode", this.getMove() == 0 ? null : checkInst() == null ? vehicle_code : checkInst().getVehicle_code());
jo.put("material_barcode", material_barcode);
jo.put("is_click", true);
jo.put("requireSucess", requireSucess);
jo.put("driver_type", "siemens_conveyor");

View File

@@ -648,6 +648,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (StrUtil.isNotEmpty(hand_material_barcode)) {
param.put("material_barcode", hand_material_barcode);
}
if (mode == 7 && weight != 0){
param.put("weight", weight);
}
param.put("type", type);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)