云
昨天 704265308b1227dbada5a36b2027b588c062ded2
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/scan/MesProScanEventController.java
@@ -23,7 +23,7 @@
@RestController @RequestMapping("/mes/pro/scan-in")
public class MesProScanEventController {
    @Resource private MesProScanEventService service;
    @PostMapping("/inbound") @PreAuthorize("@ss.hasPermission('mes:pro-scan-in:inbound')") @Operation(summary = "袋码扫码入库")
    @PostMapping("/inbound") @PreAuthorize("@ss.hasPermission('mes:pro-scan-in:inbound')") @Operation(summary = "追溯码扫码入库(袋码/托盘码/批次码)")
    public CommonResult<MesProScanEventRespVO> inbound(@Valid @RequestBody MesProScanEventCreateReqVO req) {
        return success(BeanUtils.toBean(service.createInbound(req), MesProScanEventRespVO.class));
    }
@@ -32,6 +32,20 @@
        PageResult<MesProScanEventDO> page = service.getPage(req);
        return success(new PageResult<>(BeanUtils.toBean(page.getList(), MesProScanEventRespVO.class), page.getTotal()));
    }
    @GetMapping("/my-page") @PreAuthorize("@ss.hasPermission('mes:pro-scan-in:query')")
    @Operation(summary = "本人扫码作业记录")
    public CommonResult<PageResult<MesProScanEventRespVO>> myPage(@Valid MesProScanEventPageReqVO req) {
        req.setCreator(String.valueOf(cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId()));
        return page(req);
    }
    @GetMapping("/my-event") @PreAuthorize("@ss.hasAnyPermissions('mes:pro-scan-in:query','mes:pro-scan-in:inbound')")
    @Operation(summary = "核实本人扫码操作结果")
    public CommonResult<MesProScanEventRespVO> myEvent(@RequestParam String eventId) {
        MesProScanEventDO event = service.getByEventId(eventId);
        String userId = String.valueOf(cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId());
        return success(event != null && userId.equals(event.getCreator())
                ? BeanUtils.toBean(event, MesProScanEventRespVO.class) : null);
    }
    @GetMapping("/latest") @PreAuthorize("@ss.hasPermission('mes:pro-scan-in:query')") @Operation(summary = "最新扫码事件")
    public CommonResult<MesProScanEventRespVO> latest(@RequestParam(required = false) String deviceCode) {
        return success(BeanUtils.toBean(service.getLatest(deviceCode), MesProScanEventRespVO.class));