liujie
2025-10-13 5d4ebe6d0b7dda230b19f4913bdeb60556b46678
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java
@@ -101,6 +101,18 @@
    }
    /**
     * erp采购管理分页列表
     */
    @ApiOperation(value = "erp采购管理分页列表--仓库专用")
    @PostMapping(value = "/pageListWarehouse")
    public R<PageInfo<TErpProcurementVo>> pageListWarehouse(@RequestBody TErpProcurementQuery query) {
        SysUser user = tokenService.getLoginUser().getUser();
        return R.ok(erpProcurementService.pageListWarehouse(query,user));
    }
    @ApiOperation(value = "erp采购管理详情")
    @GetMapping(value = "/detail")
@@ -169,6 +181,45 @@
        return R.ok( erpProcurementService.detailProcurement(clinicSupplierId, user, id));
    }
    @ApiOperation(value = "采购详情--发货(仓库角色)")
    @PostMapping(value = "/detailProcurementSend/{id}")
    public R<?> detailProcurementSend(@PathVariable String id) {
        SysUser user = tokenService.getLoginUser().getUser();
        Integer roleType = user.getRoleType();
        String clinicSupplierId=null;
        if(roleType == 4){
            // 供应商
            TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class)
                    .eq(TCrmSupplier::getUserId, user.getUserId())
                    .last("LIMIT 1"));
            clinicSupplierId=crmSupplier.getId();
        }
        erpProcurementService.detailProcurementSend(clinicSupplierId, user, id);
        return R.ok();
    }
//    @ApiOperation(value = "采购详情--仓库角色专用")
//    @GetMapping(value = "/detailProcurementWarehouse/{id}")
//    public R<DetailProcurementVO> detailProcurementWarehouse(@PathVariable String id) {
//        SysUser user = tokenService.getLoginUser().getUser();
//        Integer roleType = user.getRoleType();
//        String clinicSupplierId=null;
//        if(roleType == 5){
//            // 诊所
//            TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
//                    .eq(TCrmClinic::getUserId, user.getUserId())
//                    .last("LIMIT 1"));
//            clinicSupplierId = crmClinic.getId();
//        }
//
//        return R.ok( erpProcurementService.detailProcurementWarehouse(clinicSupplierId, user, id));
//    }
    @ApiOperation(value = "采购草稿")
    @GetMapping(value = "/getProcurementDraft")
    public R<ArrayList<DetailProcurementNextVO>> getProcurementDraft() {
@@ -183,7 +234,7 @@
            clinicSupplierId = crmClinic.getId();
        }
        ArrayList<DetailProcurementNextVO> detailProcurementNextVOS = new ArrayList<>();
        List<TErpProcurement> list1 = erpProcurementService.list(new LambdaQueryWrapper<TErpProcurement>().eq(TErpProcurement::getStatus, 1).orderByDesc(TErpProcurement::getCreateTime));
        List<TErpProcurement> list1 = erpProcurementService.list(new LambdaQueryWrapper<TErpProcurement>().eq(TErpProcurement::getClinicId, clinicSupplierId).eq(TErpProcurement::getStatus, 1).orderByDesc(TErpProcurement::getCreateTime));
        if(list1.isEmpty()){
            return R.ok(detailProcurementNextVOS);
        }
@@ -331,6 +382,9 @@
            tCrmChangePoints.setChangeValue(points);
            crmChangePointsService.save(tCrmChangePoints);
            branch.setUserPoints(branch.getUserPoints()+points);
            crmBranchService.updateById(branch);
            // 分佣
            BigDecimal commission = branch.getMoneyCommission().divide(BigDecimal.valueOf(100), 4, RoundingMode.HALF_DOWN).multiply(payMoney).setScale(2, RoundingMode.HALF_UP);
@@ -356,6 +410,8 @@
            tCrmChangePoints.setChangeReason(1);
            tCrmChangePoints.setChangeValue(points);
            crmChangePointsService.save(tCrmChangePoints);
            salesperson.setUserPoints(salesperson.getUserPoints()+points);
            crmSalespersonService.updateById(salesperson);