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
2f6eb271
You need to sign in or sign up before continuing.
Commit
2f6eb271
authored
May 22, 2022
by
季圣华
Browse files
给单据的序列号和批号增加重复的校验
parent
a86893a7
Changes
5
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java
View file @
2f6eb271
...
...
@@ -326,9 +326,7 @@ public class ExceptionConstants {
//比例格式错误
public
static
final
int
MATERIAL_RATIO_NOT_INTEGER_CODE
=
8000016
;
public
static
final
String
MATERIAL_RATIO_NOT_INTEGER_MSG
=
"第%s行比例格式错误"
;
//商品的批号不能为空
public
static
final
int
MATERIAL_BATCH_NUMBERE_EMPTY_CODE
=
8000017
;
public
static
final
String
MATERIAL_BATCH_NUMBERE_EMPTY_MSG
=
"抱歉,商品条码:%s的批号不能为空"
;
/**
* 单据信息
* type = 85
...
...
@@ -375,6 +373,12 @@ public class ExceptionConstants {
//单据录入-商品条码XXX的数量需要修改下
public
static
final
int
DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_CODE
=
85000014
;
public
static
final
String
DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG
=
"商品条码%s的数量需要修改下"
;
//单据录入-商品的批号不能为空
public
static
final
int
DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE
=
8000015
;
public
static
final
String
DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG
=
"抱歉,商品条码:%s的批号不能为空"
;
//单据录入-商品的批号重复
public
static
final
int
DEPOT_HEAD_BATCH_NUMBERE_EXISTS_CODE
=
8000016
;
public
static
final
String
DEPOT_HEAD_BATCH_NUMBERE_EXISTS_MSG
=
"抱歉,商品条码:%s的批号已存在"
;
/**
* 单据明细信息
* type = 90
...
...
@@ -426,7 +430,7 @@ public class ExceptionConstants {
* */
/**序列号已存在*/
public
static
final
int
SERIAL_NUMBERE_ALREADY_EXISTS_CODE
=
10500000
;
public
static
final
String
SERIAL_NUMBERE_ALREADY_EXISTS_MSG
=
"序列号已存在"
;
public
static
final
String
SERIAL_NUMBERE_ALREADY_EXISTS_MSG
=
"序列号
:%s
已存在"
;
/**序列号不能为为空*/
public
static
final
int
SERIAL_NUMBERE_NOT_BE_EMPTY_CODE
=
10500001
;
public
static
final
String
SERIAL_NUMBERE_NOT_BE_EMPTY_MSG
=
"序列号不能为为空"
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java
View file @
2f6eb271
...
...
@@ -166,4 +166,9 @@ public interface DepotItemMapperEx {
List
<
DepotItemVo4MaterialAndSum
>
getBatchBillDetailMaterialSum
(
@Param
(
"linkNumber"
)
String
linkNumber
,
@Param
(
"type"
)
String
type
);
Long
getCountByMaterialAndBatchNumber
(
@Param
(
"meId"
)
Long
meId
,
@Param
(
"batchNumber"
)
String
batchNumber
,
@Param
(
"type"
)
String
type
);
}
jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
2f6eb271
...
...
@@ -419,12 +419,20 @@ public class DepotItemService {
}
}
if
(
StringUtil
.
isExist
(
rowObj
.
get
(
"batchNumber"
)))
{
depotItem
.
setBatchNumber
(
rowObj
.
getString
(
"batchNumber"
));
//入库的时候批号不能重复
Long
bnCount
=
depotItemMapperEx
.
getCountByMaterialAndBatchNumber
(
materialExtend
.
getId
(),
rowObj
.
getString
(
"batchNumber"
),
"入库"
);
if
(
bnCount
==
0
)
{
depotItem
.
setBatchNumber
(
rowObj
.
getString
(
"batchNumber"
));
}
else
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_BATCH_NUMBERE_EXISTS_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_BATCH_NUMBERE_EXISTS_MSG
,
barCode
));
}
}
else
{
//批号不能为空
if
(
BusinessConstants
.
ENABLE_BATCH_NUMBER_ENABLED
.
equals
(
material
.
getEnableBatchNumber
()))
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL
_BATCH_NUMBERE_EMPTY_CODE
,
String
.
format
(
ExceptionConstants
.
MATERIAL
_BATCH_NUMBERE_EMPTY_MSG
,
barCode
));
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD
_BATCH_NUMBERE_EMPTY_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD
_BATCH_NUMBERE_EMPTY_MSG
,
barCode
));
}
}
if
(
StringUtil
.
isExist
(
rowObj
.
get
(
"expirationDate"
)))
{
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java
View file @
2f6eb271
...
...
@@ -418,6 +418,9 @@ public class SerialNumberService {
serialNumber
.
setUpdater
(
userInfo
==
null
?
null
:
userInfo
.
getId
());
serialNumber
.
setInBillNo
(
inBillNo
);
serialNumberMapper
.
insertSelective
(
serialNumber
);
}
else
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
SERIAL_NUMBERE_ALREADY_EXISTS_CODE
,
String
.
format
(
ExceptionConstants
.
SERIAL_NUMBERE_ALREADY_EXISTS_MSG
,
sn
));
}
}
}
...
...
jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
2f6eb271
...
...
@@ -635,4 +635,14 @@
and ifnull(dh.delete_flag,'0') !='1'
group by di.material_extend_id
</select>
<select
id=
"getCountByMaterialAndBatchNumber"
resultType=
"java.lang.Long"
>
select count(di.id) from
jsh_depot_head dh
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
where 1=1
and ifnull(dh.delete_flag,'0') !='1'
and di.material_extend_id=#{meId}
and di.batch_number=#{batchNumber}
</select>
</mapper>
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