feat(qmsInspectionStandard): 添加检验标准模块及相关接口和业务逻辑

- 新增QmsInspectionStandardController,包含分页查询、发布、启用禁用、暂存及详情查询接口
- 实现QmsInspectionStandardControllerService,支持检验标准详情查询及暂存功能
- 新增Mapper接口及XML,实现分页查询及详情查询的SQL支持
- 新增检测项及内容的增删改查及转换VO逻辑
- 新增质检物料相关Controller和Service,支持增删改查、导入导出及模板下载
- 质检物料添加物料类别校验及路径构建,导入时支持校验和批量处理
- 质检物料编辑支持多字段更新及校验,删除时限制规则已维护物料
- 引入事务管理,保证数据一致性
This commit is contained in:
曹鹏飞 2026-04-14 19:10:26 +08:00
parent e95e500e3c
commit 6a691e4984
18 changed files with 1070 additions and 0 deletions

View File

@ -5,14 +5,20 @@ import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.qo.EnableQO;
import com.nflg.wms.common.pojo.qo.IdsQO;
import com.nflg.wms.common.pojo.qo.QmsInspectionStandardSaveQO;
import com.nflg.wms.common.pojo.qo.QmsInspectionStandardSearchQO;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardDetailVO;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardVO;
import com.nflg.wms.starter.BaseController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
@ -20,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/inspection-standard")
@Validated
public class QmsInspectionStandardController extends BaseController {
@Resource
@ -50,4 +57,21 @@ public class QmsInspectionStandardController extends BaseController {
inspectionStandardControllerService.enable(request.getId(), request.getEnable());
return ApiResult.success();
}
/**
* 暂存检验标准检测项和检测项内容
*/
@PostMapping("saveDraft")
public ApiResult<Void> saveDraft(@Valid @RequestBody QmsInspectionStandardSaveQO request) {
inspectionStandardControllerService.saveDraft(request);
return ApiResult.success();
}
/**
* 查询检验标准详情包含检测项列表
*/
@GetMapping("detail")
public ApiResult<QmsInspectionStandardDetailVO> detail(@RequestParam @NotNull(message = "ID不能为空") Long id) {
return ApiResult.success(inspectionStandardControllerService.getDetail(id));
}
}

View File

@ -0,0 +1,35 @@
package com.nflg.qms.admin.controller;
import com.nflg.qms.admin.service.QmsInspectionStandardItemControllerService;
import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardItemContentVO;
import com.nflg.wms.starter.BaseController;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 检验标准项
*/
@RestController
@RequestMapping("/inspection-standard-item")
@Validated
public class QmsInspectionStandardItemController extends BaseController {
@Resource
private QmsInspectionStandardItemControllerService inspectionStandardItemControllerService;
/**
* 根据检验标准项ID查询检验内容列表
*/
@GetMapping("contents")
public ApiResult<List<QmsInspectionStandardItemContentVO>> contents(@RequestParam @NotNull(message = "检验标准项ID不能为空") Long itemId) {
return ApiResult.success(inspectionStandardItemControllerService.getItemContents(itemId));
}
}

View File

@ -3,6 +3,8 @@ package com.nflg.qms.admin.controller;
import com.nflg.qms.admin.service.QmsQcMaterialControllerService;
import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.dto.BomMaterialDTO;
import com.nflg.wms.common.pojo.qo.BomMaterialListQO;
import com.nflg.wms.common.pojo.qo.QmsQcMaterialAddQO;
import com.nflg.wms.common.pojo.qo.QmsQcMaterialSearchQO;
import com.nflg.wms.common.pojo.qo.QmsQcMaterialUpdateQO;
@ -83,4 +85,20 @@ public class QmsQcMaterialController extends BaseController {
public void exportSearch(HttpServletResponse response, @Valid @RequestBody QmsQcMaterialSearchQO request) throws IOException {
qcMaterialControllerService.exportSearch(response, request);
}
/**
* 下载导入模板
*/
@PostMapping("template")
public void template(HttpServletResponse response) throws IOException {
qcMaterialControllerService.exportTemplate(response);
}
/**
* 搜索主物料系统物料信息
*/
@PostMapping("searchBomMaterial")
public ApiResult<PageData<BomMaterialDTO>> searchBomMaterial(@Valid @RequestBody BomMaterialListQO request){
return ApiResult.success(qcMaterialControllerService.searchBomMaterial(request));
}
}

