| | |
| | | |
| | | 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; |
| | |
| | | @Operation(summary = "生成条码内容") |
| | | @Parameter(name = "bizType", description = "业务类型", required = true, example = "1") |
| | | @Parameter(name = "bizCode", description = "业务编码", required = true, example = "WO202403070001") |
| | | @Parameter(name = "bizName", description = "业务名称", required = false, example = "一号车间") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-barcode:query')") |
| | | 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) |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-barcode:query')") |
| | | 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) |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-barcode:query')") |
| | | 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')") |