chenlu
2024-05-30 ce163f03ebee5f18d5928c2b607b338df4cf614f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
package com.example.erp.controller.pp;
 
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.erp.common.Constants;
import com.example.erp.common.Result;
import com.example.erp.dto.pp.*;
import com.example.erp.entity.pp.DamageDetails;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.pp.Report;
import com.example.erp.entity.sd.Order;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.entity.sd.OrderGlassDetail;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.pp.ReportService;
import com.example.erp.service.pp.WorkOrderService;
import com.example.erp.tools.DownExcel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Date;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
 
@RestController
@Api(value = "生产报表controller", tags = {"生产报表操作接口"})
@RequestMapping("/report")
public class ReportController {
    private final ReportService reportService;
 
    public ReportController(ReportService reportService) {
        this.reportService = reportService;
    }
 
    //流程卡进度
    @ApiOperation("流程卡进度")
    @SaCheckPermission("ProcessCardProgress.search")
    @PostMapping("/processCardProgress/{orderId}")
    public Result processCardProgress(@PathVariable String orderId, @RequestBody List<Integer> columns) {
        return Result.seccess(reportService.processCardProgressSv(orderId, columns));
    }
 
    @ApiOperation("跨工序次破")
    @SaCheckPermission("CrossProcessBreaking.search")
    @PostMapping("/crossProcessBreaking/{pageNum}/{pageSize}/{selectDate}")
    public Result getOrderReport(@PathVariable Integer pageNum,
                                 @PathVariable Integer pageSize,
                                 @PathVariable List<String> selectDate,
                                 @RequestBody DamageDetails damageDetails) {
        return Result.seccess(reportService.crossProcessBreakingSv(pageNum, pageSize, selectDate, damageDetails));
 
    }
 
    @ApiOperation("在制品报表")
    @SaCheckPermission("WorkInProgress.search")
    @PostMapping("/workInProgress/{selectTime1}/{selectTime2}/{orderId}/{inputProject}/{selectProcesses}")
    public Result workInProgress(
            @PathVariable Date selectTime1,
            @PathVariable Date selectTime2,
            @PathVariable String orderId,
            @PathVariable String inputProject,
            @PathVariable String selectProcesses,
            @RequestBody Report report) {
        return Result.seccess(reportService.workInProgressSv(selectTime1, selectTime2, orderId, inputProject, selectProcesses, report));
 
    }
 
    @ApiOperation("工序待完成报表")
    @SaCheckPermission("ProcessToBeCompleted.search")
    @PostMapping("/selectProcessToBeCompleted/{selectTime1}/{selectTime2}/{orderId}/{inputProject}/{selectProcesses}")
    public Result selectProcessToBeCompleted(
            @PathVariable Date selectTime1,
            @PathVariable Date selectTime2,
            @PathVariable String orderId,
            @PathVariable String inputProject,
            @PathVariable String selectProcesses,
            @RequestBody Report report) {
        return Result.seccess(reportService.selectProcessToBeCompletedSv(selectTime1, selectTime2, orderId, inputProject, selectProcesses, report));
 
    }
 
    @ApiOperation("次破明细报表")
    @SaCheckPermission("DamageReport.search")
    @PostMapping("/damageReport/{pageNum}/{pageSize}/{selectTime1}/{selectTime2}")
    public Result damageReport(
            @PathVariable Integer pageNum,
            @PathVariable Integer pageSize,
            @PathVariable Date selectTime1,
            @PathVariable Date selectTime2,
            @RequestBody DamageReportDTO damageReportDTO) {
        return Result.seccess(reportService.selectDamageReportSv(pageNum, pageSize, selectTime1, selectTime2, damageReportDTO));
 
    }
 
    @ApiOperation("分架明细报表")
    @SaCheckPermission("SplittingDetailsOutside.search")
    @PostMapping("/splittingDetailsOutside/{orderId}")
    public Result splittingDetailsOutside(
            @PathVariable String orderId,
            @RequestBody Report report) {
        return Result.seccess(reportService.splittingDetailsOutsideSv(orderId, report));
 
    }
 
    @ApiOperation("品质报表")
    @SaCheckPermission("QualityReport.search")
    @PostMapping("/qualityReport/{selectTime1}/{selectTime2}")
    public Result qualityReport(
            @PathVariable Date selectTime1,
            @PathVariable Date selectTime2,
            @RequestBody Report report) {
        return Result.seccess(reportService.qualityReportSv(selectTime1, selectTime2, report));
 
    }
 