View File

@ -2,16 +2,33 @@ package com.nflg.qms.admin.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nflg.wms.common.exception.NflgException;
import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.qo.QmsInspectionStandardSaveQO;
import com.nflg.wms.common.pojo.qo.QmsInspectionStandardSearchQO;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardDetailVO;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardItemContentVO;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardItemVO;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardVO;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.repository.entity.QmsInspectionStandard;
import com.nflg.wms.repository.entity.QmsInspectionStandardItem;
import com.nflg.wms.repository.entity.QmsInspectionStandardItemContent;
import com.nflg.wms.repository.mapper.QmsInspectionStandardMapper;
import com.nflg.wms.repository.service.IQmsInspectionStandardService;
import com.nflg.wms.repository.service.IQmsInspectionStandardItemContentService;
import com.nflg.wms.repository.service.IQmsInspectionStandardItemService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 检验标准业务逻辑
@ -26,6 +43,12 @@ public class QmsInspectionStandardControllerService {
@Resource
private QmsInspectionStandardMapper inspectionStandardMapper;
@Resource
private IQmsInspectionStandardItemService inspectionStandardItemService;
@Resource
private IQmsInspectionStandardItemContentService inspectionStandardItemContentService;
/**
* 分页查询检验标准
*/
@ -57,4 +80,326 @@ public class QmsInspectionStandardControllerService {
public void enable(Long id, Boolean enable) {
inspectionStandardService.enable(id, enable);
}
/**
* 查询检验标准详情包含检测项列表
* @param id 检验标准ID
* @return 检验标准详情
*/
public QmsInspectionStandardDetailVO getDetail(Long id) {
// 1. 查询检验标准基本信息
QmsInspectionStandard standard = inspectionStandardService.getById(id);
if (standard == null) {
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError, "检验标准不存在");
}
// 2. 查询检验标准详情关联物料等信息
QmsInspectionStandardDetailVO detail = inspectionStandardMapper.getDetailById(id);
if (detail == null) {
detail = new QmsInspectionStandardDetailVO();
}
// 填充基础字段
detail.setId(standard.getId());
detail.setMaterialId(standard.getMaterialId());
detail.setInspectionTaskItemId(standard.getInspectionTaskItemId());
detail.setDrawingUrl(standard.getDrawingUrl());
detail.setVersionNo(standard.getVersionNo());
detail.setIsEnabled(standard.getIsEnabled());
detail.setPackagingMethodId(standard.getPackagingMethodId());
detail.setInspectionCycle(standard.getInspectionCycle());
detail.setPublishStatus(standard.getPublishStatus());
detail.setPublishUserId(standard.getPublishUserId());
detail.setPublishUserName(standard.getPublishUserName());
detail.setPublishTime(standard.getPublishTime());
detail.setCreateUserId(standard.getCreateUserId());
detail.setCreateUserName(standard.getCreateUserName());
detail.setCreateTime(standard.getCreateTime());
detail.setUpdateUserId(standard.getUpdateUserId());
detail.setUpdateUserName(standard.getUpdateUserName());
detail.setUpdateTime(standard.getUpdateTime());
// 3. 查询检测项列表
List<QmsInspectionStandardItem> items = inspectionStandardItemService.lambdaQuery()
.eq(QmsInspectionStandardItem::getInspectionStandardId, id)
.orderByAsc(QmsInspectionStandardItem::getSortNo)
.list();
// 4. 转换为VO并填充内容列表
List<QmsInspectionStandardItemVO> itemVOs = new ArrayList<>();
for (QmsInspectionStandardItem item : items) {
QmsInspectionStandardItemVO itemVO = convertToItemVO(item);
// 查询检测项内容列表
List<QmsInspectionStandardItemContent> contents = inspectionStandardItemContentService.lambdaQuery()
.eq(QmsInspectionStandardItemContent::getInspectionStandardItemId, item.getId())
.orderByAsc(QmsInspectionStandardItemContent::getSortNo)
.list();
List<QmsInspectionStandardItemContentVO> contentVOs = contents.stream()
.map(this::convertToContentVO)
.collect(Collectors.toList());
itemVO.setContents(contentVOs);
itemVOs.add(itemVO);
}
detail.setItems(itemVOs);
return detail;
}
/**
* 转换检测项实体为VO
*/
private QmsInspectionStandardItemVO convertToItemVO(QmsInspectionStandardItem item) {
QmsInspectionStandardItemVO vo = new QmsInspectionStandardItemVO();
vo.setId(item.getId());
vo.setName(item.getName());
vo.setSortNo(item.getSortNo());
vo.setTestingMethodDictItemId(item.getTestingMethodDictItemId());
vo.setSamplingMethodDictItemId(item.getSamplingMethodDictItemId());
vo.setSamplingPlanId(item.getSamplingPlanId());
vo.setInspectionLevelDictItemId(item.getInspectionLevelDictItemId());
vo.setAqlPriorityValueId(item.getAqlPriorityValueId());
vo.setAqlTypeDictItemId(item.getAqlTypeDictItemId());
vo.setItemType(item.getItemType());
vo.setPdfDrawing(item.getPdfDrawing());
vo.setCreateUserName(item.getCreateUserName());
vo.setCreateTime(item.getCreateTime());
vo.setUpdateUserName(item.getUpdateUserName());
vo.setUpdateTime(item.getUpdateTime());
return vo;
}
/**
* 转换检测项内容实体为VO
*/
private QmsInspectionStandardItemContentVO convertToContentVO(QmsInspectionStandardItemContent content) {
QmsInspectionStandardItemContentVO vo = new QmsInspectionStandardItemContentVO();
vo.setId(content.getId());
vo.setSortNo(content.getSortNo());
vo.setName(content.getName());
vo.setTestStandard(content.getTestStandard());
vo.setLegend(content.getLegend());
vo.setPdfInfo(content.getPdfInfo());
vo.setJudgmentTypeDictItemId(content.getJudgmentTypeDictItemId());
vo.setCreateUserName(content.getCreateUserName());
vo.setCreateTime(content.getCreateTime());
vo.setUpdateUserName(content.getUpdateUserName());
vo.setUpdateTime(content.getUpdateTime());
return vo;
}
/**
* 暂存检验标准检测项和检测项内容
* @param qo 暂存请求参数
*/
@Transactional(rollbackFor = Exception.class)
public void saveDraft(QmsInspectionStandardSaveQO qo) {
// 1. 校验检验标准是否存在
QmsInspectionStandard standard = inspectionStandardService.getById(qo.getInspectionStandardId());
if (standard == null) {
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError, "检验标准不存在");
}
// 已发布的标准不允许暂存修改
if (standard.getPublishStatus() != null && standard.getPublishStatus() == 1) {
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError, "已发布的检验标准不允许修改");
}
Long userId = UserUtil.getUserId();
String userName = UserUtil.getUserName();
LocalDateTime now = LocalDateTime.now();
// 2. 获取该检验标准下所有现有的检测项ID
List<Long> existingItemIds = inspectionStandardItemService.lambdaQuery()
.eq(QmsInspectionStandardItem::getInspectionStandardId, qo.getInspectionStandardId())
.list()
.stream()
.map(QmsInspectionStandardItem::getId)
.collect(Collectors.toList());
// 3. 处理传入的检测项
List<Long> newItemIds = new ArrayList<>();
if (qo.getItems() != null && !qo.getItems().isEmpty()) {
for (QmsInspectionStandardSaveQO.InspectionStandardItemQO itemQO : qo.getItems()) {
QmsInspectionStandardItem item;
if (itemQO.getId() != null) {
// 更新现有检测项
item = inspectionStandardItemService.getById(itemQO.getId());
if (item == null) {
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError, "检测项不存在:" + itemQO.getId());
}
// 更新字段
updateItemFields(item, itemQO, userId, userName, now);
inspectionStandardItemService.updateById(item);
} else {
// 新增检测项
item = new QmsInspectionStandardItem()
.setInspectionStandardId(qo.getInspectionStandardId());
updateItemFields(item, itemQO, userId, userName, now);
inspectionStandardItemService.save(item);
}
newItemIds.add(item.getId());
// 4. 处理检测项内容
processItemContents(item.getId(), itemQO.getContents(), userId, userName, now);
}
}
// 5. 删除不在传入列表中的检测项及其内容
List<Long> itemsToDelete = existingItemIds.stream()
.filter(id -> !newItemIds.contains(id))
.collect(Collectors.toList());
if (!itemsToDelete.isEmpty()) {
// 先删除检测项内容
inspectionStandardItemContentService.lambdaUpdate()
.in(QmsInspectionStandardItemContent::getInspectionStandardItemId, itemsToDelete)
.remove();
// 再删除检测项
inspectionStandardItemService.removeByIds(itemsToDelete);
}
}
/**
* 更新检测项字段
*/
private void updateItemFields(QmsInspectionStandardItem item,
QmsInspectionStandardSaveQO.InspectionStandardItemQO qo,
Long userId, String userName, LocalDateTime now) {
if (qo.getName() != null) {
item.setName(qo.getName());
}
if (qo.getSortNo() != null) {
item.setSortNo(qo.getSortNo());
}
if (qo.getTestingMethodDictItemId() != null) {
item.setTestingMethodDictItemId(qo.getTestingMethodDictItemId());
}
if (qo.getSamplingMethodDictItemId() != null) {
item.setSamplingMethodDictItemId(qo.getSamplingMethodDictItemId());
}
if (qo.getSamplingPlanId() != null) {
item.setSamplingPlanId(qo.getSamplingPlanId());
}
if (qo.getInspectionLevelDictItemId() != null) {
item.setInspectionLevelDictItemId(qo.getInspectionLevelDictItemId());
}
if (qo.getAqlPriorityValueId() != null) {
item.setAqlPriorityValueId(qo.getAqlPriorityValueId());
}
if (qo.getAqlTypeDictItemId() != null) {
item.setAqlTypeDictItemId(qo.getAqlTypeDictItemId());
}
if (qo.getItemType() != null) {
item.setItemType(qo.getItemType());
}
if (qo.getPdfDrawing() != null) {
item.setPdfDrawing(qo.getPdfDrawing());
}
item.setUpdateUserId(userId);
item.setUpdateUserName(userName);
item.setUpdateTime(now);
// 新增时设置创建信息
if (item.getCreateUserId() == null) {
item.setCreateUserId(userId);
item.setCreateUserName(userName);
item.setCreateTime(now);
}
}
/**
* 处理检测项内容新增更新删除
*/
private void processItemContents(Long itemId,
List<QmsInspectionStandardSaveQO.InspectionStandardItemContentQO> contents,
Long userId, String userName, LocalDateTime now) {
// 获取现有的内容ID列表
List<Long> existingContentIds = inspectionStandardItemContentService.lambdaQuery()
.eq(QmsInspectionStandardItemContent::getInspectionStandardItemId, itemId)
.list()
.stream()
.map(QmsInspectionStandardItemContent::getId)
.collect(Collectors.toList());
List<Long> newContentIds = new ArrayList<>();
if (contents != null && !contents.isEmpty()) {
for (QmsInspectionStandardSaveQO.InspectionStandardItemContentQO contentQO : contents) {
QmsInspectionStandardItemContent content;
if (contentQO.getId() != null) {
// 更新现有内容
content = inspectionStandardItemContentService.getById(contentQO.getId());
if (content == null) {
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError, "检测项内容不存在:" + contentQO.getId());
}
updateContentFields(content, contentQO, userId, userName, now);
inspectionStandardItemContentService.updateById(content);
} else {
// 新增内容
content = new QmsInspectionStandardItemContent()
.setInspectionStandardItemId(itemId);
updateContentFields(content, contentQO, userId, userName, now);
inspectionStandardItemContentService.save(content);
}
newContentIds.add(content.getId());
}
}
// 删除不在传入列表中的内容
List<Long> contentsToDelete = existingContentIds.stream()
.filter(id -> !newContentIds.contains(id))
.collect(Collectors.toList());
if (!contentsToDelete.isEmpty()) {
inspectionStandardItemContentService.removeByIds(contentsToDelete);
}
}
/**
* 更新检测项内容字段
*/
private void updateContentFields(QmsInspectionStandardItemContent content,
QmsInspectionStandardSaveQO.InspectionStandardItemContentQO qo,
Long userId, String userName, LocalDateTime now) {
if (qo.getSortNo() != null) {
content.setSortNo(qo.getSortNo());
}
if (qo.getName() != null) {
content.setName(qo.getName());
}
if (qo.getTestStandard() != null) {
content.setTestStandard(qo.getTestStandard());
}
if (qo.getLegend() != null) {
content.setLegend(qo.getLegend());
}
if (qo.getPdfInfo() != null) {
content.setPdfInfo(qo.getPdfInfo());
}
if (qo.getJudgmentTypeDictItemId() != null) {
content.setJudgmentTypeDictItemId(qo.getJudgmentTypeDictItemId());
}
content.setUpdateUserId(userId);
content.setUpdateUserName(userName);
content.setUpdateTime(now);
// 新增时设置创建信息
if (content.getCreateUserId() == null) {
content.setCreateUserId(userId);
content.setCreateUserName(userName);
content.setCreateTime(now);
}
}
}

