Compare commits

...

4 Commits

Author SHA1 Message Date
funny 63a0196216 Merge branch 'qms/yf' into qms/develop 2026-04-16 13:32:48 +08:00
曹鹏飞 72aef97677 refactor(qmsamplingplan): 优化字码和AQL优先值处理逻辑
- 修改QmsSamplingPlanAddQO,字码和AQL优先值从ID改为内容字段
- 在新增和更新流程中,保存字码和AQL优先值后建立内容到ID的映射
- 使用映射将字码内容和AQL优先值转换为对应ID,保证数据一致性
- 在字码矩阵维护和抽样方案检验中校验字码和优先值是否存在,抛出业务异常
- 添加QmsSamplingPlanApiTest接口测试,覆盖新增抽样方案各类参数校验和正常流程
- 测试用例包含空字段校验、完整参数场景及备注字段验证
2026-04-16 11:38:38 +08:00
曹鹏飞 2983281b94 【优化】免检物料和质量通知的是否启用字段名称改为enable 2026-04-15 15:09:20 +08:00
曹鹏飞 e3e8dc3a25 feat(material): 新增物料及齐套管理相关功能
- 新增BomControllerService实现齐套物料增删改查及Excel导入导出功能
- 新增BomMaterialService对接主物料系统进行物料信息查询和登录鉴权
- 新增MaterialController及MaterialControllerService实现图纸管理接口和服务
- 实现物料图片和zip批量上传功能,支持权限校验和异步任务提交
- 支持物料分类查询、历史版本查询及物料列表导出功能
- 优化导入数据校验逻辑,导入失败时导出错误结果文件
- 统一接口返回ApiResult封装并支持分页查询展示
- 引入PowerJob任务调度集成,支持图纸zip导入异步处理
- 代码结构调整,规范命名及异常处理逻辑
2026-04-15 14:45:13 +08:00
27 changed files with 202 additions and 102 deletions

View File

