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
0b5556a0
Commit
0b5556a0
authored
Sep 07, 2022
by
季圣华
Browse files
优化序列号逻辑,主要针对退货和编辑页面的接口
parent
489040d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/constants/BusinessConstants.java
View file @
0b5556a0
...
...
@@ -87,6 +87,7 @@ public class BusinessConstants {
public
static
final
String
SUB_TYPE_PURCHASE_RETURN
=
"采购退货"
;
public
static
final
String
SUB_TYPE_OTHER
=
"其它"
;
public
static
final
String
SUB_TYPE_RETAIL
=
"零售"
;
public
static
final
String
SUB_TYPE_RETAIL_RETURN
=
"零售退货"
;
public
static
final
String
SUB_TYPE_SALES_ORDER
=
"销售订单"
;
public
static
final
String
SUB_TYPE_SALES
=
"销售"
;
public
static
final
String
SUB_TYPE_SALES_RETURN
=
"销售退货"
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
0b5556a0
...
...
@@ -390,6 +390,8 @@ public class DepotItemService {
public
void
saveDetials
(
String
rows
,
Long
headerId
,
String
actionType
,
HttpServletRequest
request
)
throws
Exception
{
//查询单据主表信息
DepotHead
depotHead
=
depotHeadMapper
.
selectByPrimaryKey
(
headerId
);
//删除序列号和回收序列号
deleteOrCancelSerialNumber
(
actionType
,
depotHead
,
headerId
);
//删除单据的明细
deleteDepotItemHeadId
(
headerId
);
JSONArray
rowArr
=
JSONArray
.
parseArray
(
rows
);
...
...
@@ -687,6 +689,37 @@ public class DepotItemService {
}
}
/**
* 删除序列号和回收序列号
* @param actionType
* @throws Exception
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
deleteOrCancelSerialNumber
(
String
actionType
,
DepotHead
depotHead
,
Long
headerId
)
throws
Exception
{
if
(
actionType
.
equals
(
"update"
))
{
User
userInfo
=
userService
.
getCurrentUser
();
if
(
BusinessConstants
.
DEPOTHEAD_TYPE_IN
.
equals
(
depotHead
.
getType
())){
//入库逻辑
String
number
=
depotHead
.
getNumber
();
SerialNumberExample
example
=
new
SerialNumberExample
();
example
.
createCriteria
().
andInBillNoEqualTo
(
number
);
serialNumberService
.
deleteByExample
(
example
);
}
else
if
(
BusinessConstants
.
DEPOTHEAD_TYPE_OUT
.
equals
(
depotHead
.
getType
())){
//出库逻辑
DepotItemExample
example
=
new
DepotItemExample
();
example
.
createCriteria
().
andHeaderIdEqualTo
(
headerId
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
DepotItem
>
depotItemList
=
depotItemMapper
.
selectByExample
(
example
);
if
(
null
!=
depotItemList
&&
depotItemList
.
size
()
>
0
){
for
(
DepotItem
depotItem
:
depotItemList
){
if
(
StringUtil
.
isNotEmpty
(
depotItem
.
getSnList
())){
serialNumberService
.
cancelSerialNumber
(
depotItem
.
getMaterialId
(),
depotHead
.
getNumber
(),
(
depotItem
.
getBasicNumber
()
==
null
?
0
:
depotItem
.
getBasicNumber
()).
intValue
(),
userInfo
);
}
}
}
}
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
List
<
DepotItemStockWarningCount
>
findStockWarningCount
(
Integer
offset
,
Integer
rows
,
String
materialParam
,
List
<
Long
>
depotList
)
{
List
<
DepotItemStockWarningCount
>
list
=
null
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java
View file @
0b5556a0
...
...
@@ -398,7 +398,8 @@ public class SerialNumberService {
//录入序列号的时候不能重复
if
((
BusinessConstants
.
SUB_TYPE_PURCHASE
.
equals
(
subType
)
||
BusinessConstants
.
SUB_TYPE_OTHER
.
equals
(
subType
)
||
BusinessConstants
.
SUB_TYPE_SALES_RETURN
.
equals
(
subType
))
&&
BusinessConstants
.
SUB_TYPE_SALES_RETURN
.
equals
(
subType
)||
BusinessConstants
.
SUB_TYPE_RETAIL_RETURN
.
equals
(
subType
))
&&
BusinessConstants
.
DEPOTHEAD_TYPE_IN
.
equals
(
type
))
{
//将中文的逗号批量替换为英文逗号
snList
=
snList
.
replaceAll
(
","
,
","
);
...
...
@@ -406,7 +407,7 @@ public class SerialNumberService {
for
(
String
sn
:
snArr
)
{
List
<
SerialNumber
>
list
=
new
ArrayList
<>();
SerialNumberExample
example
=
new
SerialNumberExample
();
example
.
createCriteria
().
andMaterialIdEqualTo
(
materialId
).
andSerialNumberEqualTo
(
sn
)
example
.
createCriteria
().
andMaterialIdEqualTo
(
materialId
).
andSerialNumberEqualTo
(
sn
)
.
andIsSellEqualTo
(
"0"
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
list
=
serialNumberMapper
.
selectByExample
(
example
);
//判断如果不存在重复序列号就新增
...
...
@@ -432,4 +433,12 @@ public class SerialNumberService {
}
}
}
/**
* 直接删除序列号
* @param example
*/
public
void
deleteByExample
(
SerialNumberExample
example
)
{
serialNumberMapper
.
deleteByExample
(
example
);
}
}
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