Browse Source

rev:代码优化

master
涂强 1 month ago
parent
commit
6ccf38a186
  1. 1
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/point/service/IAcsPointService.java
  2. 37
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/sch/task/service/impl/WorkServiceImpl.java
  3. 3
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/hand/service/impl/HandServiceImpl.java
  4. 37
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/hand/service/impl/PdaServiceImpl.java
  5. 53
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java

1
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/point/service/IAcsPointService.java

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

37
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/sch/task/service/impl/WorkServiceImpl.java

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

3
acs/nladmin-system/nlsso-server/src/main/java/org/nl/hand/service/impl/HandServiceImpl.java

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

37
acs/nladmin-system/nlsso-server/src/main/java/org/nl/hand/service/impl/PdaServiceImpl.java

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

53
acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java

@ -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.limit_regional.server.dto.LimitRegionalDto;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl; 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.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder; import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.LuceneExecuteLogService;
@ -51,6 +54,7 @@ public class AutoCreateInst {
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
IAcsPointService acsPointService = SpringContextHolder.getBean(IAcsPointService.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogServiceImpl.class); LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogServiceImpl.class);
List<TaskDto> list = taskserver.queryAllByStatus("0"); List<TaskDto> list = taskserver.queryAllByStatus("0");
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
@ -108,6 +112,55 @@ public class AutoCreateInst {
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
continue; 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); RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath(); String path = routeLineDto.getPath();

Loading…
Cancel
Save