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