|
|
|
@ -1,5 +1,7 @@
|
|
|
|
package cn.iocoder.yudao.module.mes.service.moldtaskmanagement;
|
|
|
|
package cn.iocoder.yudao.module.mes.service.moldtaskmanagement;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
import cn.iocoder.yudao.module.common.controller.admin.moldticketresults.vo.MoldTicketResultsSaveReqVO;
|
|
|
|
import cn.iocoder.yudao.module.common.controller.admin.moldticketresults.vo.MoldTicketResultsSaveReqVO;
|
|
|
|
@ -12,6 +14,7 @@ import cn.iocoder.yudao.module.common.dal.mysql.moldticketresults.MoldTicketResu
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.vo.MoldTaskManagementCreateTicketReqVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.vo.MoldTaskManagementCreateTicketReqVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.vo.MoldTaskManagementPageReqVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.vo.MoldTaskManagementPageReqVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.vo.MoldTaskManagementSaveReqVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.vo.MoldTaskManagementSaveReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.moldticketresults.enums.MoldJobResultEnum;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance.MoldPlanMaintenanceDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance.MoldPlanMaintenanceDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldtaskmanagement.MoldTaskManagementDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldtaskmanagement.MoldTaskManagementDO;
|
|
|
|
@ -29,6 +32,8 @@ import org.springframework.validation.annotation.Validated;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
@ -166,6 +171,7 @@ public class MoldTaskManagementServiceImpl implements MoldTaskManagementService
|
|
|
|
moldticketManagementDO.setTaskEndTime(endDate !=null ? endDate.atStartOfDay(): null);
|
|
|
|
moldticketManagementDO.setTaskEndTime(endDate !=null ? endDate.atStartOfDay(): null);
|
|
|
|
moldticketManagementMapper.insert(moldticketManagementDO);
|
|
|
|
moldticketManagementMapper.insert(moldticketManagementDO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MoldTicketResultsDO> createdResults = new ArrayList<>();
|
|
|
|
for (int index = 0; index < moldSubjectDOList.size(); index++) {
|
|
|
|
for (int index = 0; index < moldSubjectDOList.size(); index++) {
|
|
|
|
MoldSubjectDO moldSubjectDO = moldSubjectDOList.get(index);
|
|
|
|
MoldSubjectDO moldSubjectDO = moldSubjectDOList.get(index);
|
|
|
|
MoldTicketResultsDO moldticketResultsDO = new MoldTicketResultsDO();
|
|
|
|
MoldTicketResultsDO moldticketResultsDO = new MoldTicketResultsDO();
|
|
|
|
@ -178,7 +184,10 @@ public class MoldTaskManagementServiceImpl implements MoldTaskManagementService
|
|
|
|
mergeTicketResultData(moldticketResultsDO,
|
|
|
|
mergeTicketResultData(moldticketResultsDO,
|
|
|
|
findMatchedTicketResult(ticketResultsList, moldSubjectDO.getSubjectName(), index));
|
|
|
|
findMatchedTicketResult(ticketResultsList, moldSubjectDO.getSubjectName(), index));
|
|
|
|
moldticketResultsMapper.insert(moldticketResultsDO);
|
|
|
|
moldticketResultsMapper.insert(moldticketResultsDO);
|
|
|
|
|
|
|
|
createdResults.add(moldticketResultsDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleInspectionResult(moldticketManagementDO, createdResults);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -227,6 +236,35 @@ public class MoldTaskManagementServiceImpl implements MoldTaskManagementService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void handleInspectionResult(MoldTicketManagementDO moldticketManagementDO,
|
|
|
|
|
|
|
|
List<MoldTicketResultsDO> ticketResultsList) {
|
|
|
|
|
|
|
|
if (moldticketManagementDO == null || CollectionUtils.isEmpty(ticketResultsList)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean hasPending = ticketResultsList.stream()
|
|
|
|
|
|
|
|
.anyMatch(result -> result.getInspectionResult() == null
|
|
|
|
|
|
|
|
|| result.getInspectionResult().equals(MoldJobResultEnum.PENDING.getCode()));
|
|
|
|
|
|
|
|
if (hasPending) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
moldticketManagementDO.setTaskTime(LocalDateTime.now());
|
|
|
|
|
|
|
|
moldticketManagementDO.setJobStatus(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean hasFail = ticketResultsList.stream()
|
|
|
|
|
|
|
|
.anyMatch(result -> result.getInspectionResult() != null
|
|
|
|
|
|
|
|
&& result.getInspectionResult().equals(MoldJobResultEnum.FAIL.getCode()));
|
|
|
|
|
|
|
|
moldticketManagementDO.setJobResult(hasFail ? MoldJobResultEnum.FAIL.getCode() : MoldJobResultEnum.PASS.getCode());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
|
|
|
|
|
if (loginUser != null) {
|
|
|
|
|
|
|
|
moldticketManagementDO.setOperator(String.valueOf(loginUser.getId()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
moldticketManagementMapper.updateById(moldticketManagementDO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String generatePrefixedOrderNo() {
|
|
|
|
public static String generatePrefixedOrderNo() {
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
String date = sdf.format(new Date());
|
|
|
|
String date = sdf.format(new Date());
|
|
|
|
|