chenlu
2025-12-01 83e57cd2c14087d79aff9c9f40c236d6b5a53860
补充
2个文件已修改
59 ■■■■ 已修改文件
north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java
@@ -140,23 +140,23 @@
    }
    @ApiOperation("成品率报表")
    @PostMapping("/yield/{selectTime1}/{selectTime2}/{selectProcesses}")
    @PostMapping("/yield/{selectDate}/{selectProcesses}/{reportTime}")
    public Result yield(
            @PathVariable String selectTime1,
            @PathVariable String selectTime2,
            @PathVariable List<String> selectDate,
            @PathVariable String selectProcesses,
            @PathVariable String reportTime,
            @RequestBody Report report) {
        return Result.success(reportService.yieldSv(selectTime1, selectTime2, selectProcesses, report));
        return Result.success(reportService.yieldSv(selectDate, selectProcesses,reportTime, report));
    }
    @ApiOperation("成品率工序汇总报表")
    @PostMapping("/yieldProcess/{selectTime1}/{selectTime2}")
    @PostMapping("/yieldProcess/{selectDate}/{reportTime}")
    public Result yieldProcess(
            @PathVariable String selectTime1,
            @PathVariable String selectTime2,
            @PathVariable List<String> selectDate,
            @PathVariable String reportTime,
            @RequestBody Report report) {
        return Result.success(reportService.yieldProcessSv(selectTime1, selectTime2, report));
        return Result.success(reportService.yieldProcessSv(selectDate,reportTime, report));
    }
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
@@ -692,10 +692,27 @@
        return map;
    }
    public Map<String, Object> yieldSv(String selectTime1, String selectTime2, String selectProcesses, Report report) {
    public Map<String, Object> yieldSv(List<String> selectDate, String selectProcesses,String reportTime, Report report) {
        Map<String, Object> map = new HashMap<>();
        map.put("data", reportMapper.yieldMp(selectTime1, selectTime2, selectProcesses, report));
        // 默认时间范围:过去 7 天(日期 + reportTime)
        String startDate = toReportTime(LocalDate.now().minusDays(7).toString(), reportTime);
        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
        // 如果前端传了时间,就用前端日期 + reportTime
        if (selectDate != null && selectDate.size() == 2) {
            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
                startDate = toReportTime(selectDate.get(0), reportTime);
            }
            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
                endDate = toReportTime(selectDate.get(1), reportTime);
            }
        }
        map.put("data", reportMapper.yieldMp(startDate, endDate, selectProcesses, report));
        map.put("process", productionSchedulingMapper.selectProcess());
        List<String> list = new ArrayList<>();
        list.add(startDate);
        list.add(endDate);
        map.put("selectDate",list);
        return map;
    }
@@ -1643,10 +1660,28 @@
        return map;
    }
    public Map<String, Object> yieldProcessSv(String selectTime1, String selectTime2, Report report) {
    public Map<String, Object> yieldProcessSv(List<String> selectDate,String reportTime, Report report) {
        Map<String, Object> map = new HashMap<>();
        map.put("data", reportMapper.yieldProcessMp(selectTime1, selectTime2, report));
        // 默认时间范围:过去 7 天(日期 + reportTime)
        String startDate = toReportTime(LocalDate.now().minusDays(7).toString(), reportTime);
        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
        // 如果前端传了时间,就用前端日期 + reportTime
        if (selectDate != null && selectDate.size() == 2) {
            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
                startDate = toReportTime(selectDate.get(0), reportTime);
            }
            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
                endDate = toReportTime(selectDate.get(1), reportTime);
            }
        }
        map.put("data", reportMapper.yieldProcessMp(startDate, endDate, report));
        map.put("process", productionSchedulingMapper.selectProcess());
        List<String> list = new ArrayList<>();
        list.add(startDate);
        list.add(endDate);
        System.out.println(list);
        map.put("selectDate",list);
        return map;
    }