Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
5f435f06
Commit
5f435f06
authored
Nov 21, 2022
by
季圣华
Browse files
解决退货单校验欠款的bug
parent
dffa557d
Changes
2
Show whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java
View file @
5f435f06
...
...
@@ -363,7 +363,7 @@ public class ExceptionConstants {
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
=
"抱歉,关联单据
实际不存在
欠款"
;
public
static
final
String
DEPOT_HEAD_BACK_BILL_DEBT_FAILED_MSG
=
"抱歉,关联单据
为空时不能
欠款"
;
//单据录入-调入仓库与原仓库不能重复
public
static
final
int
DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_CODE
=
8500010
;
public
static
final
String
DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_MSG
=
"调入仓库与原仓库不能重复"
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
5f435f06
...
...
@@ -814,13 +814,7 @@ public class DepotHeadService {
}
//欠款校验
if
(
"采购退货"
.
equals
(
subType
)
||
"销售退货"
.
equals
(
subType
))
{
//退货单对应的原单实际欠款(这里面要除去收付款的金额)
BigDecimal
originalRealDebt
=
getOriginalRealDebt
(
depotHead
.
getLinkNumber
(),
depotHead
.
getNumber
());
JSONObject
billObj
=
JSONObject
.
parseObject
(
beanJson
);
if
(
billObj
!=
null
&&
billObj
.
get
(
"debt"
)!=
null
&&
originalRealDebt
.
compareTo
(
billObj
.
getBigDecimal
(
"debt"
))<
0
)
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_BACK_BILL_DEBT_OVER_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_BACK_BILL_DEBT_OVER_MSG
));
}
checkDebtByParam
(
beanJson
,
depotHead
);
}
//判断用户是否已经登录过,登录过不再处理
User
userInfo
=
userService
.
getCurrentUser
();
...
...
@@ -912,13 +906,7 @@ public class DepotHeadService {
}
//欠款校验
if
(
"采购退货"
.
equals
(
subType
)
||
"销售退货"
.
equals
(
subType
))
{
//退货单对应的原单实际欠款(这里面要除去收付款的金额)
BigDecimal
originalRealDebt
=
getOriginalRealDebt
(
depotHead
.
getLinkNumber
(),
depotHead
.
getNumber
());
JSONObject
billObj
=
JSONObject
.
parseObject
(
beanJson
);
if
(
billObj
!=
null
&&
billObj
.
get
(
"debt"
)!=
null
&&
originalRealDebt
.
compareTo
(
billObj
.
getBigDecimal
(
"debt"
))<
0
)
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_BACK_BILL_DEBT_OVER_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_BACK_BILL_DEBT_OVER_MSG
));
}
checkDebtByParam
(
beanJson
,
depotHead
);
}
if
(
StringUtil
.
isNotEmpty
(
depotHead
.
getAccountIdList
())){
depotHead
.
setAccountIdList
(
depotHead
.
getAccountIdList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
));
...
...
@@ -971,6 +959,29 @@ public class DepotHeadService {
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
}
/**
* 针对退货单,校验欠款
* @param beanJson
* @param depotHead
* @throws Exception
*/
public
void
checkDebtByParam
(
String
beanJson
,
DepotHead
depotHead
)
throws
Exception
{
JSONObject
billObj
=
JSONObject
.
parseObject
(
beanJson
);
if
(
StringUtil
.
isNotEmpty
(
depotHead
.
getLinkNumber
()))
{
//退货单对应的原单实际欠款(这里面要除去收付款的金额)
BigDecimal
originalRealDebt
=
getOriginalRealDebt
(
depotHead
.
getLinkNumber
(),
depotHead
.
getNumber
());
if
(
billObj
!=
null
&&
billObj
.
get
(
"debt"
)!=
null
&&
originalRealDebt
.
compareTo
(
billObj
.
getBigDecimal
(
"debt"
))<
0
)
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_BACK_BILL_DEBT_OVER_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_BACK_BILL_DEBT_OVER_MSG
));
}
}
else
{
if
(
billObj
!=
null
&&
billObj
.
get
(
"debt"
)!=
null
&&
BigDecimal
.
ZERO
.
compareTo
(
billObj
.
getBigDecimal
(
"debt"
))!=
0
)
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_BACK_BILL_DEBT_FAILED_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_BACK_BILL_DEBT_FAILED_MSG
));
}
}
}
/**
* 退货单对应的原单实际欠款(这里面要除去收付款的金额)
* @param linkNumber 原单单号
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment