From e3b63b23fe3f21db978187b4153a3cc7232b9308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Thu, 20 Apr 2023 21:52:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E5=90=8D=E7=A7=B0=E3=80=81=E5=9E=8B?= =?UTF-8?q?=E5=8F=B7=E3=80=81=E8=A7=84=E6=A0=BC=E7=9A=84=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsh/erp/constants/ExceptionConstants.java | 9 +++++++++ .../jsh/erp/service/material/MaterialService.java | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java index 04f75525..e648c793 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java @@ -332,6 +332,15 @@ public class ExceptionConstants { //EXCEL中存在重复的条码 public static final int MATERIAL_EXCEL_IMPORT_BARCODE_EXIST_CODE = 80000021; public static final String MATERIAL_EXCEL_IMPORT_BARCODE_EXIST_MSG = "抱歉,EXCEL中存在重复的条码,具体条码为:%s"; + //名称长度超出 + public static final int MATERIAL_NAME_OVER_CODE = 8000022; + public static final String MATERIAL_NAME_OVER_MSG = "第%s行名称长度超出100个字符"; + //规格长度超出 + public static final int MATERIAL_STANDARD_OVER_CODE = 8000023; + public static final String MATERIAL_STANDARD_OVER_MSG = "第%s行规格长度超出100个字符"; + //型号长度超出 + public static final int MATERIAL_MODEL_OVER_CODE = 8000024; + public static final String MATERIAL_MODEL_OVER_MSG = "第%s行型号长度超出100个字符"; /** * 单据信息 diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java index ce4d1389..7902df9d 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java @@ -576,6 +576,21 @@ public class MaterialService { throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NAME_EMPTY_CODE, String.format(ExceptionConstants.MATERIAL_NAME_EMPTY_MSG, i+1)); } + //名称长度超出 + if(name.length()>100) { + throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NAME_OVER_CODE, + String.format(ExceptionConstants.MATERIAL_NAME_OVER_MSG, i+1)); + } + //规格长度超出 + if(StringUtil.isNotEmpty(standard) && standard.length()>100) { + throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STANDARD_OVER_CODE, + String.format(ExceptionConstants.MATERIAL_STANDARD_OVER_MSG, i+1)); + } + //型号长度超出 + if(StringUtil.isNotEmpty(model) && model.length()>100) { + throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_MODEL_OVER_CODE, + String.format(ExceptionConstants.MATERIAL_MODEL_OVER_MSG, i+1)); + } //基本单位为空 if(StringUtil.isEmpty(unit)) { throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_EMPTY_CODE,