Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 92dc9d31
由
LN
编写于
2023-08-30 11:35:00 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
api004问题修改
1 个父辈
61b1a9c1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
75 行增加
和
36 行删除
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/task/MicronPreTaskController.java
src/main/java/com/neotel/smfcore/custom/micron1053/task/bean/dto/TaskDto.java
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronApi.java
查看文件 @
92dc9d3
...
...
@@ -82,7 +82,7 @@ public class MicronApi {
}
public
static
boolean
Debug
=
tru
e
;
public
static
boolean
Debug
=
fals
e
;
public
static
Barcode
API001
(
String
operationId
,
String
rfid
,
Barcode
barcode
)
throws
ApiException
{
...
...
@@ -321,8 +321,13 @@ public class MicronApi {
try
{
log
.
info
(
"调用MES接口 API004: url="
+
url
+
""
);
MicronResult
result
=
HttpHelper
.
getMicronJson
(
url
);
if
(
result
.
isOk
()&&
result
.
statusIsSuccess
())
{
return
result
.
getResult
(
"dispatchIds"
);
if
(
result
.
isOk
()
)
{
List
<
DispatchId
>
resultDis
=
result
.
getResult
(
"dispatchIds"
,
false
);
if
(
resultDis
==
null
||
resultDis
.
size
()<=
0
){
log
.
info
(
"API004 ,接口通信失败"
);
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API004"
});
}
return
resultDis
;
}
else
{
log
.
info
(
"API004 ,接口通信失败"
);
...
...
@@ -581,6 +586,9 @@ public class MicronApi {
public
static
String
Api011
(
String
mode
,
String
userName
,
String
source
)
{
if
(
Debug
){
return
mode
+
"_test_operationId"
;
}
// Mode = "MBR|REQ|MCL|GR|MATRET|RET|NPI|RACK|PCBPRETASK|MCLPRETASK|LINEPREP|CTRLDISPATCH"
// Source = toolId, Facility+area for UI
String
url
=
config
.
getUrl
(
config
.
api_name_011
);
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/bean/MicronResult.java
查看文件 @
92dc9d3
...
...
@@ -51,7 +51,12 @@ public class MicronResult implements Serializable {
private
Map
<
String
,
Object
>
resultMap
=
null
;
public
<
T
>
T
getResult
(
String
key
)
throws
ApiException
{
public
<
T
>
T
getResult
(
String
key
)
throws
ApiException
{
return
getResult
(
key
,
true
);
}
public
<
T
>
T
getResult
(
String
key
,
boolean
needCheck
)
throws
ApiException
{
if
(
ObjectUtil
.
isEmpty
(
responseData
))
{
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API"
});
...
...
@@ -60,19 +65,21 @@ public class MicronResult implements Serializable {
if
(
resultMap
==
null
)
{
resultMap
=
JsonUtil
.
toMap
(
responseData
);
}
if
(
needCheck
)
{
Object
resultStatus
=
resultMap
.
get
(
"status"
);
if
(
resultStatus
==
null
||
(!
resultStatus
.
toString
().
equalsIgnoreCase
(
"SUCCESS"
)))
{
//失败
String
message
=
resultMap
.
get
(
"message"
).
toString
();
message
=
(
message
==
null
?
""
:
message
);
Object
error
=
resultMap
.
get
(
"error"
);
error
=
(
error
==
null
)
?
""
:
error
;
String
detail
=
resultMap
.
get
(
"detail"
).
toString
();
detail
=
(
detail
==
null
?
""
:
detail
);
log
.
error
(
" smfcore.api.error : error="
+
error
+
""
+
",message="
+
message
+
",detial="
+
detail
);
throw
new
ApiException
(
"smfcore.api.error"
,
"api.error: error={0},message={1},detial={2}"
,
new
String
[]{
error
.
toString
(),
message
,
detail
});
Object
resultStatus
=
resultMap
.
get
(
"status"
);
if
(
resultStatus
==
null
||
(!
resultStatus
.
toString
().
equalsIgnoreCase
(
"SUCCESS"
)))
{
//失败
String
message
=
resultMap
.
get
(
"message"
).
toString
();
message
=
(
message
==
null
?
""
:
message
);
Object
error
=
resultMap
.
get
(
"error"
);
error
=
(
error
==
null
)
?
""
:
error
;
String
detail
=
resultMap
.
get
(
"detail"
).
toString
();
detail
=
(
detail
==
null
?
""
:
detail
);
log
.
error
(
" smfcore.api.error : error="
+
error
+
""
+
",message="
+
message
+
",detial="
+
detail
);
throw
new
ApiException
(
"smfcore.api.error"
,
"api.error: error={0},message={1},detial={2}"
,
new
String
[]{
error
.
toString
(),
message
,
detail
});
}
}
if
(
key
!=
null
&&
!
key
.
isEmpty
())
{
...
...
@@ -92,6 +99,18 @@ public class MicronResult implements Serializable {
}
catch
(
Exception
ex
)
{
}
try
{
for
(
String
mKey
:
resultMap
.
keySet
()){
Object
mvalue
=
resultMap
.
get
(
mKey
);
if
(
key
.
equalsIgnoreCase
(
mKey
)){
return
(
T
)
mvalue
;
}
}
}
catch
(
Exception
ex
)
{
}
}
}
return
null
;
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/loading/LoadingController.java
查看文件 @
92dc9d3
...
...
@@ -109,7 +109,7 @@ public class LoadingController {
@ApiOperation
(
"lOADING页面获取列表详情数据"
)
@GetMapping
(
"/detial"
)
@AnonymousAccess
public
ResultBean
detial
(
@Request
Body
Map
<
String
,
Object
>
params
)
{
public
ResultBean
detial
(
@Request
Param
Map
<
String
,
Object
>
params
)
{
//参数:mType 物料类型:pcb/shoebox/pizzaBox/reel/tray
//参数:state 状态: success/xray/failure
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/task/MicronPreTaskController.java
查看文件 @
92dc9d3
package
com
.
neotel
.
smfcore
.
custom
.
micron1053
.
task
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ApiException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
...
...
@@ -25,6 +26,7 @@ import com.neotel.smfcore.custom.micron1053.api.MicronConfig;
import
com.neotel.smfcore.custom.micron1053.api.bean.DispatchId
;
import
com.neotel.smfcore.custom.micron1053.api.bean.Material
;
import
com.neotel.smfcore.custom.micron1053.api.bean.TrackStatus
;
import
com.neotel.smfcore.custom.micron1053.bean.MicronResult
;
import
com.neotel.smfcore.custom.micron1053.task.bean.PreTask
;
import
com.neotel.smfcore.custom.micron1053.task.bean.dto.MaterialDispatchStatus
;
import
com.neotel.smfcore.custom.micron1053.task.bean.dto.TaskDto
;
...
...
@@ -87,7 +89,8 @@ public class MicronPreTaskController {
@ApiOperation
(
"出库页面展示"
)
@AnonymousAccess
@GetMapping
(
"/getTaskId"
)
public
ResultBean
task
(
String
mode
)
{
public
ResultBean
task
(
String
mode
)
throws
ApiException
{
//判断是否验证
if
(!
MicronApi
.
isEnable
())
{
return
ResultBean
.
newErrorResult
(
9
,
"smfcore.micron.apiClose"
,
" Not yet open"
);
...
...
@@ -102,31 +105,37 @@ public class MicronPreTaskController {
dto
.
setItemList
(
itemList
);
List
<
MaterialDispatchStatus
>
statusList
=
getStatusList
(
itemList
);
dto
.
setStatusList
(
statusList
);
}
else
if
(
dto
!=
null
)
{
}
else
if
(
dto
!=
null
&&
dto
.
getType
()==
1
)
{
return
ResultBean
.
newOkResult
(
dto
);
}
else
{
dto
=
new
TaskDto
()
;
//获取operatorationId
// String source = micronConfig.api_011_Source;
String
operationId
=
MicronApi
.
Api011
(
mode
,
SecurityUtils
.
getLoginUsername
(),
""
);
if
(
StringUtils
.
isNotBlank
(
operationId
))
{
//获取Pre Task ID
List
<
DispatchId
>
dispatchIdList
=
MicronApi
.
Api004
(
operationId
);
if
(
dispatchIdList
!=
null
&&
!
dispatchIdList
.
isEmpty
())
{
dto
.
setMode
(
mode
);
String
operationId
=
""
;
if
(
dto
==
null
)
{
//==null需要获取operationId
dto
=
new
TaskDto
(
);
dto
.
setType
(
0
);
dto
.
setMode
(
mode
);
operationId
=
MicronApi
.
Api011
(
mode
,
SecurityUtils
.
getLoginUsername
(),
""
);
if
(
StringUtils
.
isNotBlank
(
operationId
))
{
dto
.
setOperationId
(
operationId
);
dto
.
setType
(
1
);
dto
.
setDispatchIdList
(
dispatchIdList
);
dataCache
.
updateCache
(
key
,
dto
);
log
.
info
(
"mode="
+
mode
+
",获取到数据:operationId="
+
operationId
+
",保存数据到cache "
+
key
);
}
else
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API004
"
});
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.api.fail"
,
"Api011 获取数据失败"
,
new
String
[]{
"API011
"
});
}
}
else
{
operationId
=
dto
.
getOperationId
();
}
// throw new ValidateException("smfcore.api011.fail", "Api011 获取数据失败");
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.api.fail"
,
"Api011 获取数据失败"
,
new
String
[]{
"API011"
});
//获取Pre Task ID
List
<
DispatchId
>
dispatchIdList
=
MicronApi
.
Api004
(
operationId
);
if
(
dispatchIdList
!=
null
&&
!
dispatchIdList
.
isEmpty
())
{
dto
.
setType
(
1
);
dto
.
setDispatchIdList
(
dispatchIdList
);
dataCache
.
updateCache
(
key
,
dto
);
log
.
info
(
"mode="
+
mode
+
",获取到数据:operationId="
+
operationId
+
",保存数据到cache "
+
key
);
}
else
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"API004"
});
}
}
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/task/bean/dto/TaskDto.java
查看文件 @
92dc9d3
...
...
@@ -8,7 +8,10 @@ import java.util.List;
@Data
public
class
TaskDto
{
private
int
type
=
1
;
//1=勾选页面勾选数据,2=已开始出库
/**
*0=勾选数据还未获取,1=勾选页面勾选数据,2=已开始出库
*/
private
int
type
=
1
;
//
private
String
mode
;
private
String
operationId
;
private
List
<
LiteOrderItem
>
itemList
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论