|
|
|
@ -9,14 +9,17 @@ import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
import org.dromara.pda.api.RemotePdaMesApiService;
|
|
|
|
|
import org.dromara.pda.api.model.ProdQmsPlanDetail;
|
|
|
|
|
import org.dromara.pda.api.model.bo.GenerateInspectionTaskBo;
|
|
|
|
|
import org.dromara.qms.domain.QcInspectionMain;
|
|
|
|
|
import org.dromara.qms.domain.QcInspectionResult;
|
|
|
|
|
import org.dromara.qms.domain.bo.QcInspectionResultBo;
|
|
|
|
|
import org.dromara.qms.domain.bo.QcInspectionTemplateBo;
|
|
|
|
|
import org.dromara.qms.domain.bo.QcTemplateItemBo;
|
|
|
|
|
import org.dromara.qms.domain.vo.QcInspectionMainVo;
|
|
|
|
|
import org.dromara.qms.domain.vo.QcInspectionTemplateVo;
|
|
|
|
|
import org.dromara.qms.service.IQcInspectionTemplateService;
|
|
|
|
|
import org.dromara.qms.service.IQcPDAService;
|
|
|
|
|
import org.dromara.qms.service.IQcTemplateItemService;
|
|
|
|
|
import org.dromara.qms.domain.vo.QcTemplateItemVo;
|
|
|
|
|
import org.dromara.qms.service.*;
|
|
|
|
|
import org.dromara.system.api.RemoteCodeRuleService;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.dromara.qms.service.IQcInspectionMainService;
|
|
|
|
|
import org.dromara.qms.domain.bo.QcInspectionMainBo;
|
|
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -36,6 +39,9 @@ public class QcPDAServiceImpl implements IQcPDAService {
|
|
|
|
|
|
|
|
|
|
private final IQcInspectionMainService qcInspectionMainService;
|
|
|
|
|
|
|
|
|
|
//质检结果子表
|
|
|
|
|
private final IQcInspectionResultService qcInspectionResultService;
|
|
|
|
|
|
|
|
|
|
private final IQcInspectionTemplateService qcInspectionTemplateService;
|
|
|
|
|
|
|
|
|
|
private final IQcTemplateItemService qcTemplateItemService;
|
|
|
|
@ -55,16 +61,22 @@ public class QcPDAServiceImpl implements IQcPDAService {
|
|
|
|
|
public Boolean generateInspectionTask(GenerateInspectionTaskBo bo) {
|
|
|
|
|
ProdQmsPlanDetail planDetail = remotePdaMesApiService.remoteGetProductionPlanDetail(bo);
|
|
|
|
|
if (StringUtils.isNull(planDetail)) {
|
|
|
|
|
throw new ServiceException("获取生产计划失败");
|
|
|
|
|
throw new ServiceException("获取生产计划失败!");
|
|
|
|
|
}
|
|
|
|
|
String inspectionNo = remoteCodeRuleService.selectCodeRuleCode("3");
|
|
|
|
|
if (StringUtils.isNull(inspectionNo)) {
|
|
|
|
|
throw new ServiceException("获取质检编号失败");
|
|
|
|
|
throw new ServiceException("获取质检编号失败!");
|
|
|
|
|
}
|
|
|
|
|
QcInspectionMainBo selectMain = new QcInspectionMainBo();
|
|
|
|
|
selectMain.setPlanDetailId(planDetail.getPlanDetailId());
|
|
|
|
|
List<QcInspectionMainVo> mainVoList = qcInspectionMainService.queryList(selectMain);
|
|
|
|
|
if (!mainVoList.isEmpty()){
|
|
|
|
|
throw new ServiceException("此生产计划已生成质检任务!");
|
|
|
|
|
}
|
|
|
|
|
String materialCode = planDetail.getMaterialCode();
|
|
|
|
|
|
|
|
|
|
QcInspectionTemplateBo templateBo = new QcInspectionTemplateBo();
|
|
|
|
|
templateBo.setMaterialCode(materialCode);
|
|
|
|
|
// templateBo.setQcInspectionType();
|
|
|
|
|
List<QcInspectionTemplateVo> templateVos = qcInspectionTemplateService.queryList(templateBo);
|
|
|
|
|
if (templateVos.size() != 1) {
|
|
|
|
|
throw new ServiceException("此物料无可用检测模板!");
|
|
|
|
@ -88,6 +100,31 @@ public class QcPDAServiceImpl implements IQcPDAService {
|
|
|
|
|
inspectionBo.setStatus(0L);
|
|
|
|
|
qcInspectionMainService.insertByBo(inspectionBo);
|
|
|
|
|
|
|
|
|
|
QcTemplateItemBo itemBo = new QcTemplateItemBo();
|
|
|
|
|
itemBo.setTemplateId(templateVo.getTemplateId());
|
|
|
|
|
List<QcTemplateItemVo> itemVoList = qcTemplateItemService.queryList(itemBo);
|
|
|
|
|
//存质检任务子表
|
|
|
|
|
for (QcTemplateItemVo templateItemVo : itemVoList) {
|
|
|
|
|
QcInspectionResultBo resultBo = new QcInspectionResultBo();
|
|
|
|
|
resultBo.setInspectionId(inspectionBo.getInspectionId());
|
|
|
|
|
resultBo.setItemId(templateItemVo.getItemId());
|
|
|
|
|
resultBo.setDetectResult(2L);
|
|
|
|
|
resultBo.setItemCode(templateItemVo.getItemCode());
|
|
|
|
|
resultBo.setItemName(templateItemVo.getItemName());
|
|
|
|
|
resultBo.setInspectionPosition(templateItemVo.getInspectionPosition());
|
|
|
|
|
resultBo.setCategoryName(templateItemVo.getCategoryName());
|
|
|
|
|
resultBo.setDetectType(templateItemVo.getDetectType());
|
|
|
|
|
resultBo.setControlType(templateItemVo.getControlType());
|
|
|
|
|
resultBo.setStandardValue(templateItemVo.getStandardValue());
|
|
|
|
|
resultBo.setUpperLimit(templateItemVo.getUpperLimit());
|
|
|
|
|
resultBo.setLowerLimit(templateItemVo.getLowerLimit());
|
|
|
|
|
resultBo.setSpecName(templateItemVo.getSpecName());
|
|
|
|
|
resultBo.setSpecUpper(templateItemVo.getSpecUpper());
|
|
|
|
|
resultBo.setSpecLower(templateItemVo.getSpecLower());
|
|
|
|
|
resultBo.setDescription(templateItemVo.getDescription());
|
|
|
|
|
resultBo.setTypeId(templateItemVo.getInspectionType());
|
|
|
|
|
qcInspectionResultService.insertByBo(resultBo);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|