From 338a4fbe40ae77062f9caf137b0313a2375efd77 Mon Sep 17 00:00:00 2001 From: zpl Date: Wed, 11 Aug 2021 17:45:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=9C=BA=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/PrinterController.java | 21 ++++++++++++++++++- .../mesnac/common/enums/HandleEnum.java | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/controller/PrinterController.java b/common/src/main/java/com/foreverwin/mesnac/common/controller/PrinterController.java index 17e6ee63..2ef737bb 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/controller/PrinterController.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/controller/PrinterController.java @@ -4,6 +4,7 @@ package com.foreverwin.mesnac.common.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.model.Printer; +import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.R; import org.springframework.web.bind.annotation.RequestMapping; @@ -66,7 +67,7 @@ public class PrinterController { @ResponseBody @PostMapping("/savePrinter") - public R savePrinter(Printer printer) { + public R savePrinter(@RequestBody Printer printer) { try { LocalDateTime nowDate = LocalDateTime.now(); String site = CommonMethods.getSite(); @@ -90,4 +91,22 @@ public class PrinterController { return R.ok(); } + @ResponseBody + @PostMapping("/delPrinter") + public R delPrinter(Printer printer) { + try { + String site = CommonMethods.getSite(); + + String handle = HandleEnum.PRINT.getHandle(site, printer.getPrinter()); + Printer printerModel = printerService.getById(handle); + if (printerModel == null) { + throw BusinessException.build("请先检索再删除!"); + } else { + printerService.removeById(printerModel); + } + } catch (Exception e) { + return R.failed(e.getMessage()); + } + return R.ok(); + } } \ No newline at end of file diff --git a/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java b/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java index 3e3b1ca7..1b0dbb2f 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java @@ -20,7 +20,7 @@ public enum HandleEnum { /**物料清单**/ BOM("BOMBO:","BOMBO:{0},{1},{2},{3}"), - PRINT("PrintBO:", "StatusBO:{0},{1}"), + PRINT("PrintBO:", "PrintBO:{0},{1}"), /**叫料**/ CALL_ITEM("CallItemBO:", "CallItemBO:{0},{1}"),