给单据附件的数量进行限制,不能超出条数

This commit is contained in:
季圣华
2023-06-08 00:54:58 +08:00
parent f35b2fa3b3
commit d59ace2149
2 changed files with 19 additions and 0 deletions

View File

@@ -406,6 +406,9 @@ public class ExceptionConstants {
//单据删除-单据中的序列号已经出库,不能删除
public static final int DEPOT_HEAD_SERIAL_IS_SELL_CODE = 8500024;
public static final String DEPOT_HEAD_SERIAL_IS_SELL_MSG = "抱歉,单据%s的序列号已经出库不能删除";
//单据录入-单据附件不能超过规定数量
public static final int DEPOT_HEAD_FILE_NUM_LIMIT_CODE = 8500025;
public static final String DEPOT_HEAD_FILE_NUM_LIMIT_MSG = "抱歉,单据附件不能超过%s份";
/**
* 单据明细信息

View File

@@ -936,6 +936,14 @@ public class DepotHeadService {
}
}
}
//校验附件的数量
if(StringUtil.isNotEmpty(depotHead.getFileName())) {
String[] fileArr = depotHead.getFileName().split(",");
if(fileArr.length>4) {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_FILE_NUM_LIMIT_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_FILE_NUM_LIMIT_MSG, 4));
}
}
try{
depotHeadMapper.insertSelective(depotHead);
}catch(Exception e){
@@ -1025,6 +1033,14 @@ public class DepotHeadService {
}
}
}
//校验附件的数量
if(StringUtil.isNotEmpty(depotHead.getFileName())) {
String[] fileArr = depotHead.getFileName().split(",");
if(fileArr.length>4) {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_FILE_NUM_LIMIT_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_FILE_NUM_LIMIT_MSG, 4));
}
}
try{
depotHeadMapper.updateByPrimaryKeySelective(depotHead);
}catch(Exception e){