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
efb1e828
Commit
efb1e828
authored
Sep 22, 2021
by
季圣华
Browse files
优化商品的sku库存
parent
69e40344
Changes
3
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
efb1e828
...
@@ -123,9 +123,8 @@ public class DepotItemController {
...
@@ -123,9 +123,8 @@ public class DepotItemController {
List
<
MaterialVo4Unit
>
list
=
materialService
.
getMaterialByBarCode
(
barCode
);
List
<
MaterialVo4Unit
>
list
=
materialService
.
getMaterialByBarCode
(
barCode
);
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
MaterialVo4Unit
materialVo4Unit
=
list
.
get
(
0
);
MaterialVo4Unit
materialVo4Unit
=
list
.
get
(
0
);
BigDecimal
skuStock
=
depotItemService
.
getSkuStockByParam
(
depotId
,
materialVo4Unit
.
getMeId
(),
null
,
null
);
if
(
StringUtil
.
isNotEmpty
(
materialVo4Unit
.
getSku
())){
if
(
skuStock
.
compareTo
(
BigDecimal
.
ZERO
)!=
0
){
stock
=
depotItemService
.
getSkuStockByParam
(
depotId
,
materialVo4Unit
.
getMeId
(),
null
,
null
);
stock
=
skuStock
;
}
else
{
}
else
{
stock
=
depotItemService
.
getStockByParam
(
depotId
,
materialVo4Unit
.
getId
(),
null
,
null
);
stock
=
depotItemService
.
getStockByParam
(
depotId
,
materialVo4Unit
.
getId
(),
null
,
null
);
String
commodityUnit
=
materialVo4Unit
.
getCommodityUnit
();
String
commodityUnit
=
materialVo4Unit
.
getCommodityUnit
();
...
@@ -179,9 +178,8 @@ public class DepotItemController {
...
@@ -179,9 +178,8 @@ public class DepotItemController {
item
.
put
(
"materialOther"
,
getOtherInfo
(
mpArr
,
diEx
));
item
.
put
(
"materialOther"
,
getOtherInfo
(
mpArr
,
diEx
));
Integer
ratio
=
diEx
.
getRatio
();
Integer
ratio
=
diEx
.
getRatio
();
BigDecimal
stock
;
BigDecimal
stock
;
BigDecimal
skuStock
=
depotItemService
.
getSkuStockByParam
(
diEx
.
getDepotId
(),
diEx
.
getMaterialExtendId
(),
null
,
null
);
if
(
StringUtil
.
isNotEmpty
(
diEx
.
getSku
())){
if
(
skuStock
.
compareTo
(
BigDecimal
.
ZERO
)!=
0
){
stock
=
depotItemService
.
getSkuStockByParam
(
diEx
.
getDepotId
(),
diEx
.
getMaterialExtendId
(),
null
,
null
);
stock
=
skuStock
;
}
else
{
}
else
{
stock
=
depotItemService
.
getStockByParam
(
diEx
.
getDepotId
(),
diEx
.
getMaterialId
(),
null
,
null
);
stock
=
depotItemService
.
getStockByParam
(
diEx
.
getDepotId
(),
diEx
.
getMaterialId
(),
null
,
null
);
if
(
ratio
!=
null
){
if
(
ratio
!=
null
){
...
...
jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java
View file @
efb1e828
...
@@ -200,9 +200,8 @@ public class MaterialController {
...
@@ -200,9 +200,8 @@ public class MaterialController {
item
.
put
(
"unit"
,
material
.
getCommodityUnit
()
+
ratio
);
item
.
put
(
"unit"
,
material
.
getCommodityUnit
()
+
ratio
);
item
.
put
(
"sku"
,
material
.
getSku
());
item
.
put
(
"sku"
,
material
.
getSku
());
BigDecimal
stock
;
BigDecimal
stock
;
BigDecimal
skuStock
=
depotItemService
.
getSkuStockByParam
(
depotId
,
material
.
getMeId
(),
null
,
null
);
if
(
StringUtil
.
isNotEmpty
(
material
.
getSku
())){
if
(
skuStock
.
compareTo
(
BigDecimal
.
ZERO
)!=
0
){
stock
=
depotItemService
.
getSkuStockByParam
(
depotId
,
material
.
getMeId
(),
null
,
null
);
stock
=
skuStock
;
}
else
{
}
else
{
stock
=
depotItemService
.
getStockByParam
(
depotId
,
material
.
getId
(),
null
,
null
);
stock
=
depotItemService
.
getStockByParam
(
depotId
,
material
.
getId
(),
null
,
null
);
if
(
material
.
getUnitId
()!=
null
){
if
(
material
.
getUnitId
()!=
null
){
...
@@ -493,9 +492,8 @@ public class MaterialController {
...
@@ -493,9 +492,8 @@ public class MaterialController {
mvo
.
setDepotId
(
depotId
);
mvo
.
setDepotId
(
depotId
);
//库存
//库存
BigDecimal
stock
;
BigDecimal
stock
;
BigDecimal
skuStock
=
depotItemService
.
getSkuStockByParam
(
depotId
,
mvo
.
getMeId
(),
null
,
null
);
if
(
StringUtil
.
isNotEmpty
(
mvo
.
getSku
())){
if
(
skuStock
.
compareTo
(
BigDecimal
.
ZERO
)!=
0
){
stock
=
depotItemService
.
getSkuStockByParam
(
depotId
,
mvo
.
getMeId
(),
null
,
null
);
stock
=
skuStock
;
}
else
{
}
else
{
stock
=
depotItemService
.
getStockByParam
(
depotId
,
mvo
.
getId
(),
null
,
null
);
stock
=
depotItemService
.
getStockByParam
(
depotId
,
mvo
.
getId
(),
null
,
null
);
if
(
mvo
.
getUnitId
()!=
null
){
if
(
mvo
.
getUnitId
()!=
null
){
...
...
jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
efb1e828
...
@@ -155,7 +155,7 @@
...
@@ -155,7 +155,7 @@
<select
id=
"findDetailByTypeAndMaterialIdCounts"
resultType=
"java.lang.Long"
>
<select
id=
"findDetailByTypeAndMaterialIdCounts"
resultType=
"java.lang.Long"
>
select count(1)
select count(1)
from jsh_depot_head dh
from jsh_depot_head dh
INNER
JOIN jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
left
JOIN jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
where ((dh.type!='其它' and dh.sub_type!='调拨')
where ((dh.type!='其它' and dh.sub_type!='调拨')
or (dh.type='其它' and dh.sub_type='组装单')
or (dh.type='其它' and dh.sub_type='组装单')
or (dh.type='其它' and dh.sub_type='拆卸单')
or (dh.type='其它' and dh.sub_type='拆卸单')
...
@@ -258,7 +258,7 @@
...
@@ -258,7 +258,7 @@
<select
id=
"getStockCheckSum"
resultType=
"java.math.BigDecimal"
>
<select
id=
"getStockCheckSum"
resultType=
"java.math.BigDecimal"
>
select ifnull(sum(di.basic_number),0) stockCheckSum from jsh_depot_head dh
select ifnull(sum(di.basic_number),0) stockCheckSum from jsh_depot_head dh
INNER
JOIN jsh_depot_item di on dh.id=di.header_id
left
JOIN jsh_depot_item di on dh.id=di.header_id
where 1=1
where 1=1
<if
test=
"mId != null"
>
<if
test=
"mId != null"
>
and di.material_id=#{mId}
and di.material_id=#{mId}
...
...
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