| | |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得条码") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-barcode:query')") |
| | | public CommonResult<MesWmBarcodeRespVO> getBarcode(@RequestParam("id") Long id) { |
| | | MesWmBarcodeDO barcode = barcodeService.getBarcode(id); |
| | | return success(BeanUtils.toBean(barcode, MesWmBarcodeRespVO.class)); |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得条码分页") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-barcode:query')") |
| | | public CommonResult<PageResult<MesWmBarcodeRespVO>> getBarcodePage(@Valid MesWmBarcodePageReqVO pageReqVO) { |
| | | PageResult<MesWmBarcodeDO> pageResult = barcodeService.getBarcodePage(pageReqVO); |
| | | return success(BeanUtils.toBean(pageResult, MesWmBarcodeRespVO.class)); |
| | |
| | | @Operation(summary = "根据业务对象获取条码信息", description = "前端用于生成条码图片") |
| | | @Parameter(name = "bizType", description = "业务类型", required = true, example = "102") |
| | | @Parameter(name = "bizId", description = "业务编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-barcode:query')") |
| | | public CommonResult<MesWmBarcodeRespVO> getBarcodeByBusiness( |
| | | @RequestParam("bizType") Integer bizType, |
| | | @RequestParam("bizId") Long bizId) { |
| | |
| | | @Operation(summary = "生成条码内容") |
| | | @Parameter(name = "bizType", description = "业务类型", required = true, example = "1") |
| | | @Parameter(name = "bizCode", description = "业务编码", required = true, example = "WO202403070001") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-barcode:query')") |
| | | @Parameter(name = "bizName", description = "业务名称", required = false, example = "一号车间") |
| | | public CommonResult<String> generateBarcodeContent(@RequestParam("bizType") @NotNull(message = "业务类型不能为空") Integer bizType, |
| | | @RequestParam("bizCode") @NotBlank(message = "业务编码不能为空") String bizCode) { |
| | | String content = barcodeService.generateBarcodeContent(bizType, bizCode); |
| | | @RequestParam("bizCode") @NotBlank(message = "业务编码不能为空") String bizCode, |
| | | @RequestParam(value = "bizName", required = false) String bizName) { |
| | | String content = barcodeService.generateBarcodeContent(bizType, bizCode, bizName); |
| | | return success(content); |
| | | } |
| | | |
| | | @PostMapping("/render") |
| | | @Operation(summary = "生成条码/二维码图片", description = "服务端 zxing 成图,返回 PNG Base64 供即时预览;不落库") |
| | | @Parameter(name = "content", description = "条码内容", required = true) |
| | | @Parameter(name = "format", description = "条码格式(1 二维码 / 2 EAN13 / 3 CODE39 / 4 UPC-A / 空默认 CODE128)", required = false) |
| | | @Parameter(name = "width", description = "图片宽度", required = false) |
| | | @Parameter(name = "height", description = "图片高度", required = false) |
| | | public CommonResult<String> renderBarcodeImage(@RequestParam("content") @NotBlank(message = "条码内容不能为空") String content, |
| | | @RequestParam(value = "format", required = false) Integer format, |
| | | @RequestParam(value = "width", required = false) Integer width, |
| | | @RequestParam(value = "height", required = false) Integer height) { |
| | | return success(barcodeService.renderBarcodeImage(content, format, width, height)); |
| | | } |
| | | |
| | | @PostMapping("/parse") |
| | | @Operation(summary = "解析条码内容", description = "按条码内容精确命中或模板反解,返回业务字段") |
| | | @Parameter(name = "content", description = "扫描到的条码内容", required = true) |
| | | public CommonResult<Map<String, Object>> parseBarcodeContent(@RequestParam("content") @NotBlank(message = "条码内容不能为空") String content) { |
| | | return success(barcodeService.parseBarcodeContent(content)); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导出条码清单 Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-barcode:export')") |