Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit ec84a969
由
LN
编写于
2024-08-01 09:02:39 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
按钮点击后触发API011
1 个父辈
b0783a6e
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
152 行增加
和
15 行删除
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronApi.java
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronConfig.java
src/main/java/com/neotel/smfcore/custom/micron1053/task/MicronDispatchController.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
查看文件 @
ec84a96
...
...
@@ -881,19 +881,51 @@ public class MicronApi {
return
false
;
}
public
static
boolean
Api201
(
String
linePrepOrderId
,
String
operationId
)
{
public
static
String
Api201
(
String
linePrepOrderId
,
String
operationId
)
{
// Http Status code:
// 200 - Success
// {
// "trasactionId": <TransactionId>,
// "tag":
// [
// <tagKey1> : <tagValue1>,
// <tagKey2> : <tagValue2>,
// ...
// ],
// "linePrepOrderStatus": <linePrepOrderStatus>
// }
//
// Error Status code:
// {
// "transactionId": <TransactionId>,
// "tag":
// [
// <tagKey1> : <tagValue1>,
// <tagKey2> : <tagValue2>,
// ...
// ],
// "error": <ErrCode>,
// "message": <ErrMessage>,
// "detail": <ErrDetail>
// }
String
url
=
config
.
getUrl
(
config
.
api_name_201
);
url
=
MessageFormat
.
format
(
url
,
linePrepOrderId
,
operationId
);
try
{
log
.
info
(
"调用MES接口 API201: url="
+
url
+
" "
);
MicronResult
result
=
HttpHelper
.
postMicronJson
(
url
,
null
);
return
true
;
if
(
result
.
isOk
())
{
return
""
;
}
String
msg
=
getDErrorMsg
(
result
);
if
(
ObjectUtil
.
isNotEmpty
(
msg
))
{
return
msg
;
}
throw
new
ApiException
(
"smfcore.api.fail"
,
"{0} Failed to get data"
,
new
String
[]{
"Api201"
});
}
catch
(
ApiException
e
)
{
log
.
error
(
url
+
"出错"
,
e
);
return
e
.
getMessage
();
}
return
false
;
}
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/api/MicronConfig.java
查看文件 @
ec84a96
...
...
@@ -83,6 +83,7 @@ public class MicronConfig {
/**
* Add material(s) to reservation for the LinePrep specified, so that it can charged the material to the correct PO upon transferOut event
* operation/validate/ctrldispatch?linePrepOrderId={linePrepOrderId}&operationId={operationId}
*/
public
String
api_name_201
=
"operation/validate/ctrldispatch?linePrepOrderId={linePrepOrderId}&operationId={operationId}"
;
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/task/MicronDispatchController.java
查看文件 @
ec84a96
...
...
@@ -3,7 +3,10 @@ package com.neotel.smfcore.custom.micron1053.task;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.inList.service.po.InListItem
;
...
...
@@ -26,6 +29,7 @@ import com.neotel.smfcore.custom.micron1053.api.bean.MaterialStatus;
import
com.neotel.smfcore.custom.micron1053.task.bean.DispatchItemMapper
;
import
com.neotel.smfcore.custom.micron1053.task.bean.dto.DispatchItemDto
;
import
com.neotel.smfcore.custom.micron1053.task.bean.dto.ItemDetialDto
;
import
com.neotel.smfcore.custom.micron1053.task.bean.dto.TaskDto
;
import
com.neotel.smfcore.custom.micron1053.task.enums.OrderItemStatus
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.bean.FileProperties
;
...
...
@@ -96,6 +100,21 @@ private DataCache dataCache;
@Autowired
private
IStoragePosManager
storagePosManager
;
private
TaskDto
getTaskDtoByMode
(
String
mode
){
TaskDto
dto
=
new
TaskDto
();
//记录
String
key
=
Constants
.
CACHE_DISPATCH
+
mode
;
//先从缓存中获取数据
try
{
dto
=
dataCache
.
getCache
(
key
);
}
catch
(
Exception
ex
){
return
null
;
}
return
dto
;
}
@ApiOperation
(
"获取出库页详情"
)
@AnonymousAccess
@GetMapping
(
"/getList"
)
...
...
@@ -109,7 +128,8 @@ private IStoragePosManager storagePosManager;
}
//获取是否有此类型的工单信息
//code=0,,如果已经存在,直接返回列表页面
//code=1,没有数据,进入上传工单页面
//code=1,没有数据,OutSide按钮进入上传工单页面 ,ControlledDispatch 按钮进入选择Pn或上传工单页面
//code=2,ControlledDispatch 进入输入lineID页面
List
<
LiteOrderItem
>
itemList
=
getLiteOrderItemList
(
mode
);
if
(
itemList
!=
null
&&
!
itemList
.
isEmpty
())
{
//已存在,直接返回列表页面
...
...
@@ -118,9 +138,39 @@ private IStoragePosManager storagePosManager;
}
else
{
//需要进入上传工单页面
return
ResultBean
.
newErrorResult
(
1
,
""
,
""
);
//判断是否生成,未关闭的工单
TaskDto
dto
=
getTaskDtoByMode
(
mode
);
if
(
dto
!=
null
&&
ObjectUtil
.
isNotEmpty
(
dto
.
getOperationId
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
dto
.
getLineId
())||
mode
==
"RACK"
){
//已有 operationId ,需要进入上传工单页面
return
ResultBean
.
newErrorResult
(
1
,
""
,
""
);
}
else
{
//已有 operationId ,没有lineID,需要输入lineID
return
ResultBean
.
newErrorResult
(
2
,
""
,
""
);
}
}
else
{
String
operationId
=
""
;
//==null需要获取operationId
dto
=
new
TaskDto
();
dto
.
setType
(
0
);
dto
.
setMode
(
mode
);
operationId
=
MicronApi
.
Api011
(
mode
,
SecurityUtils
.
getLoginUsername
(),
""
);
if
(
StringUtils
.
isNotBlank
(
operationId
))
{
dto
.
setOperationId
(
operationId
);
dataCache
.
updateCache
(
Constants
.
CACHE_DISPATCH
+
mode
,
dto
);
}
else
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.api.fail"
,
"Api011 获取数据失败"
,
new
String
[]{
"API011"
});
}
}
}
return
ResultBean
.
newErrorResult
(
1
,
""
,
""
);
}
...
...
@@ -166,6 +216,66 @@ private IStoragePosManager storagePosManager;
}
@ApiOperation
(
"controlledDisSure 输入lineID后确认调用此方法"
)
@AnonymousAccess
@PostMapping
(
"/controlledDisSure"
)
public
ResultBean
controlledDisSure
(
@RequestParam
String
mode
,
@RequestParam
String
reason
)
{
//判断是否验证
if
(!
MicronApi
.
isEnable
())
{
return
ResultBean
.
newErrorResult
(
9
,
"smfcore.micron.apiClose"
,
" Not yet open"
);
}
if
(
ObjectUtil
.
isEmpty
(
mode
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.micron.operationFailure"
,
"操作失败"
);
}
//获取是否有此类型的工单信息
//code=0,,如果已经存在,直接返回列表页面
//code=1,没有数据,OutSide按钮进入上传工单页面 ,ControlledDispatch 按钮进入选择Pn或上传工单页面
//code=2,ControlledDispatch 进入输入lineID页面
//code=-1:出错提示信息
List
<
LiteOrderItem
>
itemList
=
getLiteOrderItemList
(
mode
);
if
(
itemList
!=
null
&&
!
itemList
.
isEmpty
())
{
//已存在,直接返回列表页面
List
<
DispatchItemDto
>
list
=
dispatchItemMapper
.
toDto
(
itemList
);
return
ResultBean
.
newOkResult
(
list
);
}
else
{
//判断是否生成,未关闭的工单
TaskDto
dto
=
getTaskDtoByMode
(
mode
);
if
(
dto
!=
null
&&
ObjectUtil
.
isNotEmpty
(
dto
.
getOperationId
()))
{
dto
.
setLineId
(
reason
);
//调用API201
String
result
=
MicronApi
.
Api201
(
reason
,
dto
.
getOperationId
());
if
(
ObjectUtil
.
isNotEmpty
(
result
))
{
//成功
dto
.
setLineId
(
reason
);
dataCache
.
updateCache
(
Constants
.
CACHE_DISPATCH
+
mode
,
dto
);
return
ResultBean
.
newErrorResult
(
1
,
""
,
""
);
}
else
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
result
);
}
}
else
{
String
operationId
=
""
;
//==null需要获取operationId
dto
=
new
TaskDto
();
dto
.
setType
(
0
);
dto
.
setMode
(
mode
);
operationId
=
MicronApi
.
Api011
(
mode
,
SecurityUtils
.
getLoginUsername
(),
""
);
if
(
StringUtils
.
isNotBlank
(
operationId
))
{
dto
.
setOperationId
(
operationId
);
dataCache
.
updateCache
(
Constants
.
CACHE_DISPATCH
+
mode
,
dto
);
}
else
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.api.fail"
,
"Api011 获取数据失败"
,
new
String
[]{
"API011"
});
}
}
}
return
ResultBean
.
newErrorResult
(
1
,
""
,
""
);
}
@ApiOperation
(
"Pn出库提交"
)
@AnonymousAccess
...
...
@@ -403,13 +513,6 @@ private IStoragePosManager storagePosManager;
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"重试"
)
@PostMapping
(
"/retry"
)
@AnonymousAccess
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/task/MicronPreTaskController.java
查看文件 @
ec84a96
...
...
@@ -257,11 +257,11 @@ public class MicronPreTaskController {
@PostMapping
(
"/retry"
)
@AnonymousAccess
public
ResultBean
retry
(
@RequestBody
String
mode
)
{
log
.
info
(
" retry :mode="
+
mode
+
",入库完成发送失败的,重新发送,其他状态暂不处理"
);
TaskDto
dto
=
getTaskDtoByMode
(
mode
);
if
(
dto
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.micron.operationFailure"
,
"操作失败"
);
}
log
.
info
(
" retry :mode="
+
mode
+
",入库完成发送失败的,重新发送,其他状态暂不处理"
);
//判断有没有生成任务
LiteOrder
order
=
getOrderByMode
(
mode
);
if
(
order
==
null
)
{
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/task/bean/dto/TaskDto.java
查看文件 @
ec84a96
...
...
@@ -14,6 +14,7 @@ public class TaskDto {
private
int
type
=
1
;
//
private
String
mode
;
private
String
operationId
;
private
String
lineId
;
//Controlled Dispatch 按钮中输入的lineID
private
List
<
LiteOrderItem
>
itemList
;
private
List
<
DispatchId
>
dispatchIdList
;
private
List
<
MaterialDispatchStatus
>
statusList
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论