fix(api): 统一API返回格式并修复COA报告验证逻辑

- 修改CoaController.existsReport方法返回ApiResult包装格式
- 移除NormalOrderController中未使用的StringUtil导入
- 将COA报告存在性检查改为审核通过状态检查
- 更新错误提示信息为更明确的COA报告提交审核要求
- 修复QmsCoaReviewServiceImpl中删除状态判断条件
- 重命名QmsService.existsReport方法为coaReportPass
- 优化COA报告验证结果处理逻辑,避免空值导致的异常
This commit is contained in:
曹鹏飞 2026-06-08 09:02:42 +08:00
parent 6e28f6f2fc
commit 442893830e
4 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,6 @@
package com.nflg.qms.admin.controller.external;
import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.qo.QmsCoaReportCheckQO;
import com.nflg.wms.repository.service.IQmsCoaReviewService;
import com.nflg.wms.starter.BaseController;
@ -23,7 +24,7 @@ public class CoaController extends BaseController {
* 检测COA报告是否存在且已审核
*/
@PostMapping("existsReport")
public boolean existsReport(@RequestBody QmsCoaReportCheckQO qo){
return coaReviewService.existsReport(qo);
public ApiResult<Boolean> existsReport(@RequestBody QmsCoaReportCheckQO qo){
return ApiResult.success(coaReviewService.existsReport(qo));
}
}

View File

@ -18,7 +18,6 @@ import com.nflg.wms.common.pojo.dto.SAPOrderDTO;
import com.nflg.wms.common.pojo.qo.*;
import com.nflg.wms.common.pojo.vo.DeliverNormalOrderVO;
import com.nflg.wms.common.util.NumberUtil;
import com.nflg.wms.common.util.StringUtil;
import com.nflg.wms.common.util.UserUtil;
import com.nflg.wms.common.util.VUtil;
import com.nflg.wms.repository.entity.*;
@ -227,8 +226,8 @@ public class NormalOrderController extends BaseController {
// VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("没有需要打印的数据");
List<WmsQrCodeMaster> qrCodeMasters = qrCodeMasterService.getByExtendIds(ids);
qrCodeMasters.forEach(qrCodeMaster->{
VUtil.trueThrowBusinessError(!qmsService.existsReport(qrCodeMaster.getSupplierCode(),qrCodeMaster.getMaterialCode(),qrCodeMaster.getPoNumber()))
.throwMessage("物料" + qrCodeMaster.getMaterialCode() + "采购单" + qrCodeMaster.getPoNumber() + "无有效COA报告");
VUtil.trueThrowBusinessError(!qmsService.coaReportPass(qrCodeMaster.getSupplierCode(),qrCodeMaster.getMaterialCode(),qrCodeMaster.getPoNumber()))
.throwMessage("请先提交物料" + qrCodeMaster.getMaterialCode() + "(采购单" + qrCodeMaster.getPoNumber() + ")的COA报告并完成审核");
});
exportPdfPerPage(qrCodeMasters, response);
}
@ -252,8 +251,8 @@ public class NormalOrderController extends BaseController {
// exportPdfInAll(convert(orders), response);
List<WmsQrCodeMaster> qrCodeMasters = qrCodeMasterService.getByExtendIds(ids);
qrCodeMasters.forEach(qrCodeMaster->{
VUtil.trueThrowBusinessError(!qmsService.existsReport(qrCodeMaster.getSupplierCode(),qrCodeMaster.getMaterialCode(),qrCodeMaster.getPoNumber()))
.throwMessage("物料" + qrCodeMaster.getMaterialCode() + "采购单" + qrCodeMaster.getPoNumber() + "无有效COA报告");
VUtil.trueThrowBusinessError(!qmsService.coaReportPass(qrCodeMaster.getSupplierCode(),qrCodeMaster.getMaterialCode(),qrCodeMaster.getPoNumber()))
.throwMessage("请先提交物料" + qrCodeMaster.getMaterialCode() + "(采购单" + qrCodeMaster.getPoNumber() + ")的COA报告并完成审核");
});
exportPdfInAll(qrCodeMasters, response);
}
@ -405,8 +404,8 @@ public class NormalOrderController extends BaseController {
// VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("没有需要打印的数据");
List<WmsQrCodeMaster> qrCodeMasters = qrCodeMasterService.getByExtendIds(ids);
qrCodeMasters.forEach(qrCodeMaster->{
VUtil.trueThrowBusinessError(!qmsService.existsReport(qrCodeMaster.getSupplierCode(),qrCodeMaster.getMaterialCode(),qrCodeMaster.getPoNumber()))
.throwMessage("物料" + qrCodeMaster.getMaterialCode() + "采购单" + qrCodeMaster.getPoNumber() + "无有效COA报告");
VUtil.trueThrowBusinessError(!qmsService.coaReportPass(qrCodeMaster.getSupplierCode(),qrCodeMaster.getMaterialCode(),qrCodeMaster.getPoNumber()))
.throwMessage("请先提交物料" + qrCodeMaster.getMaterialCode() + "(采购单" + qrCodeMaster.getPoNumber() + ")的COA报告并完成审核");
});
return exportItemImageZip(convertToPrintDTO(qrCodeMasters));
}

View File

@ -113,9 +113,9 @@ public class QmsService {
}
/**
* 检查是否免检物料
* 检查COA报告
*/
public boolean existsReport(String supplierCode,String materialNo,String purchaseNo) {
public boolean coaReportPass(String supplierCode, String materialNo, String purchaseNo) {
log.info("检测是否已提交COA报告供应商{},物料编号:{},采购单号:{}", supplierCode, materialNo,purchaseNo);
HttpHeaders headers = new HttpHeaders();
@ -135,7 +135,7 @@ public class QmsService {
VUtil.trueThrowBusinessError(
Objects.isNull(response.getBody()) || response.getBody().getCode() != 200
).throwMessage("检测是否已提交COA报告失败" + response.getBody().getMessage());
return response.getBody().getResult();
return !Objects.equals(response.getBody().getResult(),false);
}
public void pushInventoryInspection(InventoryDetectionApplyQO request) {

View File

@ -617,7 +617,7 @@ public class QmsCoaReviewServiceImpl extends ServiceImpl<QmsCoaReviewMapper, Qms
.eq(QmsCoaReview::getMaterialId, material.getId())
.eq(QmsCoaReview::getPurchaseNo, qo.getPurchaseNo())
.eq(QmsCoaReview::getStatus, 2)
.ne(QmsCoaReview::getDeleted, true)
.ne(QmsCoaReview::getDeleted, false)
.exists();
}