Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 451bbc19
由
LN
编写于
2026-04-15 20:09:26 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge remote-tracking branch 'origin/master'
2 个父辈
8f9b2970
1ae0dc57
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
46 行增加
和
13 行删除
src/main/java/com/neotel/smfcore/core/barcode/bean/BarcodeRule.java
src/main/java/com/neotel/smfcore/custom/so1374/PokaNonInboundAndReturnController.java
src/main/java/com/neotel/smfcore/core/barcode/bean/BarcodeRule.java
查看文件 @
451bbc1
...
@@ -16,7 +16,7 @@ import java.util.Map;
...
@@ -16,7 +16,7 @@ import java.util.Map;
*
*
* 条码规则,可用字段有:
* 条码规则,可用字段有:
* PN为物料编号即 PartNumber
* PN为物料编号即 PartNumber
* RI 为唯一码即ReelId,[RI]为所有字符串作为一个唯一码
* RI 为唯一码即ReelId,[RI]为所有字符串作为一个唯一码
,[GRI]生成yyyyMMddHHmmssS格式的唯一码
* QTY 为数量
* QTY 为数量
* PRODATE为生产日期xxPRODATEyyyyMMdd
* PRODATE为生产日期xxPRODATEyyyyMMdd
* EXPDATE为过期日期xxxEXPDATEyyyyMMdd
* EXPDATE为过期日期xxxEXPDATEyyyyMMdd
...
@@ -143,8 +143,11 @@ public class BarcodeRule {
...
@@ -143,8 +143,11 @@ public class BarcodeRule {
fieldValue
=
fieldValue
.
replace
(
newRule
.
partNumber_item
.
name
,
""
);
fieldValue
=
fieldValue
.
replace
(
newRule
.
partNumber_item
.
name
,
""
);
}
}
}
}
if
(!
newRule
.
whole_reelId_item
.
hasThisField
()
&&
!
newRule
.
reelId_item
.
hasThisField
()){
if
(!
newRule
.
whole_reelId_item
.
hasThisField
()
&&
!
newRule
.
reelId_item
.
hasThisField
()
&&
!
newRule
.
generate_reelId_item
.
hasThisField
()){
if
(
newRule
.
whole_reelId_item
.
matchRule
(
fieldValue
,
i
)){
if
(
newRule
.
generate_reelId_item
.
matchRule
(
fieldValue
,
i
)){
log
.
info
(
"generate reelId: 为"
+
newRule
.
generate_reelId_item
.
toString
());
fieldValue
=
fieldValue
.
replace
(
newRule
.
generate_reelId_item
.
name
,
""
);
}
else
if
(
newRule
.
whole_reelId_item
.
matchRule
(
fieldValue
,
i
)){
log
.
info
(
"whole reelId: 为"
+
newRule
.
whole_reelId_item
.
toString
());
log
.
info
(
"whole reelId: 为"
+
newRule
.
whole_reelId_item
.
toString
());
fieldValue
=
fieldValue
.
replace
(
newRule
.
whole_reelId_item
.
name
,
""
);
fieldValue
=
fieldValue
.
replace
(
newRule
.
whole_reelId_item
.
name
,
""
);
}
else
if
(
newRule
.
reelId_item
.
matchRule
(
fieldValue
,
i
)){
}
else
if
(
newRule
.
reelId_item
.
matchRule
(
fieldValue
,
i
)){
...
@@ -212,7 +215,7 @@ public class BarcodeRule {
...
@@ -212,7 +215,7 @@ public class BarcodeRule {
}
}
boolean
validRule
=
false
;
boolean
validRule
=
false
;
if
(
newRule
.
partNumber_item
.
hasThisField
()){
if
(
newRule
.
partNumber_item
.
hasThisField
()){
if
(
newRule
.
reelId_item
.
hasThisField
()
||
newRule
.
whole_reelId_item
.
hasThisField
()){
if
(
newRule
.
reelId_item
.
hasThisField
()
||
newRule
.
whole_reelId_item
.
hasThisField
()
||
newRule
.
generate_reelId_item
.
hasThisField
()
){
validRule
=
true
;
validRule
=
true
;
}
}
}
}
...
@@ -244,6 +247,7 @@ public class BarcodeRule {
...
@@ -244,6 +247,7 @@ public class BarcodeRule {
private
RuleItem
partNumber_item
=
new
RuleItem
(
"PN"
);
private
RuleItem
partNumber_item
=
new
RuleItem
(
"PN"
);
private
RuleItem
reelId_item
=
new
RuleItem
(
"RI"
);
private
RuleItem
reelId_item
=
new
RuleItem
(
"RI"
);
private
RuleItem
whole_reelId_item
=
new
RuleItem
(
"[RI]"
);
private
RuleItem
whole_reelId_item
=
new
RuleItem
(
"[RI]"
);
private
RuleItem
generate_reelId_item
=
new
RuleItem
(
"[GRI]"
);
private
RuleItem
quantity_item
=
new
RuleItem
(
"QTY"
);
private
RuleItem
quantity_item
=
new
RuleItem
(
"QTY"
);
private
RuleItem
produceDate_item
=
new
RuleItem
(
"PRODATE"
);
private
RuleItem
produceDate_item
=
new
RuleItem
(
"PRODATE"
);
private
RuleItem
expireDate_item
=
new
RuleItem
(
"EXPDATE"
);
private
RuleItem
expireDate_item
=
new
RuleItem
(
"EXPDATE"
);
...
@@ -383,6 +387,10 @@ public class BarcodeRule {
...
@@ -383,6 +387,10 @@ public class BarcodeRule {
}
}
if
(!
Strings
.
isNullOrEmpty
(
startWith
)){
if
(!
Strings
.
isNullOrEmpty
(
startWith
)){
int
startIndex
=
codeValue
.
indexOf
(
startWith
);
if
(
startIndex
>=
0
){
codeValue
=
codeValue
.
substring
(
startIndex
);
}
//不是以startWith开头
//不是以startWith开头
if
(!
codeValue
.
startsWith
(
startWith
)){
if
(!
codeValue
.
startsWith
(
startWith
)){
return
null
;
return
null
;
...
@@ -397,6 +405,10 @@ public class BarcodeRule {
...
@@ -397,6 +405,10 @@ public class BarcodeRule {
}
}
if
(!
Strings
.
isNullOrEmpty
(
endWith
)){
if
(!
Strings
.
isNullOrEmpty
(
endWith
)){
int
endIndex
=
codeValue
.
indexOf
(
endWith
);
if
(
endIndex
>=
0
){
codeValue
=
codeValue
.
substring
(
0
,
endIndex
+
endWith
.
length
());
}
//不是以endWith结尾
//不是以endWith结尾
if
(!
codeValue
.
endsWith
(
endWith
)){
if
(!
codeValue
.
endsWith
(
endWith
)){
return
null
;
return
null
;
...
@@ -579,7 +591,9 @@ public class BarcodeRule {
...
@@ -579,7 +591,9 @@ public class BarcodeRule {
Barcode
b
=
new
Barcode
();
Barcode
b
=
new
Barcode
();
b
.
setFullCode
(
codeStr
);
b
.
setFullCode
(
codeStr
);
String
reelId
=
""
;
String
reelId
=
""
;
if
(
whole_reelId_item
.
hasThisField
()){
if
(
generate_reelId_item
.
hasThisField
()){
reelId
=
DateUtil
.
toDateString
(
new
Date
(),
"yyyyMMddHHmmssS"
);
}
else
if
(
whole_reelId_item
.
hasThisField
()){
reelId
=
codeStr
;
reelId
=
codeStr
;
}
else
{
}
else
{
reelId
=
reelId_item
.
getStrValue
(
codeArr
);
reelId
=
reelId_item
.
getStrValue
(
codeArr
);
...
@@ -861,6 +875,22 @@ public class BarcodeRule {
...
@@ -861,6 +875,22 @@ public class BarcodeRule {
rule
=
"1@2@3@xPN@5@6@7@RI@xQTY@10@@"
;
rule
=
"1@2@3@xPN@5@6@7@RI@xQTY@10@@"
;
codeStr
=
"671200%10000%1MTR"
;
codeStr
=
"671200%10000%1MTR"
;
rule
=
"PN%QTY%BATCH[RI]"
;
rule
=
"PN%QTY%BATCH[RI]"
;
codeStr
=
"A11111MDAS1PGDM4600034251T67151T100ZC1VWINBOND1D17361Q5000"
;
rule
=
"RI[-1:0:2_1P]PN[2_1P:0:2_1T]BATCH[2_1T:0:2_1V]QTY[2_1Q:0:-1]SP[2_1V:0:2_1D]"
;
rule
=
"PN[2_1P:0:2_1T]BATCH[2_1T:0:2_1V]QTY[2_1Q:0:-1]SP[2_1V:0:2_1D][GRI]"
;
codeStr
=
"3N1949569-9730 300 12345678901234567890 JUTYUUSYA"
;
rule
=
"PN[3_3N1:12_-:-1] QTY 3 4[GRI]"
;
codeStr
=
"3N1949568-9430 300 12345678901234567890"
;
rule
=
"PN[3_3N1:12_-:-1] QTY 3[GRI]"
;
codeStr
=
"3N1239071-0260 300"
;
rule
=
"PN[3_3N1:12_-:-1] QTY[GRI]"
;
codeStr
=
"3N1949377-1010"
;
rule
=
"PN[3_3N1:12_-:-1][GRI]"
;
BarcodeRule
br
=
BarcodeRule
.
newRule
(
rule
);
BarcodeRule
br
=
BarcodeRule
.
newRule
(
rule
);
Barcode
b
=
br
.
toCodeBean
(
codeStr
).
getBarcode
();
Barcode
b
=
br
.
toCodeBean
(
codeStr
).
getBarcode
();
if
(
b
!=
null
){
if
(
b
!=
null
){
...
...
src/main/java/com/neotel/smfcore/custom/so1374/PokaNonInboundAndReturnController.java
查看文件 @
451bbc1
...
@@ -78,19 +78,20 @@ public class PokaNonInboundAndReturnController {
...
@@ -78,19 +78,20 @@ public class PokaNonInboundAndReturnController {
PokaNonInboundReturnRequest
.
Label
label
=
request
.
getLabel
();
PokaNonInboundReturnRequest
.
Label
label
=
request
.
getLabel
();
if
(
"INBOUND"
.
equals
(
operation
))
{
if
(
"INBOUND"
.
equals
(
operation
))
{
//新入库(operation=INBOUND):serial 在 SMF 在库中需保持唯一,重复则拒绝入库,成功后 SMF 生成并返回 uid
//新入库(operation=INBOUND):serial 在 SMF 在库中需保持唯一,重复则拒绝入库,成功后 SMF 生成并返回 uid
barcode
=
barcodeManager
.
find
OneByLockNam
e
(
material
.
getSerial
());
barcode
=
barcodeManager
.
find
ByBarcod
e
(
material
.
getSerial
());
if
(
barcode
!=
null
)
{
if
(
barcode
!=
null
)
{
// 新增:serial重复日志
// 新增:serial重复日志
log
.
error
(
"新入库序列号重复,serial:"
+
material
.
getSerial
()
+
",clientTxnId:"
+
request
.
getClientTxnId
());
log
.
error
(
"新入库序列号重复,serial:"
+
material
.
getSerial
()
+
",clientTxnId:"
+
request
.
getClientTxnId
());
//1002 DUPLICATE_SERIAL 新入库:序列号已存在于 SMF 在库中,拒绝入库;再入库:仅当未生成新 uid 时触发该错误
//1002 DUPLICATE_SERIAL 新入库:序列号已存在于 SMF 在库中,拒绝入库;再入库:仅当未生成新 uid 时触发该错误
return
ResultBean
.
newErrorResult
(
1002
,
"DUPLICATE_SERIAL"
);
return
ResultBean
.
newErrorResult
(
1002
,
"DUPLICATE_SERIAL"
);
}
}
barcode
=
createBarcode
(
material
,
label
);
barcode
=
createBarcode
(
material
,
label
,
barcode
);
// 新增:新入库条码创建完成日志
// 新增:新入库条码创建完成日志
log
.
info
(
"新入库条码创建完成,serial:"
+
material
.
getSerial
()
+
",uid:"
+
barcode
.
getBarcode
());
log
.
info
(
"新入库条码创建完成,serial:"
+
material
.
getSerial
()
+
",uid:"
+
barcode
.
getBarcode
());
}
else
if
(
"RETURN"
.
equals
(
operation
))
{
}
else
if
(
"RETURN"
.
equals
(
operation
))
{
barcode
=
createBarcode
(
material
,
label
);
barcode
=
barcodeManager
.
findByBarcode
(
material
.
getSerial
());
barcode
=
createBarcode
(
material
,
label
,
barcode
);
// 新增:退库条码创建完成日志
// 新增:退库条码创建完成日志
log
.
info
(
"退库条码创建完成,serial:"
+
material
.
getSerial
()
+
",uid:"
+
barcode
.
getBarcode
());
log
.
info
(
"退库条码创建完成,serial:"
+
material
.
getSerial
()
+
",uid:"
+
barcode
.
getBarcode
());
}
else
{
}
else
{
...
@@ -116,7 +117,7 @@ public class PokaNonInboundAndReturnController {
...
@@ -116,7 +117,7 @@ public class PokaNonInboundAndReturnController {
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"smfTxnId"
,
request
.
getClientTxnId
());
resultMap
.
put
(
"smfTxnId"
,
request
.
getClientTxnId
());
resultMap
.
put
(
"serial"
,
material
.
getSerial
());
resultMap
.
put
(
"serial"
,
material
.
getSerial
());
resultMap
.
put
(
"uid"
,
barcode
.
get
Barcod
e
());
resultMap
.
put
(
"uid"
,
barcode
.
get
LockNam
e
());
resultMap
.
put
(
"status"
,
"COMPLETED"
);
resultMap
.
put
(
"status"
,
"COMPLETED"
);
resultMap
.
put
(
"serverTime"
,
DateUtil
.
toDateString
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
resultMap
.
put
(
"serverTime"
,
DateUtil
.
toDateString
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
//构建registered信息
//构建registered信息
...
@@ -210,10 +211,12 @@ public class PokaNonInboundAndReturnController {
...
@@ -210,10 +211,12 @@ public class PokaNonInboundAndReturnController {
return
pos
;
return
pos
;
}
}
private
Barcode
createBarcode
(
PokaNonInboundReturnRequest
.
Material
material
,
PokaNonInboundReturnRequest
.
Label
label
)
{
private
Barcode
createBarcode
(
PokaNonInboundReturnRequest
.
Material
material
,
PokaNonInboundReturnRequest
.
Label
label
,
Barcode
barcode
)
{
String
uid
=
material
.
getSerial
()
+
"_"
+
DateUtil
.
toDateString
(
new
Date
(),
"yyyyMMddHHmmss"
);
String
uid
=
material
.
getSerial
()
+
"_"
+
DateUtil
.
toDateString
(
new
Date
(),
"yyyyMMddHHmmss"
);
Barcode
barcode
=
new
Barcode
();
if
(
barcode
==
null
){
barcode
.
setBarcode
(
uid
);
barcode
=
new
Barcode
();
}
barcode
.
setBarcode
(
material
.
getSerial
());
barcode
.
setPartNumber
(
material
.
getPartNo
());
barcode
.
setPartNumber
(
material
.
getPartNo
());
barcode
.
setProvider
(
material
.
getMakerPartNo
());
barcode
.
setProvider
(
material
.
getMakerPartNo
());
barcode
.
setBatch
(
material
.
getMakerLot
());
barcode
.
setBatch
(
material
.
getMakerLot
());
...
@@ -237,7 +240,7 @@ public class PokaNonInboundAndReturnController {
...
@@ -237,7 +240,7 @@ public class PokaNonInboundAndReturnController {
barcode
.
setLabelAmount
(
qrQty
);
barcode
.
setLabelAmount
(
qrQty
);
}
}
}
}
barcode
.
setLockName
(
material
.
getSerial
()
);
barcode
.
setLockName
(
uid
);
barcode
=
barcodeManager
.
save
(
barcode
);
barcode
=
barcodeManager
.
save
(
barcode
);
return
barcode
;
return
barcode
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论