Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 6dcf1f0c
由
sunke
编写于
2022-08-11 13:24:45 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
接口重构
1 个父辈
3a32a47e
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
39 行增加
和
56 行删除
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
src/main/java/com/neotel/smfcore/core/api/SmfApi.java
src/main/java/com/neotel/smfcore/core/api/listener/BaseSmfApiListener.java
src/main/java/com/neotel/smfcore/core/api/listener/DefaultSmfApiListener.java
src/main/java/com/neotel/smfcore/core/api/listener/ISmfApiListener.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLPShelfHandler.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLShelfHandler.java
src/main/java/com/neotel/smfcore/custom/hella/handler/HellaApiHandler.java
src/main/java/com/neotel/smfcore/custom/siemens/SiemensApi.java
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
查看文件 @
6dcf1f0
...
...
@@ -248,6 +248,7 @@ public class DataInitManager {
"barcode"
,
"barcodeSetting"
,
"taskLog"
,
"msdSetting"
,
//"orderSetting",//工单设置
"inOutData"
,
//报表->出入库
"inventory"
,
//报表->库存
...
...
src/main/java/com/neotel/smfcore/core/api/SmfApi.java
查看文件 @
6dcf1f0
...
...
@@ -104,27 +104,16 @@ public class SmfApi {
}
}
public
Barcode
resolveBarcode
(
CodeValidateParam
param
)
throws
ValidateException
{
for
(
ISmfApiListener
apiListener
:
apiListenerList
)
{
Barcode
responseBarcode
=
apiListener
.
resolveBarcode
(
inCheckUrl
,
param
);
if
(
responseBarcode
!=
null
){
return
responseBarcode
;
}
}
return
null
;
}
/**
* 条码解析之前到API验证是否可以入库
* @param codeStr
* @return
* @throws ValidateException
*/
public
Barcode
canPutInBeforeResolve
(
String
codeStr
)
throws
ValidateException
{
public
Barcode
canPutInBeforeResolve
(
CodeValidateParam
params
)
throws
ValidateException
{
if
(
isUrlExist
(
inCheckUrl
)){
for
(
ISmfApiListener
apiListener
:
apiListenerList
)
{
if
(
apiListener
.
isForThisApi
(
apiName
)){
Barcode
responseBarcode
=
apiListener
.
canPutInBeforeResolve
(
inCheckUrl
,
codeStr
);
Barcode
responseBarcode
=
apiListener
.
canPutInBeforeResolve
(
inCheckUrl
,
params
);
if
(
responseBarcode
!=
null
){
return
responseBarcode
;
}
...
...
src/main/java/com/neotel/smfcore/core/api/listener/BaseSmfApiListener.java
查看文件 @
6dcf1f0
...
...
@@ -9,6 +9,7 @@ import com.neotel.smfcore.core.api.bean.ApiResult;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.inList.service.manager.IInListManager
;
import
com.neotel.smfcore.core.inList.service.po.InList
;
import
com.neotel.smfcore.core.inList.service.po.InListItem
;
...
...
@@ -45,6 +46,9 @@ public abstract class BaseSmfApiListener implements ISmfApiListener {
@Autowired
protected
InListCache
inListCache
;
@Autowired
protected
DataCache
dataCache
;
@Override
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
){
...
...
@@ -56,11 +60,6 @@ public abstract class BaseSmfApiListener implements ISmfApiListener {
}
@Override
public
Barcode
resolveBarcode
(
String
url
,
CodeValidateParam
param
)
throws
ValidateException
{
return
null
;
}
@Override
public
Barcode
canPutIn
(
String
inCheckUrl
,
Barcode
barcode
)
throws
ValidateException
{
return
null
;
}
...
...
@@ -76,7 +75,7 @@ public abstract class BaseSmfApiListener implements ISmfApiListener {
}
@Override
public
Barcode
canPutInBeforeResolve
(
String
inCheckUrl
,
String
codeStr
)
throws
ValidateException
{
public
Barcode
canPutInBeforeResolve
(
String
inCheckUrl
,
CodeValidateParam
params
)
throws
ValidateException
{
return
null
;
}
}
src/main/java/com/neotel/smfcore/core/api/listener/DefaultSmfApiListener.java
查看文件 @
6dcf1f0
...
...
@@ -82,13 +82,6 @@ public class DefaultSmfApiListener extends BaseSmfApiListener {
}
}
@Override
public
Barcode
resolveBarcode
(
String
url
,
CodeValidateParam
param
)
throws
ValidateException
{
return
null
;
}
private
String
getData
(
Map
<
String
,
Object
>
dataMap
,
String
dataKey
){
Object
data
=
dataMap
.
get
(
dataKey
);
if
(
data
==
null
){
...
...
src/main/java/com/neotel/smfcore/core/api/listener/ISmfApiListener.java
查看文件 @
6dcf1f0
...
...
@@ -25,26 +25,16 @@ public interface ISmfApiListener {
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
);
/**
* 传入原始条码,API解析条码,注意条码中带有尺寸信息,此方法会在canPutIn方法之前调用,通常料架使用(其他设备会有尺寸信息且会有多个条码所以不适用此方法)
* @param param
* @return
* @throws ValidateException
*/
Barcode
resolveBarcode
(
String
inCheckUrl
,
CodeValidateParam
param
)
throws
ValidateException
;
/**
* 是否可入库验证
*/
Barcode
canPutIn
(
String
inCheckUrl
,
Barcode
barcode
)
throws
ValidateException
;
/**
* 入库扫条码后在解析之前进行验证
* @param inCheckUrl
* @param codeStr
* @return
* @throws ValidateException
*/
Barcode
canPutInBeforeResolve
(
String
inCheckUrl
,
String
codeStr
)
throws
ValidateException
;
Barcode
canPutInBeforeResolve
(
String
inCheckUrl
,
CodeValidateParam
params
)
throws
ValidateException
;
/**
* 工单状态改变
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
查看文件 @
6dcf1f0
...
...
@@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE
;
import
com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS
;
...
...
@@ -233,7 +234,8 @@ public class BaseDeviceHandler implements IDeviceHandler {
type
=
COMPONENT_TYPE
.
FIXTURE
;
}
String
codeStr
=
statusBean
.
getCode
();
Barcode
barcodeSave
=
smfApi
.
canPutInBeforeResolve
(
codeStr
);
CodeValidateParam
params
=
new
CodeValidateParam
(
""
,
storage
.
getGroupId
(),
storage
.
getId
(),
codeStr
,
""
);
Barcode
barcodeSave
=
smfApi
.
canPutInBeforeResolve
(
params
);
if
(
barcodeSave
==
null
){
barcodeSave
=
codeResolve
.
resolveOneValideBarcode
(
codeStr
,
type
);
}
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLPShelfHandler.java
查看文件 @
6dcf1f0
...
...
@@ -94,10 +94,8 @@ public class NLPShelfHandler extends BaseDeviceHandler{
}
}
Barcode
barcodeSave
=
smfApi
.
resolveBarcode
(
new
CodeValidateParam
(
loginUser
,
groupId
,
storageId
,
code
,
token
));
if
(
barcodeSave
==
null
){
barcodeSave
=
smfApi
.
canPutInBeforeResolve
(
code
);
}
CodeValidateParam
params
=
new
CodeValidateParam
(
loginUser
,
groupId
,
storageId
,
code
,
token
);
Barcode
barcodeSave
=
smfApi
.
canPutInBeforeResolve
(
params
);
if
(
barcodeSave
==
null
){
barcodeSave
=
codeResolve
.
resolveOneValideBarcode
(
"=1x1="
+
code
);
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLShelfHandler.java
查看文件 @
6dcf1f0
...
...
@@ -5,6 +5,7 @@ import com.google.common.base.Strings;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.bean.NLShelfOperateBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
...
...
@@ -315,7 +316,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
if
(
resultBean
!=
null
){
return
resultBean
;
}
resultBean
=
putInProcess
(
code
,
token
,
loginUser
);
resultBean
=
putInProcess
(
groupId
,
storageId
,
code
,
token
,
loginUser
);
if
(
resultBean
!=
null
){
return
resultBean
;
}
...
...
@@ -348,11 +349,12 @@ public class NLShelfHandler extends BaseDeviceHandler {
}
return
null
;
}
private
ResultBean
putInProcess
(
String
code
,
String
token
,
String
loginUser
){
String
barcodeStr
=
"=1x1="
+
code
;
private
ResultBean
putInProcess
(
String
groupId
,
String
storageId
,
String
code
,
String
token
,
String
loginUser
){
//扫的是物料条码
Barcode
barcode
=
smfApi
.
canPutInBeforeResolve
(
barcodeStr
);
CodeValidateParam
params
=
new
CodeValidateParam
(
loginUser
,
groupId
,
storageId
,
code
,
token
);
Barcode
barcode
=
smfApi
.
canPutInBeforeResolve
(
params
);
if
(
barcode
==
null
){
String
barcodeStr
=
"=1x1="
+
code
;
barcode
=
codeResolve
.
resolveOneValideBarcode
(
barcodeStr
);
}
barcode
=
smfApi
.
canPutInAfterResolve
(
barcode
);
...
...
src/main/java/com/neotel/smfcore/custom/hella/handler/HellaApiHandler.java
查看文件 @
6dcf1f0
...
...
@@ -15,7 +15,7 @@ public class HellaApiHandler extends BaseSmfApiListener {
private
HellaServiceHandler
hellaServiceHandler
;
@Override
public
Barcode
resolveBarcod
e
(
String
url
,
CodeValidateParam
param
)
throws
ValidateException
{
public
Barcode
canPutInBeforeResolv
e
(
String
url
,
CodeValidateParam
param
)
throws
ValidateException
{
if
(!
HellaTcpClient
.
isEnable
())
{
return
null
;
}
...
...
src/main/java/com/neotel/smfcore/custom/siemens/SiemensApi.java
查看文件 @
6dcf1f0
...
...
@@ -4,12 +4,14 @@ import cn.hutool.core.util.ObjectUtil;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.HttpHelper
;
import
com.neotel.smfcore.common.utils.JsonUtil
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
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.utils.CodeResolve
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.custom.siemens.bean.LotCheckInfo
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -52,7 +54,7 @@ public class SiemensApi extends BaseSmfApiListener {
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
()){
if
(
task
.
isPutInTask
()){
lotInOut
(
inNotifyUrl
,
task
.
getBarcode
(),
1
);
lotInOut
(
inNotifyUrl
,
task
.
getBarcode
(),
1
,
task
.
getCid
()
);
}
}
}
...
...
@@ -63,13 +65,13 @@ public class SiemensApi extends BaseSmfApiListener {
if
(
task
.
isPutInTask
()){
}
else
{
lotInOut
(
outNotifyUrl
,
task
.
getBarcode
(),
2
);
lotInOut
(
outNotifyUrl
,
task
.
getBarcode
(),
2
,
task
.
getCid
()
);
}
}
}
private
static
boolean
lotInOut
(
String
url
,
String
lot
,
int
inoutType
)
{
private
static
boolean
lotInOut
(
String
url
,
String
lot
,
int
inoutType
,
String
deviceId
)
{
//String url=config.url;
if
(
ObjectUtil
.
isEmpty
(
url
))
{
log
.
info
(
"没有配置Siemens,无需通知"
);
...
...
@@ -85,6 +87,7 @@ public class SiemensApi extends BaseSmfApiListener {
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"LotID"
,
lot
);
params
.
put
(
"ACTION"
,
action
);
params
.
put
(
"deviceId"
,
deviceId
);
String
result
=
HttpHelper
.
postJson
(
url
,
params
);
log
.
info
(
"Siemens["
+
url
+
"]返回料盘["
+
lot
+
"]的["
+
action
+
"]结果:"
+
result
);
Map
<
String
,
Object
>
returnMap
=
JsonUtil
.
toMap
(
result
);
...
...
@@ -125,15 +128,20 @@ public class SiemensApi extends BaseSmfApiListener {
}
@Override
public
Barcode
canPutInBeforeResolve
(
String
inCheckUrl
,
String
codeStr
)
throws
ValidateException
{
public
Barcode
canPutInBeforeResolve
(
String
inCheckUrl
,
CodeValidateParam
params
)
throws
ValidateException
{
if
(
ObjectUtil
.
isEmpty
(
inCheckUrl
))
{
log
.
info
(
"没有配置Siemens,无需验证"
);
return
null
;
}
try
{
Collection
<
CodeBean
>
codeBeans
=
codeResolve
.
resolveCodeStr
(
codeStr
,
COMPONENT_TYPE
.
COMPONENT
);
Collection
<
CodeBean
>
codeBeans
=
codeResolve
.
resolveCodeStr
(
params
.
getCode
(),
COMPONENT_TYPE
.
COMPONENT
);
String
cid
=
""
;
Storage
storage
=
dataCache
.
getStorageById
(
params
.
getStorageId
());
if
(
storage
!=
null
){
cid
=
storage
.
getCid
();
}
for
(
CodeBean
codebean
:
codeBeans
)
{
LotCheckInfo
info
=
lotCheckIn
(
codebean
.
getCodeStr
(),
inCheckUrl
);
LotCheckInfo
info
=
lotCheckIn
(
codebean
.
getCodeStr
(),
inCheckUrl
,
cid
);
if
(
info
!=
null
&&
info
.
isStatus
()
&&
ObjectUtil
.
isNotEmpty
(
info
.
getPartnum
())
&&
ObjectUtil
.
isNotEmpty
(
info
.
getQuantity
()))
{
//查找元器件是否存在
com
.
neotel
.
smfcore
.
core
.
barcode
.
service
.
po
.
Component
component
=
componentManager
.
findOneByPN
(
info
.
getPartnum
());
...
...
@@ -175,14 +183,14 @@ public class SiemensApi extends BaseSmfApiListener {
return
barcode
;
}
}
throw
new
ValidateException
(
"siemens.barcode.failed"
,
"SIEMENS验证条码["
+
codeStr
+
"]失败"
);
throw
new
ValidateException
(
"siemens.barcode.failed"
,
"SIEMENS验证条码["
+
params
.
getCode
()
+
"]失败"
);
}
catch
(
Exception
ex
)
{
log
.
info
(
"siemensCheckCode 验证条码 ["
+
codeStr
+
"] 出错:"
+
ex
.
getMessage
());
log
.
info
(
"siemensCheckCode 验证条码 ["
+
params
.
getCode
()
+
"] 出错:"
+
ex
.
getMessage
());
throw
new
ValidateException
(
"siemens.barcode.error"
,
ex
.
getMessage
());
}
}
public
static
LotCheckInfo
lotCheckIn
(
String
lot
,
String
url
)
{
public
static
LotCheckInfo
lotCheckIn
(
String
lot
,
String
url
,
String
deviceId
)
{
if
(
ObjectUtil
.
isEmpty
(
url
))
{
log
.
info
(
"没有配置Siemens,无需验证"
);
return
null
;
...
...
@@ -194,6 +202,7 @@ public class SiemensApi extends BaseSmfApiListener {
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"LotID"
,
lot
);
params
.
put
(
"ACTION"
,
action
);
params
.
put
(
"deviceId"
,
deviceId
);
String
result
=
HttpHelper
.
postJson
(
url
,
params
);
log
.
info
(
"Siemens["
+
url
+
"]返回料盘["
+
lot
+
"]的["
+
action
+
"]结果:"
+
result
);
Map
<
String
,
Object
>
returnMap
=
JsonUtil
.
toMap
(
result
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论