18 小时以前 7dc2054d4d93f17ce8595f1b0559c904bee2a38f
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
package cn.iocoder.yudao.module.mes.controller.admin.pro.scan;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.mes.controller.admin.pro.scan.vo.MesProScanEventCreateReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.pro.scan.vo.MesProScanEventRespVO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mes.controller.admin.pro.scan.vo.MesProScanEventPageReqVO;
import java.util.List;
import java.util.Map;
import cn.iocoder.yudao.module.mes.dal.dataobject.pro.scan.MesProScanEventDO;
import cn.iocoder.yudao.module.mes.service.pro.scan.MesProScanEventService;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 
@Tag(name = "管理后台 - MES 扫码入库")
@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 = "袋码扫码入库")
    public CommonResult<MesProScanEventRespVO> inbound(@Valid @RequestBody MesProScanEventCreateReqVO req) {
        return success(BeanUtils.toBean(service.createInbound(req), MesProScanEventRespVO.class));
    }
    @GetMapping("/page") @PreAuthorize("@ss.hasPermission('mes:pro-scan-in:query')") @Operation(summary = "扫码事件分页")
    public CommonResult<PageResult<MesProScanEventRespVO>> page(@Valid MesProScanEventPageReqVO req) {
        PageResult<MesProScanEventDO> page = service.getPage(req);
        return success(new PageResult<>(BeanUtils.toBean(page.getList(), MesProScanEventRespVO.class), page.getTotal()));
    }
    @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));
    }
    @GetMapping("/dashboard") @PreAuthorize("@ss.hasPermission('mes:pro-scan-in:dashboard')") @Operation(summary = "扫码入库看板")
    public CommonResult<Map<String, Object>> dashboard() { return success(service.getDashboard()); }
}