3 天以前 b852254d90e7d1955db31db154193ec8ee84d8b3
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
package cn.iocoder.yudao.module.mes.controller.admin.cal.schedule;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.controller.admin.cal.schedule.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.cal.schedule.MesCalScheduleDetailDO;
import cn.iocoder.yudao.module.mes.service.cal.schedule.MesCalScheduleDetailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
@Tag(name = "管理后台 - MES 员工级排班明细")
@RestController
@RequestMapping("/mes/cal/schedule-detail")
@Validated
public class MesCalScheduleDetailController {
 
    @Resource
    private MesCalScheduleDetailService scheduleDetailService;
 
    @PostMapping("/generate")
    @Operation(summary = "按班组排班生成员工级排班明细")
    @Parameter(name = "planId", description = "排班计划编号", required = true, example = "1")
    @PreAuthorize("@ss.hasPermission('mes:cal-schedule-detail:generate')")
    public CommonResult<Boolean> generateDetails(@RequestParam("planId") Long planId) {
        scheduleDetailService.generateDetails(planId);
        return success(true);
    }
 
    @PutMapping("/update")
    @Operation(summary = "更新员工级排班明细(人工微调)")
    @PreAuthorize("@ss.hasPermission('mes:cal-schedule-detail:update')")
    public CommonResult<Boolean> updateDetail(@Valid @RequestBody MesCalScheduleDetailSaveReqVO updateReqVO) {
        scheduleDetailService.updateDetail(updateReqVO);
        return success(true);
    }
 
    @GetMapping("/page")
    @Operation(summary = "获得员工级排班明细分页")
    @PreAuthorize("@ss.hasPermission('mes:cal-schedule-detail:query')")
    public CommonResult<PageResult<MesCalScheduleDetailRespVO>> getDetailPage(
            @Valid MesCalScheduleDetailPageReqVO pageReqVO) {
        PageResult<MesCalScheduleDetailDO> pageResult = scheduleDetailService.getDetailPage(pageReqVO);
        List<MesCalScheduleDetailRespVO> list = BeanUtils.toBean(pageResult.getList(), MesCalScheduleDetailRespVO.class);
        return success(new PageResult<>(list, pageResult.getTotal()));
    }
 
    @GetMapping("/list")
    @Operation(summary = "获得员工级排班明细列表")
    @PreAuthorize("@ss.hasPermission('mes:cal-schedule-detail:query')")
    public CommonResult<List<MesCalScheduleDetailRespVO>> getDetailList(
            @Valid MesCalScheduleDetailPageReqVO pageReqVO) {
        return success(BeanUtils.toBean(scheduleDetailService.getDetailList(pageReqVO), MesCalScheduleDetailRespVO.class));
    }
 
    @GetMapping("/check")
    @Operation(summary = "员工排班合规校验(连续工时/休息间隔)")
    @PreAuthorize("@ss.hasPermission('mes:cal-schedule-detail:query')")
    public CommonResult<List<MesCalScheduleDetailCheckRespVO>> checkCompliance(
            @Valid MesCalScheduleDetailCheckReqVO checkReqVO) {
        return success(scheduleDetailService.checkCompliance(checkReqVO));
    }
 
}