Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 61b1a9c1
由
LN
编写于
2023-08-29 17:14:18 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.状态修改。
2.API001启用API测试时才调用。 3.API001失败也需要记录。 4.入库数量可点开查看详情。
1 个父辈
76483319
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
230 行增加
和
30 行删除
src/main/java/com/neotel/smfcore/core/device/handler/impl/RobotBoxHandler.java
src/main/java/com/neotel/smfcore/core/inList/enums/INITEM/INITEM_STATUS.java
src/main/java/com/neotel/smfcore/core/inList/service/po/InListItem.java
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronApi.java
src/main/java/com/neotel/smfcore/custom/micron1053/bean/MicronResult.java
src/main/java/com/neotel/smfcore/custom/micron1053/loading/LoadingController.java
src/main/java/com/neotel/smfcore/custom/micron1053/loading/dto/MaterialDtialDto.java
src/main/java/com/neotel/smfcore/custom/micron1053/loading/dto/MaterialLoadingDto.java
src/main/java/com/neotel/smfcore/custom/micron1053/loading/util/LoadingUtil.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/RobotBoxHandler.java
查看文件 @
61b1a9c
...
...
@@ -670,6 +670,13 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if
(
ObjectUtil
.
isEmpty
(
rfid
))
{
return
barcode
;
}
Boolean
useAPi
=
dataCache
.
getCache
(
Constants
.
CACHE_API_TEST
);
if
(
useAPi
==
null
){
useAPi
=
false
;
}
if
(!
useAPi
)
{
return
barcode
;
}
//是否启用
if
(!
MicronApi
.
isEnable
())
{
return
barcode
;
...
...
@@ -702,7 +709,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
log
.
info
(
"条码["
+
barcode
.
getBarcode
()
+
"]获取库位号,operationId 为空,不需要接口验证"
);
return
barcode
;
}
barcode
=
MicronApi
.
API001
(
operationId
,
barcode
);
barcode
=
MicronApi
.
API001
(
operationId
,
rfid
,
barcode
);
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"未找到有效的条码"
);
}
...
...
src/main/java/com/neotel/smfcore/core/inList/enums/INITEM/INITEM_STATUS.java
查看文件 @
61b1a9c
...
...
@@ -3,27 +3,30 @@ package com.neotel.smfcore.core.inList.enums.INITEM;
public
class
INITEM_STATUS
{
/**等待中*/
public
static
int
Wait
=
0
;
public
static
String
Wait
=
"Wait"
;
/**Api001验证失败*/
public
static
String
API001NG
=
"API001NG"
;
/**入库中*/
public
static
int
PutIn
=
1
;
public
static
String
PutIn
=
"PutIn"
;
/**入库完成*/
public
static
int
PutEnd
=
2
;
/**入库完成
,等待API002推送
*/
public
static
String
PutEnd
=
"PutEnd"
;
//入库取消
public
static
int
Cancel
=
3
;
/**入库取消*/
public
static
String
Cancel
=
"Cancel"
;
/**XRay点料*/
public
static
int
XRay
=
4
;
public
static
String
XRay
=
"XRay"
;
/**XRay点料结果提交失败*/
public
static
int
XRayFail
=
5
;
public
static
String
XRayFail
=
"XRayFail"
;
/**已点料完成,等待获取库位号*/
public
static
String
XRayEnd
=
"XRayEnd"
;
/**入库正常完成*/
public
static
int
Success
=
6
;
/**入库通知失败*/
public
static
int
Fail
=
7
;
/**已点料完成,等待获取库位号*/
public
static
int
XRayEnd
=
8
;
public
static
String
Success
=
"Success"
;
/**入库通知失败 新页面显示提交失败的*/
public
static
String
Fail
=
"Fail"
;
}
src/main/java/com/neotel/smfcore/core/inList/service/po/InListItem.java
查看文件 @
61b1a9c
...
...
@@ -26,7 +26,7 @@ public class InListItem extends BasePo implements Serializable {
item
.
setNum
(
num
);
return
item
;
}
public
static
InListItem
newMItem
(
String
name
,
Barcode
barcode
,
String
rfid
,
String
posName
,
int
s
,
String
mType
){
public
static
InListItem
newMItem
(
String
name
,
Barcode
barcode
,
String
rfid
,
String
posName
,
String
s
,
String
mType
){
InListItem
item
=
new
InListItem
();
item
.
setName
(
name
);
item
.
setPN
(
barcode
.
getPartNumber
());
...
...
@@ -88,13 +88,18 @@ public class InListItem extends BasePo implements Serializable {
private
String
posName
;
/**
* 错误信息
*/
private
String
ngMsg
;
/**
* 入库状态,0=未开始,1=验证成功,入库中,2=XRay点料,3=入库提交完成,4=入库提交失败
*
*/
private
int
state
=
INITEM_STATUS
.
Wait
;
private
String
state
=
INITEM_STATUS
.
Wait
;
public
boolean
isEnd
()
{
return
state
==
INITEM_STATUS
.
Success
||
state
==
INITEM_STATUS
.
Cancel
;
return
state
==
INITEM_STATUS
.
Success
||
state
==
INITEM_STATUS
.
Cancel
||
state
==
INITEM_STATUS
.
API001NG
;
}
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronApi.java
查看文件 @
61b1a9c
...
...
@@ -16,6 +16,7 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import
com.neotel.smfcore.custom.micron1053.api.bean.*
;
import
com.neotel.smfcore.custom.micron1053.bean.MaterialInfo
;
import
com.neotel.smfcore.custom.micron1053.bean.MicronResult
;
import
com.neotel.smfcore.custom.micron1053.loading.util.LoadingUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -47,6 +48,13 @@ public class MicronApi {
MicronApi
.
dataCache
=
cache
;
}
public
static
LoadingUtil
loadingUtil
;
@Autowired
public
void
setLoadingUtil
(
LoadingUtil
loadingUtil
)
{
MicronApi
.
loadingUtil
=
loadingUtil
;
}
public
static
IBarcodeManager
barcodeManager
;
@Autowired
...
...
@@ -74,9 +82,9 @@ public class MicronApi {
}
public
static
boolean
Debug
=
fals
e
;
public
static
boolean
Debug
=
tru
e
;
public
static
Barcode
API001
(
String
operationId
,
Barcode
barcode
)
throws
ApiException
{
public
static
Barcode
API001
(
String
operationId
,
String
rfid
,
Barcode
barcode
)
throws
ApiException
{
String
url
=
config
.
getUrl
(
config
.
api_name_001
);
if
(
ObjectUtil
.
isEmpty
(
url
))
{
...
...
@@ -167,7 +175,17 @@ public class MicronApi {
barcode
.
setToXray
(
true
);
}
// 2023-08-29 14:45:35.971 INFO [HttpHelper.java:339] - Request to [http://istio-ingressgateway-istio-system.apps.ose-dev45.micron.com/material/validation/label] response: code=500,responseContent={
// "transactionId": "2810c627-d3b6-4200-ba7c-f8e3eddf47f6",
// "error": 102,
// "message": "Server error exception",
// "detail": "Failed at MAM [GetMAInfo]. Exception:: You must supply a valid MA Type."
// }
}
else
{
Integer
error
=
result
.
getErrorValue
(
"error"
);
String
message
=
result
.
getErrorValue
(
"message"
);
loadingUtil
.
AddErrorItem
(
rfid
,
barcode
,
error
,
message
);
log
.
info
(
"API001 ,验证失败,获取数据失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API001"
});
}
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/bean/MicronResult.java
查看文件 @
61b1a9c
...
...
@@ -96,4 +96,33 @@ public class MicronResult implements Serializable {
}
return
null
;
}
public
<
T
>
T
getErrorValue
(
String
key
)
{
if
(
resultMap
==
null
)
{
resultMap
=
JsonUtil
.
toMap
(
responseData
);
}
if
(
key
!=
null
&&
!
key
.
isEmpty
())
{
Object
value
=
resultMap
.
get
(
key
);
if
(
value
!=
null
)
{
return
(
T
)
value
;
}
else
{
try
{
char
[]
cs
=
key
.
toCharArray
();
char
c
=
cs
[
0
];
cs
[
0
]
=
Character
.
isUpperCase
(
c
)
?
Character
.
toLowerCase
(
c
)
:
Character
.
toUpperCase
(
c
);
String
newKey
=
String
.
valueOf
(
cs
);
value
=
resultMap
.
get
(
newKey
);
if
(
value
!=
null
)
{
return
(
T
)
value
;
}
}
catch
(
Exception
ex
)
{
}
}
}
return
null
;
}
}
src/main/java/com/neotel/smfcore/custom/micron1053/loading/LoadingController.java
查看文件 @
61b1a9c
...
...
@@ -7,6 +7,8 @@ import com.neotel.smfcore.common.exception.ValidateException;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.DateUtil
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.inList.enums.INITEM.INITEM_STATUS
;
import
com.neotel.smfcore.core.inList.enums.INLIST_STATUS
;
...
...
@@ -17,6 +19,7 @@ import com.neotel.smfcore.core.inList.util.InListCache;
import
com.neotel.smfcore.custom.micron1053.api.APIMODE
;
import
com.neotel.smfcore.custom.micron1053.api.MicronApi
;
import
com.neotel.smfcore.custom.micron1053.loading.Bean.LoadingInfo
;
import
com.neotel.smfcore.custom.micron1053.loading.dto.MaterialDtialDto
;
import
com.neotel.smfcore.custom.micron1053.loading.dto.MaterialLoadingDto
;
import
com.neotel.smfcore.custom.micron1053.loading.util.LoadingUtil
;
import
com.neotel.smfcore.custom.micron1053.util.MicronDataCache
;
...
...
@@ -48,6 +51,9 @@ public class LoadingController {
@Autowired
private
LoadingUtil
loadingUtil
;
@Autowired
private
IBarcodeManager
barcodeManager
;
@ApiOperation
(
"lOADING页面获取列表数据"
)
@GetMapping
(
"/list"
)
@AnonymousAccess
...
...
@@ -72,10 +78,13 @@ public class LoadingController {
for
(
InListItem
item
:
inList
.
getInListItems
())
{
String
mtype
=
item
.
getMType
();
MaterialLoadingDto
dto
=
dtoMap
.
getOrDefault
(
mtype
,
new
MaterialLoadingDto
(
mtype
,
0
,
0
,
0
));
MaterialLoadingDto
dto
=
dtoMap
.
getOrDefault
(
mtype
,
new
MaterialLoadingDto
(
mtype
,
0
,
0
,
0
,
0
));
if
(
item
.
isSuccess
())
{
dto
.
setSuccessQty
(
dto
.
getSuccessQty
()
+
1
);
}
else
if
(
item
.
isFailure
())
{
}
else
if
(
item
.
getState
()==
INITEM_STATUS
.
API001NG
)
{
dto
.
setNg
(
dto
.
getNg
()
+
1
);
}
else
if
(
item
.
isFailure
())
{
dto
.
setFailure
(
dto
.
getFailure
()
+
1
);
}
else
if
(
item
.
isXray
())
{
dto
.
setXRay
(
dto
.
getXRay
()
+
1
);
...
...
@@ -89,14 +98,66 @@ public class LoadingController {
}
if
(
resultList
.
size
()<=
0
&&
MicronApi
.
Debug
)
{
resultList
.
add
(
new
MaterialLoadingDto
(
MicronDataCache
.
PIZZABOX
,
2
,
5
,
6
));
resultList
.
add
(
new
MaterialLoadingDto
(
MicronDataCache
.
REEL
,
23
,
54
,
6
));
resultList
.
add
(
new
MaterialLoadingDto
(
MicronDataCache
.
PCB
,
22
,
52
,
65
));
resultList
.
add
(
new
MaterialLoadingDto
(
MicronDataCache
.
PIZZABOX
,
2
,
3
,
5
,
6
));
resultList
.
add
(
new
MaterialLoadingDto
(
MicronDataCache
.
REEL
,
23
,
2
,
54
,
6
));
resultList
.
add
(
new
MaterialLoadingDto
(
MicronDataCache
.
PCB
,
22
,
2
,
52
,
65
));
}
return
resultList
;
}
@ApiOperation
(
"lOADING页面获取列表详情数据"
)
@GetMapping
(
"/detial"
)
@AnonymousAccess
public
ResultBean
detial
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
//参数:mType 物料类型:pcb/shoebox/pizzaBox/reel/tray
//参数:state 状态: success/xray/failure
String
mType
=
params
.
get
(
"mType"
).
toString
();
String
state
=
params
.
get
(
"state"
).
toString
();
List
<
MaterialDtialDto
>
dtos
=
new
ArrayList
<>();
if
(
MicronApi
.
Debug
){
for
(
int
i
=
1
;
i
<=
5
;
i
++
){
MaterialDtialDto
dto
=
new
MaterialDtialDto
(
"barcode"
+
i
,
"pn"
+
i
,
new
Date
(),
"proN"
+
i
,
233
,
7
,
8
,
"provider"
+
i
,
"batch"
+
i
,
"msl"
+
i
,
"posName"
+
i
,
""
);
dtos
.
add
(
dto
);
}
}
InList
inList
=
loadingUtil
.
getInlist
();
if
(
inList
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.micron.nodata"
,
"未找到信息"
);
}
for
(
InListItem
item
:
inList
.
getInListItems
())
{
if
(
item
.
getMType
().
equals
(
mType
))
{
boolean
is
=
false
;
if
(
item
.
isSuccess
()
&&
state
.
equals
(
"success"
))
{
is
=
true
;
}
else
if
(
item
.
isFailure
()&&
state
.
equals
(
"xray"
))
{
is
=
true
;
}
else
if
(
item
.
isXray
()&&
state
.
equals
(
"failure"
))
{
is
=
true
;
}
if
(
is
){
Barcode
code
=
barcodeManager
.
findByBarcode
(
item
.
getRi
());
MaterialDtialDto
dto
=
new
MaterialDtialDto
(
code
.
getBarcode
(),
code
.
getPartNumber
(),
code
.
getExpireDate
(),
code
.
getProviderNumber
(),
code
.
getAmount
(),
code
.
getPlateSize
(),
code
.
getHeight
(),
code
.
getProvider
(),
code
.
getBatch
(),
code
.
getMsl
(),
code
.
getPosName
(),
""
);
dtos
.
add
(
dto
);
}
}
}
return
ResultBean
.
newOkResult
(
dtos
);
}
@ApiOperation
(
"loading->ReturnMaterial 输入RFID后获取数据"
)
@PostMapping
(
"/returnMaterial"
)
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/loading/dto/MaterialDtialDto.java
0 → 100644
查看文件 @
61b1a9c
package
com
.
neotel
.
smfcore
.
custom
.
micron1053
.
loading
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
MaterialDtialDto
implements
Serializable
{
@ApiModelProperty
(
"条码编号"
)
private
String
barcode
;
@ApiModelProperty
(
"料件编号"
)
private
String
partNumber
;
@ApiModelProperty
(
"过期时间(入库时间+最大存储时间)"
)
private
Date
expTime
;
@ApiModelProperty
(
"供应商编号"
)
private
String
providerNumber
;
@ApiModelProperty
(
"数量"
)
private
int
amount
;
@ApiModelProperty
(
"宽度"
)
private
int
plateSize
=
0
;
@ApiModelProperty
(
"高度"
)
private
int
height
=
0
;
@ApiModelProperty
(
"供应商"
)
private
String
provider
;
@ApiModelProperty
(
"批次"
)
private
String
batch
;
@ApiModelProperty
(
"等级"
)
private
String
msl
;
@ApiModelProperty
(
"库位号"
)
private
String
posName
;
@ApiModelProperty
(
"错误信息"
)
private
String
errMsg
;
}
src/main/java/com/neotel/smfcore/custom/micron1053/loading/dto/MaterialLoadingDto.java
查看文件 @
61b1a9c
...
...
@@ -17,6 +17,8 @@ public class MaterialLoadingDto implements Serializable {
@ApiModelProperty
(
"成功盘数"
)
private
int
successQty
;
@ApiModelProperty
(
"NG盘数"
)
private
int
ng
;
@ApiModelProperty
(
"去点料盘数"
)
private
int
xRay
;
@ApiModelProperty
(
"失败盘数"
)
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/loading/util/LoadingUtil.java
查看文件 @
61b1a9c
...
...
@@ -56,9 +56,35 @@ public class LoadingUtil {
}
return
null
;
}
//获取库位号成功,增加一个正在入库的
public
void
AddErrorItem
(
String
rfid
,
Barcode
barcode
,
Integer
error
,
String
message
)
{
InList
inList
=
getInlist
();
if
(
inList
==
null
)
{
return
;
}
inList
.
addRfid
(
rfid
);
inList
.
setStatus
(
INLIST_STATUS
.
ABNORMAL
);
String
mtype
=
MicronDataCache
.
GetReelType
(
barcode
.
getPlateSize
(),
barcode
.
getHeight
());
log
.
info
(
"为入库单["
+
inList
.
getName
()
+
"]增加一条验证失败信息:barcode["
+
barcode
.
getBarcode
()
+
"],mtype["
+
mtype
+
"],pn["
+
barcode
.
getPartNumber
()
+
"],rfid["
+
rfid
+
"],s["
+
INITEM_STATUS
.
API001NG
+
"],ngMsg["
+
error
+
":"
+
message
+
"]"
);
InListItem
item
=
InListItem
.
newMItem
(
inList
.
getName
(),
barcode
,
rfid
,
""
,
INITEM_STATUS
.
API001NG
,
mtype
);
if
(
inList
.
getEndRfidList
()
!=
null
&&
inList
.
getEndRfidList
().
contains
(
rfid
))
{
item
.
setRfidEnd
(
true
);
}
item
.
setNgMsg
(
error
+
":"
+
message
);
item
=
inListItemManager
.
save
(
item
);
List
<
InListItem
>
items
=
inList
.
getInListItems
();
items
.
add
(
item
);
inList
.
setInListItems
(
items
);
inListManager
.
save
(
inList
);
inListCache
.
addInListToMap
(
inList
);
}
//获取库位号成功,增加一个正在入库的
public
void
AddInListItem
(
String
rfid
,
Barcode
barcode
,
String
posName
,
int
s
)
{
public
void
AddInListItem
(
String
rfid
,
Barcode
barcode
,
String
posName
,
String
s
)
{
InList
inList
=
getInlist
();
if
(
inList
==
null
)
{
...
...
@@ -101,11 +127,11 @@ public class LoadingUtil {
public
void
xRayEndUpdateItem
(
String
barcode
,
int
count
,
int
s
)
{
public
void
xRayEndUpdateItem
(
String
barcode
,
int
count
,
String
s
)
{
updateItemState
(
barcode
,
""
,
INITEM_STATUS
.
XRayFail
);
}
public
InListItem
updateItemState
(
String
barcode
,
String
posName
,
int
s
)
{
public
InListItem
updateItemState
(
String
barcode
,
String
posName
,
String
s
)
{
InList
inList
=
getInlist
();
...
...
@@ -145,7 +171,7 @@ public class LoadingUtil {
public
void
putEndUpdate
(
DataLog
dataLog
)
{
String
barcode
=
dataLog
.
getBarcode
();
String
posName
=
dataLog
.
getPosName
();
int
state
=
INITEM_STATUS
.
PutEnd
;
String
state
=
INITEM_STATUS
.
PutEnd
;
if
(
dataLog
.
isCancel
())
{
state
=
INITEM_STATUS
.
Cancel
;
}
...
...
@@ -278,7 +304,7 @@ public class LoadingUtil {
if
(
item
.
getRfid
().
equals
(
rfid
))
{
if
(
item
.
getState
()
==
INITEM_STATUS
.
Success
)
{
}
else
{
int
newS
=
INITEM_STATUS
.
Fail
;
String
newS
=
INITEM_STATUS
.
Fail
;
if
(
resultMap
.
containsKey
(
item
.
getRi
()))
{
Boolean
result
=
resultMap
.
get
(
item
.
getRi
());
if
(
result
==
null
)
{
...
...
@@ -358,7 +384,7 @@ public class LoadingUtil {
//查找所有失败的重新推送
for
(
InListItem
item
:
inList
.
getInListItems
())
{
if
(
item
.
getState
()
<=
INITEM_STATUS
.
Success
&&
item
.
getRi
().
equals
(
barcode
))
{
if
(
item
.
getState
()
.
equals
(
INITEM_STATUS
.
Fail
)
&&
item
.
getRi
().
equals
(
barcode
))
{
return
item
.
getRfid
();
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论