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
8554fda9
Commit
8554fda9
authored
Dec 20, 2020
by
季圣华
Browse files
优化库存的计算
parent
967ff1f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
8554fda9
...
@@ -532,14 +532,27 @@ public class DepotItemService {
...
@@ -532,14 +532,27 @@ public class DepotItemService {
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
updateCurrentStock
(
DepotItem
depotItem
,
Long
tenantId
){
public
void
updateCurrentStock
(
DepotItem
depotItem
,
Long
tenantId
){
updateCurrentStockFun
(
depotItem
.
getMaterialId
(),
depotItem
.
getDepotId
(),
tenantId
);
if
(
depotItem
.
getAnotherDepotId
()!=
null
){
updateCurrentStockFun
(
depotItem
.
getMaterialId
(),
depotItem
.
getAnotherDepotId
(),
tenantId
);
}
}
/**
* 根据商品和仓库来更新当前库存
* @param mId
* @param dId
* @param tenantId
*/
public
void
updateCurrentStockFun
(
Long
mId
,
Long
dId
,
Long
tenantId
)
{
MaterialCurrentStockExample
example
=
new
MaterialCurrentStockExample
();
MaterialCurrentStockExample
example
=
new
MaterialCurrentStockExample
();
example
.
createCriteria
().
andMaterialIdEqualTo
(
depotItem
.
getMaterialId
()).
andDepotIdEqualTo
(
depotItem
.
getDepotId
()
)
example
.
createCriteria
().
andMaterialIdEqualTo
(
mId
).
andDepotIdEqualTo
(
dId
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
MaterialCurrentStock
>
list
=
materialCurrentStockMapper
.
selectByExample
(
example
);
List
<
MaterialCurrentStock
>
list
=
materialCurrentStockMapper
.
selectByExample
(
example
);
MaterialCurrentStock
materialCurrentStock
=
new
MaterialCurrentStock
();
MaterialCurrentStock
materialCurrentStock
=
new
MaterialCurrentStock
();
materialCurrentStock
.
setMaterialId
(
depotItem
.
getMaterialId
()
);
materialCurrentStock
.
setMaterialId
(
mId
);
materialCurrentStock
.
setDepotId
(
d
epotItem
.
getDepotId
()
);
materialCurrentStock
.
setDepotId
(
d
Id
);
materialCurrentStock
.
setCurrentNumber
(
getStockByParam
(
d
epotItem
.
getDepotId
(),
depotItem
.
getMaterialId
()
,
null
,
null
,
tenantId
));
materialCurrentStock
.
setCurrentNumber
(
getStockByParam
(
d
Id
,
mId
,
null
,
null
,
tenantId
));
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
Long
mcsId
=
list
.
get
(
0
).
getId
();
Long
mcsId
=
list
.
get
(
0
).
getId
();
materialCurrentStock
.
setId
(
mcsId
);
materialCurrentStock
.
setId
(
mcsId
);
...
...
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