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
fa9a5610
Commit
fa9a5610
authored
Sep 20, 2021
by
季圣华
Browse files
优化选择商品的时候的库存展示
parent
385f3bb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java
View file @
fa9a5610
...
...
@@ -199,16 +199,18 @@ public class MaterialController {
item
.
put
(
"model"
,
material
.
getModel
());
item
.
put
(
"unit"
,
material
.
getCommodityUnit
()
+
ratio
);
item
.
put
(
"sku"
,
material
.
getSku
());
BigDecimal
stock
;
BigDecimal
skuStock
=
depotItemService
.
getSkuStockByParam
(
depotId
,
material
.
getMeId
(),
null
,
null
);
if
(
StringUtil
.
isNotEmpty
(
material
.
getSku
())){
item
.
put
(
"skuStock"
,
skuStock
);
}
BigDecimal
stock
=
depotItemService
.
getStockByParam
(
depotId
,
material
.
getId
(),
null
,
null
);
if
(
material
.
getUnitId
()!=
null
){
Unit
unit
=
unitService
.
getUnit
(
material
.
getUnitId
());
if
(
material
.
getCommodityUnit
().
equals
(
unit
.
getOtherUnit
()))
{
if
(
unit
.
getRatio
()!=
0
)
{
stock
=
stock
.
divide
(
BigDecimal
.
valueOf
(
unit
.
getRatio
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
skuStock
.
compareTo
(
BigDecimal
.
ZERO
)!=
0
){
stock
=
skuStock
;
}
else
{
stock
=
depotItemService
.
getStockByParam
(
depotId
,
material
.
getId
(),
null
,
null
);
if
(
material
.
getUnitId
()!=
null
){
Unit
unit
=
unitService
.
getUnit
(
material
.
getUnitId
());
if
(
material
.
getCommodityUnit
().
equals
(
unit
.
getOtherUnit
()))
{
if
(
unit
.
getRatio
()!=
0
)
{
stock
=
stock
.
divide
(
BigDecimal
.
valueOf
(
unit
.
getRatio
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
}
}
...
...
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