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,