Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 727a88d6
由
sunke
编写于
2023-01-17 10:10:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
兼容SMD box 接口
1 个父辈
4af5f741
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
111 行增加
和
1 行删除
src/main/java/com/neotel/smfcore/core/storage/rest/MesApiController.java → src/main/java/com/neotel/smfcore/custom/smdbox/MesApiController.java
src/main/java/com/neotel/smfcore/custom/smdbox/SmdboxApi.java
src/main/java/com/neotel/smfcore/c
ore/storage/rest
/MesApiController.java
→
src/main/java/com/neotel/smfcore/c
ustom/smdbox
/MesApiController.java
查看文件 @
727a88d
package
com
.
neotel
.
smfcore
.
c
ore
.
storage
.
rest
;
package
com
.
neotel
.
smfcore
.
c
ustom
.
smdbox
;
import
com.google.common.base.Strings
;
import
com.google.common.base.Strings
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
...
...
src/main/java/com/neotel/smfcore/custom/smdbox/SmdboxApi.java
0 → 100644
查看文件 @
727a88d
package
com
.
neotel
.
smfcore
.
custom
.
smdbox
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.DateUtil
;
import
com.neotel.smfcore.common.utils.HttpHelper
;
import
com.neotel.smfcore.common.utils.JsonUtil
;
import
com.neotel.smfcore.core.api.bean.ApiResult
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
import
com.neotel.smfcore.core.barcode.bean.BarcodeRule
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE
;
import
com.neotel.smfcore.core.barcode.service.manager.IComponentManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Component
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrderItem
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.logging.log4j.util.Strings
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
@Service
@Slf4j
public
class
SmdboxApi
extends
BaseSmfApiListener
{
@Autowired
private
ILiteOrderItemManager
liteOrderItemManager
;
@Autowired
private
CodeResolve
codeResolve
;
@Autowired
private
IComponentManager
componentManager
;
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"smdbox"
);
}
@Override
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
())
{
postInNotification
(
inNotifyUrl
,
task
.
getBarcode
(),
task
.
getStorageId
());
}
}
private
boolean
postInNotification
(
String
url
,
String
reelBarcode
,
String
storageId
)
{
try
{
if
(
com
.
google
.
common
.
base
.
Strings
.
isNullOrEmpty
(
url
))
{
return
false
;
}
log
.
info
(
"向 MES("
+
url
+
") 通知【"
+
reelBarcode
+
"】的入库信息"
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
reelBarcode
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"RI"
,
reelBarcode
);
params
.
put
(
"LOC"
,
storageId
);
if
(
barcode
!=
null
)
{
params
.
put
(
"PN"
,
barcode
.
getPartNumber
());
params
.
put
(
"QTY"
,
barcode
.
getAmount
());
params
.
put
(
"PRODATE"
,
barcode
.
getProduceDate
());
params
.
put
(
"EXPDATE"
,
barcode
.
getExpireDate
());
params
.
put
(
"SP"
,
barcode
.
getProvider
());
params
.
put
(
"BATCH"
,
barcode
.
getAmount
());
}
String
result
=
HttpHelper
.
postParam
(
url
,
params
);
log
.
info
(
"收到MES ["
+
url
+
"]的关于["
+
reelBarcode
+
"]入库通知的反馈信息:"
+
result
);
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"向 MES ["
+
url
+
"]入库通知【"
+
reelBarcode
+
"】的信息出错"
,
e
);
}
return
false
;
}
private
boolean
postOutNotification
(
String
url
,
String
reelBarcode
,
String
cid
)
{
try
{
//log.info("出库完成,通知 Agv 小车开始取料");
// AgvUtil.ArmGet();
if
(
com
.
google
.
common
.
base
.
Strings
.
isNullOrEmpty
(
url
))
{
return
false
;
}
log
.
info
(
"向 MES 通知【"
+
reelBarcode
+
"】的出库信息"
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"ReelID"
,
reelBarcode
);
String
result
=
HttpHelper
.
postParam
(
url
,
params
);
log
.
info
(
"收到MES ["
+
url
+
"]的关于["
+
reelBarcode
+
"]出库通知的反馈信息:"
+
result
);
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"向 MES ["
+
url
+
"]出库通知【"
+
reelBarcode
+
"】的信息出错"
,
e
);
}
return
false
;
}
@Override
public
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
())
{
postOutNotification
(
outNotifyUrl
,
task
.
getBarcode
(),
task
.
getCid
());
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论