View File

@ -0,0 +1,70 @@
package com.nflg.qms.admin.service;
import com.nflg.wms.common.exception.NflgException;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardItemContentVO;
import com.nflg.wms.repository.entity.QmsInspectionStandardItem;
import com.nflg.wms.repository.entity.QmsInspectionStandardItemContent;
import com.nflg.wms.repository.service.IQmsInspectionStandardItemContentService;
import com.nflg.wms.repository.service.IQmsInspectionStandardItemService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/**
* 检验标准项业务逻辑
*/
@Slf4j
@Component
public class QmsInspectionStandardItemControllerService {
@Resource
private IQmsInspectionStandardItemService inspectionStandardItemService;
@Resource
private IQmsInspectionStandardItemContentService inspectionStandardItemContentService;
/**
* 根据检验标准项ID查询检验内容列表
* @param itemId 检验标准项ID
* @return 检验内容列表
*/
public List<QmsInspectionStandardItemContentVO> getItemContents(Long itemId) {
// 校验检验标准项是否存在
QmsInspectionStandardItem item = inspectionStandardItemService.getById(itemId);
if (item == null) {
throw new NflgException(com.nflg.wms.common.constant.STATE.BusinessError, "检验标准项不存在");
}
// 查询检验内容列表
List<QmsInspectionStandardItemContent> contents = inspectionStandardItemContentService.lambdaQuery()
.eq(QmsInspectionStandardItemContent::getInspectionStandardItemId, itemId)
.orderByAsc(QmsInspectionStandardItemContent::getSortNo)
.list();
return contents.stream()
.map(this::convertToContentVO)
.collect(Collectors.toList());
}
/**
* 转换检测项内容实体为VO
*/
private QmsInspectionStandardItemContentVO convertToContentVO(QmsInspectionStandardItemContent content) {
QmsInspectionStandardItemContentVO vo = new QmsInspectionStandardItemContentVO();
vo.setId(content.getId());
vo.setSortNo(content.getSortNo());
vo.setName(content.getName());
vo.setTestStandard(content.getTestStandard());
vo.setLegend(content.getLegend());
vo.setPdfInfo(content.getPdfInfo());
vo.setJudgmentTypeDictItemId(content.getJudgmentTypeDictItemId());
vo.setCreateUserName(content.getCreateUserName());
vo.setCreateTime(content.getCreateTime());
vo.setUpdateUserName(content.getUpdateUserName());
vo.setUpdateTime(content.getUpdateTime());
return vo;
}
}

