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
ee04284a
Commit
ee04284a
authored
Sep 18, 2021
by
季圣华
Browse files
解决入库单被删之后,关联的订单状态不变的bug
parent
5c632731
Changes
3
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/constants/BusinessConstants.java
View file @
ee04284a
...
...
@@ -37,7 +37,7 @@ public class BusinessConstants {
* 单据主表出入库类型 type 入库 出库
* depothead
* */
public
static
final
String
DEPOTHEAD_TYPE_
STORAGE
=
"入库"
;
public
static
final
String
DEPOTHEAD_TYPE_
IN
=
"入库"
;
public
static
final
String
DEPOTHEAD_TYPE_OUT
=
"出库"
;
/**
* 付款类型 payType //现付/预付款
...
...
jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java
View file @
ee04284a
...
...
@@ -330,6 +330,12 @@ public class ExceptionConstants {
//单据删除-只有未审核的单据才能删除
public
static
final
int
DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_CODE
=
8500011
;
public
static
final
String
DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_MSG
=
"抱歉,只有未审核的单据才能删除"
;
//单据审核-只有未审核的单据才能审核
public
static
final
int
DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_CODE
=
8500012
;
public
static
final
String
DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_MSG
=
"抱歉,只有未审核的单据才能审核"
;
//单据反审核-只有已审核的单据才能反审核
public
static
final
int
DEPOT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_CODE
=
8500013
;
public
static
final
String
DEPOT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_MSG
=
"抱歉,只有已审核的单据才能反审核"
;
/**
* 单据明细信息
* type = 90
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
ee04284a
...
...
@@ -284,15 +284,28 @@ public class DepotHeadService {
}
}
}
/
**
删除单据子表数据
*/
/
/
删除单据子表数据
depotItemMapperEx
.
batchDeleteDepotItemByDepotHeadIds
(
new
Long
[]{
depotHead
.
getId
()});
//删除单据主表信息
batchDeleteDepotHeadByIds
(
depotHead
.
getId
().
toString
());
//将关联的订单置为审核状态-针对采购入库和销售出库
if
(
StringUtil
.
isNotEmpty
(
depotHead
.
getLinkNumber
())){
if
((
BusinessConstants
.
DEPOTHEAD_TYPE_IN
.
equals
(
depotHead
.
getType
())
&&
BusinessConstants
.
SUB_TYPE_PURCHASE
.
equals
(
depotHead
.
getSubType
()))
||
(
BusinessConstants
.
DEPOTHEAD_TYPE_OUT
.
equals
(
depotHead
.
getType
())
&&
BusinessConstants
.
SUB_TYPE_SALES
.
equals
(
depotHead
.
getSubType
())))
{
DepotHead
dh
=
new
DepotHead
();
dh
.
setStatus
(
BusinessConstants
.
BILLS_STATUS_AUDIT
);
DepotHeadExample
example
=
new
DepotHeadExample
();
example
.
createCriteria
().
andNumberEqualTo
(
depotHead
.
getLinkNumber
());
depotHeadMapper
.
updateByExampleSelective
(
dh
,
example
);
}
}
//更新当前库存
List
<
DepotItem
>
list
=
depotItemService
.
getListByHeaderId
(
depotHead
.
getId
());
for
(
DepotItem
depotItem
:
list
)
{
depotItemService
.
updateCurrentStock
(
depotItem
);
}
/**删除单据主表信息*/
batchDeleteDepotHeadByIds
(
depotHead
.
getId
().
toString
());
}
else
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_MSG
));
...
...
@@ -350,32 +363,32 @@ public class DepotHeadService {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
String
status
,
String
depotHeadIDs
)
throws
Exception
{
int
result
=
0
;
try
{
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
);
}
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
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_MSG
));
}
}
else
if
(
"1"
.
equals
(
status
)){
if
(
"0"
.
equals
(
depotHead
.
getStatus
()))
{
dhIds
.
add
(
id
);
}
else
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_MSG
));
}
}
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
){
JshException
.
writeFail
(
logger
,
e
);
}
if
(
dhIds
.
size
()>
0
)
{
DepotHead
depotHead
=
new
DepotHead
();
depotHead
.
setStatus
(
status
);
DepotHeadExample
example
=
new
DepotHeadExample
();
example
.
createCriteria
().
andIdIn
(
dhIds
);
result
=
depotHeadMapper
.
updateByExampleSelective
(
depotHead
,
example
);
}
return
result
;
}
...
...
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