From bea6dee3099eec426e8b85ac8502947092027800 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Sat, 16 Sep 2023 12:13:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF=E8=AE=BE?= =?UTF-8?q?=E5=A4=87+=E4=BA=A7=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/op/wms/controller/BaseProductController.java | 8 +++++++- .../main/java/com/op/wms/mapper/BaseEquipmentMapper.java | 2 ++ .../com/op/wms/service/impl/BaseEquipmentServiceImpl.java | 6 +++++- .../src/main/resources/mapper/wms/BaseEquipmentMapper.xml | 6 ++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseProductController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseProductController.java index 743fd0da..e23e53a1 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseProductController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseProductController.java @@ -72,7 +72,13 @@ public class BaseProductController extends BaseController { @Log(title = "物料信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody BaseProduct baseProduct) { - return toAjax(baseProductService.insertBaseProduct(baseProduct)); + if (baseProductService.checkCodeUnique(baseProduct)) { + return AjaxResult.error("产品物料编码已存在!"); + }else if(baseProductService.checkNameUnique(baseProduct)){ + return AjaxResult.error("产品物料名称已存在!"); + }else{ + return toAjax(baseProductService.insertBaseProduct(baseProduct)); + } } /** diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseEquipmentMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseEquipmentMapper.java index ac3a2205..319bc220 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseEquipmentMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseEquipmentMapper.java @@ -65,4 +65,6 @@ public interface BaseEquipmentMapper { //判断 String checkEquipmentCodeUnique(BaseEquipment baseEquipment); String checkEquipmentNameUnique(BaseEquipment baseEquipment); + + String getWorkCenterName(BaseEquipment baseEquipment); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseEquipmentServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseEquipmentServiceImpl.java index 4926df22..a1cf2e5e 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseEquipmentServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseEquipmentServiceImpl.java @@ -57,6 +57,8 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService { public int insertBaseEquipment(BaseEquipment baseEquipment) { baseEquipment.setCreateTime(DateUtils.getNowDate()); String equipmentTypeName = baseEquipmentMapper.getEquipmentTypeName(baseEquipment); + String workCenterName = baseEquipmentMapper.getWorkCenterName(baseEquipment); + baseEquipment.setWorkshopName(workCenterName); baseEquipment.setEquipmentTypeName(equipmentTypeName); return baseEquipmentMapper.insertBaseEquipment(baseEquipment); } @@ -71,7 +73,9 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService { @DS("#header.poolName") public int updateBaseEquipment(BaseEquipment baseEquipment) { baseEquipment.setUpdateTime(DateUtils.getNowDate()); - String equipmentTypeName = baseEquipmentMapper.getEquipmentTypeName(baseEquipment); + String equipmentTypeName = baseEquipmentMapper.getEquipmentTypeName(baseEquipment); + String workCenterName = baseEquipmentMapper.getWorkCenterName(baseEquipment); + baseEquipment.setWorkshopName(workCenterName); baseEquipment.setEquipmentTypeName(equipmentTypeName); return baseEquipmentMapper.updateBaseEquipment(baseEquipment); } diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml index 926d1274..6e30fdc7 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml @@ -182,4 +182,10 @@ where equipment_code = #{equipmentCode} + + \ No newline at end of file