Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 600bf353
由
zshaohui
编写于
2023-03-02 13:26:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
松亚入库判断接口修改
1 个父辈
96fbaa34
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
94 行增加
和
2 行删除
src/main/java/com/neotel/smfcore/custom/sungya20456/SungyaApi.java
src/main/java/com/neotel/smfcore/custom/sungya20456/SungyaApi.java
查看文件 @
600bf35
...
@@ -8,8 +8,11 @@ import com.neotel.smfcore.common.utils.JsonUtil;
...
@@ -8,8 +8,11 @@ import com.neotel.smfcore.common.utils.JsonUtil;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
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.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
...
@@ -23,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -23,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -42,11 +46,98 @@ public class SungyaApi extends BaseSmfApiListener {
...
@@ -42,11 +46,98 @@ public class SungyaApi extends BaseSmfApiListener {
@Autowired
@Autowired
private
DataCache
dataCache
;
private
DataCache
dataCache
;
@Autowired
private
CodeResolve
codeResolve
;
@Override
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
public
boolean
isForThisApi
(
String
apiName
)
{
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"sungya"
);
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"sungya"
);
}
}
@Override
public
Barcode
canPutInBeforeResolve
(
String
codeResolveUrl
,
CodeValidateParam
codeParams
)
throws
ValidateException
{
log
.
info
(
"向 Sungya["
+
codeResolveUrl
+
"]请求料盘【"
+
codeParams
.
getCode
()
+
"】的信息"
);
Collection
<
CodeBean
>
codeBeans
=
codeResolve
.
resolveCodeStr
(
codeParams
.
getCode
(),
COMPONENT_TYPE
.
COMPONENT
);
String
errorMsg
=
""
;
try
{
for
(
CodeBean
codeBean
:
codeBeans
)
{
if
(
codeBean
.
getReelHeight
()
<=
0
)
{
codeBean
.
setReelHeight
(
1
);
}
if
(
codeBean
.
getReelWidth
()
<=
0
)
{
codeBean
.
setReelWidth
(
1
);
}
Barcode
barcode
=
codeBean
.
getBarcode
();
if
(
codeBean
.
getBarcode
()
==
null
)
{
barcode
=
new
Barcode
();
barcode
.
setBarcode
(
codeBean
.
getCodeStr
());
}
barcode
.
setPlateSize
(
codeBean
.
getReelWidth
());
barcode
.
setHeight
(
codeBean
.
getReelHeight
());
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"funcname"
,
"INWHCK"
);
Map
<
String
,
String
>
bodyMap
=
new
HashMap
<>();
bodyMap
.
put
(
"reelId"
,
barcode
.
getBarcode
());
bodyMap
.
put
(
"fullCode"
,
StringUtils
.
isBlank
(
barcode
.
getFullCode
())
?
barcode
.
getBarcode
()
:
barcode
.
getFullCode
());
paramMap
.
put
(
"body"
,
bodyMap
);
log
.
info
(
barcode
.
getBarcode
()
+
"入库验证,参数:"
+
JsonUtil
.
toJsonStr
(
paramMap
));
String
result
=
HttpHelper
.
postJson
(
codeResolveUrl
,
paramMap
);
log
.
info
(
barcode
.
getBarcode
()
+
"入库验证,出参:"
+
result
);
SungyaResult
sungyaResult
=
JsonUtil
.
toObj
(
result
,
SungyaResult
.
class
);
if
(
"1"
.
equals
(
sungyaResult
.
getStatus
()))
{
Item
item
=
sungyaResult
.
getItem
();
//物料编号
if
(
StringUtils
.
isNotBlank
(
item
.
getPartNum
()))
{
barcode
.
setPartNumber
(
item
.
getPartNum
());
}
//供应商信息
if
(
StringUtils
.
isNotBlank
(
item
.
getVendor
()))
{
barcode
.
setProvider
(
item
.
getVendor
());
}
//物料数量
if
(
item
.
getQty
()
!=
null
)
{
barcode
.
setAmount
(
item
.
getQty
());
}
//尺寸
if
(
item
.
getW
()
!=
null
)
{
barcode
.
setPlateSize
(
item
.
getW
());
}
//厚度
if
(
item
.
getH
()
!=
null
)
{
barcode
.
setHeight
(
item
.
getH
());
}
//生产日期
if
(
StringUtils
.
isNotBlank
(
item
.
getProduceDate
()))
{
barcode
.
setProduceDate
(
DateUtil
.
toDate
(
item
.
getProduceDate
(),
"yyyy-MM-dd HH:mm:ss"
));
}
//过期时间
if
(
StringUtils
.
isNotBlank
(
item
.
getExpireDate
()))
{
barcode
.
setExpireDate
(
DateUtil
.
toDate
(
item
.
getExpireDate
(),
"yyyy-MM-dd HH:mm:ss"
));
}
//批次
if
(
StringUtils
.
isNotBlank
(
item
.
getBatch
()))
{
barcode
.
setBatch
(
item
.
getBatch
());
}
//搅拌时间(锡膏料仓使用)
if
(
item
.
getMixTime
()
!=
null
)
{
barcode
.
setMixTime
(
item
.
getMixTime
());
}
return
barcode
;
}
else
{
errorMsg
=
"Sungya ["
+
barcode
.
getBarcode
()
+
"] NG:"
+
result
;
}
}
}
catch
(
Exception
e
)
{
String
msg
=
"Request to Sungya["
+
codeParams
.
getCode
()
+
"] Error"
;
log
.
error
(
msg
,
e
);
throw
new
ValidateException
(
"sungya.error"
,
msg
+
":"
+
e
.
getMessage
());
}
throw
new
ValidateException
(
errorMsg
,
"Sungya验证失败"
);
}
/**
/**
* 入库判定接口
* 入库判定接口
*
*
...
@@ -58,7 +149,7 @@ public class SungyaApi extends BaseSmfApiListener {
...
@@ -58,7 +149,7 @@ public class SungyaApi extends BaseSmfApiListener {
*/
*/
@Override
@Override
public
Barcode
canPutInAfterResolve
(
String
inCheckUrl
,
CodeValidateParam
params
,
Barcode
barcode
)
throws
ValidateException
{
public
Barcode
canPutInAfterResolve
(
String
inCheckUrl
,
CodeValidateParam
params
,
Barcode
barcode
)
throws
ValidateException
{
try
{
/*
try {
Map<String, Object> paramMap = new HashMap<>();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("funcname", "INWHCK");
paramMap.put("funcname", "INWHCK");
Map<String, String> bodyMap = new HashMap<>();
Map<String, String> bodyMap = new HashMap<>();
...
@@ -116,7 +207,8 @@ public class SungyaApi extends BaseSmfApiListener {
...
@@ -116,7 +207,8 @@ public class SungyaApi extends BaseSmfApiListener {
} catch (ApiException e) {
} catch (ApiException e) {
log.error("入库验证接口出错:" + e.getMessage());
log.error("入库验证接口出错:" + e.getMessage());
throw new ValidateException("smfcore.mesApi.inCheck.error", "MES验证出错:" + e.getMessage());
throw new ValidateException("smfcore.mesApi.inCheck.error", "MES验证出错:" + e.getMessage());
}
}*/
return
null
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论