skyouc
6 天以前 162072ac75b009a24cb84569ea7000a782c0fa34
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;
@@ -211,4 +212,42 @@
        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("审核完成!!");
    }
}