|
|
@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.*;
|
|
|
import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopExecutionPlanDO;
|
|
|
import cn.iocoder.yudao.module.iscs.dal.mysql.sop.SopExecutionPlanMapper;
|
|
|
import cn.iocoder.yudao.module.iscs.utils.SuperDateUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import org.checkerframework.checker.units.qual.A;
|
|
|
@@ -162,6 +163,104 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
|
|
|
return bean;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public SopExecutionPlanRespVO selectSopExecutionPlanBySopId(Long sopId) {
|
|
|
+ SopExecutionPlanDO sopExecutionPlanDO = getOne(Wrappers.<SopExecutionPlanDO>lambdaQuery()
|
|
|
+ .eq(SopExecutionPlanDO::getId, sopId));
|
|
|
+ SopExecutionPlanRespVO bean = BeanUtils.toBean(sopExecutionPlanDO, SopExecutionPlanRespVO.class);
|
|
|
+ // sop数据
|
|
|
+ SopRespVO sopDetailById = sopService.getSopDetailById(bean.getSopId());
|
|
|
+ ArrayList<SopPreviewDataVO> sopRespVOS = new ArrayList<>();
|
|
|
+ // 年
|
|
|
+ if (bean.getFrequencyUnit().equals(0)) {
|
|
|
+ // 处理年的数据
|
|
|
+ String yyyymmdd = SuperDateUtils.getYYYYMMDD();
|
|
|
+ List<String> adjacentDatesYearDay = SuperDateUtils.getAdjacentDatesYearDay(
|
|
|
+ yyyymmdd,
|
|
|
+ null,
|
|
|
+ bean.getFrequency(),
|
|
|
+ Integer.parseInt(bean.getTimePoint()),
|
|
|
+ 10);
|
|
|
+ for (String s : adjacentDatesYearDay) {
|
|
|
+ SopPreviewDataVO sopPreviewDataVO = new SopPreviewDataVO();
|
|
|
+ sopPreviewDataVO.setPlanDay(s);
|
|
|
+ sopPreviewDataVO.setStartTime(bean.getStartTime());
|
|
|
+ sopPreviewDataVO.setDuration(bean.getDuration());
|
|
|
+ sopPreviewDataVO.setWorkstationName(sopDetailById.getWorkstationName());
|
|
|
+ sopPreviewDataVO.setMachineryName(sopDetailById.getMachineryName());
|
|
|
+ sopPreviewDataVO.setSopTypeName(sopDetailById.getSopTypeName());
|
|
|
+ sopRespVOS.add(sopPreviewDataVO);
|
|
|
+ }
|
|
|
+ bean.setPreviewDataList(sopRespVOS);
|
|
|
+ }
|
|
|
+ // 月
|
|
|
+ if (bean.getFrequencyUnit().equals(1)) {
|
|
|
+ // 处理月的数据
|
|
|
+ String yyyymmdd = SuperDateUtils.getYYYYMMDD();
|
|
|
+ List<String> adjacentDatesMonthDay = SuperDateUtils.getAdjacentDatesMonthDay(
|
|
|
+ yyyymmdd,
|
|
|
+ null,
|
|
|
+ bean.getFrequency(),
|
|
|
+ Integer.parseInt(bean.getTimePoint()),
|
|
|
+ 10);
|
|
|
+ for (String s : adjacentDatesMonthDay) {
|
|
|
+ SopPreviewDataVO sopPreviewDataVO = new SopPreviewDataVO();
|
|
|
+ sopPreviewDataVO.setPlanDay(s);
|
|
|
+ sopPreviewDataVO.setStartTime(bean.getStartTime());
|
|
|
+ sopPreviewDataVO.setDuration(bean.getDuration());
|
|
|
+ sopPreviewDataVO.setWorkstationName(sopDetailById.getWorkstationName());
|
|
|
+ sopPreviewDataVO.setMachineryName(sopDetailById.getMachineryName());
|
|
|
+ sopPreviewDataVO.setSopTypeName(sopDetailById.getSopTypeName());
|
|
|
+ sopRespVOS.add(sopPreviewDataVO);
|
|
|
+ }
|
|
|
+ bean.setPreviewDataList(sopRespVOS);
|
|
|
+ }
|
|
|
+ // 周
|
|
|
+ if (bean.getFrequencyUnit().equals(2)) {
|
|
|
+ // 处理周的数据
|
|
|
+ String yyyymmdd = SuperDateUtils.getYYYYMMDD();
|
|
|
+ List<String> adjacentDatesByWeekday = SuperDateUtils.getAdjacentDatesByWeekday(
|
|
|
+ yyyymmdd,
|
|
|
+ null,
|
|
|
+ bean.getFrequency(),
|
|
|
+ bean.getTimePoint(),
|
|
|
+ 10);
|
|
|
+ for (String s : adjacentDatesByWeekday) {
|
|
|
+ SopPreviewDataVO sopPreviewDataVO = new SopPreviewDataVO();
|
|
|
+ sopPreviewDataVO.setPlanDay(s);
|
|
|
+ sopPreviewDataVO.setStartTime(bean.getStartTime());
|
|
|
+ sopPreviewDataVO.setDuration(bean.getDuration());
|
|
|
+ sopPreviewDataVO.setWorkstationName(sopDetailById.getWorkstationName());
|
|
|
+ sopPreviewDataVO.setMachineryName(sopDetailById.getMachineryName());
|
|
|
+ sopPreviewDataVO.setSopTypeName(sopDetailById.getSopTypeName());
|
|
|
+ sopRespVOS.add(sopPreviewDataVO);
|
|
|
+ }
|
|
|
+ bean.setPreviewDataList(sopRespVOS);
|
|
|
+ }
|
|
|
+ // 天
|
|
|
+ if (bean.getFrequencyUnit().equals(3)) {
|
|
|
+ // 处理天的数据
|
|
|
+ String yyyymmdd = SuperDateUtils.getYYYYMMDD();
|
|
|
+ List<String> adjacentDatesByDay = SuperDateUtils.getAdjacentDatesByDay(
|
|
|
+ yyyymmdd,
|
|
|
+ null,
|
|
|
+ bean.getFrequency(),
|
|
|
+ 10);
|
|
|
+ for (String s : adjacentDatesByDay) {
|
|
|
+ SopPreviewDataVO sopPreviewDataVO = new SopPreviewDataVO();
|
|
|
+ sopPreviewDataVO.setPlanDay(s);
|
|
|
+ sopPreviewDataVO.setStartTime(bean.getStartTime());
|
|
|
+ sopPreviewDataVO.setDuration(bean.getDuration());
|
|
|
+ sopPreviewDataVO.setWorkstationName(sopDetailById.getWorkstationName());
|
|
|
+ sopPreviewDataVO.setMachineryName(sopDetailById.getMachineryName());
|
|
|
+ sopPreviewDataVO.setSopTypeName(sopDetailById.getSopTypeName());
|
|
|
+ sopRespVOS.add(sopPreviewDataVO);
|
|
|
+ }
|
|
|
+ bean.setPreviewDataList(sopRespVOS);
|
|
|
+ }
|
|
|
+ return bean;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public PageResult<SopExecutionPlanDO> getSopExecutionPlanPage(SopExecutionPlanPageReqVO pageReqVO) {
|
|
|
return sopExecutionPlanMapper.selectPage(pageReqVO);
|