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
6e27143f
"eladmin-system/vscode:/vscode.git/clone" did not exist on "d5ee3681bc38fac55d41ec628fffae1345875bfa"
Commit
6e27143f
authored
Jun 23, 2021
by
季圣华
Browse files
解决单据批量审核和删除的bug
parent
4ba05f48
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
6e27143f
...
@@ -233,44 +233,47 @@ public class DepotHeadService {
...
@@ -233,44 +233,47 @@ public class DepotHeadService {
try
{
try
{
//查询单据主表信息
//查询单据主表信息
DepotHead
depotHead
=
getDepotHead
(
id
);
DepotHead
depotHead
=
getDepotHead
(
id
);
User
userInfo
=
userService
.
getCurrentUser
();
//只有未审核的单据才能被删除
//删除出库数据回收序列号
if
(
"0"
.
equals
(
depotHead
.
getStatus
()))
{
if
(
BusinessConstants
.
DEPOTHEAD_TYPE_OUT
.
equals
(
depotHead
.
getType
())
User
userInfo
=
userService
.
getCurrentUser
();
&&!
BusinessConstants
.
SUB_TYPE_TRANSFER
.
equals
(
depotHead
.
getSubType
())){
//删除出库数据回收序列号
//查询单据子表列表
if
(
BusinessConstants
.
DEPOTHEAD_TYPE_OUT
.
equals
(
depotHead
.
getType
())
List
<
DepotItem
>
depotItemList
=
null
;
&&
!
BusinessConstants
.
SUB_TYPE_TRANSFER
.
equals
(
depotHead
.
getSubType
()))
{
try
{
//查询单据子表列表
depotItemList
=
depotItemMapperEx
.
findDepotItemListBydepotheadId
(
id
,
BusinessConstants
.
ENABLE_SERIAL_NUMBER_ENABLED
);
List
<
DepotItem
>
depotItemList
=
null
;
}
catch
(
Exception
e
){
try
{
JshException
.
readFail
(
logger
,
e
);
depotItemList
=
depotItemMapperEx
.
findDepotItemListBydepotheadId
(
id
,
BusinessConstants
.
ENABLE_SERIAL_NUMBER_ENABLED
);
}
}
catch
(
Exception
e
)
{
JshException
.
readFail
(
logger
,
e
);
}
/**回收序列号*/
/**回收序列号*/
if
(
depotItemList
!=
null
&&
depotItemList
.
size
()>
0
){
if
(
depotItemList
!=
null
&&
depotItemList
.
size
()
>
0
)
{
for
(
DepotItem
depotItem:
depotItemList
){
for
(
DepotItem
depotItem
:
depotItemList
)
{
//BasicNumber=OperNumber*ratio
//BasicNumber=OperNumber*ratio
serialNumberService
.
cancelSerialNumber
(
depotItem
.
getMaterialId
(),
depotItem
.
getHeaderId
(),(
depotItem
.
getBasicNumber
()==
null
?
0
:
depotItem
.
getBasicNumber
()).
intValue
(),
userInfo
);
serialNumberService
.
cancelSerialNumber
(
depotItem
.
getMaterialId
(),
depotItem
.
getHeaderId
(),
(
depotItem
.
getBasicNumber
()
==
null
?
0
:
depotItem
.
getBasicNumber
()).
intValue
(),
userInfo
);
}
}
}
}
}
}
/**删除单据子表数据*/
/**删除单据子表数据*/
try
{
try
{
depotItemMapperEx
.
batchDeleteDepotItemByDepotHeadIds
(
new
Long
[]{
id
});
depotItemMapperEx
.
batchDeleteDepotItemByDepotHeadIds
(
new
Long
[]{
id
});
//更新当前库存
//更新当前库存
List
<
DepotItem
>
list
=
depotItemService
.
getListByHeaderId
(
id
);
List
<
DepotItem
>
list
=
depotItemService
.
getListByHeaderId
(
id
);
for
(
DepotItem
depotItem
:
list
)
{
for
(
DepotItem
depotItem:
list
){
Long
tenantId
=
redisService
.
getTenantId
(
request
);
Long
tenantId
=
redisService
.
getTenantId
(
request
);
depotItemService
.
updateCurrentStock
(
depotItem
,
tenantId
);
depotItemService
.
updateCurrentStock
(
depotItem
,
tenantId
);
}
}
catch
(
Exception
e
)
{
JshException
.
writeFail
(
logger
,
e
);
}
}
}
catch
(
Exception
e
){
/**删除单据主表信息*/
JshException
.
writeFail
(
logger
,
e
);
batchDeleteDepotHeadByIds
(
id
.
toString
());
logService
.
insertLog
(
"单据"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
depotHead
.
getNumber
()).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
result
=
1
;
}
}
/**删除单据主表信息*/
batchDeleteDepotHeadByIds
(
id
.
toString
());
logService
.
insertLog
(
"单据"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
depotHead
.
getNumber
()).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
result
=
1
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
JshException
.
writeFail
(
logger
,
e
);
}
}
...
@@ -321,14 +324,31 @@ public class DepotHeadService {
...
@@ -321,14 +324,31 @@ public class DepotHeadService {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
String
status
,
String
depotHeadIDs
)
throws
Exception
{
public
int
batchSetStatus
(
String
status
,
String
depotHeadIDs
)
throws
Exception
{
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
depotHeadIDs
);
DepotHead
depotHead
=
new
DepotHead
();
depotHead
.
setStatus
(
status
);
DepotHeadExample
example
=
new
DepotHeadExample
();
example
.
createCriteria
().
andIdIn
(
ids
);
int
result
=
0
;
int
result
=
0
;
try
{
try
{
result
=
depotHeadMapper
.
updateByExampleSelective
(
depotHead
,
example
);
List
<
Long
>
dhIds
=
new
ArrayList
<>();
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
depotHeadIDs
);
for
(
Long
id:
ids
)
{
DepotHead
depotHead
=
getDepotHead
(
id
);
if
(
"0"
.
equals
(
status
)){
if
(
"1"
.
equals
(
depotHead
.
getStatus
()))
{
dhIds
.
add
(
id
);
}
}
else
if
(
"1"
.
equals
(
status
)){
if
(
"0"
.
equals
(
depotHead
.
getStatus
()))
{
dhIds
.
add
(
id
);
}
}
}
if
(
dhIds
.
size
()>
0
)
{
DepotHead
depotHead
=
new
DepotHead
();
depotHead
.
setStatus
(
status
);
DepotHeadExample
example
=
new
DepotHeadExample
();
example
.
createCriteria
().
andIdIn
(
dhIds
);
result
=
depotHeadMapper
.
updateByExampleSelective
(
depotHead
,
example
);
}
else
{
return
1
;
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
JshException
.
writeFail
(
logger
,
e
);
}
}
...
...
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