Merge remote-tracking branch '惠信/feature/NoScanning' into feature/NoScanning

This commit is contained in:
曹鹏飞 2026-06-09 16:32:29 +08:00
commit 7a6f99014e
5 changed files with 174 additions and 11 deletions

View File

@ -5,12 +5,14 @@ import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleAuditQO;
import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleEditQO;
import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleSearchQO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleDetailVO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionPointListVO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleVO;
import com.nflg.qms.admin.service.QmsPqcInspectionRuleControllerService;
import com.nflg.wms.common.constant.Constant;
import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.qo.PqcInspectionRuleExportQO;
import com.nflg.wms.common.pojo.vo.QmsPqcInspectionPointItemsGroupedVO;
import com.nflg.wms.common.util.MultilingualUtil;
import com.nflg.wms.repository.entity.DictionaryItem;
import com.nflg.wms.repository.service.IDictionaryItemService;
@ -18,6 +20,7 @@ import com.nflg.wms.starter.BaseController;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@ -132,6 +135,23 @@ public class QmsPqcInspectionRuleController extends BaseController {
return ApiResult.success(result);
}
/**
* 根据机型编号查询该机型最新启用PQC规则下的检查点列表
*/
@GetMapping("/points")
public ApiResult<List<PqcInspectionPointListVO>> listPointsByModelNo(@NotNull String modelNo) {
return ApiResult.success(ruleControllerService.listPointsByModelNo(modelNo));
}
/**
* 根据检查点ID查询对应的检测项列表分组返回
* 返回三类关键物料拍照类工序检查-自检复核类工序检查-QC检测类
*/
@GetMapping("/items")
public ApiResult<QmsPqcInspectionPointItemsGroupedVO> listItemsByInspectionPointId(@NotNull Long inspectionPointId) {
return ApiResult.success(ruleControllerService.listItemsByInspectionPointIdGrouped(inspectionPointId));
}
/**
* 获取步装字典
*/

View File

