对欠款进行校验
This commit is contained in:
@@ -318,6 +318,9 @@ public class ExceptionConstants {
|
|||||||
//单据录入-请修改多账户的结算金额
|
//单据录入-请修改多账户的结算金额
|
||||||
public static final int DEPOT_HEAD_MANY_ACCOUNT_FAILED_CODE = 8500008;
|
public static final int DEPOT_HEAD_MANY_ACCOUNT_FAILED_CODE = 8500008;
|
||||||
public static final String DEPOT_HEAD_MANY_ACCOUNT_FAILED_MSG = "请修改多账户的结算金额";
|
public static final String DEPOT_HEAD_MANY_ACCOUNT_FAILED_MSG = "请修改多账户的结算金额";
|
||||||
|
//单据录入-退货单不能欠款
|
||||||
|
public static final int DEPOT_HEAD_BACK_BILL_DEBT_FAILED_CODE = 8500009;
|
||||||
|
public static final String DEPOT_HEAD_BACK_BILL_DEBT_FAILED_MSG = "退货单不能欠款";
|
||||||
/**
|
/**
|
||||||
* 单据明细信息
|
* 单据明细信息
|
||||||
* type = 90
|
* type = 90
|
||||||
|
|||||||
@@ -629,6 +629,13 @@ public class DepotHeadService {
|
|||||||
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
|
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//欠款校验
|
||||||
|
if("采购退货".equals(subType) || "销售退货".equals(subType)) {
|
||||||
|
if(depotHead.getChangeAmount().abs().compareTo(depotHead.getDiscountLastMoney().add(depotHead.getOtherMoney()))!=0) {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_CODE,
|
||||||
|
String.format(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_MSG));
|
||||||
|
}
|
||||||
|
}
|
||||||
//判断用户是否已经登录过,登录过不再处理
|
//判断用户是否已经登录过,登录过不再处理
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
depotHead.setCreator(userInfo==null?null:userInfo.getId());
|
depotHead.setCreator(userInfo==null?null:userInfo.getId());
|
||||||
@@ -708,6 +715,13 @@ public class DepotHeadService {
|
|||||||
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
|
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//欠款校验
|
||||||
|
if("采购退货".equals(subType) || "销售退货".equals(subType)) {
|
||||||
|
if(depotHead.getChangeAmount().abs().compareTo(depotHead.getDiscountLastMoney().add(depotHead.getOtherMoney()))!=0) {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_CODE,
|
||||||
|
String.format(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_MSG));
|
||||||
|
}
|
||||||
|
}
|
||||||
if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
|
if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
|
||||||
depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
|
depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user