新建指令先创建再下发,防止未插入数据库NDC已有反馈导致数据不存在

This commit is contained in:
pangshenghao
2023-07-07 08:56:18 +08:00
parent 095e3d2047
commit 4ad099f874

View File

@@ -339,7 +339,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver; StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
try { try {
String start_device_code = dto.getStart_device_code(); String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code(); String next_device_code = dto.getNext_device_code();
@@ -360,6 +360,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
if (ObjectUtil.isEmpty(route)) { if (ObjectUtil.isEmpty(route)) {
throw new BadRequestException("未查询到相关路由!"); throw new BadRequestException("未查询到相关路由!");
} }
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto); ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
@@ -370,10 +373,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
log.error(""); log.error("");
} }
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
JSONObject json = (JSONObject) JSONObject.toJSON(dto); JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json); wo.update(json);
instructions.add(dto); instructions.add(dto);
} }