rev:代码优化

This commit is contained in:
2025-02-28 20:45:23 +08:00
parent fa98960659
commit 6ccf38a186
5 changed files with 94 additions and 37 deletions

View File

@@ -28,7 +28,6 @@ public interface IAcsPointService extends IService<AcsPoint> {
* @return IPage<SchBasePoint>
*/
IPage<AcsPoint> queryAll(PointQuery whereJson, PageQuery pageable);
/**
* 创建
*

View File

@@ -165,6 +165,7 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements Wo
}
List<Task> list = taskService.lambdaQuery()
.in(Task::getTask_status, VALID_STATUS)
.eq(Task::getStart_device_code,"QZJYTW2")
.list();
if (list.size()>0) {
throw new BadRequestException("已存在正在执行中或者就绪的AGV任务!");
@@ -186,24 +187,24 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements Wo
throw new BadRequestException("工单起点和终点未确认!");
}
AcsPoint startPoint = acsPointService.lambdaQuery()
.eq(AcsPoint::getPoint_code, "QZJYTW2")
.one();
AcsPoint nextPoint = acsPointService.lambdaQuery()
.eq(AcsPoint::getPoint_code,taskDto.getNext_device_code())
.one();
if (ObjectUtil.isEmpty(nextPoint)) {
throw new BadRequestException("终点设备不存在");
}
if (!nextPoint.getIs_used().booleanValue() || nextPoint.getPoint_status().equals(CommonFinalParam.ONE)) {
throw new BadRequestException("下发任务失败的原因是:终点点位被禁用或者终点点位有货,请检查起点点位"+nextPoint.getPoint_code()+"的状态!");
}
if (ObjectUtil.isEmpty(startPoint)) {
throw new BadRequestException("起点设备不存在");
}
if (!startPoint.getIs_used().booleanValue() || startPoint.getPoint_status().equals(CommonFinalParam.ZERO)) {
throw new BadRequestException("下发任务失败的原因是:起点点位被禁用或者起点点位无货,请检查起点点位"+startPoint.getPoint_code()+"的状态!");
}
// AcsPoint startPoint = acsPointService.lambdaQuery()
// .eq(AcsPoint::getPoint_code, "QZJYTW2")
// .one();
// AcsPoint nextPoint = acsPointService.lambdaQuery()
// .eq(AcsPoint::getPoint_code,taskDto.getNext_device_code())
// .one();
// if (ObjectUtil.isEmpty(nextPoint)) {
// throw new BadRequestException("终点设备不存在");
// }
// if (!nextPoint.getIs_used().booleanValue() || nextPoint.getPoint_status().equals(CommonFinalParam.ONE)) {
// throw new BadRequestException("下发任务失败的原因是:终点点位被禁用或者终点点位有货,请检查起点点位"+nextPoint.getPoint_code()+"的状态!");
// }
// if (ObjectUtil.isEmpty(startPoint)) {
// throw new BadRequestException("起点设备不存在");
// }
// if (!startPoint.getIs_used().booleanValue() || startPoint.getPoint_status().equals(CommonFinalParam.ZERO)) {
// throw new BadRequestException("下发任务失败的原因是:起点点位被禁用或者起点点位无货,请检查起点点位"+startPoint.getPoint_code()+"的状态!");
// }
taskDto.setStart_device_code("QZJYTW2");
taskDto.setTask_type(CommonFinalParam.ONE);

View File

@@ -47,6 +47,9 @@ public class HandServiceImpl implements HandService {
if (work == null){
return PdaResponseVo.pdaResultOk("配料作业不存在");
}
if (work.getRemain_num()==0){
return PdaResponseVo.pdaResultOk("配料作业剩余数量不能为0!");
}
workService.confirm(work.getWork_id());
return PdaResponseVo.pdaResultOk("配料作业确认成功");
}

View File

@@ -284,29 +284,30 @@ public class PdaServiceImpl implements PdaService {
}
List<Task> list = taskService.lambdaQuery()
.in(Task::getTask_status, VALID_STATUS)
.eq(Task::getNext_device_code,"QZJYTW1")
.list();
if (list.size()>0) {
throw new BadRequestException("已存在正在执行中或者就绪的AGV任务!");
}
AcsPoint startPoint = acsPointService.lambdaQuery()
.eq(AcsPoint::getPoint_code, start_device_code)
.one();
AcsPoint nextPoint = acsPointService.lambdaQuery()
.eq(AcsPoint::getPoint_code,"QZJYTW1")
.one();
if (ObjectUtil.isEmpty(nextPoint)) {
throw new BadRequestException("终点设备不存在");
}
if (!nextPoint.getIs_used().booleanValue() || nextPoint.getPoint_status().equals(CommonFinalParam.ONE)) {
throw new BadRequestException("下发任务失败的原因是:终点点位被禁用或者终点点位有货,请检查起点点位"+nextPoint.getPoint_code()+"的状态!");
}
if (ObjectUtil.isEmpty(startPoint)) {
throw new BadRequestException("起点设备不存在");
}
if (!startPoint.getIs_used().booleanValue() || startPoint.getPoint_status().equals(CommonFinalParam.ZERO)) {
throw new BadRequestException("下发任务失败的原因是:起点点位被禁用或者起点点位无货,请检查起点点位"+startPoint.getPoint_code()+"的状态!");
}
// AcsPoint startPoint = acsPointService.lambdaQuery()
// .eq(AcsPoint::getPoint_code, start_device_code)
// .one();
// AcsPoint nextPoint = acsPointService.lambdaQuery()
// .eq(AcsPoint::getPoint_code,"QZJYTW1")
// .one();
// if (ObjectUtil.isEmpty(nextPoint)) {
// throw new BadRequestException("终点设备不存在");
// }
// if (!nextPoint.getIs_used().booleanValue() || nextPoint.getPoint_status().equals(CommonFinalParam.ONE)) {
// throw new BadRequestException("下发任务失败的原因是:终点点位被禁用或者终点点位有货,请检查起点点位"+nextPoint.getPoint_code()+"的状态!");
// }
// if (ObjectUtil.isEmpty(startPoint)) {
// throw new BadRequestException("起点设备不存在");
// }
// if (!startPoint.getIs_used().booleanValue() || startPoint.getPoint_status().equals(CommonFinalParam.ZERO)) {
// throw new BadRequestException("下发任务失败的原因是:起点点位被禁用或者起点点位无货,请检查起点点位"+startPoint.getPoint_code()+"的状态!");
// }
JSONObject jo = new JSONObject();
jo.put("start_device_code", start_device_code);

View File

@@ -18,12 +18,15 @@ import org.nl.acs.limit_regional.server.LimitRegionalService;
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.point.domain.AcsPoint;
import org.nl.acs.point.service.IAcsPointService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.LuceneExecuteLogService;
@@ -51,6 +54,7 @@ public class AutoCreateInst {
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
IAcsPointService acsPointService = SpringContextHolder.getBean(IAcsPointService.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogServiceImpl.class);
List<TaskDto> list = taskserver.queryAllByStatus("0");
for (int i = 0; i < list.size(); i++) {
@@ -108,6 +112,55 @@ public class AutoCreateInst {
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
continue;
}
if (acsTask.getNext_device_code().equals("QZJYTW1")){
AcsPoint startPoint = acsPointService.lambdaQuery()
.eq(AcsPoint::getPoint_code, start_device_code)
.one();
AcsPoint nextPoint = acsPointService.lambdaQuery()
.eq(AcsPoint::getPoint_code,"QZJYTW1")
.one();
if (ObjectUtil.isEmpty(nextPoint)) {
log.error("终点设备不存在");
continue;
}
if (!nextPoint.getIs_used().booleanValue() || nextPoint.getPoint_status().equals(CommonFinalParam.ONE)) {
log.error("下发任务失败的原因是:终点点位被禁用或者终点点位有货,请检查起点点位"+nextPoint.getPoint_code()+"的状态!");
continue;
}
if (ObjectUtil.isEmpty(startPoint)) {
log.error("起点设备不存在");
continue;
}
if (!startPoint.getIs_used().booleanValue() || startPoint.getPoint_status().equals(CommonFinalParam.ZERO)) {
log.error("下发任务失败的原因是:起点点位被禁用或者起点点位无货,请检查起点点位"+startPoint.getPoint_code()+"的状态!");
continue;
}
}
if (acsTask.getStart_device_code().equals("QZJYTW2")) {
AcsPoint startPoint = acsPointService.lambdaQuery()
.eq(AcsPoint::getPoint_code, "QZJYTW2")
.one();
AcsPoint nextPoint = acsPointService.lambdaQuery()
.eq(AcsPoint::getPoint_code, acsTask.getNext_device_code())
.one();
if (ObjectUtil.isEmpty(nextPoint)) {
log.error("终点设备不存在");
continue;
}
if (!nextPoint.getIs_used().booleanValue() || nextPoint.getPoint_status().equals(CommonFinalParam.ONE)) {
log.error("下发任务失败的原因是:终点点位被禁用或者终点点位有货,请检查起点点位" + nextPoint.getPoint_code() + "的状态!");
continue;
}
if (ObjectUtil.isEmpty(startPoint)) {
log.error("起点设备不存在");
continue;
}
if (!startPoint.getIs_used().booleanValue() || startPoint.getPoint_status().equals(CommonFinalParam.ZERO)) {
log.error("下发任务失败的原因是:起点点位被禁用或者起点点位无货,请检查起点点位" + startPoint.getPoint_code() + "的状态!");
continue;
}
}
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();