Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 14a0f64e
由
LN
编写于
2023-06-28 15:03:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
入库验证测试修改
1 个父辈
1aa037e4
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
50 行增加
和
28 行删除
src/main/java/com/neotel/smfcore/common/exception/ApiException.java
src/main/java/com/neotel/smfcore/custom/micron20031/Micron20031Api.java
src/main/java/com/neotel/smfcore/custom/micron20031/MicronSpApiListener.java
src/main/resources/config/application-prod.yml
src/main/resources/config/application.yml
src/main/java/com/neotel/smfcore/common/exception/ApiException.java
查看文件 @
14a0f64
...
...
@@ -12,9 +12,9 @@ public class ApiException extends Exception {
super
(
message
);
}
p
rivate
String
msgKey
=
""
;
p
rivate
String
[]
msgParam
;
p
rivate
String
defaultMsg
=
""
;
p
ublic
String
msgKey
=
""
;
p
ublic
String
[]
msgParam
;
p
ublic
String
defaultMsg
=
""
;
public
ApiException
(
String
msgKey
,
String
defMsg
){
super
(
defMsg
);
...
...
src/main/java/com/neotel/smfcore/custom/micron20031/Micron20031Api.java
查看文件 @
14a0f64
...
...
@@ -343,6 +343,8 @@ public class Micron20031Api {
log
.
info
(
"调用MES接口 triggerMatReqOrder,参数:"
+
JsonUtil
.
toJsonStr
(
dataMap
));
String
resultStr
=
HttpHelper
.
postJsonWithAuth
(
checkStockAvailableUrl
,
dataMap
,
auth
);
log
.
info
(
"调用MES接口 triggerMatReqOrder 返回:"
+
resultStr
);
Object
object
=
getResult
(
resultStr
,
"MicronPN"
);
MatOrderBean
resultOrderBean
=
JsonUtil
.
toObj
(
resultStr
,
MatOrderBean
.
class
);
return
resultOrderBean
;
...
...
@@ -419,17 +421,20 @@ public class Micron20031Api {
String
resultStr
=
HttpHelper
.
postJsonWithAuth
(
depositCreateMAUrl
,
dataMap
,
auth
);
log
.
info
(
"调用MES接口 depositCreateMA 返回:"
+
resultStr
);
Map
<
String
,
Object
>
resultMap
=
JsonUtil
.
toMap
(
resultStr
);
Object
resultStatus
=
resultMap
.
get
(
"Status"
);
Object
resultStatus
=
resultMap
.
get
(
"status"
);
if
(
ObjectUtil
.
isEmpty
(
resultStr
)
||
ObjectUtil
.
isEmpty
(
resultStatus
))
{
throw
new
ApiException
(
"smfcore.api.returnNoData"
,
"depositCreateMA Failed to get data"
,
new
String
[]{
"depositCreateMA"
});
}
if
(
resultStatus
!=
null
&&
!
resultStatus
.
toString
().
equalsIgnoreCase
(
"PASS"
)){
String
msg
=
resultMap
.
get
(
"
M
essage"
).
toString
();
String
msg
=
resultMap
.
get
(
"
m
essage"
).
toString
();
throw
new
ApiException
(
msg
);
}
Object
stabilizationEndDateObj
=
resultMap
.
get
(
"S
tabilizationEndDate"
);
Object
stabilizationEndDateObj
=
resultMap
.
get
(
"s
tabilizationEndDate"
);
Date
stabilizationEndDate
=
DateUtil
.
toDate
(
stabilizationEndDateObj
.
toString
(),
"MM-dd-yyyy"
);
barcode
.
updateAppendData
(
"stabilizationEndDate"
,
stabilizationEndDate
);
barcode
.
updateAppendData
(
"opUsername"
,
username
);
barcode
.
updateAppendData
(
"maTrackOut"
,
false
);
Object
exposureStartDateObj
=
resultMap
.
get
(
"
E
xposureStartDate"
);
Object
exposureStartDateObj
=
resultMap
.
get
(
"
e
xposureStartDate"
);
Date
exposureStartDate
=
DateUtil
.
toDate
(
exposureStartDateObj
.
toString
(),
"MM-dd-yyyy"
);
barcode
.
setOpenTime
(
exposureStartDate
);
return
barcode
;
...
...
@@ -657,9 +662,9 @@ public class Micron20031Api {
return
null
;
}
Map
<
String
,
Object
>
resultMap
=
JsonUtil
.
toMap
(
resultJson
);
Object
resultStatus
=
resultMap
.
get
(
"
S
tatus"
);
Object
resultStatus
=
resultMap
.
get
(
"
s
tatus"
);
if
(
resultStatus
!=
null
&&
!
resultStatus
.
toString
().
equalsIgnoreCase
(
"PASS"
))
{
String
msg
=
resultMap
.
get
(
"
M
essage"
).
toString
();
String
msg
=
resultMap
.
get
(
"
m
essage"
).
toString
();
throw
new
ApiException
(
"smfcore.api.error"
,
msg
);
}
if
(
key
!=
null
&&
!
key
.
isEmpty
())
{
...
...
@@ -722,9 +727,9 @@ public class Micron20031Api {
log
.
info
(
"调用MES接口 ReturnMaterial,参数:"
+
JsonUtil
.
toJsonStr
(
dataMap
));
String
resultStr
=
HttpHelper
.
postJsonWithAuth
(
checkStockAvailableUrl
,
dataMap
,
auth
);
log
.
info
(
"调用MES接口 ReturnMaterial 返回:"
+
resultStr
);
if
(
ObjectUtil
.
isEmpty
(
resultStr
)){
log
.
info
(
"调用MES接口 ReturnMaterial 返回:"
+
resultStr
+
" ,返回数据为空,return null "
);
return
null
;
if
(
ObjectUtil
.
isEmpty
(
resultStr
))
{
log
.
info
(
"调用MES接口 ReturnMaterial 返回:"
+
resultStr
+
" ,返回数据为空,return null "
);
throw
new
ApiException
(
"smfcore.api.returnNoData"
,
"ReturnMaterial Failed to get data"
,
new
String
[]{
"ReturnMaterial"
})
;
}
log
.
info
(
"调用MES接口 ReturnMaterial 返回:"
+
resultStr
);
...
...
src/main/java/com/neotel/smfcore/custom/micron20031/MicronSpApiListener.java
查看文件 @
14a0f64
...
...
@@ -14,6 +14,8 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
@Slf4j
public
class
MicronSpApiListener
extends
BaseSmfApiListener
{
...
...
@@ -30,36 +32,49 @@ public class MicronSpApiListener extends BaseSmfApiListener {
}
@Override
public
Barcode
canPutInAfterResolve
(
String
inCheckUrl
,
CodeValidateParam
params
,
Barcode
barcode
)
throws
ValidateException
{
List
<
Storage
>
ids
=
params
.
getStorageList
();
if
(
ids
==
null
||
ids
.
size
()<=
0
){
if
(
ObjectUtil
.
isNotEmpty
(
params
.
getStorageId
())){
Storage
storage
=
dataCache
.
getStorageById
(
params
.
getStorageId
());
if
(
storage
!=
null
)
{
ids
.
add
(
storage
);
}
}
}
//判断是否是入库单入库
for
(
Storage
storage
:
params
.
getStorageList
()
)
{
ids
)
{
if
(
ObjectUtil
.
isNotEmpty
(
storage
.
getInListName
()))
{
//如果入库单还在执行中,验证是否可以入库
InList
inList
=
inListCache
.
getInList
(
storage
.
getInListName
());
if
(
inList
.
getStatus
()
<
INLIST_STATUS
.
WAIT
)
{
if
(
inList
.
getStatus
()
<=
INLIST_STATUS
.
WAIT
)
{
log
.
info
(
"canPutInAfterResolve 料仓【"
+
storage
.
getName
()+
"】入库单【"
+
inList
.
getName
()+
"】入库, 调用 depositCreateMA"
);
try
{
Barcode
resultBarcode
=
Micron20031Api
.
depositCreateMA
(
barcode
,
params
.
getLoginUser
());
if
(
resultBarcode
!=
null
)
{
if
(
resultBarcode
!=
null
)
{
return
resultBarcode
;
}
}
catch
(
ApiException
apiException
)
{
log
.
error
(
"MicronSpApiListener canPutInAfterResolve depositCreateMA error: "
+
apiException
.
getMessage
());
return
null
;
throw
new
ValidateException
(
apiException
.
msgKey
,
apiException
.
defaultMsg
,
apiException
.
msgParam
)
;
}
}
}
//普通入库验证 调用return
try
{
Barcode
resultBarcode
=
Micron20031Api
.
returnMaterial
(
barcode
,
Micron20031Api
.
MODE_ENABLE_MAM_SAP
,
params
.
getLoginUser
());
if
(
resultBarcode
!=
null
){
return
resultBarcode
;
}
}
catch
(
ApiException
apiException
)
{
log
.
error
(
"MicronSpApiListener canPutInAfterResolve returnMaterial error: "
+
apiException
.
getMessage
());
return
null
;
//普通入库验证 调用return
try
{
log
.
info
(
"canPutInAfterResolve 普通入库验证 调用return"
);
Barcode
resultBarcode
=
Micron20031Api
.
returnMaterial
(
barcode
,
Micron20031Api
.
MODE_ENABLE_MAM_SAP
,
params
.
getLoginUser
());
if
(
resultBarcode
!=
null
)
{
return
resultBarcode
;
}
}
catch
(
ApiException
apiException
)
{
log
.
error
(
"MicronSpApiListener canPutInAfterResolve returnMaterial error: "
+
apiException
.
getMessage
());
throw
new
ValidateException
(
apiException
.
msgKey
,
apiException
.
defaultMsg
,
apiException
.
msgParam
);
}
}
return
null
;
}
...
...
src/main/resources/config/application-prod.yml
查看文件 @
14a0f64
...
...
@@ -17,7 +17,8 @@ micron:
to
:
cc
:
api
:
# name: 20031
name
:
20031
inCheckUrl
:
https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/ReturnMaterial
# loginCheckUrl: https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/CheckUserRights
# 登录相关配置
...
...
src/main/resources/config/application.yml
查看文件 @
14a0f64
...
...
@@ -20,7 +20,8 @@ micron:
to
:
cc
:
api
:
# name: 20031
name
:
20031
inCheckUrl
:
https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/ReturnMaterial
# loginCheckUrl: https://testapigtwy.micron.com/t/app.mfg/mmsil/v1/DEVL/SINGAPORE/CheckUserRights
# 文件存储路径
file
:
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论