Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a096d682
由
LN
编写于
2024-07-15 19:30:50 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
api修改
1 个父辈
16e42b66
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
99 行增加
和
29 行删除
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronApi.java
src/main/java/com/neotel/smfcore/custom/micron1053/api/bean/MaterialStatus.java
src/main/java/com/neotel/smfcore/custom/micron1053/bean/MicronResult.java
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
查看文件 @
a096d68
...
...
@@ -354,6 +354,7 @@ public class LiteOrderCache {
}
else
{
item
.
setExecutFailReason
(
msg
);
item
.
setStatus
(
OrderItemStatus
.
notify_fail
);
item
.
setExecutFailReason
(
msg
);
}
}
liteOrderItemManager
.
save
(
item
);
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronApi.java
查看文件 @
a096d68
...
...
@@ -33,6 +33,7 @@ import java.util.Map;
@Slf4j
public
class
MicronApi
{
public
static
boolean
Debug
=
false
;
private
static
MicronConfig
config
;
@Autowired
...
...
@@ -83,7 +84,6 @@ public class MicronApi {
}
public
static
boolean
Debug
=
false
;
public
static
Barcode
API001
(
String
operationId
,
String
rfid
,
Barcode
barcode
)
throws
ApiException
{
...
...
@@ -143,7 +143,8 @@ public class MicronApi {
// "transactionId": "833ec781-1eba-4860-bb91-f667cd89afd4",
// "status": "Success"
errorMsg
=
getDErrorMsg
(
result
);
if
(
result
.
isOk
()
&&
result
.
statusIsSuccess
())
{
// if (result.isOk() && result.statusIsSuccess()) {
if
(
result
.
isOk
()
&&
result
.
IsSuccess
())
{
String
partNumber
=
result
.
getResult
(
"partNumber"
);
String
serialNumber
=
result
.
getResult
(
"serialNumber"
);
Boolean
xrayReq
=
result
.
getResult
(
"xrayReq"
);
...
...
@@ -328,10 +329,10 @@ public class MicronApi {
// "error": <ErrCode>,
// "message": <ErrMessage>,
// "detail": <ErrDetail>
String
errMsg
=
getDErrorMsg
(
result
);
resultMap
.
put
(
"msg"
,
errMsg
);
if
(
result
.
isOk
()&&
result
.
statusIsSuccess
())
{
// if (result.isOk()&& result.statusIsSuccess()) {
if
(
result
.
isOk
()
)
{
List
<
Object
>
resultList
=
result
.
getResult
(
"materialStatusList"
);
for
(
Object
Obj
:
resultList
)
{
...
...
@@ -400,6 +401,7 @@ public class MicronApi {
try
{
log
.
info
(
"调用MES接口 API004: url="
+
url
+
""
);
MicronResult
result
=
HttpHelper
.
getMicronJson
(
url
);
String
errMsg
=
getDErrorMsg
(
result
);
if
(
result
.
isOk
()
)
{
List
<
DispatchId
>
resultDis
=
result
.
getResult
(
"dispatchIds"
,
false
);
if
(
resultDis
==
null
||
resultDis
.
size
()<=
0
){
...
...
@@ -423,6 +425,9 @@ public class MicronApi {
throw
new
ApiException
(
msg
);
}
return
resultDis
;
}
else
if
(
ObjectUtil
.
isNotEmpty
(
errMsg
)){
log
.
info
(
"API004 ,接口通信失败:"
+
errMsg
);
throw
new
ApiException
(
errMsg
);
}
else
{
log
.
info
(
"API004 ,接口通信失败"
);
...
...
@@ -456,6 +461,7 @@ public class MicronApi {
try
{
log
.
info
(
"调用MES接口 API005: url="
+
url
+
""
);
MicronResult
result
=
HttpHelper
.
getMicronJson
(
url
);
String
errMsg
=
getDErrorMsg
(
result
);
if
(
result
.
isOk
()
)
{
List
<
Object
>
objects
=
result
.
getResult
(
"materials"
,
false
);
if
(
objects
==
null
||
objects
.
size
()<=
0
){
...
...
@@ -468,6 +474,10 @@ public class MicronApi {
materialList
.
add
(
material
);
}
return
materialList
;
}
else
if
(
ObjectUtil
.
isNotEmpty
(
errMsg
))
{
log
.
info
(
"API005 ,接口通信失败:"
+
errMsg
);
throw
new
ApiException
(
errMsg
);
}
else
{
log
.
info
(
"API005 ,接口通信失败"
);
...
...
@@ -508,6 +518,7 @@ public class MicronApi {
log
.
info
(
"调用MES接口 API006: url="
+
url
+
",body="
+
paramStr
+
""
);
MicronResult
result
=
HttpHelper
.
postMicronJson
(
url
,
paramMap
);
String
errMsg
=
getDErrorMsg
(
result
);
if
(
result
.
isOk
())
{
List
<
Object
>
objects
=
result
.
getResult
(
"materials"
,
false
);
if
(
objects
==
null
||
objects
.
size
()<=
0
){
...
...
@@ -521,6 +532,9 @@ public class MicronApi {
materialList
.
add
(
material
);
}
return
materialList
;
}
else
if
(
ObjectUtil
.
isNotEmpty
(
errMsg
))
{
log
.
info
(
"API006 ,接口通信失败:"
+
errMsg
);
throw
new
ApiException
(
errMsg
);
}
else
{
log
.
info
(
"API006 ,接口通信失败"
);
...
...
@@ -536,9 +550,9 @@ public class MicronApi {
public
static
String
Api007
(
String
operationId
,
String
rfid
,
List
<
DataLog
>
dataLogList
)
{
String
url
=
config
.
getUrl
(
config
.
api_name_007
);
String
errMsg
=
""
;
String
errMsg
=
""
;
try
{
String
jobId
=
operationId
+
"_"
+
rfid
;
String
jobId
=
operationId
+
"_"
+
rfid
;
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"jobId"
,
jobId
);
paramMap
.
put
(
"operationId"
,
operationId
);
...
...
@@ -561,15 +575,32 @@ public class MicronApi {
String
paramStr
=
JsonUtil
.
toJsonStr
(
paramMap
);
log
.
info
(
"调用MES接口 API007: url="
+
url
+
",body="
+
paramStr
+
""
);
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
MicronResult
micronResult
=
HttpHelper
.
postMicronJson
(
url
,
paramMap
);
errMsg
=
getDErrorMsg
(
micronResult
);
if
(
micronResult
.
isOk
()&&
micronResult
.
statusIsSuccess
())
{
errMsg
=
getDErrorMsg
(
micronResult
);
// if (micronResult.isOk()&& micronResult.statusIsSuccess()) {
if
(
micronResult
.
isOk
())
{
List
<
Object
>
resultList
=
micronResult
.
getResult
(
"materialStatusList"
);
for
(
Object
Obj
:
resultList
)
{
MaterialStatus
s
=
JsonUtil
.
toObj
(
JsonUtil
.
toJsonStr
(
Obj
),
MaterialStatus
.
class
);
// if (s.getMaterialStatus().toUpperCase().equals("SUCCESS")) {
if
(
s
.
isSuccess
())
{
resultMap
.
put
(
s
.
getSerialNum
(),
"true"
);
}
else
if
(
ObjectUtil
.
isNotEmpty
(
s
.
getDescription
()))
{
resultMap
.
put
(
s
.
getSerialNum
(),
s
.
getDescription
());
}
else
{
resultMap
.
put
(
s
.
getSerialNum
(),
errMsg
);
}
}
//需要解析
return
""
;
}
else
if
(
ObjectUtil
.
isNotEmpty
(
errMsg
)){
}
else
if
(
ObjectUtil
.
isNotEmpty
(
errMsg
))
{
log
.
info
(
"API007 ,接口通信失败:"
+
errMsg
);
return
errMsg
;
}
else
{
// throw new ApiException(errMsg);
}
else
{
log
.
info
(
"API007 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API007"
});
}
...
...
@@ -588,8 +619,8 @@ public class MicronApi {
try
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"serialNum"
,
serialNum
);
paramMap
.
put
(
"newQty"
,
newQty
);
paramMap
.
put
(
"serialNum"
,
serialNum
);
paramMap
.
put
(
"newQty"
,
newQty
);
String
paramStr
=
JsonUtil
.
toJsonStr
(
paramMap
);
log
.
info
(
"调用MES接口 API008: url="
+
url
+
",body="
+
paramStr
+
""
);
...
...
@@ -607,9 +638,15 @@ public class MicronApi {
// ]
// }
// String trasactionId=micronResult.getResult("trasactionId");
if
(
micronResult
.
isOk
()&&
micronResult
.
statusIsSuccess
())
{
// if (micronResult.isOk()&& micronResult.statusIsSuccess()) {
String
errMsg
=
getDErrorMsg
(
micronResult
);
if
(
micronResult
.
isOk
())
{
return
true
;
}
else
{
}
else
if
(
ObjectUtil
.
isNotEmpty
(
errMsg
))
{
log
.
info
(
"API008 ,接口通信失败:"
+
errMsg
);
throw
new
ApiException
(
errMsg
);
}
else
{
log
.
info
(
"API008 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API008"
});
...
...
@@ -625,10 +662,10 @@ public class MicronApi {
public
static
Map
<
String
,
MaterialStatus
>
Api009
(
List
<
Barcode
>
barcodeList
)
{
Map
<
String
,
MaterialStatus
>
resultMap
=
new
HashMap
<>();
if
(
Debug
)
{
for
(
Barcode
barcode:
barcodeList
)
{
resultMap
.
put
(
barcode
.
getBarcode
(),
new
MaterialStatus
(
barcode
.
getBarcode
(),
barcode
.
getPartNumber
(),
""
,
""
,
""
,
true
));
if
(
Debug
)
{
for
(
Barcode
barcode
:
barcodeList
)
{
resultMap
.
put
(
barcode
.
getBarcode
(),
new
MaterialStatus
(
barcode
.
getBarcode
(),
barcode
.
getPartNumber
(),
""
,
""
,
true
));
}
}
...
...
@@ -650,7 +687,13 @@ public class MicronApi {
log
.
info
(
"调用MES接口 API009: url="
+
url
+
",body="
+
paramStr
+
""
);
MicronResult
micronResult
=
HttpHelper
.
postMicronJson
(
url
,
paramMap
);
if
(
micronResult
.
isOk
()
&&
micronResult
.
statusIsSuccess
())
{
// API-009 In Body: add operationId and linePrepOrderId
// Out Body: Change linePrepOrderId to reservedLinePrepOrderId (added 13-6-2024)
// if (micronResult.isOk() && micronResult.statusIsSuccess()) {
String
errMsg
=
getDErrorMsg
(
micronResult
);
if
(
micronResult
.
isOk
())
{
// 200 - Success
// {
...
...
@@ -671,9 +714,13 @@ public class MicronApi {
List
<
Object
>
resultList
=
micronResult
.
getResult
(
"results"
);
for
(
Object
Obj
:
resultList
)
{
MaterialStatus
s
=
JsonUtil
.
toObj
(
JsonUtil
.
toJsonStr
(
Obj
)
,
MaterialStatus
.
class
);
resultMap
.
put
(
s
.
getSerialNum
(),
s
);
MaterialStatus
s
=
JsonUtil
.
toObj
(
JsonUtil
.
toJsonStr
(
Obj
),
MaterialStatus
.
class
);
resultMap
.
put
(
s
.
getSerialNum
(),
s
);
}
}
else
if
(
ObjectUtil
.
isNotEmpty
(
errMsg
))
{
log
.
info
(
"API009 ,接口通信失败:"
+
errMsg
);
throw
new
ApiException
(
errMsg
);
}
else
{
log
.
info
(
"API009 ,接口通信失败"
);
...
...
@@ -701,6 +748,8 @@ public class MicronApi {
MicronResult
micronResult
=
HttpHelper
.
postMicronJson
(
url
,
paramMap
);
// JSONObject jsonObject = JSONObject.parseObject(micronResult.getResponseData());
// String trackStatus = jsonObject.getString("trackStatus");
// 0712 API-010 Out Body: Remove materialStatus node
String
errMsg
=
getDErrorMsg
(
micronResult
);
if
(
micronResult
.
isOk
()
)
{
List
<
Object
>
objects
=
micronResult
.
getResult
(
"trackStatus"
,
false
);
...
...
@@ -726,6 +775,10 @@ public class MicronApi {
trackStatus
.
setSerialNum
(
m
.
getSerialNum
());
statusList
.
add
(
trackStatus
);
}
}
else
if
(
ObjectUtil
.
isNotEmpty
(
errMsg
))
{
log
.
info
(
"API010 ,接口通信失败:"
+
errMsg
);
throw
new
ApiException
(
errMsg
);
}
else
{
log
.
info
(
"API010 ,接口通信失败"
);
...
...
@@ -757,11 +810,19 @@ public class MicronApi {
try
{
log
.
info
(
"调用MES接口 Api011: url="
+
url
+
" "
);
MicronResult
result
=
HttpHelper
.
getMicronJson
(
url
);
if
(
result
.
isOk
()&&
result
.
statusIsSuccess
())
{
//0712 API-011 Out Body: Remove status node
// if (result.isOk()&& result.statusIsSuccess()) {
String
errMsg
=
getDErrorMsg
(
result
);
if
(
result
.
isOk
()
)
{
String
operationId
=
result
.
getResult
(
"operationId"
);
log
.
info
(
" Api011 ,mode="
+
mode
+
",userName="
+
userName
+
", 获取到 operationId="
+
operationId
);
return
operationId
;
}
else
if
(
ObjectUtil
.
isNotEmpty
(
errMsg
))
{
log
.
info
(
"Api011 ,接口通信失败:"
+
errMsg
);
throw
new
ApiException
(
errMsg
);
}
else
{
log
.
info
(
"Api011 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"Api011"
});
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/api/bean/MaterialStatus.java
查看文件 @
a096d68
...
...
@@ -13,8 +13,8 @@ public class MaterialStatus implements Serializable {
private
String
serialNum
;
private
String
partNumber
;
private
String
materialStatus
;
private
String
l
inePrepOrderId
;
//
private String materialStatus;
private
String
reservedL
inePrepOrderId
;
private
String
description
;
private
boolean
success
=
false
;
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/bean/MicronResult.java
查看文件 @
a096d68
...
...
@@ -40,9 +40,17 @@ public class MicronResult implements Serializable {
return
false
;
}
public
boolean
statusIsSuccess
()
throws
ApiException
{
String
status
=
getResult
(
"status"
,
false
);
if
(
ObjectUtil
.
isNotEmpty
(
status
)
&&
status
.
toString
().
equalsIgnoreCase
(
"SUCCESS"
))
{
// public boolean statusIsSuccess()throws ApiException {
// String status = getResult("status",false);
// if (ObjectUtil.isNotEmpty(status) && status.toString().equalsIgnoreCase("SUCCESS")) {
// return true;
// }
// return false;
// }
public
boolean
IsSuccess
()
throws
ApiException
{
Boolean
status
=
getResult
(
"success"
,
false
);
if
(
ObjectUtil
.
isNotEmpty
(
status
)
&&
status
)
{
return
true
;
}
return
false
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论