rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyInspectServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.manager.controller.params.IsptOrderParam;
@@ -112,7 +113,7 @@
                        .select("asn_id as id, SUM(anfme) anfme, SUM(qty) qty, area_id, area_name, asn_code, asn_id, splr_id, splr_batch")
                        .eq(StringUtils.isNotBlank(code), "asn_code", code)
                        .lambda()
                        .isNull(WarehouseAreasItem::getIsptResult)
//                        .isNull(WarehouseAreasItem::getIsptResult)
                        .lt(WarehouseAreasItem::getWorkQty, 1)
                        .lt(WarehouseAreasItem::getQty, 1)
                .groupBy(WarehouseAreasItem::getAsnCode));
@@ -174,11 +175,16 @@
                isptItem.setAsnItemId(orderItem.getId())
                        .setIspectId(inspect.getId())
                        .setRcptQty(orderItem.getAnfme())
                        .setRcptId(orderItem.getId())
                        .setPlatOrderCode(orderItem.getPlatOrderCode())
                        .setPlatWorkCode(orderItem.getPlatWorkCode())
                        .setProjectCode(orderItem.getProjectCode())
                        .setAnfme(0.0)
                        .setFieldsIndex(orderItem.getFieldsIndex())
                        .setSplrBatch(orderItem.getSplrBatch())
                        .setSplrName(orderItem.getSplrId$())
                        .setCreateBy(loginUserId)
                        .setUpdateBy(loginUserId)
                        .setDlyQty(orderItem.getAnfme());
                items.add(isptItem);
            }
@@ -210,4 +216,43 @@
        return this.save(qlyInspect);
    }
    /**
     * @author Ryan
     * @date 2025/5/14
     * @description: 质检审核确认
     * @version 1.0
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R verifyComplate(Long id) {
        if (Objects.isNull(id)) {
            throw new CoolException("参数不能为空!!");
        }
        QlyInspect inspect = this.getById(id);
        if (Objects.isNull(inspect)) {
            throw new CoolException("质检单据不存在!!");
        }
        inspect.setIsptStatus(QlyIsptStatus.QLY_ISPT_STAS_DONE.val);
        if (!this.saveOrUpdate(inspect)) {
            throw new CoolException("单据修改失败!!");
        }
        List<QlyIsptItem> items = qlyIsptItemService.selectIsptResult(new LambdaQueryWrapper<QlyIsptItem>().eq(QlyIsptItem::getIspectId, inspect.getId()));
        if (items.isEmpty()) {
            throw new CoolException("质检单据明细不存在!!");
        }
        for (QlyIsptItem isptItem : items) {
            if (isptItem.getSafeQty().compareTo(0.0) <= 0 && isptItem.getDisQty().compareTo(0.0) <= 0 ) {
                continue;
            }
            WarehouseAreasItem item = warehouseAreasItemService.getById(isptItem.getRcptId());
            if (Objects.isNull(item)) {
                throw new CoolException("库存明细不存在!!");
            }
            qlyIsptItemService.confirmReceipt(isptItem, item);
        }
        return R.ok("审核完成!!");
    }
}