Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 401977bf
由
LN
编写于
2023-08-18 13:39:45 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.将数据类型 "msLevel "改为字符串
2.接口返回状态码=200 并且status=Success为成功,其他为失败. 3."arraySize "和 "panelNum "不是pcb时发送null.
1 个父辈
9b209f68
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
94 行增加
和
92 行删除
src/main/java/com/neotel/smfcore/custom/micron1053/api/AMaterialBean.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/api/AMaterialBean.java
查看文件 @
401977b
...
...
@@ -25,7 +25,7 @@ public class AMaterialBean {
private
Integer
qty
;
private
String
expirationDateStr
;
private
LocalDateTime
expirationDate
;
private
Integer
msLevel
;
private
String
msLevel
;
private
String
containerType
;
private
Integer
arraySize
;
private
Integer
panelNum
;
...
...
@@ -48,9 +48,9 @@ public class AMaterialBean {
String
msLevelStr
=
barcode
.
getMsl
();
if
(
msLevelStr
.
startsWith
(
"E"
))
{
bean
.
msLevel
=
ToInt
(
msLevelStr
.
substring
(
1
),
0
)
;
bean
.
msLevel
=
msLevelStr
.
substring
(
1
)
;
}
else
if
(
msLevelStr
.
startsWith
(
"7E"
))
{
bean
.
msLevel
=
ToInt
(
msLevelStr
.
substring
(
2
),
0
)
;
bean
.
msLevel
=
msLevelStr
.
substring
(
2
)
;
}
}
catch
(
Exception
ex
)
{
...
...
@@ -72,8 +72,8 @@ public class AMaterialBean {
}
return
defValue
;
}
public
Map
<
String
,
Object
>
toMap
(){
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
public
Map
<
String
,
Object
>
toMap
()
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"serialNum"
,
serialNum
);
resultMap
.
put
(
"partNumber"
,
partNumber
);
...
...
@@ -86,9 +86,14 @@ public class AMaterialBean {
resultMap
.
put
(
"msLevel"
,
msLevel
);
resultMap
.
put
(
"containerType"
,
containerType
);
//类型
resultMap
.
put
(
"arraySize"
,
arraySize
);
//1Q
resultMap
.
put
(
"panelNum"
,
panelNum
);
//Q
//对于(容器类型 = pcb),KTS 发送带有 "arraySize "和 "panelNum "值的请求;如果不是 pcb 类型,则发送NULL。
if
(
containerType
.
equals
(
MicronDataCache
.
PCB
))
{
resultMap
.
put
(
"arraySize"
,
arraySize
);
//1Q
resultMap
.
put
(
"panelNum"
,
panelNum
);
//Q
}
else
{
resultMap
.
put
(
"arraySize"
,
null
);
//1Q
resultMap
.
put
(
"panelNum"
,
null
);
//Q
}
return
resultMap
;
}
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronApi.java
查看文件 @
401977b
...
...
@@ -119,7 +119,7 @@ public class MicronApi {
// "message": "Server error exception",
// "detail": "Value cannot be null. (Parameter 'value')"
// }
if
(
result
.
statusIsSuccess
())
{
if
(
result
.
isOk
()&&
result
.
statusIsSuccess
())
{
String
partNumber
=
result
.
getResult
(
"partNumber"
);
String
serialNum
=
result
.
getResult
(
"serialNum"
);
Boolean
xrayReq
=
result
.
getResult
(
"xrayReq"
);
...
...
@@ -130,6 +130,9 @@ public class MicronApi {
}
log
.
info
(
"API001 ,barcode="
+
barcode
.
getBarcode
()
+
",返回结果:partNumber="
+
partNumber
+
", serialNum="
+
serialNum
+
", xrayReq="
+
xrayReq
+
", Qty="
+
mamQty
);
}
else
{
log
.
info
(
"API001 ,验证失败,获取数据失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API001"
});
}
return
barcode
;
...
...
@@ -228,19 +231,23 @@ public class MicronApi {
// ]
// "status": "Success"
// }
Map
<
String
,
Boolean
>
resultMap
=
new
HashMap
<>();
String
paramStr
=
JsonUtil
.
toJsonStr
(
paramsMap
);
log
.
info
(
"调用MES接口 API002: url="
+
url
+
",body="
+
paramStr
+
""
);
MicronResult
result
=
HttpHelper
.
postMicronJson
(
url
,
paramsMap
);
List
<
MaterialStatus
>
resultList
=
result
.
getResult
(
"materialStatusList"
);
Map
<
String
,
Boolean
>
resultMap
=
new
HashMap
<>();
for
(
MaterialStatus
s
:
resultList
)
{
if
(
s
.
getMaterialStatus
().
toUpperCase
()
.
equals
(
"SUCCESS"
)
){
resultMap
.
put
(
s
.
getSerialNum
(),
true
);
}
else
{
resultMap
.
put
(
s
.
getSerialNum
(),
false
);
if
(
result
.
isOk
()&&
result
.
statusIsSuccess
())
{
List
<
MaterialStatus
>
resultList
=
result
.
getResult
(
"materialStatusList"
);
for
(
MaterialStatus
s
:
resultList
)
{
if
(
s
.
getMaterialStatus
().
toUpperCase
().
equals
(
"SUCCESS"
)
)
{
resultMap
.
put
(
s
.
getSerialNum
(),
true
);
}
else
{
resultMap
.
put
(
s
.
getSerialNum
(),
false
);
}
}
}
else
{
log
.
info
(
"API002 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API002"
});
}
return
resultMap
;
}
...
...
@@ -276,62 +283,14 @@ public class MicronApi {
try
{
log
.
info
(
"调用MES接口 API004: url="
+
url
+
""
);
MicronResult
result
=
HttpHelper
.
getMicronJson
(
url
);
// dispatchMode: MCLPRETASK|PCBPRETASK|LINEPREP
// Http Status code:
// 200 - Success
// {
// "trasactionId": <TransactionId>,
// "tag":
// [
// <tagKey1> : <tagValue1>,
// <tagKey2> : <tagValue2>,
// ...
// ],
// "dispatchMode": "MCLPRETASK",
// "dispatchIds" :
// [
// {
// lineId: <LineId>,
// Ids:
// [
// {
// "Id": <MCLPRETASK>,
// "Attribute":
// [ <PPID>,<PPID2>,<PPID3>]
// },
// ...
// ]
// }
// ]
// }
//
// Http Status code:
// 200 - Success
// {
// "trasactionId": <TransactionId>,
// "tag":
// [
// <tagKey1> : <tagValue1>,
// <tagKey2> : <tagValue2>,
// ...
// ],
// "dispatchMode": "PCBPRETASK",
// "dispatchIds" :
// [
// {
// lineId: <LineId>,
// Ids:
// [
// {
// "Id": <PCBPRETASK>,
// "Attribute":[<PCB DID><PCB REV>]
// },
// ...
// ]
// }
// ]
// }
return
result
.
getResult
(
"dispatchIds"
);
if
(
result
.
isOk
()&&
result
.
statusIsSuccess
())
{
return
result
.
getResult
(
"dispatchIds"
);
}
else
{
log
.
info
(
"API004 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API004"
});
}
}
catch
(
Exception
e
)
{
log
.
error
(
url
+
"出错"
,
e
);
}
...
...
@@ -352,7 +311,13 @@ public class MicronApi {
try
{
log
.
info
(
"调用MES接口 API005: url="
+
url
+
""
);
MicronResult
result
=
HttpHelper
.
getMicronJson
(
url
);
materialList
=
result
.
getResult
(
"materials"
);
if
(
result
.
isOk
()&&
result
.
statusIsSuccess
())
{
materialList
=
result
.
getResult
(
"materials"
);
}
else
{
log
.
info
(
"API005 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API005"
});
}
}
catch
(
Exception
e
)
{
log
.
error
(
url
+
"出错"
,
e
);
return
null
;
...
...
@@ -388,11 +353,14 @@ public class MicronApi {
String
paramStr
=
JsonUtil
.
toJsonStr
(
paramMap
);
log
.
info
(
"调用MES接口 API006: url="
+
url
+
",body="
+
paramStr
+
""
);
MicronResult
micronResult
=
HttpHelper
.
postMicronJson
(
url
,
paramMap
);
String
responseData
=
micronResult
.
getResponseData
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
responseData
);
String
materials
=
jsonObject
.
getString
(
"materials"
);
materialList
=
JSONObject
.
parseArray
(
materials
,
Material
.
class
);
MicronResult
result
=
HttpHelper
.
postMicronJson
(
url
,
paramMap
);
if
(
result
.
isOk
()&&
result
.
statusIsSuccess
())
{
materialList
=
result
.
getResult
(
"materials"
);
}
else
{
log
.
info
(
"API006 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API006"
});
}
}
catch
(
Exception
e
)
{
log
.
error
(
url
+
"出错"
,
e
);
...
...
@@ -429,7 +397,13 @@ public class MicronApi {
String
paramStr
=
JsonUtil
.
toJsonStr
(
paramMap
);
log
.
info
(
"调用MES接口 API007: url="
+
url
+
",body="
+
paramStr
+
""
);
MicronResult
micronResult
=
HttpHelper
.
postMicronJson
(
url
,
paramMap
);
return
micronResult
.
statusIsSuccess
();
if
(
micronResult
.
isOk
()&&
micronResult
.
statusIsSuccess
())
{
return
true
;
}
else
{
log
.
info
(
"API007 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API007"
});
}
}
catch
(
ApiException
e
)
{
log
.
error
(
url
+
"出错"
,
e
);
}
...
...
@@ -461,9 +435,14 @@ public class MicronApi {
// ...
// ]
// }
String
trasactionId
=
micronResult
.
getResult
(
"trasactionId"
);
// String trasactionId=micronResult.getResult("trasactionId");
if
(
micronResult
.
isOk
()&&
micronResult
.
statusIsSuccess
())
{
return
true
;
}
else
{
return
true
;
log
.
info
(
"API008 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API008"
});
}
}
catch
(
ApiException
e
)
{
log
.
error
(
url
+
"出错"
,
e
);
return
false
;
...
...
@@ -491,7 +470,13 @@ public class MicronApi {
log
.
info
(
"调用MES接口 API009: url="
+
url
+
",body="
+
paramStr
+
""
);
MicronResult
micronResult
=
HttpHelper
.
postMicronJson
(
url
,
paramMap
);
return
true
;
if
(
micronResult
.
isOk
()&&
micronResult
.
statusIsSuccess
())
{
return
true
;
}
else
{
log
.
info
(
"API009 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API009"
});
}
}
catch
(
ApiException
e
)
{
log
.
error
(
url
+
"出错"
,
e
);
}
...
...
@@ -512,10 +497,15 @@ public class MicronApi {
log
.
info
(
"调用MES接口 API010: url="
+
url
+
",body="
+
paramStr
+
""
);
MicronResult
micronResult
=
HttpHelper
.
postMicronJson
(
url
,
paramMap
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
micronResult
.
getResponseData
());
String
trackStatus
=
jsonObject
.
getString
(
"trackStatus"
);
statusList
=
JSONObject
.
parseArray
(
trackStatus
,
TrackStatus
.
class
);
// JSONObject jsonObject = JSONObject.parseObject(micronResult.getResponseData());
// String trackStatus = jsonObject.getString("trackStatus");
if
(
micronResult
.
isOk
()&&
micronResult
.
statusIsSuccess
())
{
statusList
=
micronResult
.
getResult
(
"trackStatus"
);
}
else
{
log
.
info
(
"API010 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API010"
});
}
//statusList = micronResult.getResult("trackStatus");
}
catch
(
Exception
e
)
{
log
.
error
(
url
+
"出错"
,
e
);
...
...
@@ -539,9 +529,15 @@ public class MicronApi {
try
{
log
.
info
(
"调用MES接口 Api011: url="
+
url
+
" "
);
MicronResult
result
=
HttpHelper
.
getMicronJson
(
url
);
String
operationId
=
result
.
getResult
(
"operationId"
);
log
.
info
(
" Api011 ,mode="
+
mode
+
",userName="
+
userName
+
", 获取到 operationId="
+
operationId
);
return
operationId
;
if
(
result
.
isOk
()&&
result
.
statusIsSuccess
())
{
String
operationId
=
result
.
getResult
(
"operationId"
);
log
.
info
(
" Api011 ,mode="
+
mode
+
",userName="
+
userName
+
", 获取到 operationId="
+
operationId
);
return
operationId
;
}
else
{
log
.
info
(
"Api011 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"Api011"
});
}
}
catch
(
Exception
e
)
{
log
.
error
(
url
+
"出错"
,
e
);
}
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/bean/MicronResult.java
查看文件 @
401977b
...
...
@@ -54,7 +54,8 @@ public class MicronResult implements Serializable {
public
<
T
>
T
getResult
(
String
key
)
throws
ApiException
{
if
(
ObjectUtil
.
isEmpty
(
responseData
))
{
return
null
;
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API"
});
// return null;
}
if
(
resultMap
==
null
)
{
resultMap
=
JsonUtil
.
toMap
(
responseData
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论