@ -110,7 +110,7 @@ public class QmsExemptMaterialController extends BaseController {
*/
@PostMapping("toggleEnable")
public ApiResult<Void> toggleEnable(@RequestBody ToggleEnableQO request) {
exemptMaterialService.toggleEnable(request.getId(), request.getEnableStatus());
exemptMaterialService.toggleEnable(request.getId(), request.getEnable());
return ApiResult.success();
}

View File

@ -3,7 +3,7 @@ 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.dto.MaterialMainDTO;
import com.nflg.wms.common.pojo.qo.BomMaterialListQO;
import com.nflg.wms.common.pojo.qo.QmsQcMaterialAddQO;
import com.nflg.wms.common.pojo.qo.QmsQcMaterialSearchQO;
@ -15,11 +15,7 @@ import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.springframework.transaction.annotation.Transactional;
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.RestController;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@ -98,7 +94,7 @@ public class QmsQcMaterialController extends BaseController {
* 搜索主物料系统物料信息
*/
@PostMapping("searchBomMaterial")
public ApiResult<PageData<BomMaterialDTO>> searchBomMaterial(@Valid @RequestBody BomMaterialListQO request){
public ApiResult<PageData<MaterialMainDTO>> searchBomMaterial(@Valid @RequestBody BomMaterialListQO request){
return ApiResult.success(qcMaterialControllerService.searchBomMaterial(request));
}
}

View File

@ -9,8 +9,8 @@ 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.MaterialMainDTO;
import com.nflg.wms.common.pojo.dto.QmsQcMaterialImportDTO;
import com.nflg.wms.common.pojo.qo.BomMaterialListQO;
import com.nflg.wms.common.pojo.qo.QmsQcMaterialAddQO;
@ -433,9 +433,9 @@ public class QmsQcMaterialControllerService {
return pathName.toString();
}
public PageData<BomMaterialDTO> searchBomMaterial(@Valid BomMaterialListQO request) {
BomPageResultDTO<BomMaterialDTO> bomPageResultDTO = bomMaterialService.searchMaterial(request);
return new PageData<BomMaterialDTO>()
public PageData<MaterialMainDTO> searchBomMaterial(@Valid BomMaterialListQO request) {
BomPageResultDTO<MaterialMainDTO> bomPageResultDTO = bomMaterialService.searchMaterial(request);
return new PageData<MaterialMainDTO>()
.setPage(request.getPage())
.setPageSize(request.getPageSize())
.setTotal((int) bomPageResultDTO.getTotal())

View File

@ -82,7 +82,8 @@ public class QmsSamplingPlanControllerService {
samplingPlanService.save(plan);
Long planId = plan.getId();
// 2. 保存AQL优先值预定义
// 2. 保存AQL优先值预定义并建立优先值到ID的映射
Map<java.math.BigDecimal, Long> aqlPriorityValueIdMap = new java.util.HashMap<>();
if (CollectionUtil.isNotEmpty(request.getAqlPriorityValues())) {
List<QmsAqlPriorityValue> aqlPriorityValues = new ArrayList<>();
for (QmsSamplingPlanAddQO.AqlPriorityValueQO qo : request.getAqlPriorityValues()) {
@ -92,6 +93,10 @@ public class QmsSamplingPlanControllerService {
aqlPriorityValues.add(entity);
}
aqlPriorityValueService.saveBatch(aqlPriorityValues);
// MyBatis-Plus的saveBatch会回填ID建立映射关系
for (QmsAqlPriorityValue entity : aqlPriorityValues) {
aqlPriorityValueIdMap.put(entity.getPriorityValue(), entity.getId());
}
}
// 3. 保存抽样严格性转移规则
@ -109,7 +114,8 @@ public class QmsSamplingPlanControllerService {
strictnessTransferRuleService.saveBatch(rules);
}
// 4. 保存字码
// 4. 保存字码并建立字码到ID的映射
Map<String, Long> codeLetterIdMap = new java.util.HashMap<>();
if (CollectionUtil.isNotEmpty(request.getCodeLetters())) {
List<QmsCodeLetter> codeLetters = new ArrayList<>();
for (QmsSamplingPlanAddQO.CodeLetterQO qo : request.getCodeLetters()) {
@ -119,17 +125,28 @@ public class QmsSamplingPlanControllerService {
codeLetters.add(entity);
}
codeLetterService.saveBatch(codeLetters);
// MyBatis-Plus的saveBatch会回填ID建立映射关系
for (QmsCodeLetter entity : codeLetters) {
codeLetterIdMap.put(entity.getCodeLetter(), entity.getId());
}
}
// 5. 保存字码矩阵维护
if (CollectionUtil.isNotEmpty(request.getCodeLetterMatrices())) {
List<QmsCodeLetterMatrix> matrices = new ArrayList<>();
for (QmsSamplingPlanAddQO.CodeLetterMatrixQO qo : request.getCodeLetterMatrices()) {
// 通过字码内容获取字码ID
Long codeLetterId = codeLetterIdMap.get(qo.getCodeLetter());
VUtil.trueThrowBusinessError(codeLetterId == null).throwMessage("字码矩阵维护中的字码[" + qo.getCodeLetter() + "]在字码列表中不存在");
// 通过AQL优先值获取AQL优先值ID
Long aqlPriorityValueId = aqlPriorityValueIdMap.get(qo.getAqlPriorityValue());
VUtil.trueThrowBusinessError(aqlPriorityValueId == null).throwMessage("字码矩阵维护中的AQL优先值[" + qo.getAqlPriorityValue() + "]在AQL优先值列表中不存在");
QmsCodeLetterMatrix entity = new QmsCodeLetterMatrix()
.setSamplingPlanId(planId)
.setInspectionType(qo.getInspectionType())
.setCodeLetterId(qo.getCodeLetterId())
.setAqlPriorityValueId(qo.getAqlPriorityValueId())
.setCodeLetterId(codeLetterId)
.setAqlPriorityValueId(aqlPriorityValueId)
.setSampleSize(qo.getSampleSize())
.setReValue(qo.getReValue())
.setAcValue(qo.getAcValue());
@ -142,12 +159,16 @@ public class QmsSamplingPlanControllerService {
if (CollectionUtil.isNotEmpty(request.getSamplingPlanInspections())) {
List<QmsSamplingPlanInspection> inspections = new ArrayList<>();
for (QmsSamplingPlanAddQO.SamplingPlanInspectionQO qo : request.getSamplingPlanInspections()) {
// 通过字码内容获取字码ID
Long codeLetterId = codeLetterIdMap.get(qo.getCodeLetter());
VUtil.trueThrowBusinessError(codeLetterId == null).throwMessage("抽样方案检验中的字码[" + qo.getCodeLetter() + "]在字码列表中不存在");
QmsSamplingPlanInspection entity = new QmsSamplingPlanInspection()
.setSamplingPlanId(planId)
.setRangeStart(qo.getRangeStart())
.setRangeEnd(qo.getRangeEnd())
.setInspectionDictionaryItemId(qo.getInspectionDictionaryItemId())
.setCodeLetterId(qo.getCodeLetterId());
.setCodeLetterId(codeLetterId);
inspections.add(entity);
}
samplingPlanInspectionService.saveBatch(inspections);
@ -181,7 +202,8 @@ public class QmsSamplingPlanControllerService {
.set(QmsSamplingPlan::getUpdateTime, now)
.update();
// 2. 删除并重新保存AQL优先值预定义
// 2. 删除并重新保存AQL优先值预定义并建立优先值到ID的映射
Map<java.math.BigDecimal, Long> aqlPriorityValueIdMap = new java.util.HashMap<>();
aqlPriorityValueService.lambdaUpdate()
.eq(QmsAqlPriorityValue::getSamplingPlanId, planId)
.remove();
@ -194,6 +216,10 @@ public class QmsSamplingPlanControllerService {
aqlPriorityValues.add(entity);
}
aqlPriorityValueService.saveBatch(aqlPriorityValues);
// MyBatis-Plus的saveBatch会回填ID建立映射关系
for (QmsAqlPriorityValue entity : aqlPriorityValues) {
aqlPriorityValueIdMap.put(entity.getPriorityValue(), entity.getId());
}
}
// 3. 删除并重新保存抽样严格性转移规则
@ -214,7 +240,8 @@ public class QmsSamplingPlanControllerService {
strictnessTransferRuleService.saveBatch(rules);
}
// 4. 删除并重新保存字码
// 4. 删除并重新保存字码并建立字码到ID的映射
Map<String, Long> codeLetterIdMap = new java.util.HashMap<>();
codeLetterService.lambdaUpdate()
.eq(QmsCodeLetter::getSamplingPlanId, planId)
.remove();
@ -227,6 +254,10 @@ public class QmsSamplingPlanControllerService {
codeLetters.add(entity);
}
codeLetterService.saveBatch(codeLetters);
// MyBatis-Plus的saveBatch会回填ID建立映射关系
for (QmsCodeLetter entity : codeLetters) {
codeLetterIdMap.put(entity.getCodeLetter(), entity.getId());
}
}
// 5. 删除并重新保存字码矩阵维护
@ -236,11 +267,18 @@ public class QmsSamplingPlanControllerService {
if (CollectionUtil.isNotEmpty(request.getCodeLetterMatrices())) {
List<QmsCodeLetterMatrix> matrices = new ArrayList<>();
for (QmsSamplingPlanAddQO.CodeLetterMatrixQO qo : request.getCodeLetterMatrices()) {
// 通过字码内容获取字码ID
Long codeLetterId = codeLetterIdMap.get(qo.getCodeLetter());
VUtil.trueThrowBusinessError(codeLetterId == null).throwMessage("字码矩阵维护中的字码[" + qo.getCodeLetter() + "]在字码列表中不存在");
// 通过AQL优先值获取AQL优先值ID
Long aqlPriorityValueId = aqlPriorityValueIdMap.get(qo.getAqlPriorityValue());
VUtil.trueThrowBusinessError(aqlPriorityValueId == null).throwMessage("字码矩阵维护中的AQL优先值[" + qo.getAqlPriorityValue() + "]在AQL优先值列表中不存在");
QmsCodeLetterMatrix entity = new QmsCodeLetterMatrix()
.setSamplingPlanId(planId)
.setInspectionType(qo.getInspectionType())
.setCodeLetterId(qo.getCodeLetterId())
.setAqlPriorityValueId(qo.getAqlPriorityValueId())
.setCodeLetterId(codeLetterId)
.setAqlPriorityValueId(aqlPriorityValueId)
.setSampleSize(qo.getSampleSize())
.setReValue(qo.getReValue())
.setAcValue(qo.getAcValue());
@ -256,12 +294,16 @@ public class QmsSamplingPlanControllerService {
if (CollectionUtil.isNotEmpty(request.getSamplingPlanInspections())) {
List<QmsSamplingPlanInspection> inspections = new ArrayList<>();
for (QmsSamplingPlanAddQO.SamplingPlanInspectionQO qo : request.getSamplingPlanInspections()) {
// 通过字码内容获取字码ID
Long codeLetterId = codeLetterIdMap.get(qo.getCodeLetter());
VUtil.trueThrowBusinessError(codeLetterId == null).throwMessage("抽样方案检验中的字码[" + qo.getCodeLetter() + "]在字码列表中不存在");
QmsSamplingPlanInspection entity = new QmsSamplingPlanInspection()
.setSamplingPlanId(planId)
.setRangeStart(qo.getRangeStart())
.setRangeEnd(qo.getRangeEnd())
.setInspectionDictionaryItemId(qo.getInspectionDictionaryItemId())
.setCodeLetterId(qo.getCodeLetterId());
.setCodeLetterId(codeLetterId);
inspections.add(entity);
}
samplingPlanInspectionService.saveBatch(inspections);

View File

@ -69,7 +69,7 @@ public class QualityNotificationControllerService {
.setTitle(request.getTitle())
.setTargetType(request.getTargetType())
.setContent(request.getContent())
.setState(1) // 默认启用
.setEnable(true) // 默认启用
.setCreateById(operatorId)
.setCreateBy(operator)
.setCreateTime(now)
@ -165,7 +165,7 @@ public class QualityNotificationControllerService {
vo.setTitle(entity.getTitle());
vo.setTargetType(entity.getTargetType());
vo.setContent(entity.getContent());
vo.setState(entity.getState());
vo.setEnable(entity.getEnable());
vo.setCreateById(entity.getCreateById());
vo.setCreateBy(entity.getCreateBy());
vo.setCreateTime(entity.getCreateTime());
@ -253,8 +253,8 @@ public class QualityNotificationControllerService {
vo.setTargetTypeName(vo.getTargetType() == 1 ? "全部" : "手动选择");
}
// 启用状态名称
if (vo.getState() != null) {
vo.setStateName(vo.getState() == 1 ? "启用" : "禁用");
if (vo.getEnable() != null) {
vo.setEnableName(vo.getEnable() ? "启用" : "禁用");
}
}
@ -272,7 +272,7 @@ public class QualityNotificationControllerService {
qualityNotificationService.lambdaUpdate()
.eq(QmsQualityNotification::getId, id)
.set(QmsQualityNotification::getState, enable ? 1 : 2)
.set(QmsQualityNotification::getEnable, enable)
.set(QmsQualityNotification::getUpdateById, operatorId)
.set(QmsQualityNotification::getUpdateBy, operator)
.set(QmsQualityNotification::getUpdateTime, now)

View File

@ -236,13 +236,13 @@ public class QmsSamplingPlanApiTest {
request.setCodeLetters(codeLetters);
// 构建字码矩阵维护列表
// 注意codeLetterId aqlPriorityValueId 应该是数据库中已存在的ID
// 这里使用占位符ID测试时需要根据实际数据调整
// 使用字码内容和AQL优先值来关联而不是ID
// 字码内容需要在codeLetters列表中存在AQL优先值需要在aqlPriorityValues列表中存在
List<QmsSamplingPlanAddQO.CodeLetterMatrixQO> matrices = new ArrayList<>();
QmsSamplingPlanAddQO.CodeLetterMatrixQO matrix = new QmsSamplingPlanAddQO.CodeLetterMatrixQO();
matrix.setInspectionType((short) 0); // 正常检查
matrix.setCodeLetterId(1L);
matrix.setAqlPriorityValueId(1L);
matrix.setCodeLetter("A"); // 关联字码列表中的"A"
matrix.setAqlPriorityValue(new BigDecimal("0.010")); // 关联AQL优先值列表中的0.010
matrix.setSampleSize(125);
matrix.setReValue(3);
matrix.setAcValue(3);
@ -255,7 +255,7 @@ public class QmsSamplingPlanApiTest {
inspection.setRangeStart(1201);
inspection.setRangeEnd(3200);
inspection.setInspectionDictionaryItemId(1L);
inspection.setCodeLetterId(1L);
inspection.setCodeLetter("A"); // 关联字码列表中的"A"
inspections.add(inspection);
request.setSamplingPlanInspections(inspections);

View File

@ -4,14 +4,13 @@ import com.nflg.wms.admin.service.MaterialControllerService;
import com.nflg.wms.common.constant.UserType;
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.MaterialCategoryVO;
import com.nflg.wms.common.pojo.dto.MaterialMainDTO;
import com.nflg.wms.common.pojo.qo.*;
import com.nflg.wms.common.pojo.vo.EbomParentVO;
import com.nflg.wms.common.pojo.vo.MaterialVO;
import com.nflg.wms.common.pojo.vo.QueryMaterialsVO;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.repository.entity.WmsMaterial;
import com.nflg.wms.starter.BaseController;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
@ -155,7 +154,7 @@ public class MaterialController extends BaseController {
* 搜索主物料系统物料信息
*/
@PostMapping("searchBomMaterial")
public ApiResult<PageData<BomMaterialDTO>> searchBomMaterial(@Valid @RequestBody BomMaterialListQO request){
public ApiResult<PageData<MaterialMainDTO>> searchBomMaterial(@Valid @RequestBody BomMaterialListQO request){
return ApiResult.success(materialControllerService.searchBomMaterial(request));
}

View File

@ -9,6 +9,7 @@ import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.dto.BomExportExcelDTO;
import com.nflg.wms.common.pojo.dto.BomImportExcelDTO;
import com.nflg.wms.common.pojo.dto.BomMaterialDTO;
import com.nflg.wms.common.pojo.dto.MaterialMainDTO;
import com.nflg.wms.common.pojo.qo.BomSearchQO;
import com.nflg.wms.common.pojo.qo.BomUpdateQO;
import com.nflg.wms.common.pojo.qo.ScanTypeUpdateQO;
@ -139,7 +140,7 @@ public class BomControllerService {
if (Objects.isNull(dto.getParentNo())) {
sb.append("父级物料编号不能为空;");
} else {
BomMaterialDTO pm = bomMaterialService.getMaterialInfo(dto.getParentNo());
MaterialMainDTO pm = bomMaterialService.getMaterialInfo(dto.getParentNo());
if (Objects.isNull(pm)) {
sb.append("父级物料编号无效");
} else {
@ -168,7 +169,7 @@ public class BomControllerService {
if (StrUtil.isBlank(dto.getChildNo())) {
sb.append("子级物料编号不能为空;");
} else {
BomMaterialDTO cm = bomMaterialService.getMaterialInfo(dto.getChildNo());
MaterialMainDTO cm = bomMaterialService.getMaterialInfo(dto.getChildNo());
if (Objects.isNull(cm)) {
sb.append("子级物料编号无效;");
} else if (bom.getParentId() != 0L) {

View File

@ -44,7 +44,6 @@ import tech.powerjob.common.request.query.JobInfoQuery;
import tech.powerjob.common.response.JobInfoDTO;
import tech.powerjob.common.response.ResultDTO;
import javax.print.attribute.standard.PrinterURI;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -166,7 +165,7 @@ public class MaterialControllerService {
for (MultipartFile file : files) {
String name = file.getOriginalFilename();
String materialNo = name.substring(0, name.lastIndexOf("."));
BomMaterialDTO bomMaterialDTO = bomMaterialService.getMaterialInfo(materialNo);
MaterialMainDTO bomMaterialDTO = bomMaterialService.getMaterialInfo(materialNo);
if (Objects.isNull(bomMaterialDTO)) {
pics.add(name);
} else {
@ -225,9 +224,9 @@ public class MaterialControllerService {
}
}
public PageData<BomMaterialDTO> searchBomMaterial(@Valid BomMaterialListQO request) {
BomPageResultDTO<BomMaterialDTO> bomPageResultDTO = bomMaterialService.searchMaterial(request);
return new PageData<BomMaterialDTO>()
public PageData<MaterialMainDTO> searchBomMaterial(@Valid BomMaterialListQO request) {
BomPageResultDTO<MaterialMainDTO> bomPageResultDTO = bomMaterialService.searchMaterial(request);
return new PageData<MaterialMainDTO>()
.setPage(request.getPage())
.setPageSize(request.getPageSize())
.setTotal((int) bomPageResultDTO.getTotal())

View File

@ -4,12 +4,11 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nflg.wms.common.constant.Constant;
import com.nflg.wms.common.constant.STATE;
import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.dto.BomMaterialDTO;
import com.nflg.wms.common.pojo.dto.MaterialMainDTO;
import com.nflg.wms.common.pojo.dto.StorageExcelExportDTO;
import com.nflg.wms.common.pojo.dto.StorageExcelImportDTO;
import com.nflg.wms.common.pojo.qo.EnableQO;
@ -21,8 +20,14 @@ import com.nflg.wms.common.util.DateTimeUtil;
import com.nflg.wms.common.util.EecExcelUtil;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.common.util.VUtil;
import com.nflg.wms.repository.entity.*;
import com.nflg.wms.repository.service.*;
import com.nflg.wms.repository.entity.DictionaryItem;
import com.nflg.wms.repository.entity.WmsBin;
import com.nflg.wms.repository.entity.WmsStorage;
import com.nflg.wms.repository.entity.WmsWarehouse;
import com.nflg.wms.repository.service.IDictionaryItemService;
import com.nflg.wms.repository.service.IWmsBinService;
import com.nflg.wms.repository.service.IWmsStorageService;
import com.nflg.wms.repository.service.IWmsWarehouseService;
import com.nflg.wms.starter.service.BomMaterialService;
import com.nflg.wms.starter.service.FileUploadService;
import jakarta.annotation.Resource;
@ -146,7 +151,7 @@ public class StorageControllerService {
if (StrUtil.isBlank(dto.getMaterialNo())) {
sb.append("物料编号不能为空;");
} else {
BomMaterialDTO material = bomMaterialService.getMaterialInfo(dto.getMaterialNo());
MaterialMainDTO material = bomMaterialService.getMaterialInfo(dto.getMaterialNo());
if (Objects.isNull(material)) {
sb.append("物料编号无效;");
} else {

View File

@ -2,30 +2,32 @@ package com.nflg.wms.admin.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Pair;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nflg.wms.admin.pojo.dto.PdfPageDTO;
import com.nflg.wms.admin.pojo.dto.ZWM3A17DTO;
import com.nflg.wms.admin.pojo.dto.ZWM3A17Item1DTO;
import com.nflg.wms.admin.util.PdfGeneratorUtil;
import com.nflg.wms.admin.util.QRCodeUtil;
import com.nflg.wms.admin.util.ThymeleafUtil;
import com.nflg.wms.common.constant.Constant;
import com.nflg.wms.common.constant.STATE;
import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.dto.*;
import com.nflg.wms.common.pojo.dto.MaterialMainDTO;
import com.nflg.wms.common.pojo.dto.PackageMaterialDTO;
import com.nflg.wms.common.pojo.dto.PackageMaterialExcelExportDTO;
import com.nflg.wms.common.pojo.dto.PackageMaterialExcelImportDTO;
import com.nflg.wms.common.pojo.qo.*;
import com.nflg.wms.common.pojo.vo.PackageVO;
import com.nflg.wms.common.util.DateTimeUtil;
import com.nflg.wms.common.util.EecExcelUtil;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.common.util.VUtil;
import com.nflg.wms.repository.entity.*;
import com.nflg.wms.repository.entity.WmsInTaskItem;
import com.nflg.wms.repository.entity.WmsMaterial;
import com.nflg.wms.repository.entity.WmsModel;
import com.nflg.wms.repository.entity.WmsStructuralPackage;
import com.nflg.wms.repository.service.*;
import com.nflg.wms.starter.service.BomMaterialService;
import com.nflg.wms.starter.service.FileUploadService;
@ -312,7 +314,7 @@ public class StructuralPackageControllerService {
case 2:
String no = row.getString(1);
VUtil.trueThrowBusinessError(StrUtil.isBlank(no)).throwMessage("钢构包编码不能为空");
BomMaterialDTO material = bomMaterialService.getMaterialInfo(no);
MaterialMainDTO material = bomMaterialService.getMaterialInfo(no);
VUtil.trueThrowBusinessError(Objects.isNull(material)).throwMessage("钢构包编码无效");
packageInfo.setNo(no);
packageInfo.setName(material.getMaterialDesc());

View File

@ -0,0 +1,54 @@
package com.nflg.wms.common.pojo.dto;
import lombok.Data;
@Data
public class MaterialMainDTO {
private Long rowId;
private String materialNo;
private String materialName;
private String materialDesc;
private String materialDescEn;
private String drawingNo;
/**
* 物料单位
*/
private String materialUnit;
/**
* 物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用
*/
private Integer materialState;
/**
* 一级分类编号
*/
private String firstMaterialCategoryCode;
/**
* 二级分类编号
*/
private String secondMaterialCategoryCode;
/**
* 三级分类编号
*/
private String thirdMaterialCategoryCode;
/**
* 大类/中类/小类/细分类
*/
private String oldCategoryNameTree;
/**
* 物料规格
*/
private String materialSpecifications;
}

View File

@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BomMaterialListQO extends PageQO{
public class BomMaterialListQO extends PageQO {
/**
* 物料编号
@ -22,10 +22,10 @@ public class BomMaterialListQO extends PageQO{
/**
* 物料分类不需要设置
*/
private int materialClass=0;
private int materialClass = 0;
/**
* 物料一级分类编码
* 分类编码
*/
private String firstMaterialCategoryCode;
private String materialCategoryCode;
}

View File

@ -31,9 +31,9 @@ public class QmsExemptMaterialSearchQO extends PageQO {
private Integer auditStatus;
/**
* 启用状态false 禁用true
* 启用状态true=启用false=
*/
private Boolean enableStatus;
private Boolean enable;
/**
* 有效开始日期 - 起始

View File

@ -21,7 +21,7 @@ public class QmsQualityNotificationSearchQO extends SearchBaseQO {
private Long notificationTypeId;
/**
* 启用状态1=启用2=禁用
* 启用状态true=启用false=禁用
*/
private Integer state;
private Boolean enable;
}

View File

@ -126,16 +126,16 @@ public class QmsSamplingPlanAddQO {
private Short inspectionType;
/**
* 字码ID
* 字码关联codeLetters中的字码
*/
@NotNull(message = "字码ID不能为空")
private Long codeLetterId;
@NotBlank(message = "字码不能为空")
private String codeLetter;
/**
* AQL优先值ID
* AQL优先值关联aqlPriorityValues中的优先值
*/
@NotNull(message = "AQL优先值ID不能为空")
private Long aqlPriorityValueId;
@NotNull(message = "AQL优先值不能为空")
private BigDecimal aqlPriorityValue;
/**
* 样本量
@ -180,9 +180,9 @@ public class QmsSamplingPlanAddQO {
private Long inspectionDictionaryItemId;
/**
* 字码ID
* 字码关联codeLetters中的字码
*/
@NotNull(message = "字码ID不能为空")
private Long codeLetterId;
@NotBlank(message = "字码不能为空")
private String codeLetter;
}
}

View File

@ -9,5 +9,5 @@ import lombok.Data;
public class ToggleEnableQO {
private Long id;
private Boolean enableStatus;
private Boolean enable;
}

View File

@ -51,9 +51,9 @@ public class QmsExemptMaterialVO {
private String rejectReason;
/**
* 启用状态false 禁用true
* 启用状态true=启用false=
*/
private Boolean enableStatus;
private Boolean enable;
/**
* 免检模式0 永久1 周期

View File

@ -44,14 +44,14 @@ public class QmsQualityNotificationVO {
private String content;
/**
* 启用状态1=启用2=禁用
* 启用状态true=启用false=禁用
*/
private Integer state;
private Boolean enable;
/**
* 启用状态名称
*/
private String stateName;
private String enableName;
/**
* 创建人ID

View File

@ -44,9 +44,9 @@ public class QmsExemptMaterial implements Serializable {
private Integer auditStatus;
/**
* 启用状态false 禁用true
* 启用状态true=启用false=
*/
private Boolean enableStatus;
private Boolean enable;
/**
* 免检模式0 永久1 周期

View File

@ -47,9 +47,9 @@ public class QmsQualityNotification implements Serializable {
private String content;
/**
* 启用状态1=启用2=禁用
* 启用状态true=启用false=禁用
*/
private Integer state;
private Boolean enable;
/**
* 创建人ID

View File

@ -38,7 +38,7 @@ public interface IQmsExemptMaterialService extends IService<QmsExemptMaterial> {
/**
* 启用/禁用切换
*/
void toggleEnable(Long id, Boolean enableStatus);
void toggleEnable(Long id, Boolean enable);
/**
* 审核免检物料

View File

@ -85,7 +85,7 @@ public class QmsExemptMaterialServiceImpl extends ServiceImpl<QmsExemptMaterialM
entity.setSupplierId(supplierId);
entity.setMaterialNo(materialNo);
entity.setAuditStatus(0);
entity.setEnableStatus(true);
entity.setEnable(true);
entity.setCreateBy(userId);
entity.setCreateByName(userName);
entity.setCreateTime(now);
@ -123,12 +123,12 @@ public class QmsExemptMaterialServiceImpl extends ServiceImpl<QmsExemptMaterialM
}
@Override
public void toggleEnable(Long id, Boolean enableStatus) {
public void toggleEnable(Long id, Boolean enable) {
QmsExemptMaterial entity = this.getById(id);
if (entity == null) {
throw new NflgException(STATE.BusinessError, "记录不存在");
}
entity.setEnableStatus(enableStatus);
entity.setEnable(enable);
entity.setUpdateBy(UserUtil.getUserId());
entity.setUpdateByName(UserUtil.getUserName());
entity.setUpdateTime(LocalDateTime.now());

View File

@ -12,7 +12,7 @@
em.material_no,
qm.material_desc,
em.audit_status,
em.enable_status,
em.enable,
em.exempt_mode,
em.valid_start_date,
em.valid_end_date,
@ -45,8 +45,8 @@
<if test="request.auditStatus != null">
AND em.audit_status = #{request.auditStatus}
</if>
<if test="request.enableStatus != null">
AND em.enable_status = #{request.enableStatus}
<if test="request.enable != null">
AND em.enable = #{request.enable}
</if>
<if test="request.validStartDateBegin != null">
AND em.valid_start_date &gt;= #{request.validStartDateBegin}
@ -80,7 +80,7 @@
em.material_no,
qm.material_desc,
em.audit_status,
em.enable_status,
em.enable,
em.exempt_mode,
em.valid_start_date,
em.valid_end_date,
@ -112,7 +112,7 @@
em.material_no,
qm.material_desc,
em.audit_status,
em.enable_status,
em.enable,
em.exempt_mode,
em.valid_start_date,
em.valid_end_date,

View File

@ -9,7 +9,7 @@
q.title,
q.target_type,
q.content,
q.state,
q.enable,
q.create_by_id,
q.create_by,
q.create_time,
@ -25,8 +25,8 @@
<if test="request.notificationTypeId != null">
AND q.notification_type_id = #{request.notificationTypeId}
</if>
<if test="request.state != null">
AND q.state = #{request.state}
<if test="request.enable != null">
AND q.enable = #{request.enable}
</if>
<if test="request.startDate != null">
AND q.create_time &gt;= #{request.startDate}

View File

@ -5,7 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.nflg.wms.common.constant.UserType;
import com.nflg.wms.common.pojo.dto.BomMaterialDTO;
import com.nflg.wms.common.pojo.dto.MaterialMainDTO;
import com.nflg.wms.repository.entity.WmsMaterial;
import com.nflg.wms.repository.service.IWmsMaterialService;
import com.nflg.wms.starter.service.BomMaterialService;
@ -27,7 +27,6 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@ -69,7 +68,7 @@ public class MaterialZipImportProcessor implements BasicProcessor {
}
String materialNo = name.substring(0, name.lastIndexOf("."));
omsLogger.info("物料编号:{}", materialNo);
BomMaterialDTO bomMaterialDTO = bomMaterialService.getMaterialInfo(materialNo);
MaterialMainDTO bomMaterialDTO = bomMaterialService.getMaterialInfo(materialNo);
if (Objects.isNull(bomMaterialDTO)) {
omsLogger.error("主数据中未查找到该物料:{}", materialNo);
} else {

View File

@ -106,13 +106,13 @@ public class BomMaterialService {
return Optional.ofNullable(resultDTO.getData()).orElse(Collections.emptyList());
}
public BomMaterialDTO getMaterialInfo(String no) {
public MaterialMainDTO getMaterialInfo(String no) {
VUtil.trueThrowBusinessError(StrUtil.isBlank(no)).throwMessage("物料编号不能为空");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("authorization", getToken());
HttpEntity<Void> requestEntity = new HttpEntity<>(null, headers);
ResponseEntity<BomResultDTO<BomMaterialDTO>> response = restTemplate.exchange(
ResponseEntity<BomResultDTO<MaterialMainDTO>> response = restTemplate.exchange(
baseUrl + materialInfoUrl + no,
HttpMethod.GET,
requestEntity,
@ -122,29 +122,32 @@ public class BomMaterialService {
log.info("查询主物料系统返回状态码:" + response.getStatusCode().value());
VUtil.trueThrowBusinessError(!response.getStatusCode().is2xxSuccessful())
.throwMessage("查询主物料系统失败");
BomResultDTO<BomMaterialDTO> resultDTO = response.getBody();
BomResultDTO<MaterialMainDTO> resultDTO = response.getBody();
log.info("查询主物料系统返回数据:" + JSONUtil.toJsonStr(resultDTO));
return resultDTO.getData();
}
public BomPageResultDTO<BomMaterialDTO> searchMaterial(BomMaterialListQO qo) {
public BomPageResultDTO<MaterialMainDTO> searchMaterial(BomMaterialListQO qo) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("authorization", getToken());
HttpEntity<BomMaterialListQO> requestEntity = new HttpEntity<>(qo, headers);
ResponseEntity<BomResultDTO<BomPageResultDTO<BomMaterialDTO>>> response = restTemplate.exchange(
ResponseEntity<BomResultDTO<BomPageResultDTO<MaterialMainDTO>>> response = restTemplate.exchange(
baseUrl + materialSearchUrl,
HttpMethod.POST,
requestEntity,
new ParameterizedTypeReference<>() {
}
);
// ResponseEntity<String> responseEntity=restTemplate.postForEntity(baseUrl + materialSearchUrl, requestEntity, String.class);
log.info("查询主物料系统返回状态码:" + response.getStatusCode().value());
VUtil.trueThrowBusinessError(!response.getStatusCode().is2xxSuccessful())
.throwMessage("查询主物料系统失败");
BomResultDTO<BomPageResultDTO<BomMaterialDTO>> resultDTO = response.getBody();
BomResultDTO<BomPageResultDTO<MaterialMainDTO>> resultDTO = response.getBody();
log.info("查询主物料系统返回数据:" + JSONUtil.toJsonStr(resultDTO));
return resultDTO.getData();
// log.info("查询主物料系统返回数据:" +responseEntity.getBody());
// return new BomPageResultDTO();
}
private String getToken() {