Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 7e26e143
由
zshaohui
编写于
2024-06-03 15:41:14 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
功能提交
1 个父辈
add365d1
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
190 行增加
和
22 行删除
src/main/java/com/neotel/smfcore/core/barcode/service/po/Barcode.java
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
src/main/java/com/neotel/smfcore/core/message/service/po/Message.java
src/main/java/com/neotel/smfcore/core/message/util/DeviceMessageUtil.java
src/main/java/com/neotel/smfcore/core/order/listener/DefaultOrderFileListener.java
src/main/java/com/neotel/smfcore/custom/lizhen/LizhenApi.java
src/main/java/com/neotel/smfcore/custom/lizhen/setting/util/ExpireDateUtil.java
src/main/resources/config/application-21088prod.yml
src/main/resources/config/application-21088test.yml
src/main/resources/config/application.yml
src/main/java/com/neotel/smfcore/core/barcode/service/po/Barcode.java
查看文件 @
7e26e14
...
...
@@ -295,6 +295,9 @@ public class Barcode extends BasePo implements Serializable {
*/
private
boolean
isInventory
=
false
;
//判断是否请求过入库
private
boolean
askPutIn
=
false
;
/**
* 添加相关联条码
*
...
...
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
查看文件 @
7e26e14
...
...
@@ -10,6 +10,7 @@ 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.ReelLockPosUtil
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.api.listener.ISmfApiListener
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
...
...
@@ -187,6 +188,15 @@ public class DeviceController {
throw
new
ValidateException
(
"smfcore.error.barcode.expired"
,
"物料已过期,无法入库."
);
}
}
//判断库别是否为空
/*Barcode barcode1F = lizhenApi.getBarcode(barcode.getBarcode());
if (barcode1F == null || StringUtils.isEmpty(barcode1F.getWarehouseCode())){
throw new ValidateException("", barcode.getBarcode()+"未找到对应的库别信息");
}
String warhouseCode = barcode1F.getWarehouseCode();*/
String
warhouseCode
=
""
;
//判断虚拟仓有没有存在,如果有,把虚拟仓库位置空
StoragePos
storagePos
=
storagePosManager
.
getByBarcode
(
barcode
.
getBarcode
());
if
(
storagePos
!=
null
)
{
...
...
@@ -242,6 +252,7 @@ public class DeviceController {
barcode
=
barcodeApi
;
}
for
(
DataLog
dataLog
:
taskService
.
getAllTasks
())
{
// if(!dataLog.isPackageReel()){
//已经在任务当中,返回对应的信息
...
...
@@ -308,6 +319,12 @@ public class DeviceController {
Storage
theStorage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
//lizhenApi.backToWarehouse(warhouseCode,theStorage.getName(),barcode.getBarcode());
barcode
.
setWarehouseCode
(
warhouseCode
);
barcode
.
setAskPutIn
(
true
);
barcode
=
barcodeManager
.
save
(
barcode
);
resultMap
.
put
(
"result"
,
"0"
);
resultMap
.
put
(
"msg"
,
""
);
...
...
src/main/java/com/neotel/smfcore/core/message/service/po/Message.java
查看文件 @
7e26e14
...
...
@@ -31,6 +31,21 @@ public class Message extends BasePo implements Serializable {
Message
message
=
new
Message
(
deviceName
,
deviceId
,
module
,
type
,
msgCode
,
msg
,
msgParams
,
null
,
null
,
""
,
errorCode
);
return
message
;
}
public
boolean
sameMas
(
Message
msg
){
if
(
deviceName
.
equals
(
msg
.
getDeviceName
())
&&
deviceId
.
equals
(
msg
.
getDeviceId
())
&&
module
.
equals
(
msg
.
getModule
())
&&
type
.
equals
(
msg
.
getType
())
&&
getMsg
().
equals
(
msg
.
getMsg
())
&&
errorCode
.
equals
(
msg
.
getErrorCode
())
){
return
true
;
}
return
false
;
}
/**
* 设备名称
*/
...
...
src/main/java/com/neotel/smfcore/core/message/util/DeviceMessageUtil.java
查看文件 @
7e26e14
...
...
@@ -18,6 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.mongodb.core.aggregation.ComparisonOperators
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Slf4j
@Component
public
class
DeviceMessageUtil
{
...
...
@@ -73,6 +77,37 @@ public class DeviceMessageUtil {
return
null
;
}
private
static
List
<
Message
>
messageList
=
new
ArrayList
<>();
private
synchronized
static
boolean
msgNeedSave
(
Message
message
)
{
int
TimeOutMs
=
20000
;
boolean
needSave
=
true
;
if
(
messageList
==
null
)
{
messageList
=
new
ArrayList
<>();
}
List
<
Message
>
oldMsg
=
new
ArrayList
<>();
oldMsg
.
addAll
(
messageList
);
messageList
=
new
ArrayList
<>();
message
.
setCreateDate
(
new
Date
());
for
(
Message
msg
:
oldMsg
)
{
long
ms
=
(
new
Date
()).
getTime
()
-
msg
.
getCreateDate
().
getTime
();
if
(
ms
<
TimeOutMs
)
{
if
(
msg
.
sameMas
(
message
))
{
needSave
=
false
;
messageList
.
add
(
message
);
}
else
{
messageList
.
add
(
msg
);
}
}
}
if
(
needSave
){
messageList
.
add
(
message
);
}
return
needSave
;
}
public
static
void
addDeviceMessage
(
String
cid
,
String
msgType
,
String
moudle
,
String
msgCode
,
String
msg
,
String
[]
msgParam
,
String
errorCode
)
{
DeviceInfo
deviceInfo
=
getDeviceName
(
cid
);
...
...
@@ -84,7 +119,10 @@ public class DeviceMessageUtil {
}
}
Message
message
=
Message
.
newMsg
(
msgType
,
deviceInfo
.
getName
(),
deviceInfo
.
getId
(),
moudle
,
code
,
msg
,
msgParam
,
errorCode
);
messageManager
.
save
(
message
);
boolean
result
=
msgNeedSave
(
message
);
if
(
result
){
messageManager
.
save
(
message
);
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/order/listener/DefaultOrderFileListener.java
查看文件 @
7e26e14
...
...
@@ -86,7 +86,7 @@ public class DefaultOrderFileListener implements IOrderFileListener {
}
}
liteOrder
.
setLine
(
lineStr
);
liteOrder
.
setSource
(
LITEORDER_SOURCE
.
OUTTER
.
name
());
//
liteOrder.setSource(LITEORDER_SOURCE.OUTTER.name());
liteOrder
=
liteOrderManager
.
createWithItems
(
liteOrder
);
liteOrderCache
.
addOrderToMap
(
liteOrder
);
return
true
;
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/LizhenApi.java
查看文件 @
7e26e14
...
...
@@ -65,6 +65,13 @@ public class LizhenApi extends DefaultSmfApiListener {
@Value
(
"${api.checkReelMeasure}"
)
private
String
checkReelMeasureUrl
=
""
;
@Value
(
"${api.getBarcode}"
)
private
String
getBarcodeUrl
=
""
;
@Value
(
"${api.inNotifyUrl}"
)
private
String
inNotifyUrl
=
""
;
@PostConstruct
public
void
init
(){
fetchGRUrl
=
dataCache
.
getConfigCache
(
"fetchGRUrl"
,
fetchGRUrl
);
...
...
@@ -74,6 +81,8 @@ public class LizhenApi extends DefaultSmfApiListener {
werks
=
dataCache
.
getConfigCache
(
"werks"
,
werks
);
outNotifyUrlPK
=
dataCache
.
getConfigCache
(
"api.outNotifyUrlPK"
,
outNotifyUrlPK
);
batchCheckUrl
=
dataCache
.
getConfigCache
(
"api.batchCheckUrl"
,
batchCheckUrl
);
getBarcodeUrl
=
dataCache
.
getConfigCache
(
"api.getBarcodeUrl"
,
getBarcodeUrl
);
inNotifyUrl
=
dataCache
.
getConfigCache
(
"api.getBarcodeUrl"
,
inNotifyUrl
);
}
/**
...
...
@@ -260,22 +269,7 @@ public class LizhenApi extends DefaultSmfApiListener {
*/
@Override
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
()){
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"PLANT_CODE"
,
CommonUtil
.
plantCode
);
paramMap
.
put
(
"RETURN_TYPE"
,
"return_tower"
);
//退回大库: return 退回料塔: return_tower
paramMap
.
put
(
"BIN_CODE"
,
task
.
getPosName
());
paramMap
.
put
(
"REEL_LIST"
,
Arrays
.
asList
(
task
.
getBarcode
()));
log
.
info
(
task
.
getBarcode
()+
"入库通知,调用电子料入退库,请求参数为:"
+
JSON
.
toJSONString
(
paramMap
));
try
{
String
resultStr
=
HttpHelper
.
postJson
(
inNotifyUrl
,
paramMap
);
log
.
info
(
task
.
getBarcode
()+
"入库通知,调用电子料入退库,结果为:"
+
resultStr
);
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
log
.
info
(
task
.
getBarcode
()+
"入库通知,调用电子料入退库,异常为:"
+
e
.
getMessage
());
}
}
}
/**
...
...
@@ -439,8 +433,107 @@ public class LizhenApi extends DefaultSmfApiListener {
}
public
Barcode
getBarcode
(
String
codeStr
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"codeStr"
,
codeStr
);
try
{
String
resultStr
=
HttpHelper
.
postJson
(
getBarcodeUrl
,
paramMap
);
return
JsonUtil
.
toObj
(
resultStr
,
Barcode
.
class
);
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
log
.
error
(
codeStr
+
"getBarcode报错:"
+
e
.
getMessage
());
}
return
null
;
}
public
void
backToWarehouse
(
String
warhouseCode
,
String
machineName
,
String
barcode
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"PLANT_CODE"
,
CommonUtil
.
plantCode
);
paramMap
.
put
(
"RETURN_TYPE"
,
"return_tower"
);
//退回大库: return 退回料塔: return_tower
paramMap
.
put
(
"BIN_CODE"
,
machineName
+
warhouseCode
);
paramMap
.
put
(
"REEL_LIST"
,
Arrays
.
asList
(
barcode
));
log
.
info
(
barcode
+
"入库通知,调用电子料入退库,请求参数为:"
+
JSON
.
toJSONString
(
paramMap
));
try
{
String
resultStr
=
HttpHelper
.
postJson
(
inNotifyUrl
,
paramMap
);
log
.
info
(
barcode
+
"入库通知,调用电子料入退库,结果为:"
+
resultStr
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
resultStr
);
String
msgty
=
jsonObject
.
getString
(
"MSGTY"
);
if
(!
"S"
.
equalsIgnoreCase
(
msgty
)){
throw
new
ValidateException
(
""
,
barcode
+
"调用电子料入退库失败:"
+
resultStr
);
}
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
log
.
info
(
barcode
+
"入库通知,调用电子料入退库,异常为:"
+
e
.
getMessage
());
}
}
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"Lizhen"
);
}
public
static
void
main
(
String
[]
args
)
{
String
resultStr
=
"{\n"
+
" \"MSGTY\": \"S\",\n"
+
" \"MSGTX\": \"退回成功\",\n"
+
" \"DATA\": {\n"
+
" \"inventory_id\": \"21380985746190001\",\n"
+
" \"plant_code\": \"W339\",\n"
+
" \"material_type\": \"ROH\",\n"
+
" \"material_code\": \"118S00258\",\n"
+
" \"warehouse_code\": \"W10B\",\n"
+
" \"bin_code\": \"Tower2-LW10B\",\n"
+
" \"keeper_code\": \"BR013\",\n"
+
" \"label_id\": \"L2024051700000039\",\n"
+
" \"group_id\": null,\n"
+
" \"label_qty\": 20000.0,\n"
+
" \"vendor_code\": \"0000797001\",\n"
+
" \"vendor_name\": null,\n"
+
" \"fl_code\": null,\n"
+
" \"allocate_qty\": 0.0,\n"
+
" \"ticket_type\": null,\n"
+
" \"fifo_priority\": 0,\n"
+
" \"extend_days\": 0,\n"
+
" \"extend_times\": 0,\n"
+
" \"rohs\": null,\n"
+
" \"order_no\": null,\n"
+
" \"version\": null,\n"
+
" \"os_version\": null,\n"
+
" \"date_code\": null,\n"
+
" \"week_code\": null,\n"
+
" \"lot_code\": null,\n"
+
" \"remark\": null,\n"
+
" \"batch_code\": \"1000000030\",\n"
+
" \"expire_date\": null,\n"
+
" \"gr_date\": \"2023-08-18 13:21:22\",\n"
+
" \"tran_date\": \"2024-05-17 08:42:54\",\n"
+
" \"status\": 0,\n"
+
" \"reel_qty\": 1.0,\n"
+
" \"pack_type\": null,\n"
+
" \"brand\": \"CYNTEC\",\n"
+
" \"mpn\": null,\n"
+
" \"unit\": \"PC\",\n"
+
" \"coo\": null,\n"
+
" \"region\": null,\n"
+
" \"cavity\": null,\n"
+
" \"group_code\": null,\n"
+
" \"create_at\": \"2024-05-17 08:42:54\",\n"
+
" \"create_by\": \"MLB_API\",\n"
+
" \"update_at\": null,\n"
+
" \"update_by\": null\n"
+
" }\n"
+
"}"
;
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
resultStr
);
String
msgty
=
jsonObject
.
getString
(
"MSGTY"
);
String
msgty1
=
jsonObject
.
getString
(
"msgty"
);
System
.
out
.
println
(
msgty
);
System
.
out
.
println
(
msgty1
);
if
(!
"S"
.
equalsIgnoreCase
(
jsonObject
.
getString
(
"MSGTY"
))
&&
!
"S"
.
equalsIgnoreCase
(
jsonObject
.
getString
(
"msgty"
))){
throw
new
ValidateException
(
""
,
"调用电子料入退库失败:"
+
resultStr
);
}
}
}
src/main/java/com/neotel/smfcore/custom/lizhen/setting/util/ExpireDateUtil.java
查看文件 @
7e26e14
...
...
@@ -38,7 +38,7 @@ public class ExpireDateUtil {
}
public
static
Date
getExpireDate
(
String
dateStr
,
String
vendor
)
{
try
{
/*
try {
vendor = vendor.toUpperCase(Locale.ROOT);
switch (vendor) {
case "UMT":
...
...
@@ -168,7 +168,7 @@ public class ExpireDateUtil {
log.error(vendor + "---" + dateStr + "生产日期解析出错:" + e.getMessage());
return null;
}
log
.
error
(
vendor
+
"---"
+
dateStr
+
"解析失返回为null"
);
log.error(vendor + "---" + dateStr + "解析失返回为null");
*/
return
null
;
}
...
...
src/main/resources/config/application-21088prod.yml
查看文件 @
7e26e14
...
...
@@ -3,4 +3,5 @@ api:
name
:
Lizhen
inCheckUrl
:
http://10.68.21.21:8001/Npm/WmsCheckReelfob
#禁用料接口
outNotifyUrl
:
http://10.68.30.22:8082/api/mlb/TowerIssue
inNotifyUrl
:
http://10.68.30.22:8082/api/mlb/BackToWarehouse
\ No newline at end of file
inNotifyUrl
:
http://10.68.30.22:8082/api/mlb/BackToWarehouse
getBarcode
:
http://10.68.27.83/smf-core/thirdBarcode/getBarcode
\ No newline at end of file
src/main/resources/config/application-21088test.yml
查看文件 @
7e26e14
...
...
@@ -3,4 +3,5 @@ api:
name
:
Lizhen
inCheckUrl
:
http://10.68.21.21:8001/Npm/WmsCheckReelfob
#禁用料接口
outNotifyUrl
:
http://10.42.220.171:8082/api/mlb/TowerIssue
inNotifyUrl
:
http://10.42.220.171:8082/api/mlb/BackToWarehouse
\ No newline at end of file
inNotifyUrl
:
http://10.42.220.171:8082/api/mlb/BackToWarehouse
getBarcode
:
http://10.68.27.83/smf-core/thirdBarcode/getBarcode
\ No newline at end of file
src/main/resources/config/application.yml
查看文件 @
7e26e14
...
...
@@ -103,5 +103,5 @@ app:
type
:
"
"
menu
:
show
:
#innerMaterial
show
:
workOrder
hide
:
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论