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));
|
}
|
|
}
|