    @ApiOperation("成品率报表")
    @SaCheckPermission("Yield.search")
    @PostMapping("/yield/{selectTime1}/{selectTime2}/{selectProcesses}")
    public Result yield(
            @PathVariable Date selectTime1,
            @PathVariable Date selectTime2,
            @PathVariable String selectProcesses,
            @RequestBody Report report) {
        return Result.seccess(reportService.yieldSv(selectTime1, selectTime2, selectProcesses, report));
 
    }
 
    @ApiOperation("生产发货进度")
    @SaCheckPermission("ProductionSchedule.search")
    @PostMapping("/productionSchedule/{orderId}")
    public Result productionSchedule(@PathVariable String orderId, @RequestBody List<Integer> columns) {
        return Result.seccess(reportService.productionScheduleSv(orderId, columns));
    }
 
    @ApiOperation("任务完成情况汇总进度")
    @SaCheckPermission("TaskCompletionStatus.search")
    @PostMapping("/taskCompletionStatus/{selectTime1}/{selectTime2}")
    public Result taskCompletionStatus(@PathVariable Date selectTime1,
                                       @PathVariable Date selectTime2,
                                       @RequestBody List<Integer> columns) {
        return Result.seccess(reportService.taskCompletionStatusSv(selectTime1, selectTime2, columns));
    }
 
    @ApiOperation("订单计划分解")
    @SaCheckPermission("OrderPlanDecomposition.search")
    @PostMapping("/orderPlanDecomposition/{selectTime1}/{selectTime2}")
    public Result orderPlanDecomposition(@PathVariable Date selectTime1,
                                         @PathVariable Date selectTime2,
                                         @RequestBody Report report) {
        return Result.seccess(reportService.orderPlanDecompositionSv(selectTime1, selectTime2, report));
    }
 
    @ApiOperation("原片领料")
    @SaCheckPermission("RawMaterialRequisition.search")
    @PostMapping("/rawMaterialRequisition/{selectTime1}/{selectTime2}")
    public Result rawMaterialRequisition(@PathVariable Date selectTime1,
                                         @PathVariable Date selectTime2,
                                         @RequestBody Report report) {
        return Result.seccess(reportService.rawMaterialRequisitionSv(selectTime1, selectTime2, report));
    }
 
    @ApiOperation("跨工序次破报表导出")
    @PostMapping("/exportCrossProcessBreaking")
    public void exportCrossProcessBreaking(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, CrossProcessBreakingDTO.class, reportService.exportCrossProcessBreakingSv(dates), "CrossProcessBreaking");
    }
 
    @ApiOperation("次破明细报表导出")
    @PostMapping("/exportDamageReport")
    public void exportDamageReport(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, DamageReportDTO.class, reportService.exportDamageReportSv(dates), "DamageReport");
    }
 
    @ApiOperation("订单计划分解报表导出")
    @PostMapping("/exportOrderPlanDecomposition")
    public void exportOrderPlanDecomposition(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, OrderPlanDecompositionDTO.class, reportService.exportOrderPlanDecompositionSv(dates), "OrderPlanDecomposition");
    }
 
    @ApiOperation("工序待完成报表导出")
    @PostMapping("/exportProcessToBeCompleted")
    public void exportProcessToBeCompleted(HttpServletResponse response,
                                          @RequestBody Map<String,Object> dates)
            throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, ProcessToBeCompletedDTO.class, reportService.exportProcessToBeCompletedSv(dates), "ProcessToBeCompleted");
    }
 
    @ApiOperation("在制品报表导出")
    @PostMapping("/exportWorkInProgress")
    public void exportWorkInProgress(HttpServletResponse response,
                                           @RequestBody Map<String,Object> dates)
            throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, WorkInProgressDTO.class, reportService.exportWorkInProgressSv(dates), "WorkInProgress");
    }
 
    @ApiOperation("分架明细报表导出")
    @PostMapping("/exportSplittingDetailsOutside")
    public void exportSplittingDetailsOutside(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, SplittingDetailsOutsideDTO.class, reportService.exportOrderPlanDecompositionSv(dates), "OrderPlanDecomposition");
    }
}