云
4 天以前 f02d0df2f1dfc7a8b775cf50d45375e57628a5ef
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/MesQcCompletionHelper.java
@@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.mes.service.qc;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@@ -9,7 +8,6 @@
/** 按数量汇总质检结果,不推断不合格品的后续处置方式。 */
@Component
public class MesQcCompletionHelper {
    @Resource private StorageAttachmentApi storageApi;
    @Resource private org.springframework.jdbc.core.JdbcTemplate jdbcTemplate;
    public void lockDocument(String type, Long id) {
@@ -29,8 +27,7 @@
        if (total.signum() <= 0 || checked == null || total.compareTo(checked) != 0) {
            throw new ServiceException(400, "合格数量与不合格数量之和须大于零且等于检测数量");
        }
        var attachments = storageApi.listAttachments("mes_qc_" + type + "_attachment", id);
        if (attachments == null || attachments.isEmpty()) throw new ServiceException(400, "请先上传检验附件");
        // 检验附件改为非必填,完成检验时不再强制校验是否已上传。
        // 与现有 mes_qc_check_result 字典一致:1 通过,2 不通过。
        return unqualified.signum() == 0 ? 1 : 2;
    }