gongchunyi
2026-04-29 25748d86291c225dd5a52315f116330f1583b182
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
package com.ruoyi.production.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.production.dto.ProductionProductMainDetailExportDto;
import com.ruoyi.production.dto.ProductionProductMainDto;
import com.ruoyi.production.dto.ProductionProductMainSummaryExportDto;
import com.ruoyi.production.dto.ProductionReportDailySummaryDto;
import com.ruoyi.production.dto.ProductionReportStateDto;
import com.ruoyi.production.pojo.ProductionProductMain;
import com.ruoyi.production.service.ProductionProductMainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.List;
 
@RequestMapping("productionProductMain")
@RestController
@Api(value = "生产报工")
public class ProductionProductMainController {
 
    @Autowired
    private ProductionProductMainService productionProductMainService;
 
    /**
     * 报工查询
     *
     * @param page
     * @param productionProductMainDto
     * @return
     */
    @ApiOperation("报工台账汇总分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "current", value = "页码", dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "size", value = "每页数量", dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "workOrderNo", value = "工单编号(模糊)", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "workOrderStatus", value = "工单状态", dataType = "string", paramType = "query")
    })
    @GetMapping("listPage")
    public R<?> page(Page<ProductionProductMainDto> page, ProductionProductMainDto productionProductMainDto) {
        return R.ok(productionProductMainService.listPageProductionProductMainDto(page, productionProductMainDto));
    }
 
    /**
     * 报工明细查询(每条报工记录)
     */
    @ApiOperation("报工明细分页(每条报工记录)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "current", value = "页码", dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "size", value = "每页数量", dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "workOrderId", value = "工单ID", dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "startDate", value = "开始日期(按结束时间过滤, yyyy-MM-dd)", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期(按结束时间过滤, yyyy-MM-dd)", dataType = "string", paramType = "query")
    })
    @GetMapping("listPageDetail")
    public R<?> pageDetail(Page<ProductionProductMainDto> page, ProductionProductMainDto productionProductMainDto) {
        return R.ok(productionProductMainService.listPageProductionProductMainDetailDto(page, productionProductMainDto));
    }
 
 
    /**
     * 报工新增更新
     *
     * @param productionProductMainDto
     * @return
     */
    @PostMapping("addProductMain")
    public R<?> addProductMain(@RequestBody ProductionProductMainDto productionProductMainDto) {
        return R.ok(productionProductMainService.addProductMain(productionProductMainDto));
    }
 
    /**
     * 扫码后查询当前用户是否存在进行中的报工
     */
    @ApiOperation("查询进行中的报工(当前登录人)")
    @GetMapping("getRunning")
    public R<ProductionProductMain> getRunning(Long workOrderId, Long productProcessRouteItemId) {
        ProductionProductMain productionProductMain = productionProductMainService.getRunning(workOrderId, productProcessRouteItemId);
        return R.ok(productionProductMain);
    }
 
    /**
     * 每日报工时长汇总(当前登录人)
     */
    @ApiOperation("每日报工时长汇总(当前登录人)")
    @GetMapping("dailyDuration")
    public R<List<ProductionReportDailySummaryDto>> dailyDuration(Long workOrderId, Long productProcessRouteItemId, LocalDate startDate, LocalDate endDate) {
        return R.ok(productionProductMainService.dailyDuration(workOrderId, productProcessRouteItemId, startDate, endDate));
    }
 
    /**
     * 查询报工状态: 1-开始报工 2-结束报工 3-报工完成
     */
    @ApiOperation("查询报工状态(当前登录人)")
    @GetMapping("reportState")
    public R<ProductionReportStateDto> reportState(Long workOrderId, Long productProcessRouteItemId) {
        return R.ok(productionProductMainService.reportState(workOrderId, productProcessRouteItemId));
    }
 
    @ApiOperation("删除报工")
    @DeleteMapping("/delete")
    public R<?> delete(@RequestBody ProductionProductMainDto productionProductMainDto) {
        return R.ok(productionProductMainService.removeProductMain(productionProductMainDto.getId()));
    }
 
 
    /**
     * 报工台账汇总导出
     */
    @ApiOperation("报工台账汇总导出")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "workOrderIds", value = "工单ID列表, 可传多个", allowMultiple = true, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "workOrderNo", value = "工单编号(模糊)", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "workOrderStatus", value = "工单状态", dataType = "string", paramType = "query")
    })
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProductionProductMainDto productionProductMainDto) {
        List<ProductionProductMainSummaryExportDto> list = productionProductMainService.listSummaryExportData(productionProductMainDto);
        ExcelUtil<ProductionProductMainSummaryExportDto> util = new ExcelUtil<>(ProductionProductMainSummaryExportDto.class);
        util.exportExcel(response, list, "生产报工汇总数据");
    }
 
    /**
     * 报工明细导出
     */
    @ApiOperation("报工明细导出")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "workOrderIds", value = "工单ID列表, 可传多个", allowMultiple = true, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "workOrderId", value = "工单ID", dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "startDate", value = "开始日期(按结束时间过滤, yyyy-MM-dd)", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期(按结束时间过滤, yyyy-MM-dd)", dataType = "string", paramType = "query")
    })
    @PostMapping("/exportDetail")
    public void exportDetail(HttpServletResponse response, ProductionProductMainDto productionProductMainDto) {
        List<ProductionProductMainDetailExportDto> list = productionProductMainService.listDetailExportData(productionProductMainDto);
        ExcelUtil<ProductionProductMainDetailExportDto> util = new ExcelUtil<>(ProductionProductMainDetailExportDto.class);
        util.exportExcel(response, list, "生产报工明细数据");
    }
}