@ -22,6 +22,7 @@ public class QmdReportManagementControllerService {
private final IQmsInspectionStandardService inspectionStandardService;
private final IQmsInspectionStandardItemService inspectionStandardItemService;
private final IQmsQcMaterialService qcMaterialService;
private final IQmsPdiDetectionRulesService pdiDetectionRulesService;
private final IQmsPdiDetectionRulesStatusItemService pdiStatusItemService;
private final IQmsPdiComponentAnagementService pdiComponentService;
@ -33,8 +34,13 @@ public class QmdReportManagementControllerService {
* IQC报表查询
*/
public List<QmdReportManagementVO.IqcReportItemVO> searchIqc(QmdReportManagementQO.IqcReportQO request) {
List<Long> materialIds = getIqcMaterialIds(request.getMaterialNo());
if (CollectionUtil.isEmpty(materialIds)) {
return Collections.emptyList();
}
QmsInspectionStandard currentStandard = inspectionStandardService.lambdaQuery()
.eq(QmsInspectionStandard::getMaterialId, request.getMaterialId())
.in(QmsInspectionStandard::getMaterialId, materialIds)
.eq(QmsInspectionStandard::getVersion, request.getVersion())
.last("LIMIT 1")
.one();
@ -51,7 +57,7 @@ public class QmdReportManagementControllerService {
}
List<QmsInspectionStandard> allStandards = inspectionStandardService.lambdaQuery()
.eq(QmsInspectionStandard::getMaterialId, request.getMaterialId())
.in(QmsInspectionStandard::getMaterialId, materialIds)
.list();
Map<Long, String> versionMap = allStandards.stream()
.collect(Collectors.toMap(QmsInspectionStandard::getId, QmsInspectionStandard::getVersion, (a, b) -> a));
@ -84,9 +90,14 @@ public class QmdReportManagementControllerService {
* IQC版本号查询
*/
public List<String> searchIqcVersions(QmdReportManagementQO.IqcVersionQO request) {
List<Long> materialIds = getIqcMaterialIds(request.getMaterialNo());
if (CollectionUtil.isEmpty(materialIds)) {
return Collections.emptyList();
}
return inspectionStandardService.lambdaQuery()
.select(QmsInspectionStandard::getVersion)
.eq(QmsInspectionStandard::getMaterialId, request.getMaterialId())
.in(QmsInspectionStandard::getMaterialId, materialIds)
.list()
.stream()
.map(QmsInspectionStandard::getVersion)
@ -251,6 +262,17 @@ public class QmdReportManagementControllerService {
.toList();
}
private List<Long> getIqcMaterialIds(String materialNo) {
return qcMaterialService.lambdaQuery()
.select(QmsQcMaterial::getId)
.eq(QmsQcMaterial::getMaterialNo, materialNo)
.list()
.stream()
.map(QmsQcMaterial::getId)
.filter(Objects::nonNull)
.toList();
}
private Map<Long, QmsPdiComponentAnagement> getPdiComponentMap(List<QmsPdiDetectionRulesStatusItem> items) {
Set<Long> componentIds = items.stream()
.map(QmsPdiDetectionRulesStatusItem::getComponentsId)

View File

@ -5,11 +5,13 @@ import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleAddQO;
import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleAuditQO;
import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleEditQO;
import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleSearchQO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionPointListVO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleDetailVO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleVO;
import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.qo.PqcInspectionRuleExportQO;
import com.nflg.wms.common.pojo.vo.QmsPqcInspectionPointItemsGroupedVO;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;
@ -69,6 +71,16 @@ public interface QmsPqcInspectionRuleControllerService {
*/
Long deletePoint(Long pointId);
List<PqcInspectionPointListVO> listPointsByModelNo(String modelNo);
/**
* 根据检查点ID查询检测项列表分组返回
*/
QmsPqcInspectionPointItemsGroupedVO listItemsByInspectionPointIdGrouped(Long inspectionPointId);
/**
* 导入PQC检测规则
* @param file Excel文件

View File

@ -11,6 +11,7 @@ import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleAuditQO;
import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleEditQO;
import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleSearchQO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionPointItemVO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionPointListVO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionPointVO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleDetailVO;
import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleVO;
@ -22,6 +23,8 @@ import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.dto.PqcInspectionRuleExportDTO;
import com.nflg.wms.common.pojo.dto.PqcInspectionRuleImportDTO;
import com.nflg.wms.common.pojo.qo.PqcInspectionRuleExportQO;
import com.nflg.wms.common.pojo.vo.QmsPqcInspectionPointItemListVO;
import com.nflg.wms.common.pojo.vo.QmsPqcInspectionPointItemsGroupedVO;
import com.nflg.wms.common.util.DateTimeUtil;
import com.nflg.wms.common.util.EecExcelUtil;
import com.nflg.wms.common.util.PageUtil;
@ -90,6 +93,87 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
@Resource
private IFileUploadRecordService fileUploadRecordService;
@Override
public QmsPqcInspectionPointItemsGroupedVO listItemsByInspectionPointIdGrouped(Long inspectionPointId) {
// 查询所有检测项
List<QmsPqcInspectionPointItems> allItems = itemsService.lambdaQuery()
.eq(QmsPqcInspectionPointItems::getInspectionCodeId, inspectionPointId)
.orderByAsc(QmsPqcInspectionPointItems::getSort)
.list();
// 初始化三个分类列表
List<QmsPqcInspectionPointItemListVO> materialItems = new ArrayList<>(); // 第1类关键物料拍照
List<QmsPqcInspectionPointItemListVO> selfReviewItems = new ArrayList<>(); // 第2类工序检查-自检复核
List<QmsPqcInspectionPointItemListVO> qcItems = new ArrayList<>(); // 第3类工序检查-QC检测
// 分类逻辑
for (QmsPqcInspectionPointItems item : allItems) {
QmsPqcInspectionPointItemListVO vo = new QmsPqcInspectionPointItemListVO()
.setId(item.getId())
.setInspectionCodeId(item.getInspectionCodeId())
.setSort(item.getSort())
.setInspectionContent(item.getInspectionContent())
.setInspectionType(item.getInspectionType())
.setInspectionMethods(item.getInspectionMethods())
.setInspectionImgUrl(item.getInspectionImgUrl())
.setInspectionLevel(item.getInspectionLevel());
Integer type = item.getInspectionType();
Integer level = item.getInspectionLevel();
// 第1类关键物料拍照类
// 包含inspectionType = 0所有+ inspectionType = 2所有
if (type == 0 || type == 2) {
materialItems.add(vo);
}
// 第2类和第3类工序检查按类型和星级分
// 包含inspectionType = 1 2
if (type == 1 || type == 2) {
if (level == 1 || level == 2) {
// 星级1或2 自检复核类
selfReviewItems.add(vo);
} else if (level == 3) {
// 星级3 QC检测类
qcItems.add(vo);
}
}
}
// 组装返回结果
QmsPqcInspectionPointItemsGroupedVO groupedVO = new QmsPqcInspectionPointItemsGroupedVO();
groupedVO.setMaterialItems(materialItems);
groupedVO.setSelfReviewItems(selfReviewItems);
groupedVO.setQcItems(qcItems);
return groupedVO;
}
/**
* 保存检查点和检查项
*/
@Override
public List<PqcInspectionPointListVO> listPointsByModelNo(String modelNo) {
QmsPqcInspectionRule latestRule = ruleService.lambdaQuery()
.eq(QmsPqcInspectionRule::getModelNo, modelNo)
.eq(QmsPqcInspectionRule::getIsDisabled, true)
.orderByDesc(QmsPqcInspectionRule::getRuleVersion)
.last("LIMIT 1")
.one();
if (latestRule == null) {
return Collections.emptyList();
}
return pointService.lambdaQuery()
.eq(QmsPqcInspectionPoint::getPqcRuleId, latestRule.getId())
.list()
.stream()
.map(point -> new PqcInspectionPointListVO()
.setId(point.getId())
.setInspectionPointCode(point.getInspectionPointCode())
.setInspectionPointName(point.getInspectionPointName()))
.collect(Collectors.toList());
}
@Override
public PageData<PqcInspectionRuleVO> search(PqcInspectionRuleSearchQO qo) {
LambdaQueryWrapper<QmsPqcInspectionRule> queryWrapper = new LambdaQueryWrapper<>();
@ -393,6 +477,31 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
return rule != null ? rule.getId() : null;
}
public List<PqcInspectionPointListVO> getCurrentValidPoints(String modelNo) {
QmsPqcInspectionRule rule = ruleService.lambdaQuery()
.eq(QmsPqcInspectionRule::getModelNo, modelNo)
.eq(QmsPqcInspectionRule::getIsDisabled, true)
.eq(QmsPqcInspectionRule::getAuditStatus, 1)
.orderByDesc(QmsPqcInspectionRule::getRuleVersion)
.orderByDesc(QmsPqcInspectionRule::getCreateTime)
.last("LIMIT 1")
.one();
if (Objects.isNull(rule)) {
return Collections.emptyList();
}
return pointService.lambdaQuery()
.eq(QmsPqcInspectionPoint::getPqcRuleId, rule.getId())
.orderByAsc(QmsPqcInspectionPoint::getId)
.list()
.stream()
.map(point -> new PqcInspectionPointListVO()
.setId(point.getId())
.setInspectionPointCode(point.getInspectionPointCode())
.setInspectionPointName(point.getInspectionPointName()))
.toList();
}
// ========================= 私有方法 =========================
/**

View File

@ -14,11 +14,11 @@ public class QmdReportManagementQO {
public static class IqcReportQO {
/**
* 物料ID
* 物料编号
*/
@JsonAlias("material_id")
@NotNull(message = "物料ID不能为空")
private Long materialId;
@JsonAlias("material_no")
@NotBlank(message = "物料编号不能为空")
private String materialNo;
/**
* 版本号
@ -31,11 +31,11 @@ public class QmdReportManagementQO {
public static class IqcVersionQO {
/**
* 物料ID
* 物料编号
*/
@JsonAlias("material_id")
@NotNull(message = "物料ID不能为空")
private Long materialId;
@JsonAlias("material_no")
@NotBlank(message = "物料编号不能为空")
private String materialNo;
}
@Data