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
c937dbc6
Commit
c937dbc6
authored
Jul 11, 2021
by
季圣华
Browse files
优化单据多账户
parent
fc03578d
Changes
2
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java
View file @
c937dbc6
...
...
@@ -315,9 +315,9 @@ public class ExceptionConstants {
//单据录入-账户不能为空
public
static
final
int
DEPOT_HEAD_ACCOUNT_FAILED_CODE
=
8500007
;
public
static
final
String
DEPOT_HEAD_ACCOUNT_FAILED_MSG
=
"结算账户不能为空"
;
//单据录入-多账户的金额
合计不等于本次付款或本次收款
//单据录入-
请修改
多账户的
结算
金额
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
=
"
请修改
多账户的
结算
金额"
;
/**
* 单据明细信息
* type = 90
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
c937dbc6
...
...
@@ -639,11 +639,11 @@ public class DepotHeadService {
depotHead
.
setAccountIdList
(
depotHead
.
getAccountIdList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
));
}
if
(
StringUtil
.
isNotEmpty
(
depotHead
.
getAccountMoneyList
()))
{
//校验多账户的结算金额
String
accountMoneyList
=
depotHead
.
getAccountMoneyList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
);
//校验多账户的金额合计是否等于本次付款或本次收款
int
sum
=
StringUtil
.
getArrSum
(
accountMoneyList
.
split
(
","
));
BigDecimal
manyAccountSum
=
BigDecimal
.
valueOf
(
sum
);
if
(
manyAccountSum
.
compareTo
(
depotHead
.
getChangeAmount
())!=
0
)
{
BigDecimal
manyAccountSum
=
BigDecimal
.
valueOf
(
sum
)
.
abs
()
;
if
(
manyAccountSum
.
compareTo
(
depotHead
.
getChangeAmount
()
.
abs
()
)!=
0
)
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_MANY_ACCOUNT_FAILED_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_MANY_ACCOUNT_FAILED_MSG
));
}
...
...
@@ -712,7 +712,15 @@ public class DepotHeadService {
depotHead
.
setAccountIdList
(
depotHead
.
getAccountIdList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
));
}
if
(
StringUtil
.
isNotEmpty
(
depotHead
.
getAccountMoneyList
()))
{
depotHead
.
setAccountMoneyList
(
depotHead
.
getAccountMoneyList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
));
//校验多账户的结算金额
String
accountMoneyList
=
depotHead
.
getAccountMoneyList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
);
int
sum
=
StringUtil
.
getArrSum
(
accountMoneyList
.
split
(
","
));
BigDecimal
manyAccountSum
=
BigDecimal
.
valueOf
(
sum
).
abs
();
if
(
manyAccountSum
.
compareTo
(
depotHead
.
getChangeAmount
().
abs
())!=
0
)
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_MANY_ACCOUNT_FAILED_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_MANY_ACCOUNT_FAILED_MSG
));
}
depotHead
.
setAccountMoneyList
(
accountMoneyList
);
}
try
{
depotHeadMapper
.
updateByPrimaryKeySelective
(
depotHead
);
...
...
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