View File

@ -9,7 +9,10 @@ import com.nflg.wms.common.constant.STATE;
import com.nflg.wms.common.exception.NflgException;
import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.dto.BomMaterialDTO;
import com.nflg.wms.common.pojo.dto.BomPageResultDTO;
import com.nflg.wms.common.pojo.dto.QmsQcMaterialImportDTO;
import com.nflg.wms.common.pojo.qo.BomMaterialListQO;
import com.nflg.wms.common.pojo.qo.QmsQcMaterialAddQO;
import com.nflg.wms.common.pojo.qo.QmsQcMaterialSearchQO;
import com.nflg.wms.common.pojo.qo.QmsQcMaterialUpdateQO;
@ -23,6 +26,7 @@ import com.nflg.wms.repository.entity.QmsQcMaterialCategory;
import com.nflg.wms.repository.mapper.QmsQcMaterialMapper;
import com.nflg.wms.repository.service.IQmsQcMaterialCategoryService;
import com.nflg.wms.repository.service.IQmsQcMaterialService;
import com.nflg.wms.starter.service.BomMaterialService;
import com.nflg.wms.starter.service.FileUploadService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
@ -60,6 +64,9 @@ public class QmsQcMaterialControllerService {
@Resource
private FileUploadService fileUploadService;
@Resource
private BomMaterialService bomMaterialService;
/**
* 分页查询质检物料
*/
@ -364,6 +371,24 @@ public class QmsQcMaterialControllerService {
EecExcelUtil.export("质检物料", "质检物料", qcMaterialMapper.searchAll(request), response);
}
/**
* 导出导入模板
*/
public void exportTemplate(HttpServletResponse response) throws IOException {
// 构造一行示例数据作为模板
QmsQcMaterialImportDTO example = new QmsQcMaterialImportDTO()
.setMaterialNo("示例物料编号")
.setMaterialDesc("示例物料描述")
.setMaterialCategoryCode("示例类别编码")
.setDrawingNo("示例图号")
.setDrawingNoVer("示例版本号")
.setMaterialName("示例物料名称")
.setMaterialTexture("示例材质")
.setMaterialSpecifications("示例规格");
EecExcelUtil.export("质检物料导入模板", "质检物料导入模板", List.of(example), response);
}
/**
* 构建物料类别全路径名称
* 根据parentTree字段解析路径查询所有父级名称拼接
@ -407,4 +432,13 @@ public class QmsQcMaterialControllerService {
return pathName.toString();
}
public PageData<BomMaterialDTO> searchBomMaterial(@Valid BomMaterialListQO request) {
BomPageResultDTO<BomMaterialDTO> bomPageResultDTO = bomMaterialService.searchMaterial(request);
return new PageData<BomMaterialDTO>()
.setPage(request.getPage())
.setPageSize(request.getPageSize())
.setTotal((int) bomPageResultDTO.getTotal())
.setItems(bomPageResultDTO.getRecords());
}
}

View File

@ -0,0 +1,136 @@
package com.nflg.wms.common.pojo.qo;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List;
/**
* 检验标准暂存请求参数
*/
@Data
public class QmsInspectionStandardSaveQO {
/**
* 检验标准ID
*/
@NotNull(message = "检验标准ID不能为空")
private Long inspectionStandardId;
/**
* 检测项列表
*/
@Valid
private List<InspectionStandardItemQO> items;
/**
* 检测项
*/
@Data
public static class InspectionStandardItemQO {
/**
* 检测项ID更新时传入新增时不传
*/
private Long id;
/**
* 检测项名称
*/
private String name;
/**
* 排序号
*/
private Integer sortNo;
/**
* 检测方式关联字典项id
*/
private Long testingMethodDictItemId;
/**
* 抽样方式关联字典项id
*/
private Long samplingMethodDictItemId;
/**
* 抽样方案ID
*/
private Long samplingPlanId;
/**
* 检验水平关联字典项id
*/
private Long inspectionLevelDictItemId;
/**
* AQL值关联AQL优先值预定义表id
*/
private Long aqlPriorityValueId;
/**
* AQL类型关联字典项id
*/
private Long aqlTypeDictItemId;
/**
* 检验标准项类型0-标准检测项1-尺寸检测项
*/
private Short itemType;
/**
* PDF图纸
*/
private String pdfDrawing;
/**
* 检测项内容列表
*/
@Valid
private List<InspectionStandardItemContentQO> contents;
}
/**
* 检测项内容
*/
@Data
public static class InspectionStandardItemContentQO {
/**
* 内容ID更新时传入新增时不传
*/
private Long id;
/**
* 排序号
*/
private Integer sortNo;
/**
* 检测项名称
*/
private String name;
/**
* 检测标准
*/
private String testStandard;
/**
* 图例
*/
private String legend;
/**
* PDF信息
*/
private String pdfInfo;
/**
* 判定类型关联字典项id
*/
private Long judgmentTypeDictItemId;
}
}

View File

@ -0,0 +1,133 @@
package com.nflg.wms.common.pojo.vo;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* 检验标准详情 VO
*/
@Data
public class QmsInspectionStandardDetailVO {
/**
* 检验标准ID
*/
private Long id;
/**
* 物料ID
*/
private Long materialId;
/**
* 物料编号
*/
private String materialNo;
/**
* 物料类别路径名称
*/
private String materialCategoryCodePathName;
/**
* 物料描述
*/
private String materialDesc;
/**
* 图号版本号
*/
private String drawingNoVer;
/**
* 检验任务项ID
*/
private Long inspectionTaskItemId;
/**
* 图纸URL
*/
private String drawingUrl;
/**
* 版本号
*/
private String versionNo;
/**
* 是否启用
*/
private Boolean isEnabled;
/**
* 包装方式ID
*/
private Long packagingMethodId;
/**
* 检验周期
*/
private Integer inspectionCycle;
/**
* 发布状态0-未发布1-已发布
*/
private Short publishStatus;
/**
* 发布人ID
*/
private Long publishUserId;
/**
* 发布人姓名
*/
private String publishUserName;
/**
* 发布时间
*/
private LocalDateTime publishTime;
/**
* 所属IQE姓名
*/
private String iqeName;
/**
* 创建人ID
*/
private Long createUserId;
/**
* 创建人姓名
*/
private String createUserName;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新人ID
*/
private Long updateUserId;
/**
* 更新人姓名
*/
private String updateUserName;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 检测项列表
*/
private List<QmsInspectionStandardItemVO> items;
}

View File

@ -0,0 +1,67 @@
package com.nflg.wms.common.pojo.vo;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 检验标准项内容 VO
*/
@Data
public class QmsInspectionStandardItemContentVO {
/**
* 内容ID
*/
private Long id;
/**
* 排序号
*/
private Integer sortNo;
/**
* 检测项名称
*/
private String name;
/**
* 检测标准
*/
private String testStandard;
/**
* 图例
*/
private String legend;
/**
* PDF信息
*/
private String pdfInfo;
/**
* 判定类型字典项ID
*/
private Long judgmentTypeDictItemId;
/**
* 创建人姓名
*/
private String createUserName;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新人姓名
*/
private String updateUserName;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}

View File

@ -0,0 +1,93 @@
package com.nflg.wms.common.pojo.vo;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* 检验标准项 VO
*/
@Data
public class QmsInspectionStandardItemVO {
/**
* 检测项ID
*/
private Long id;
/**
* 检测项名称
*/
private String name;
/**
* 排序号
*/
private Integer sortNo;
/**
* 检测方式字典项ID
*/
private Long testingMethodDictItemId;
/**
* 抽样方式字典项ID
*/
private Long samplingMethodDictItemId;
/**
* 抽样方案ID
*/
private Long samplingPlanId;
/**
* 检验水平字典项ID
*/
private Long inspectionLevelDictItemId;
/**
* AQL值ID
*/
private Long aqlPriorityValueId;
/**
* AQL类型字典项ID
*/
private Long aqlTypeDictItemId;
/**
* 检验标准项类型0-标准检测项1-尺寸检测项
*/
private Short itemType;
/**
* PDF图纸
*/
private String pdfDrawing;
/**
* 创建人姓名
*/
private String createUserName;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新人姓名
*/
private String updateUserName;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 检测项内容列表
*/
private List<QmsInspectionStandardItemContentVO> contents;
}

View File

@ -0,0 +1,10 @@
package com.nflg.wms.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nflg.wms.repository.entity.QmsInspectionStandardItemContent;
/**
* 检验标准项内容 Mapper
*/
public interface QmsInspectionStandardItemContentMapper extends BaseMapper<QmsInspectionStandardItemContent> {
}

View File

@ -0,0 +1,10 @@
package com.nflg.wms.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nflg.wms.repository.entity.QmsInspectionStandardItem;
/**
* 检验标准项 Mapper
*/
public interface QmsInspectionStandardItemMapper extends BaseMapper<QmsInspectionStandardItem> {
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nflg.wms.common.pojo.qo.QmsInspectionStandardSearchQO;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardDetailVO;
import com.nflg.wms.common.pojo.vo.QmsInspectionStandardVO;
import com.nflg.wms.repository.entity.QmsInspectionStandard;
import org.apache.ibatis.annotations.Param;
@ -17,4 +18,9 @@ public interface QmsInspectionStandardMapper extends BaseMapper<QmsInspectionSta
* 分页查询检验标准
*/
IPage<QmsInspectionStandardVO> searchPage(@Param("request") QmsInspectionStandardSearchQO request, Page<QmsInspectionStandardVO> page);
/**
* 根据ID查询检验标准详情关联物料等信息
*/
QmsInspectionStandardDetailVO getDetailById(@Param("id") Long id);
}

View File

@ -0,0 +1,10 @@
package com.nflg.wms.repository.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.wms.repository.entity.QmsInspectionStandardItemContent;
/**
* 检验标准项内容 服务类
*/
public interface IQmsInspectionStandardItemContentService extends IService<QmsInspectionStandardItemContent> {
}

View File

@ -0,0 +1,10 @@
package com.nflg.wms.repository.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.wms.repository.entity.QmsInspectionStandardItem;
/**
* 检验标准项 服务类
*/
public interface IQmsInspectionStandardItemService extends IService<QmsInspectionStandardItem> {
}

View File

@ -0,0 +1,15 @@
package com.nflg.wms.repository.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.wms.repository.entity.QmsInspectionStandardItemContent;
import com.nflg.wms.repository.mapper.QmsInspectionStandardItemContentMapper;
import com.nflg.wms.repository.service.IQmsInspectionStandardItemContentService;
import org.springframework.stereotype.Service;
/**
* 检验标准项内容 服务实现类
*/
@Service
public class QmsInspectionStandardItemContentServiceImpl extends ServiceImpl<QmsInspectionStandardItemContentMapper, QmsInspectionStandardItemContent>
implements IQmsInspectionStandardItemContentService {
}

View File

@ -0,0 +1,15 @@
package com.nflg.wms.repository.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.wms.repository.entity.QmsInspectionStandardItem;
import com.nflg.wms.repository.mapper.QmsInspectionStandardItemMapper;
import com.nflg.wms.repository.service.IQmsInspectionStandardItemService;
import org.springframework.stereotype.Service;
/**
* 检验标准项 服务实现类
*/
@Service
public class QmsInspectionStandardItemServiceImpl extends ServiceImpl<QmsInspectionStandardItemMapper, QmsInspectionStandardItem>
implements IQmsInspectionStandardItemService {
}

View File

@ -47,4 +47,43 @@
ORDER BY s.id DESC
</select>
<!--
根据ID查询检验标准详情关联物料等信息
-->
<select id="getDetailById" resultType="com.nflg.wms.common.pojo.vo.QmsInspectionStandardDetailVO">
SELECT
s.id,
s.material_id AS materialId,
m.material_no AS materialNo,
m.material_category_code_path_name AS materialCategoryCodePathName,
m.material_desc AS materialDesc,
m.drawing_no_ver AS drawingNoVer,
s.inspection_task_item_id AS inspectionTaskItemId,
s.drawing_url AS drawingUrl,
s.version_no AS versionNo,
s.is_enabled AS isEnabled,
s.packaging_method_id AS packagingMethodId,
s.inspection_cycle AS inspectionCycle,
s.publish_status AS publishStatus,
s.publish_user_id AS publishUserId,
s.publish_user_name AS publishUserName,
s.publish_time AS publishTime,
STRING_AGG(DISTINCT iqe_user.user_name, ',') AS iqeName,
s.create_user_id AS createUserId,
s.create_user_name AS createUserName,
s.create_time AS createTime,
s.update_user_id AS updateUserId,
s.update_user_name AS updateUserName,
s.update_time AS updateTime
FROM qms_inspection_standard s
LEFT JOIN qms_qc_material m ON s.material_id = m.id
LEFT JOIN qms_quality_inspector iqe ON m.id = iqe.material_id AND iqe.inspection_type = 1 AND iqe.enable = true
LEFT JOIN "user" iqe_user ON iqe.user_id = iqe_user.id
WHERE s.id = #{id}
GROUP BY s.id, s.material_id, m.material_no, m.material_category_code_path_name, m.material_desc, m.drawing_no_ver,
s.inspection_task_item_id, s.drawing_url, s.version_no, s.is_enabled, s.packaging_method_id,
s.inspection_cycle, s.publish_status, s.publish_user_id, s.publish_user_name, s.publish_time,
s.create_user_id, s.create_user_name, s.create_time, s.update_user_id, s.update_user_name, s.update_time
</select>
</mapper>