Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f90a593e
由
孙克
编写于
2023-12-28 09:02:14 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge branch 'master' of
http://106.15.194.121:8083/sunke/smf-core
2 个父辈
902d68b5
4b1661ef
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
42 个修改的文件
包含
869 行增加
和
181 行删除
src/main/java/com/neotel/smfcore/common/init/MenuInit.java
src/main/java/com/neotel/smfcore/common/utils/Constants.java
src/main/java/com/neotel/smfcore/common/utils/FileUtil.java
src/main/java/com/neotel/smfcore/common/utils/HttpHelper.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/barcode/bean/BarcodeRule.java
src/main/java/com/neotel/smfcore/core/barcode/rest/BarcodeController.java
src/main/java/com/neotel/smfcore/core/barcode/utils/CodeResolve.java
src/main/java/com/neotel/smfcore/mimo/controller/SmdBoxMimoController.java → src/main/java/com/neotel/smfcore/core/dashboard/mimo/SmdBoxMimoController.java
src/main/java/com/neotel/smfcore/core/device/bean/MsgInfo.java
src/main/java/com/neotel/smfcore/core/device/bean/NLShelfOperateBean.java
src/main/java/com/neotel/smfcore/core/device/bean/StatusBean.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLShelfHandler.java
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
src/main/java/com/neotel/smfcore/core/inList/rest/InListController.java
src/main/java/com/neotel/smfcore/core/inList/service/po/InListItem.java
src/main/java/com/neotel/smfcore/core/inList/util/InListCache.java
src/main/java/com/neotel/smfcore/core/language/util/MessageUtils.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/LiteOrderCache.java
src/main/java/com/neotel/smfcore/core/solder/handler/SpBoxHandler.java
src/main/java/com/neotel/smfcore/core/system/rest/SettingsController.java
src/main/java/com/neotel/smfcore/core/system/rest/bean/dto/SysSettingsDto.java
src/main/java/com/neotel/smfcore/core/system/util/DevicesStatusUtil.java
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
src/main/java/com/neotel/smfcore/custom/iriichi1081/IriichiApi.java
src/main/java/com/neotel/smfcore/custom/iriichi1081/config/IriichiConfig.java
src/main/java/com/neotel/smfcore/custom/micron1053/controller/MicronStatusController.java
src/main/java/com/neotel/smfcore/custom/nanrui/NanRuiApi.java
src/main/java/com/neotel/smfcore/custom/nanrui/NanRuiConfig.java
src/main/java/com/neotel/smfcore/custom/siemens/bean/LotCheckInfo.java
src/main/resources/messages.properties
src/main/resources/messages_en_US.properties
src/main/resources/messages_ja_JP.properties
src/main/resources/messages_zh_CN.properties
src/main/resources/messages_zh_TW.properties
src/main/java/com/neotel/smfcore/common/init/MenuInit.java
查看文件 @
f90a593
...
@@ -113,6 +113,8 @@ public class MenuInit {
...
@@ -113,6 +113,8 @@ public class MenuInit {
//AGV看板
//AGV看板
//addDefaultFunctionMenu(1,null,"AGV看板","agvkanban", "agv/agvkanban/index","agv");
//addDefaultFunctionMenu(1,null,"AGV看板","agvkanban", "agv/agvkanban/index","agv");
addDefaultFunctionMenu
(-
1
,
null
,
"Neo Ai"
,
"neoai"
,
"neoai/index"
,
"neoai"
);
//Mimo临时看板
//Mimo临时看板
addDefaultFunctionMenu
(
0
,
null
,
"SMD BOX MIMO"
,
"SMDBOXMIMO"
,
"smdBoxMimo/index"
,
"smdMimo"
);
addDefaultFunctionMenu
(
0
,
null
,
"SMD BOX MIMO"
,
"SMDBOXMIMO"
,
"smdBoxMimo/index"
,
"smdMimo"
);
...
...
src/main/java/com/neotel/smfcore/common/utils/Constants.java
查看文件 @
f90a593
...
@@ -168,4 +168,9 @@ public class Constants {
...
@@ -168,4 +168,9 @@ public class Constants {
*/
*/
public
static
final
String
CACHE_spSettings
=
"spSettings"
;
public
static
final
String
CACHE_spSettings
=
"spSettings"
;
/**
* 缺料不自动关闭工单
*/
public
static
final
String
CACHE_closeWorkOrder
=
"CACHE_closeWorkOrder"
;
}
}
src/main/java/com/neotel/smfcore/common/utils/FileUtil.java
查看文件 @
f90a593
...
@@ -355,7 +355,11 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -355,7 +355,11 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
if
(
CollectionUtils
.
isNotEmpty
(
dataList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
dataList
))
{
for
(
Map
<
String
,
Object
>
data
:
dataList
)
{
for
(
Map
<
String
,
Object
>
data
:
dataList
)
{
for
(
String
key
:
titles
)
{
for
(
String
key
:
titles
)
{
buf
.
append
(
data
.
get
(
key
)).
append
(
CSV_COLUMN_SEPARATOR
);
if
(
data
.
get
(
key
).
toString
().
contains
(
CSV_COLUMN_SEPARATOR
)){
buf
.
append
(
"\""
+
data
.
get
(
key
)+
"\""
).
append
(
CSV_COLUMN_SEPARATOR
);
}
else
{
buf
.
append
(
data
.
get
(
key
)).
append
(
CSV_COLUMN_SEPARATOR
);
}
}
}
buf
.
append
(
CSV_ROW_SEPARATOR
);
buf
.
append
(
CSV_ROW_SEPARATOR
);
}
}
...
...
src/main/java/com/neotel/smfcore/common/utils/HttpHelper.java
查看文件 @
f90a593
...
@@ -476,6 +476,44 @@ public class HttpHelper {
...
@@ -476,6 +476,44 @@ public class HttpHelper {
}
}
}
}
public
static
String
postParam
(
String
url
,
Map
<
String
,
Object
>
paramMap
,
Map
<
String
,
String
>
headerMap
)
throws
ApiException
{
// 设置请求参数
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
List
<
NameValuePair
>
params
=
toNameValuePair
(
paramMap
);
URI
uri
=
new
URIBuilder
(
url
).
setParameters
(
params
).
build
();
log
.
info
(
"执行请求:"
+
uri
.
toString
());
HttpPost
httpPost
=
new
HttpPost
(
uri
);
for
(
Entry
<
String
,
String
>
entry
:
headerMap
.
entrySet
())
{
httpPost
.
addHeader
(
entry
.
getKey
(),
entry
.
getValue
());
}
// httpPost.setEntity(new UrlEncodedFormEntity(params, CONTENT_CHARSET));
httpClient
=
HttpClients
.
createDefault
();
response
=
httpClient
.
execute
(
httpPost
);
HttpEntity
entity
=
response
.
getEntity
();
String
responseContent
=
EntityUtils
.
toString
(
entity
,
CONTENT_CHARSET
);
//response.close();
//httpClient.close();
return
responseContent
;
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"Request params to ["
+
url
+
"] failed:"
+
e
.
getMessage
());
}
finally
{
try
{
if
(
response
!=
null
)
{
response
.
close
();
}
if
(
httpClient
!=
null
)
{
httpClient
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
private
static
String
appendString
(
String
url
,
String
paramStr
)
{
private
static
String
appendString
(
String
url
,
String
paramStr
)
{
StringBuffer
stringBuffer
=
new
StringBuffer
();
StringBuffer
stringBuffer
=
new
StringBuffer
();
stringBuffer
.
append
(
url
);
stringBuffer
.
append
(
url
);
...
...
src/main/java/com/neotel/smfcore/core/api/SmfApi.java
查看文件 @
f90a593
...
@@ -2,12 +2,14 @@ package com.neotel.smfcore.core.api;
...
@@ -2,12 +2,14 @@ package com.neotel.smfcore.core.api;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.neotel.smfcore.common.exception.ApiException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.init.MenuInit
;
import
com.neotel.smfcore.common.init.MenuInit
;
import
com.neotel.smfcore.core.api.listener.ISmfApiListener
;
import
com.neotel.smfcore.core.api.listener.ISmfApiListener
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.inList.service.po.InList
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -262,6 +264,20 @@ public class SmfApi {
...
@@ -262,6 +264,20 @@ public class SmfApi {
return
false
;
return
false
;
}
}
public
InList
fetchInList
(
String
number
)
{
if
(
isUrlExist
(
fetchInListUrl
))
{
for
(
ISmfApiListener
apiListener
:
apiListenerList
)
{
if
(
apiListener
.
isForThisApi
(
apiName
))
{
InList
inList
=
apiListener
.
fetchInList
(
fetchInListUrl
,
number
);
if
(
inList
!=
null
)
{
return
inList
;
}
}
}
}
return
null
;
}
public
String
getApiName
(){
public
String
getApiName
(){
return
apiName
;
return
apiName
;
}
}
...
...
src/main/java/com/neotel/smfcore/core/api/listener/BaseSmfApiListener.java
查看文件 @
f90a593
...
@@ -118,6 +118,11 @@ public abstract class BaseSmfApiListener implements ISmfApiListener {
...
@@ -118,6 +118,11 @@ public abstract class BaseSmfApiListener implements ISmfApiListener {
public
boolean
canLogin
(
String
loginCheckUrl
,
String
userName
,
String
pwd
)
throws
ValidateException
{
public
boolean
canLogin
(
String
loginCheckUrl
,
String
userName
,
String
pwd
)
throws
ValidateException
{
return
true
;
return
true
;
}
}
@Override
public
InList
fetchInList
(
String
fetchInListUrl
,
String
number
){
return
null
;
}
protected
String
getData
(
Map
<
String
,
Object
>
dataMap
,
String
dataKey
)
{
protected
String
getData
(
Map
<
String
,
Object
>
dataMap
,
String
dataKey
)
{
Object
data
=
dataMap
.
get
(
dataKey
);
Object
data
=
dataMap
.
get
(
dataKey
);
if
(
data
==
null
)
{
if
(
data
==
null
)
{
...
...
src/main/java/com/neotel/smfcore/core/api/listener/DefaultSmfApiListener.java
查看文件 @
f90a593
...
@@ -197,31 +197,31 @@ public class DefaultSmfApiListener extends BaseSmfApiListener {
...
@@ -197,31 +197,31 @@ public class DefaultSmfApiListener extends BaseSmfApiListener {
}
}
}
}
public
InList
fetchInList
(
String
fetchInListUrl
,
String
number
)
throws
ApiException
{
public
InList
fetchInList
(
String
fetchInListUrl
,
String
number
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"number"
,
number
);
paramMap
.
put
(
"number"
,
number
);
try
{
try
{
log
.
info
(
"调用获取入库单接口,参数"
+
JsonUtil
.
toJsonStr
(
paramMap
));
log
.
info
(
"调用获取入库单接口,参数"
+
JsonUtil
.
toJsonStr
(
paramMap
));
String
result
=
HttpHelper
.
postJson
(
fetchInListUrl
,
paramMap
);
String
result
=
HttpHelper
.
postJson
(
fetchInListUrl
,
paramMap
);
log
.
info
(
number
+
"获取入库单接口返回"
+
result
);
log
.
info
(
number
+
"获取入库单接口返回"
+
result
);
ApiResult
apiResult
=
JsonUtil
.
toObj
(
result
,
ApiResult
.
class
);
ApiResult
apiResult
=
JsonUtil
.
toObj
(
result
,
ApiResult
.
class
);
if
(
apiResult
.
isOk
())
{
if
(
apiResult
.
isOk
())
{
Map
<
String
,
Object
>
dataMap
=
(
Map
<
String
,
Object
>)
apiResult
.
getData
();
Map
<
String
,
Object
>
dataMap
=
(
Map
<
String
,
Object
>)
apiResult
.
getData
();
String
returnNumber
=
dataMap
.
get
(
"number"
).
toString
();
String
returnNumber
=
dataMap
.
get
(
"number"
).
toString
();
InList
inList
=
new
InList
();
InList
inList
=
new
InList
();
inList
.
setName
(
returnNumber
);
inList
.
setName
(
returnNumber
);
List
<
InListItem
>
items
=
new
ArrayList
<>();
List
<
InListItem
>
items
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
itemList
=
(
List
<
Map
<
String
,
Object
>>)
dataMap
.
get
(
"items"
);
List
<
Map
<
String
,
Object
>>
itemList
=
(
List
<
Map
<
String
,
Object
>>)
dataMap
.
get
(
"items"
);
for
(
Map
<
String
,
Object
>
itemMap
:
itemList
)
{
for
(
Map
<
String
,
Object
>
itemMap
:
itemList
)
{
String
partNum
=
itemMap
.
get
(
"partNum"
).
toString
();
String
partNum
=
itemMap
.
get
(
"partNum"
).
toString
();
Object
qtyStr
=
itemMap
.
get
(
"qty"
);
Object
qtyStr
=
itemMap
.
get
(
"qty"
);
Object
reelCountStr
=
itemMap
.
get
(
"reelCount"
);
Object
reelCountStr
=
itemMap
.
get
(
"reelCount"
);
InListItem
item
=
new
InListItem
();
InListItem
item
=
new
InListItem
();
item
.
setPN
(
partNum
);
item
.
setPN
(
partNum
);
if
(
qtyStr
!=
null
&&
!
qtyStr
.
toString
().
isEmpty
())
{
if
(
qtyStr
!=
null
&&
!
qtyStr
.
toString
().
isEmpty
())
{
item
.
setNum
(
Integer
.
valueOf
(
qtyStr
.
toString
()));
item
.
setNum
(
Integer
.
valueOf
(
qtyStr
.
toString
()));
}
}
if
(
reelCountStr
!=
null
&&
!
qtyStr
.
toString
().
isEmpty
())
{
if
(
reelCountStr
!=
null
&&
!
qtyStr
.
toString
().
isEmpty
())
{
item
.
setInReelCount
(
Integer
.
valueOf
(
reelCountStr
.
toString
()));
item
.
setInReelCount
(
Integer
.
valueOf
(
reelCountStr
.
toString
()));
}
}
items
.
add
(
item
);
items
.
add
(
item
);
...
@@ -231,12 +231,12 @@ public class DefaultSmfApiListener extends BaseSmfApiListener {
...
@@ -231,12 +231,12 @@ public class DefaultSmfApiListener extends BaseSmfApiListener {
inList
=
inListManager
.
createWithItems
(
inList
);
inList
=
inListManager
.
createWithItems
(
inList
);
inListCache
.
addInListToMap
(
inList
);
inListCache
.
addInListToMap
(
inList
);
return
inList
;
return
inList
;
}
else
{
}
else
{
throw
new
ApiException
(
"smfcore.fetchInList.ng"
,
"获取入库单MES返回NG:"
+
apiResult
.
getMsg
());
throw
new
ApiException
(
"smfcore.fetchInList.ng"
,
"获取入库单MES返回NG:"
+
apiResult
.
getMsg
());
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
number
+
"获取入库单接口出错:"
+
e
.
getMessage
());
log
.
error
(
number
+
"获取入库单接口出错:"
+
e
.
getMessage
());
throw
new
ApiException
(
"smfcore.fetchInList.error"
,
"获取入库单出错:"
+
e
.
getMessage
())
;
return
null
;
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/api/listener/ISmfApiListener.java
查看文件 @
f90a593
package
com
.
neotel
.
smfcore
.
core
.
api
.
listener
;
package
com
.
neotel
.
smfcore
.
core
.
api
.
listener
;
import
com.neotel.smfcore.common.exception.ApiException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.inList.service.po.InList
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
...
@@ -67,4 +69,7 @@ public interface ISmfApiListener {
...
@@ -67,4 +69,7 @@ public interface ISmfApiListener {
* 是否可以登陆
* 是否可以登陆
*/
*/
boolean
canLogin
(
String
loginCheckUrl
,
String
userName
,
String
pwd
)
throws
ValidateException
;
boolean
canLogin
(
String
loginCheckUrl
,
String
userName
,
String
pwd
)
throws
ValidateException
;
InList
fetchInList
(
String
fetchInListUrl
,
String
number
);
}
}
src/main/java/com/neotel/smfcore/core/barcode/bean/BarcodeRule.java
查看文件 @
f90a593
...
@@ -841,6 +841,8 @@ public class BarcodeRule {
...
@@ -841,6 +841,8 @@ public class BarcodeRule {
rule
=
"EXPDATEyyMMdd[12:0:-1]|BATCH[2:0:-1]|QTY[2:0:-1]|RI[2:0:-1]|PN[1:0:-1]|MPN[-1:0:2]"
;
rule
=
"EXPDATEyyMMdd[12:0:-1]|BATCH[2:0:-1]|QTY[2:0:-1]|RI[2:0:-1]|PN[1:0:-1]|MPN[-1:0:2]"
;
// rule="PN[1:0:-1]|BATCH[2:0:-1]|LOT[2:0:-1]|QTY[2_7Q:0:-1]|RI[1:0:-1]|SP[3:0:-1]|PRODATEyyyyMMdd[2:0:-1]|xxx";
// rule="PN[1:0:-1]|BATCH[2:0:-1]|LOT[2:0:-1]|QTY[2_7Q:0:-1]|RI[1:0:-1]|SP[3:0:-1]|PRODATEyyyyMMdd[2:0:-1]|xxx";
codeStr
=
"41000100883,2329,38M0540150,4341,1,710032329883000188"
;
rule
=
"RI,PRODATEyyWW,PN,QTY,MSL,BATCH"
;
BarcodeRule
br
=
BarcodeRule
.
newRule
(
rule
);
BarcodeRule
br
=
BarcodeRule
.
newRule
(
rule
);
Barcode
b
=
br
.
toCodeBean
(
codeStr
).
getBarcode
();
Barcode
b
=
br
.
toCodeBean
(
codeStr
).
getBarcode
();
if
(
b
!=
null
){
if
(
b
!=
null
){
...
@@ -881,7 +883,7 @@ public class BarcodeRule {
...
@@ -881,7 +883,7 @@ public class BarcodeRule {
}
}
p
rivate
static
String
toCodeRule
(
String
codeStr
,
Map
<
String
,
String
>
fieldValueMap
){
p
ublic
static
String
toCodeRule
(
String
codeStr
,
Map
<
String
,
String
>
fieldValueMap
){
String
separator
=
findSeparator
(
codeStr
);
String
separator
=
findSeparator
(
codeStr
);
String
[]
codeArr
=
new
String
[]{
codeStr
};
String
[]
codeArr
=
new
String
[]{
codeStr
};
if
(!
Strings
.
isNullOrEmpty
(
separator
)){
if
(!
Strings
.
isNullOrEmpty
(
separator
)){
...
...
src/main/java/com/neotel/smfcore/core/barcode/rest/BarcodeController.java
查看文件 @
f90a593
...
@@ -8,15 +8,18 @@ import com.neotel.smfcore.common.exception.ValidateException;
...
@@ -8,15 +8,18 @@ import com.neotel.smfcore.common.exception.ValidateException;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.barcode.bean.BarcodeRule
;
import
com.neotel.smfcore.core.barcode.bean.BarcodeRule
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeRuleDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeRuleDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.mapstruct.BarcodeMapper
;
import
com.neotel.smfcore.core.barcode.rest.bean.mapstruct.BarcodeMapper
;
import
com.neotel.smfcore.core.barcode.rest.bean.query.BarcodeQueryCriteria
;
import
com.neotel.smfcore.core.barcode.rest.bean.query.BarcodeQueryCriteria
;
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.barcode.utils.QrcodeUtils
;
import
com.neotel.smfcore.core.barcode.utils.QrcodeUtils
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.system.service.po.Settings
;
import
com.neotel.smfcore.core.system.service.po.Settings
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.bean.FileProperties
;
import
com.neotel.smfcore.security.bean.FileProperties
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -58,6 +61,9 @@ public class BarcodeController {
...
@@ -58,6 +61,9 @@ public class BarcodeController {
@Autowired
@Autowired
private
final
FileProperties
properties
;
private
final
FileProperties
properties
;
@Autowired
private
CodeResolve
codeResolve
;
@ApiOperation
(
"导出条码数据"
)
@ApiOperation
(
"导出条码数据"
)
@GetMapping
(
value
=
"/download"
)
@GetMapping
(
value
=
"/download"
)
public
void
download
(
HttpServletResponse
response
,
BarcodeQueryCriteria
criteria
)
throws
Exception
{
public
void
download
(
HttpServletResponse
response
,
BarcodeQueryCriteria
criteria
)
throws
Exception
{
...
@@ -181,12 +187,36 @@ public class BarcodeController {
...
@@ -181,12 +187,36 @@ public class BarcodeController {
}
}
/*
@ApiOperation("根据条码信息获取条码规则")
@ApiOperation
(
"根据条码信息获取条码规则"
)
@PostMapping
(
value
=
"getBarcodeRule"
)
@PostMapping
(
value
=
"getBarcodeRule"
)
@AnonymousAccess
public
ResultBean
getBarcodeRule
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
getBarcodeRule
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String ruleStr = BarcodeRule.toCodeRule(paramMap.get("codeStr"), paramMap);
String
codeStr
=
paramMap
.
get
(
"codeStr"
);
paramMap
.
remove
(
"codeStr"
);
String
ruleStr
=
BarcodeRule
.
toCodeRule
(
codeStr
,
paramMap
);
return
ResultBean
.
newOkResult
(
ruleStr
);
return
ResultBean
.
newOkResult
(
ruleStr
);
}*/
}
@ApiOperation
(
"获取条码内容"
)
@PostMapping
(
"/getBarCodeInfo"
)
@AnonymousAccess
public
ResultBean
getBarCodeInfo
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
//获取条码内容
String
codeStr
=
paramMap
.
get
(
"code"
);
List
<
BarcodeRule
>
barcodeRuleList
=
codeResolve
.
getBarcodeRuleList
();
if
(
barcodeRuleList
!=
null
&&
!
barcodeRuleList
.
isEmpty
())
{
for
(
BarcodeRule
barcodeRule
:
barcodeRuleList
)
{
CodeBean
codeBean
=
barcodeRule
.
toCodeBean
(
codeStr
);
if
(
codeBean
.
getBarcode
()
!=
null
)
{
return
ResultBean
.
newOkResult
(
codeBean
.
getBarcode
());
}
}
}
else
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.error.barcode.noRules"
,
"解析规则未定义"
);
}
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.error.barcode.invalid"
,
"未找到有效条码"
);
}
protected
String
handleBarcode
(
String
fileURL
)
throws
Exception
{
protected
String
handleBarcode
(
String
fileURL
)
throws
Exception
{
...
...
src/main/java/com/neotel/smfcore/core/barcode/utils/CodeResolve.java
查看文件 @
f90a593
...
@@ -47,6 +47,11 @@ public class CodeResolve {
...
@@ -47,6 +47,11 @@ public class CodeResolve {
}
}
}
}
}
}
public
List
<
BarcodeRule
>
getBarcodeRuleList
(){
return
barcodeRuleList
;
}
public
void
updateExpiresDay
(
Integer
expiresDay
){
public
void
updateExpiresDay
(
Integer
expiresDay
){
defaultExpiresDay
=
expiresDay
;
defaultExpiresDay
=
expiresDay
;
}
}
...
@@ -202,6 +207,13 @@ public class CodeResolve {
...
@@ -202,6 +207,13 @@ public class CodeResolve {
}
}
}
}
}
}
if
(
produceDate
!=
null
){
barcode
.
setProduceDate
(
produceDate
);
log
.
info
(
"重新设置"
+
codeBeanFromRule
.
getCodeStr
()+
"的过生产日期"
);
needUpdate
=
true
;
}
if
(
barcodeFromRule
.
getExpireDate
()!=
null
/*&&barcode.getExpireDate()==null*/
){
if
(
barcodeFromRule
.
getExpireDate
()!=
null
/*&&barcode.getExpireDate()==null*/
){
barcode
.
setExpireDate
(
barcodeFromRule
.
getExpireDate
());
barcode
.
setExpireDate
(
barcodeFromRule
.
getExpireDate
());
log
.
info
(
"重新设置"
+
codeBeanFromRule
.
getCodeStr
()+
"的过期日期"
);
log
.
info
(
"重新设置"
+
codeBeanFromRule
.
getCodeStr
()+
"的过期日期"
);
...
...
src/main/java/com/neotel/smfcore/
mimo/controller
/SmdBoxMimoController.java
→
src/main/java/com/neotel/smfcore/
core/dashboard/mimo
/SmdBoxMimoController.java
查看文件 @
f90a593
package
com
.
neotel
.
smfcore
.
mimo
.
controller
;
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
mimo
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUnit
;
...
...
src/main/java/com/neotel/smfcore/core/device/bean/MsgInfo.java
0 → 100644
查看文件 @
f90a593
package
com
.
neotel
.
smfcore
.
core
.
device
.
bean
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
MsgInfo
implements
Serializable
{
public
MsgInfo
(
String
msg
,
String
type
){
this
.
msg
=
msg
;
this
.
type
=
type
;
}
/**
* 提示消息
*/
private
String
msg
=
""
;
/**
* 消息类型,INFO,WARNING,ERROR,DATA
*/
private
String
type
;
/**
* 英文提示消息
*/
private
String
msgEn
=
""
;
private
String
msgJp
=
""
;
/**
* 翻译key
*/
private
String
msgKey
=
""
;
/**
* 翻译参数
*/
private
String
[]
msgParam
;
/**
* 报警类型
*/
private
String
alarmType
=
""
;
/**
*报警错误码
*/
private
String
alarmCode
=
""
;
}
src/main/java/com/neotel/smfcore/core/device/bean/NLShelfOperateBean.java
查看文件 @
f90a593
...
@@ -22,6 +22,19 @@ public class NLShelfOperateBean {
...
@@ -22,6 +22,19 @@ public class NLShelfOperateBean {
*/
*/
private
String
nextPosId
;
private
String
nextPosId
;
/**
* 上一个库位的Id,用于自动推荐库位
*/
private
String
lastPosId
;
public
String
getLastPosId
()
{
return
lastPosId
;
}
public
void
setLastPosId
(
String
lastPosId
)
{
updateOpTime
();
this
.
lastPosId
=
lastPosId
;
}
public
StoragePos
getOpPos
()
{
public
StoragePos
getOpPos
()
{
return
opPos
;
return
opPos
;
...
...
src/main/java/com/neotel/smfcore/core/device/bean/StatusBean.java
查看文件 @
f90a593
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
查看文件 @
f90a593
...
@@ -324,13 +324,15 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -324,13 +324,15 @@ public class BaseDeviceHandler implements IDeviceHandler {
serverExceptions
.
remove
(
storage
.
getCid
());
serverExceptions
.
remove
(
storage
.
getCid
());
}
catch
(
ValidateException
e
)
{
}
catch
(
ValidateException
e
)
{
String
msgEn
=
MessageUtils
.
getText
(
e
.
getMsgKey
(),
e
.
getMsgParam
(),
new
Locale
(
"en"
,
"US"
),
e
.
getMessage
());
// String msgEn = MessageUtils.getText(e.getMsgKey(), e.getMsgParam(), new Locale("en","US"), e.getMessage());
String
msgJp
=
MessageUtils
.
getText
(
e
.
getMsgKey
(),
e
.
getMsgParam
(),
new
Locale
(
"ja"
,
"JP"
),
e
.
getMessage
());
// String msgJp = MessageUtils.getText(e.getMsgKey(), e.getMsgParam(), new Locale("ja","JP"), e.getMessage());
log
.
warn
(
statusBean
.
getCode
()
+
"入库到"
+
storage
.
getCid
()
+
"失败:"
+
e
.
getMessage
()+
","
+
msgEn
+
","
+
msgJp
);
// log.warn(statusBean.getCode() + "入库到" + storage.getCid() + "失败:" + e.getMessage()+","+msgEn+","+msgJp);
statusBean
.
setMsg
(
e
.
getMessage
());
// statusBean.setMsg(e.getMessage());
statusBean
.
setMsgCode
(
e
.
getMsgKey
());
// statusBean.setMsgCode(e.getMsgKey());
statusBean
.
setMsgEn
(
msgEn
);
// statusBean.setMsgEn(msgEn);
statusBean
.
setMsgJp
(
msgJp
);
// statusBean.setMsgJp(msgJp);
statusBean
.
setRMsg
(
e
.
getMsgKey
(),
e
.
getMsgParam
(),
e
.
getMessage
());
log
.
warn
(
statusBean
.
getCode
()
+
"入库到"
+
storage
.
getCid
()
+
"失败:"
+
e
.
getMessage
()+
","
+
statusBean
.
getMsg
()+
","
+
statusBean
.
getMsgEn
()+
","
+
statusBean
.
getMsgJp
());
serverExceptions
.
put
(
storage
.
getCid
(),
e
);
serverExceptions
.
put
(
storage
.
getCid
(),
e
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
statusBean
.
getCode
()
+
"入库到"
+
storage
.
getCid
()
+
"失败"
,
e
);
log
.
error
(
statusBean
.
getCode
()
+
"入库到"
+
storage
.
getCid
()
+
"失败"
,
e
);
...
@@ -841,25 +843,39 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -841,25 +843,39 @@ public class BaseDeviceHandler implements IDeviceHandler {
protected
void
handleMsg
(
StatusBean
statusBean
)
{
protected
void
handleMsg
(
StatusBean
statusBean
)
{
try
{
try
{
//转换为新格式
statusBean
.
MsgDataProcess
();
//判断是否刚刚上线
//判断是否刚刚上线
StatusBean
bean
=
DevicesStatusUtil
.
getStatusBean
(
statusBean
.
getCid
());
StatusBean
bean
=
DevicesStatusUtil
.
getStatusBean
(
statusBean
.
getCid
());
if
(
bean
==
null
||
bean
.
getBoxStatus
()
==
null
)
{
if
(
bean
==
null
||
bean
.
getBoxStatus
()
==
null
)
{
DeviceMessageUtil
.
addOnlineMessage
(
statusBean
.
getCid
(),
""
,
statusBean
.
getClientIp
());
DeviceMessageUtil
.
addOnlineMessage
(
statusBean
.
getCid
(),
""
,
statusBean
.
getClientIp
());
DevicesStatusUtil
.
updateClientMsg
(
statusBean
.
getCid
(),
""
,
""
,
""
,
""
,
null
);
DevicesStatusUtil
.
updateClientMsg
(
statusBean
.
getCid
(),
new
ArrayList
<>()
);
}
else
if
(
bean
.
timeOut
()
&&
(
bean
.
getOfflineTime
()
>
-
1
))
{
}
else
if
(
bean
.
timeOut
()
&&
(
bean
.
getOfflineTime
()
>
-
1
))
{
DeviceMessageUtil
.
addOnlineMessage
(
statusBean
.
getCid
(),
""
,
statusBean
.
getClientIp
());
DeviceMessageUtil
.
addOnlineMessage
(
statusBean
.
getCid
(),
""
,
statusBean
.
getClientIp
());
DevicesStatusUtil
.
updateClientMsg
(
statusBean
.
getCid
(),
""
,
""
,
""
,
""
,
null
);
DevicesStatusUtil
.
updateClientMsg
(
statusBean
.
getCid
(),
new
ArrayList
<>()
);
}
}
if
(
ObjectUtil
.
isNotEmpty
(
statusBean
.
msgList
)&&
statusBean
.
msgList
.
size
()>
0
)
{
//展示到界面
DevicesStatusUtil
.
updateClientMsg
(
statusBean
.
getCid
(),
statusBean
.
msgList
);
String
msg
=
statusBean
.
getMsg
();
String
msgEn
=
statusBean
.
getMsgEn
();
String
msgCode
=
statusBean
.
getMsgCode
();
String
msgJp
=
statusBean
.
getMsgJp
();
if
(
ObjectUtil
.
isNotEmpty
(
msg
)||
ObjectUtil
.
isNotEmpty
(
msgCode
))
{
DevicesStatusUtil
.
updateClientMsg
(
statusBean
.
getCid
(),
msgCode
,
msg
,
msgEn
,
msgJp
,
statusBean
.
getMsgParam
());
}
}
// //判断是否刚刚上线
// StatusBean bean = DevicesStatusUtil.getStatusBean(statusBean.getCid());
// if (bean == null || bean.getBoxStatus() == null) {
// DeviceMessageUtil.addOnlineMessage(statusBean.getCid(), "",statusBean.getClientIp());
// DevicesStatusUtil.updateClientMsg(statusBean.getCid(), "", "", "","", null);
// } else if (bean.timeOut() && (bean.getOfflineTime() > -1)) {
// DeviceMessageUtil.addOnlineMessage(statusBean.getCid(), "",statusBean.getClientIp());
// DevicesStatusUtil.updateClientMsg(statusBean.getCid(), "", "", "","", null);
// }
//
// //展示到界面
// String msg = statusBean.getMsg();
// String msgEn = statusBean.getMsgEn();
// String msgCode = statusBean.getMsgCode();
// String msgJp=statusBean.getMsgJp();
//
// if(ObjectUtil.isNotEmpty(msg)||ObjectUtil.isNotEmpty(msgCode)) {
// DevicesStatusUtil.updateClientMsg(statusBean.getCid(), msgCode, msg, msgEn, msgJp,statusBean.getMsgParam());
// }
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"客户端故障消息处理出错"
,
e
);
log
.
error
(
"客户端故障消息处理出错"
,
e
);
}
}
...
@@ -946,7 +962,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -946,7 +962,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
boolean
isFind
=
false
;
boolean
isFind
=
false
;
for
(
DataLog
dataLog
:
dataLogList
)
{
for
(
DataLog
dataLog
:
dataLogList
)
{
if
(
dataLog
.
getStatus
().
equals
(
OP_STATUS
.
EXECUTING
))
{
if
(
dataLog
.
getStatus
().
equals
(
OP_STATUS
.
EXECUTING
.
name
()
))
{
dataLogs
.
add
(
dataLog
);
dataLogs
.
add
(
dataLog
);
isFind
=
true
;
isFind
=
true
;
break
;
break
;
...
@@ -963,7 +979,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -963,7 +979,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
}
}
for
(
LiteOrderItem
item
:
order
.
getOrderItems
())
{
for
(
LiteOrderItem
item
:
order
.
getOrderItems
())
{
for
(
DataLog
dataLog
:
dataLogList
)
{
for
(
DataLog
dataLog
:
dataLogList
)
{
if
(
dataLog
.
getStatus
().
equals
(
OP_STATUS
.
WAIT
))
{
if
(
dataLog
.
getStatus
().
equals
(
OP_STATUS
.
WAIT
.
name
()
))
{
if
((
ObjectUtil
.
isNotEmpty
(
item
.
getPn
())
&&
item
.
getPn
().
equals
(
dataLog
.
getPartNumber
()))
||
if
((
ObjectUtil
.
isNotEmpty
(
item
.
getPn
())
&&
item
.
getPn
().
equals
(
dataLog
.
getPartNumber
()))
||
(
ObjectUtil
.
isNotEmpty
(
item
.
getRi
())
&&
item
.
getRi
().
equals
(
dataLog
.
getBarcode
()))
(
ObjectUtil
.
isNotEmpty
(
item
.
getRi
())
&&
item
.
getRi
().
equals
(
dataLog
.
getBarcode
()))
)
{
)
{
...
@@ -977,9 +993,9 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -977,9 +993,9 @@ public class BaseDeviceHandler implements IDeviceHandler {
break
;
break
;
}
}
}
}
}
if
(
isFind
)
{
if
(
isFind
)
{
break
;
break
;
}
}
}
}
}
return
dataLogs
;
return
dataLogs
;
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLShelfHandler.java
查看文件 @
f90a593
...
@@ -5,6 +5,7 @@ import com.google.common.base.Strings;
...
@@ -5,6 +5,7 @@ import com.google.common.base.Strings;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
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.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.bean.NLShelfOperateBean
;
import
com.neotel.smfcore.core.device.bean.NLShelfOperateBean
;
...
@@ -86,34 +87,42 @@ public class NLShelfHandler extends BaseDeviceHandler {
...
@@ -86,34 +87,42 @@ public class NLShelfHandler extends BaseDeviceHandler {
//亮灯
//亮灯
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
(
statusBean
.
getCid
());
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
(
statusBean
.
getCid
());
for
(
DataLog
queueTask
:
queueTasks
)
{
for
(
DataLog
queueTask
:
queueTasks
)
{
if
(
queueTask
.
isWait
())
{
if
(!
openZhiYin
||
StringUtils
.
isBlank
(
queueTask
.
getSourceId
()))
{
queueTask
.
setStatus
(
OP_STATUS
.
EXECUTING
.
name
());
if
(
queueTask
.
isWait
())
{
taskService
.
updateQueueTask
(
queueTask
);
String
rgb
=
queueTask
.
getLightColor
();
String
rgb
=
queueTask
.
getLightColor
();
ORDER_COLOR
color
=
ORDER_COLOR
.
fromRgb
(
rgb
);
ORDER_COLOR
color
=
ORDER_COLOR
.
fromRgb
(
rgb
);
if
(
color
==
null
)
{
if
(
color
==
null
)
{
if
(
queueTask
.
isPutInTask
())
{
if
(
queueTask
.
isPutInTask
())
{
color
=
ORDER_COLOR
.
DARKGREEN
;
color
=
ORDER_COLOR
.
DARKGREEN
;
}
else
{
}
else
if
(
openZhiYin
&&
ObjectUtil
.
isNotEmpty
(
queueTask
.
getSourceId
()))
{
color
=
ORDER_COLOR
.
BLUE
;
List
<
DataLog
>
dataLogList
=
outMap
.
get
(
queueTask
.
getSourceId
());
if
(
dataLogList
==
null
)
{
dataLogList
=
new
ArrayList
<>();
}
}
dataLogList
.
add
(
queueTask
);
outMap
.
put
(
queueTask
.
getSourceId
(),
dataLogList
);
}
else
{
color
=
ORDER_COLOR
.
BLUE
;
}
}
queueTask
.
setStatus
(
OP_STATUS
.
EXECUTING
.
name
());
taskService
.
updateQueueTask
(
queueTask
);
statusBean
.
addData
(
"open"
,
queueTask
.
getPosName
()
+
"="
+
color
.
name
());
log
.
info
(
"库位["
+
queueTask
.
getPosName
()
+
"]["
+
queueTask
.
getType
()
+
"]+亮灯:"
+
color
.
name
());
}
}
else
{
if
(
queueTask
.
isWait
()
||
queueTask
.
isExecuting
())
{
List
<
DataLog
>
dataLogList
=
outMap
.
get
(
queueTask
.
getSourceId
());
if
(
dataLogList
==
null
)
{
dataLogList
=
new
ArrayList
<>();
}
dataLogList
.
add
(
queueTask
);
outMap
.
put
(
queueTask
.
getSourceId
(),
dataLogList
);
}
}
statusBean
.
addData
(
"open"
,
queueTask
.
getPosName
()+
"="
+
color
.
name
());
log
.
info
(
"库位["
+
queueTask
.
getPosName
()
+
"]["
+
queueTask
.
getType
()+
"]+亮灯:"
+
color
.
name
());
}
}
}
}
List
<
DataLog
>
dataLogs
=
getLightGuideTask
(
outMap
);
List
<
DataLog
>
dataLogs
=
getLightGuideTask
(
outMap
);
for
(
DataLog
task
:
dataLogs
)
{
for
(
DataLog
task
:
dataLogs
)
{
statusBean
.
addData
(
"open"
,
task
.
getPosName
()
+
"="
+
ORDER_COLOR
.
fromRgb
(
task
.
getLightColor
()).
name
());
String
colorName
=
ORDER_COLOR
.
fromRgb
(
task
.
getLightColor
()).
name
();
statusBean
.
addData
(
"open"
,
task
.
getPosName
()
+
"="
+
colorName
);
log
.
info
(
"库位["
+
task
.
getPosName
()
+
"]["
+
task
.
getType
()
+
"]+亮灯:"
+
colorName
);
}
}
return
statusBean
;
return
statusBean
;
}
}
...
@@ -314,6 +323,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
...
@@ -314,6 +323,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
NLShelfOperateBean
operateBean
=
getOperateBean
(
token
);
NLShelfOperateBean
operateBean
=
getOperateBean
(
token
);
operateBean
.
setOpPos
(
pos
);
operateBean
.
setOpPos
(
pos
);
operateBean
.
setPosToClose
(
pos
);
operateBean
.
setPosToClose
(
pos
);
operateBean
.
setLastPosId
(
pos
.
getId
());
shelfPutInBeanMap
.
put
(
token
,
operateBean
);
shelfPutInBeanMap
.
put
(
token
,
operateBean
);
log
.
info
(
ptoken
+
":库位["
+
pos
.
getPosName
()
+
"]操作成功,请扫描要放入的物料"
);
log
.
info
(
ptoken
+
":库位["
+
pos
.
getPosName
()
+
"]操作成功,请扫描要放入的物料"
);
return
ResultBean
.
newOkResult
(
"smfcore.shelf.msg.tipScanReel"
,
"库位["
+
pos
.
getPosName
()
+
"]操作成功,请扫描要放入的物料"
,
new
String
[]{
pos
.
getPosName
()},
pos
.
getPosName
());
return
ResultBean
.
newOkResult
(
"smfcore.shelf.msg.tipScanReel"
,
"库位["
+
pos
.
getPosName
()
+
"]操作成功,请扫描要放入的物料"
,
new
String
[]{
pos
.
getPosName
()},
pos
.
getPosName
());
...
@@ -412,10 +422,40 @@ public class NLShelfHandler extends BaseDeviceHandler {
...
@@ -412,10 +422,40 @@ public class NLShelfHandler extends BaseDeviceHandler {
NLShelfOperateBean
operateBean
=
getOperateBean
(
token
);
NLShelfOperateBean
operateBean
=
getOperateBean
(
token
);
StoragePos
opPos
=
operateBean
.
getOpPos
();
StoragePos
opPos
=
operateBean
.
getOpPos
();
if
(
opPos
==
null
)
{
if
(
opPos
==
null
)
{
//未扫描库位
String
lastPosId
=
operateBean
.
getLastPosId
();
log
.
info
(
ptoken
+
":条码["
+
code
+
"],请先扫描库位码"
);
if
(
StringUtils
.
isBlank
(
lastPosId
)){
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.shelf.msg.scanPos"
,
"请先扫描库位码"
);
//未扫描库位
}
else
{
log
.
info
(
ptoken
+
":条码["
+
code
+
"],请先扫描库位码"
);
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.shelf.msg.scanPos"
,
"请先扫描库位码"
);
}
else
{
long
updateTime
=
operateBean
.
getUpdateTime
();
if
(
System
.
currentTimeMillis
()
-
updateTime
>
1000
*
60
*
5
){
log
.
info
(
"上一次操作超过10分钟,重新扫描库位码"
);
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.shelf.msg.scanPos"
,
"请先扫描库位码"
);
}
}
Long
nextPosId
=
Long
.
valueOf
(
lastPosId
)
+
1
;
StoragePos
nextPos
=
storagePosManager
.
get
(
String
.
valueOf
(
nextPosId
));
if
(
nextPos
!=
null
){
Collection
<
String
>
excludePosIds
=
taskService
.
excludePosIds
();
if
(
excludePosIds
.
contains
(
nextPos
.
getId
())){
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.shelf.nextPos.hasTask"
,
"库位[{0}]已有任务,请重新扫描库位码"
,
new
String
[]{
nextPos
.
getPosName
()});
}
//先关闭上一个库位
StoragePos
posToClose
=
operateBean
.
getPosToClose
();
if
(
posToClose
!=
null
){
opPosLight
(
"close"
,
posToClose
,
""
);
}
opPos
=
nextPos
;
openAndCloseLights
(
token
,
opPos
,
putInColor
,
delayCloseTime
);
operateBean
.
setOpPos
(
opPos
);
operateBean
.
setPosToClose
(
opPos
);
operateBean
.
setLastPosId
(
opPos
.
getId
());
shelfPutInBeanMap
.
put
(
token
,
operateBean
);
}
}
if
(
opPos
!=
null
){
Storage
currentStorage
=
dataCache
.
getStorageById
(
opPos
.
getStorageId
());
Storage
currentStorage
=
dataCache
.
getStorageById
(
opPos
.
getStorageId
());
//入库单验证
//入库单验证
ResultBean
resultBean
=
inListCache
.
inListValidate
(
currentStorage
.
getInListName
(),
barcode
.
getPartNumber
()
);
ResultBean
resultBean
=
inListCache
.
inListValidate
(
currentStorage
.
getInListName
(),
barcode
.
getPartNumber
()
);
...
@@ -438,6 +478,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
...
@@ -438,6 +478,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
log
.
error
(
"Error:"
+
e
.
getMessage
());
log
.
error
(
"Error:"
+
e
.
getMessage
());
return
ResultBean
.
newErrorResult
(
1
,
e
.
getMessage
(),
e
.
getMessage
(),
e
.
getMsgParam
());
return
ResultBean
.
newErrorResult
(
1
,
e
.
getMessage
(),
e
.
getMessage
(),
e
.
getMsgParam
());
}
}
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.shelf.msg.scanPos"
,
"请先扫描库位码"
);
}
}
/**
/**
...
...
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
查看文件 @
f90a593
package
com
.
neotel
.
smfcore
.
core
.
device
.
rest
;
package
com
.
neotel
.
smfcore
.
core
.
device
.
rest
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.base.Strings
;
import
com.google.common.base.Strings
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
...
@@ -11,9 +12,13 @@ import com.neotel.smfcore.common.exception.ValidateException;
...
@@ -11,9 +12,13 @@ import com.neotel.smfcore.common.exception.ValidateException;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
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.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Component
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.bean.PosInfo
;
import
com.neotel.smfcore.core.device.bean.PosInfo
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
...
@@ -63,6 +68,12 @@ public class DeviceController {
...
@@ -63,6 +68,12 @@ public class DeviceController {
@Autowired
@Autowired
private
IStoragePosManager
storagePosManager
;
private
IStoragePosManager
storagePosManager
;
@Autowired
private
IComponentManager
componentManager
;
@Autowired
private
IBarcodeManager
barcodeManager
;
/**
/**
* 权限验证API列表
* 权限验证API列表
*/
*/
...
@@ -629,4 +640,167 @@ public class DeviceController {
...
@@ -629,4 +640,167 @@ public class DeviceController {
data
.
put
(
"plateH"
,
pos
.
getBarcode
().
getHeight
()
+
""
);
data
.
put
(
"plateH"
,
pos
.
getBarcode
().
getHeight
()
+
""
);
return
ResultBean
.
newOkResult
(
data
);
return
ResultBean
.
newOkResult
(
data
);
}
}
@ApiOperation
(
"根据条码返回尺寸信息"
)
@RequestMapping
(
"/service/store/getHeightandWidthByCode"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
getHeightandWidthByCode
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
code
=
paramMap
.
get
(
"code"
);
if
(
StringUtils
.
isNotBlank
(
code
))
{
Barcode
barcode
=
codeResolve
.
resolveCode
(
code
);
if
(
barcode
!=
null
)
{
String
partNumber
=
barcode
.
getPartNumber
();
Component
component
=
componentManager
.
findOneByPN
(
partNumber
);
if
(
component
!=
null
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"partNumber"
,
partNumber
);
resultMap
.
put
(
"plateSize"
,
component
.
getPlateSize
());
resultMap
.
put
(
"height"
,
component
.
getHeight
());
return
ResultBean
.
newOkResult
(
resultMap
);
}
}
}
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueNotExist"
,
"{0}[{1}]不存在"
,
new
String
[]{
"commpont"
,
code
});
}
@ApiOperation
(
"获取需要移动的库位是否有料"
)
@RequestMapping
(
"/service/store/needMovePosHasReel"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
needMovePosHasReel
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
checkOutPosName
=
paramMap
.
get
(
"checkOutPosName"
);
String
needMovePosName
=
paramMap
.
get
(
"needMovePosName"
);
log
.
info
(
"出库的库位为:"
+
checkOutPosName
+
",需要移动的库位为:"
+
needMovePosName
);
StoragePos
checkOutPos
=
storagePosManager
.
getByPosName
(
checkOutPosName
);
if
(
checkOutPos
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueNotExist"
,
"{0}[{1}]不存在"
,
new
String
[]{
"posName"
,
checkOutPosName
});
}
StoragePos
needMovePos
=
storagePosManager
.
getByPosName
(
needMovePosName
);
if
(
needMovePos
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueNotExist"
,
"{0}[{1}]不存在"
,
new
String
[]{
"posName"
,
needMovePosName
});
}
//如果barcode不为空,则提前锁定目标库位
boolean
hasReel
=
true
;
Barcode
barcode
=
needMovePos
.
getBarcode
();
if
(
barcode
!=
null
)
{
Storage
storage
=
dataCache
.
getStorageById
(
checkOutPos
.
getStorageId
());
ReelLockPosInfo
reelLocInfo
=
new
ReelLockPosInfo
();
reelLocInfo
.
setBarcode
(
barcode
.
getBarcode
());
reelLocInfo
.
setCid
(
storage
.
getCid
());
reelLocInfo
.
setLockPosName
(
checkOutPos
.
getPosName
());
reelLocInfo
.
setLockPosId
(
checkOutPos
.
getId
());
ReelLockPosUtil
.
addReelLockPosInfo
(
reelLocInfo
,
Arrays
.
asList
(
storage
.
getCid
()));
log
.
info
(
"提前锁定库位:"
+
checkOutPos
.
getPosName
()
+
",barcode为:"
+
barcode
.
getBarcode
());
}
else
{
hasReel
=
false
;
}
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"hasReel"
,
hasReel
);
if
(
hasReel
){
resultMap
.
put
(
"barcode"
,
barcode
.
getBarcode
());
resultMap
.
put
(
"partNumber"
,
barcode
.
getPartNumber
());
}
return
ResultBean
.
newOkResult
(
resultMap
);
}
@ApiOperation
(
"移动物料到另外一个库位"
)
@RequestMapping
(
"/service/store/moveToOtherPos"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
moveToOtherPos
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
needMovePosName
=
paramMap
.
get
(
"needMovePosName"
);
//需要移动的库位
String
targetPosName
=
paramMap
.
get
(
"targetPosName"
);
//目标库位
log
.
info
(
"需要移动的库位为:"
+
needMovePosName
+
",目标库位为:"
+
targetPosName
);
//判断有没有物料
StoragePos
needMovePos
=
storagePosManager
.
getByPosName
(
needMovePosName
);
Barcode
barcode
=
needMovePos
.
getBarcode
();
if
(
barcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueNotExist"
,
"{0}[{1}]不存在"
,
new
String
[]{
needMovePosName
,
"barcode"
});
}
//生成一条出库任务
taskService
.
addTaskToFinished
(
needMovePos
,
barcode
,
"admin-move"
);
//判断目标库位是否存在
StoragePos
targetPos
=
storagePosManager
.
getByPosName
(
targetPosName
);
if
(
targetPos
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueNotExist"
,
"{0}[{1}]不存在"
,
new
String
[]{
"posName"
,
targetPosName
});
}
taskService
.
addTaskToFinished
(
targetPos
,
barcode
,
"admin-move"
);
ReelLockPosUtil
.
removeReelLockPosInfo
(
barcode
.
getBarcode
());
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"取消任务,禁用库位"
)
@RequestMapping
(
value
=
"/service/store/cancelAndDisable"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
cancelAndDisable
(
HttpServletRequest
request
)
{
String
posName
=
request
.
getParameter
(
"posName"
);
if
(
StringUtils
.
isNotBlank
(
posName
))
{
DataLog
task
=
null
;
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
dataLog
:
allTasks
)
{
if
(
posName
.
equals
(
dataLog
.
getPosName
())
&&
dataLog
.
isCheckOutTask
()
&&
!
dataLog
.
isFinished
())
{
task
=
dataLog
;
break
;
}
}
if
(
task
!=
null
)
{
boolean
result
=
taskService
.
cancelTask
(
task
.
getId
());
if
(
result
)
{
StoragePos
pos
=
storagePosManager
.
getByPosName
(
posName
);
if
(
pos
!=
null
)
{
pos
.
setEnabled
(
false
);
storagePosManager
.
save
(
pos
);
dataCache
.
updateDisablePos
(
pos
);
log
.
info
(
"任务["
+
task
.
getId
()
+
"] posName["
+
task
.
getPosName
()
+
"] Reel Id["
+
task
.
getBarcode
()
+
"]取消成功,禁用库位["
+
task
.
getPosName
()
+
"]"
);
DeviceMessageUtil
.
addEnabledPosMessage
(
pos
,
SecurityUtils
.
getCurrentUsername
());
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
if
(
storage
!=
null
)
{
dataCache
.
reloadStorage
(
storage
,
""
);
}
}
return
ResultBean
.
newOkResult
(
""
);
}
}
else
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.task.notExist"
,
"Task does not exist"
);
}
}
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.cancelOutTask.fail"
,
"客户端取消入库任务[{0}]失败:{1}"
,
new
String
[]{
posName
,
""
});
}
@ApiOperation
(
"修改barcode数量"
)
@RequestMapping
(
"/service/store/updateAmount"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
updateAmount
(
HttpServletRequest
request
)
{
String
barcodeStr
=
request
.
getParameter
(
"barcode"
);
String
amountStr
=
request
.
getParameter
(
"amount"
);
log
.
info
(
barcodeStr
+
"修改数量为:"
+
amountStr
);
//1.判断物料是否存在
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
barcodeStr
);
if
(
barcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueNotExist"
,
"{0}[{1}]不存在"
,
new
String
[]{
"barcode"
,
barcodeStr
});
}
int
amount
=
NumberUtil
.
parseInt
(
amountStr
);
log
.
info
(
barcodeStr
+
"当前数量为:"
+
barcode
.
getAmount
()
+
",新的数量为:"
+
amount
);
barcode
.
setAmount
(
amount
);
barcodeManager
.
save
(
barcode
);
return
ResultBean
.
newOkResult
(
barcode
);
}
}
}
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
查看文件 @
f90a593
...
@@ -129,7 +129,10 @@ public class DataCache {
...
@@ -129,7 +129,10 @@ public class DataCache {
cacheMap
=
Maps
.
newConcurrentMap
();
cacheMap
=
Maps
.
newConcurrentMap
();
List
<
CacheItem
>
all
=
cacheItemDao
.
findAll
();
List
<
CacheItem
>
all
=
cacheItemDao
.
findAll
();
for
(
CacheItem
cacheItem
:
all
)
{
for
(
CacheItem
cacheItem
:
all
)
{
cacheMap
.
put
(
cacheItem
.
getCacheKey
(),
cacheItem
.
getCacheValue
());
Object
cacheValue
=
cacheItem
.
getCacheValue
();
if
(
cacheValue
!=
null
)
{
cacheMap
.
put
(
cacheItem
.
getCacheKey
(),
cacheItem
.
getCacheValue
());
}
}
}
if
(
cacheMap
.
get
(
Constants
.
CACHE_StopOut
)
==
null
)
{
if
(
cacheMap
.
get
(
Constants
.
CACHE_StopOut
)
==
null
)
{
updateCache
(
Constants
.
CACHE_StopOut
,
false
);
updateCache
(
Constants
.
CACHE_StopOut
,
false
);
...
@@ -176,7 +179,9 @@ public class DataCache {
...
@@ -176,7 +179,9 @@ public class DataCache {
*/
*/
public
void
updateCache
(
String
cacheKey
,
Object
value
)
{
public
void
updateCache
(
String
cacheKey
,
Object
value
)
{
cacheItemDao
.
updateCacheItem
(
cacheKey
,
value
);
cacheItemDao
.
updateCacheItem
(
cacheKey
,
value
);
cacheMap
.
put
(
cacheKey
,
value
);
if
(
value
!=
null
){
cacheMap
.
put
(
cacheKey
,
value
);
}
if
(
cacheKey
.
equals
(
Constants
.
CACHE_CodeRule
))
{
if
(
cacheKey
.
equals
(
Constants
.
CACHE_CodeRule
))
{
List
<
String
>
ruleList
=
(
List
<
String
>)
value
;
List
<
String
>
ruleList
=
(
List
<
String
>)
value
;
codeResolve
.
updateBarcodeRuleList
(
ruleList
);
codeResolve
.
updateBarcodeRuleList
(
ruleList
);
...
...
src/main/java/com/neotel/smfcore/core/inList/rest/InListController.java
查看文件 @
f90a593
...
@@ -9,6 +9,7 @@ import com.neotel.smfcore.common.csv.CsvReader;
...
@@ -9,6 +9,7 @@ import com.neotel.smfcore.common.csv.CsvReader;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.inList.enums.INLIST_STATUS
;
import
com.neotel.smfcore.core.inList.enums.INLIST_STATUS
;
import
com.neotel.smfcore.core.inList.rest.bean.dto.InListDto
;
import
com.neotel.smfcore.core.inList.rest.bean.dto.InListDto
;
...
@@ -73,6 +74,9 @@ public class InListController {
...
@@ -73,6 +74,9 @@ public class InListController {
@Autowired
@Autowired
private
IStorageManager
storageManager
;
private
IStorageManager
storageManager
;
@Autowired
private
SmfApi
smfApi
;
@ApiOperation
(
"上传入库单"
)
@ApiOperation
(
"上传入库单"
)
@PostMapping
(
value
=
"/upload"
)
@PostMapping
(
value
=
"/upload"
)
@AnonymousAccess
@AnonymousAccess
...
@@ -187,13 +191,17 @@ public class InListController {
...
@@ -187,13 +191,17 @@ public class InListController {
String
inListName
=
params
.
get
(
"inListName"
);
String
inListName
=
params
.
get
(
"inListName"
);
String
storageId
=
params
.
get
(
"storageId"
);
String
storageId
=
params
.
get
(
"storageId"
);
String
groupId
=
params
.
get
(
"groupId"
);
String
groupId
=
params
.
get
(
"groupId"
);
if
(
ObjectUtil
.
isEmpty
(
inListName
)){
InList
inList
=
null
;
if
(
ObjectUtil
.
isEmpty
(
inListName
))
{
}
}
else
{
else
{
inList
=
inListCache
.
getInList
(
inListName
);
InList
inList
=
inListCache
.
getInList
(
inListName
);
if
(
inList
==
null
)
{
if
(
inList
==
null
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.inlist.notFound"
,
"未找到入库单[{0}]"
,
new
String
[]{
inListName
});
//如果入库单为空的话,调用api获取
inList
=
smfApi
.
fetchInList
(
inListName
);
if
(
inList
==
null
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.inlist.notFound"
,
"未找到入库单[{0}]"
,
new
String
[]{
inListName
});
}
}
}
if
(
inList
.
getStatus
()
==
INLIST_STATUS
.
OK
)
{
if
(
inList
.
getStatus
()
==
INLIST_STATUS
.
OK
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.inlist.listOk"
,
"入库单[{0}]已完成"
,
new
String
[]{
inListName
});
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.inlist.listOk"
,
"入库单[{0}]已完成"
,
new
String
[]{
inListName
});
...
@@ -206,11 +214,11 @@ public class InListController {
...
@@ -206,11 +214,11 @@ public class InListController {
for
(
String
cid
:
cidList
)
{
for
(
String
cid
:
cidList
)
{
Storage
storage
=
dataCache
.
getStorage
(
cid
);
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
!=
null
)
{
if
(
storage
!=
null
)
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
,
DeviceType
.
NLS
}))
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
,
DeviceType
.
NLS
}))
{
storage
.
setInListName
(
inListName
);
storage
.
setInListName
(
inListName
);
log
.
info
(
"设置组["
+
groupId
+
"]料架["
+
storage
.
getName
()
+
"]的入库单为:["
+
inListName
+
"]"
);
log
.
info
(
"设置组["
+
groupId
+
"]料架["
+
storage
.
getName
()
+
"]的入库单为:["
+
inListName
+
"]"
);
storageManager
.
save
(
storage
);
storageManager
.
save
(
storage
);
dataCache
.
reloadStorage
(
storage
,
""
);
dataCache
.
reloadStorage
(
storage
,
""
);
}
}
}
}
...
@@ -218,15 +226,15 @@ public class InListController {
...
@@ -218,15 +226,15 @@ public class InListController {
}
else
{
}
else
{
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
)
{
if
(
storage
!=
null
)
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
,
DeviceType
.
NLS
}))
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
,
DeviceType
.
NLS
}))
{
storage
.
setInListName
(
inListName
);
storage
.
setInListName
(
inListName
);
log
.
info
(
"设置料架["
+
storage
.
getName
()
+
"]的入库单为:["
+
inListName
+
"]"
);
log
.
info
(
"设置料架["
+
storage
.
getName
()
+
"]的入库单为:["
+
inListName
+
"]"
);
storageManager
.
save
(
storage
);
storageManager
.
save
(
storage
);
dataCache
.
reloadStorage
(
storage
,
""
);
dataCache
.
reloadStorage
(
storage
,
""
);
}
}
}
}
}
}
return
ResultBean
.
newOkResult
(
"smfcore.inlist.setOk"
,
"设置成功"
);
return
ResultBean
.
newOkResult
(
inListMapper
.
toDto
(
inList
)
);
}
}
@ApiOperation
(
"下载入库单模板"
)
@ApiOperation
(
"下载入库单模板"
)
...
...
src/main/java/com/neotel/smfcore/core/inList/service/po/InListItem.java
查看文件 @
f90a593
...
@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
...
@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
@Data
@Data
@Document
@Document
...
@@ -58,12 +59,14 @@ public class InListItem extends BasePo implements Serializable {
...
@@ -58,12 +59,14 @@ public class InListItem extends BasePo implements Serializable {
private
List
<
ItemReelInfo
>
reelLists
;
private
List
<
ItemReelInfo
>
reelLists
;
public
void
addReelInfo
(
ItemReelInfo
reelInfo
){
public
void
addReelInfo
(
ItemReelInfo
reelInfo
){
if
(
ObjectUtil
.
isEmpty
(
ri
)){
if
(
ObjectUtil
.
isEmpty
(
ri
)){
inNum
+=
reelInfo
.
getInNum
();
inNum
+=
reelInfo
.
getInNum
();
}
else
{
}
else
{
inNum
=
num
;
inNum
=
num
;
}
}
if
(
reelLists
==
null
){
reelLists
=
new
ArrayList
<>();
}
reelLists
.
add
(
reelInfo
);
reelLists
.
add
(
reelInfo
);
inReelCount
+=
1
;
inReelCount
+=
1
;
...
...
src/main/java/com/neotel/smfcore/core/inList/util/InListCache.java
查看文件 @
f90a593
...
@@ -129,7 +129,7 @@ public class InListCache {
...
@@ -129,7 +129,7 @@ public class InListCache {
for
(
InListItem
item
:
inList
.
getInListItems
()
for
(
InListItem
item
:
inList
.
getInListItems
()
)
{
)
{
if
(
item
.
getNum
()
!=
item
.
getInNum
())
{
if
(
item
.
getNum
()
>
item
.
getInNum
())
{
listOk
=
false
;
listOk
=
false
;
break
;
break
;
}
}
...
@@ -137,7 +137,7 @@ public class InListCache {
...
@@ -137,7 +137,7 @@ public class InListCache {
if
(
listOk
)
{
if
(
listOk
)
{
inList
.
setStatus
(
INLIST_STATUS
.
OK
);
inList
.
setStatus
(
INLIST_STATUS
.
OK
);
log
.
info
(
"UpdateInList 入库单["
+
inListName
+
"]更改状态为:OK"
);
log
.
info
(
"UpdateInList 入库单["
+
inListName
+
"]更改状态为:OK"
);
}
else
if
(
updateOk
)
{
}
else
if
(
!
listOk
&&
updateOk
)
{
inList
.
setStatus
(
INLIST_STATUS
.
ABNORMAL
);
inList
.
setStatus
(
INLIST_STATUS
.
ABNORMAL
);
log
.
info
(
"UpdateInList 入库单["
+
inListName
+
"]更改状态为:ABNORMAL"
);
log
.
info
(
"UpdateInList 入库单["
+
inListName
+
"]更改状态为:ABNORMAL"
);
}
}
...
...
src/main/java/com/neotel/smfcore/core/language/util/MessageUtils.java
查看文件 @
f90a593
...
@@ -63,13 +63,23 @@ public class MessageUtils {
...
@@ -63,13 +63,23 @@ public class MessageUtils {
private
static
Map
<
String
,
Map
<
String
,
LanguageMsg
>>
msgMap
=
new
HashMap
<>();
private
static
Map
<
String
,
Map
<
String
,
LanguageMsg
>>
msgMap
=
new
HashMap
<>();
private
static
ILanguageMsgManager
languageMsgManager
;
private
static
DataCache
dataCache
;
private
static
LanguageMsgService
messageService
;
@Autowired
@Autowired
ILanguageMsgManager
languageMsgManager
;
void
setLanguageMsgManager
(
ILanguageMsgManager
languageMsgManager
)
{
@Autowired
MessageUtils
.
languageMsgManager
=
languageMsgManager
;
DataCache
dataCache
;
}
@Autowired
@Autowired
LanguageMsgService
messageService
;
void
SetDataCache
(
DataCache
dataCache
)
{
MessageUtils
.
dataCache
=
dataCache
;
}
@Autowired
void
SetMessageService
(
LanguageMsgService
messageService
)
{
MessageUtils
.
messageService
=
messageService
;
}
public
static
final
String
ZH_CN
=
"zh-CN"
;
public
static
final
String
ZH_CN
=
"zh-CN"
;
public
static
final
String
ZH_TW
=
"zh-TW"
;
public
static
final
String
ZH_TW
=
"zh-TW"
;
...
@@ -157,6 +167,7 @@ public class MessageUtils {
...
@@ -157,6 +167,7 @@ public class MessageUtils {
return
msg
.
getMsg
();
return
msg
.
getMsg
();
}
}
log
.
info
(
"获取资源["
+
msgKey
+
"]["
+
defaultMsg
+
"]["
+
lanType
+
"]失败:未找到code["
+
msgKey
+
"]"
);
log
.
info
(
"获取资源["
+
msgKey
+
"]["
+
defaultMsg
+
"]["
+
lanType
+
"]失败:未找到code["
+
msgKey
+
"]"
);
// autoAddMsg(msgKey,defaultMsg,"");
}
}
return
defaultMsg
;
return
defaultMsg
;
}
}
...
@@ -224,6 +235,23 @@ public class MessageUtils {
...
@@ -224,6 +235,23 @@ public class MessageUtils {
return
lanList
;
return
lanList
;
}
}
private
static
void
autoAddMsg
(
String
msgKey
,
String
defaultMsg
,
String
type
)
{
try
{
if
(
ObjectUtil
.
isEmpty
(
type
))
{
type
=
smfcore
;
}
LanguageMsg
languageMsg
=
new
LanguageMsg
(
msgKey
,
defaultMsg
,
type
);
List
<
LanguageInfo
>
list
=
dataCache
.
getLanguageList
();
for
(
LanguageInfo
lan:
list
)
{
languageMsg
.
setContent
(
lan
.
getLanCode
(),
defaultMsg
);
}
languageMsg
=
languageMsgManager
.
save
(
languageMsg
);
updateMsg
(
languageMsg
);
log
.
info
(
"autoAddMsg: key="
+
msgKey
+
",msg="
+
defaultMsg
+
",type="
+
type
+
",defLocal="
+
getDefaultLocal
().
toLanguageTag
()
+
""
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"autoAddMsg: key="
+
msgKey
+
",msg="
+
defaultMsg
+
",type="
+
type
+
",defLocal="
+
getDefaultLocal
().
toLanguageTag
()
+
"出错:"
+
ex
.
toString
());
}
}
}
}
src/main/java/com/neotel/smfcore/core/message/service/po/Message.java
查看文件 @
f90a593
...
@@ -22,13 +22,20 @@ import java.util.Locale;
...
@@ -22,13 +22,20 @@ import java.util.Locale;
@AllArgsConstructor
@AllArgsConstructor
public
class
Message
extends
BasePo
implements
Serializable
{
public
class
Message
extends
BasePo
implements
Serializable
{
public
static
Message
newMsg
(
MessageType
type
,
String
deviceName
,
String
deviceId
,
String
module
,
String
msgCode
,
String
msg
,
String
[]
msgParams
){
public
static
Message
newMsg
(
MessageType
type
,
String
deviceName
,
String
deviceId
,
String
module
,
String
msgCode
,
String
msg
,
String
[]
msgParams
){
Message
message
=
new
Message
(
deviceName
,
deviceId
,
module
,
type
.
name
(),
msgCode
,
msg
,
msgParams
,
null
,
null
,
""
);
Message
message
=
new
Message
(
deviceName
,
deviceId
,
module
,
type
.
name
(),
msgCode
,
msg
,
msgParams
,
null
,
null
,
""
,
msgCode
,
""
);
return
message
;
return
message
;
}
}
public
static
Message
newMsg
(
String
type
,
String
deviceName
,
String
deviceId
,
String
module
,
String
msgCode
,
String
msg
,
String
[]
msgParams
){
public
static
Message
newMsg
(
String
type
,
String
deviceName
,
String
deviceId
,
String
module
,
String
msgCode
,
String
msg
,
String
[]
msgParams
){
Message
message
=
new
Message
(
deviceName
,
deviceId
,
module
,
type
,
msgCode
,
msg
,
msgParams
,
null
,
null
,
""
);
Message
message
=
new
Message
(
deviceName
,
deviceId
,
module
,
type
,
msgCode
,
msg
,
msgParams
,
null
,
null
,
""
,
msgCode
,
""
);
return
message
;
}
public
static
Message
newMsg
(
MessageType
type
,
String
deviceName
,
String
deviceId
,
String
module
,
String
msgCode
,
String
msg
,
String
[]
msgParams
,
String
alarmType
,
String
alarmCode
){
Message
message
=
new
Message
(
deviceName
,
deviceId
,
module
,
type
.
name
(),
msgCode
,
msg
,
msgParams
,
null
,
null
,
""
,
alarmType
,
alarmCode
);
return
message
;
}
public
static
Message
newMsg
(
String
type
,
String
deviceName
,
String
deviceId
,
String
module
,
String
msgCode
,
String
msg
,
String
[]
msgParams
,
String
alarmType
,
String
alarmCode
){
Message
message
=
new
Message
(
deviceName
,
deviceId
,
module
,
type
,
msgCode
,
msg
,
msgParams
,
null
,
null
,
""
,
alarmType
,
alarmCode
);
return
message
;
return
message
;
}
}
/**
/**
...
@@ -75,6 +82,14 @@ public class Message extends BasePo implements Serializable {
...
@@ -75,6 +82,14 @@ public class Message extends BasePo implements Serializable {
*/
*/
private
String
operator
;
private
String
operator
;
/**
* 报警类型
*/
public
String
alarmType
=
""
;
/**
*报警错误码
*/
public
String
alarmCode
=
""
;
public
void
addData
(
String
key
,
String
value
){
public
void
addData
(
String
key
,
String
value
){
if
(
dataList
==
null
){
if
(
dataList
==
null
){
dataList
=
new
ArrayList
<>();
dataList
=
new
ArrayList
<>();
...
...
src/main/java/com/neotel/smfcore/core/message/util/DeviceMessageUtil.java
查看文件 @
f90a593
...
@@ -96,6 +96,20 @@ public class DeviceMessageUtil {
...
@@ -96,6 +96,20 @@ public class DeviceMessageUtil {
messageManager
.
save
(
message
);
messageManager
.
save
(
message
);
}
}
}
}
public
static
void
addDeviceMessage
(
String
cid
,
String
msgType
,
String
moudle
,
String
msgCode
,
String
msg
,
String
[]
msgParam
,
String
almType
,
String
almCode
)
{
DeviceInfo
deviceInfo
=
getDeviceName
(
cid
);
if
(
deviceInfo
!=
null
)
{
String
code
=
msgCode
;
if
(
ObjectUtil
.
isNotEmpty
(
msgCode
)){
if
(!
msgCode
.
startsWith
(
MessageUtils
.
smfcore
)){
code
=
MessageUtils
.
smfcore
+
"."
+
msgCode
;
}
}
Message
message
=
Message
.
newMsg
(
msgType
,
deviceInfo
.
getName
(),
deviceInfo
.
getId
(),
moudle
,
code
,
msg
,
msgParam
,
almType
,
almCode
);
messageManager
.
save
(
message
);
}
}
public
static
void
addOnlineMessage
(
String
cid
,
String
moudle
,
String
ip
)
{
public
static
void
addOnlineMessage
(
String
cid
,
String
moudle
,
String
ip
)
{
DeviceInfo
deviceInfo
=
getDeviceName
(
cid
);
DeviceInfo
deviceInfo
=
getDeviceName
(
cid
);
...
...
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
查看文件 @
f90a593
...
@@ -215,16 +215,26 @@ public class LiteOrderCache {
...
@@ -215,16 +215,26 @@ public class LiteOrderCache {
* 结束当前的任务
* 结束当前的任务
*/
*/
public
void
finishedOrderTasks
(
LiteOrder
liteOrder
){
public
void
finishedOrderTasks
(
LiteOrder
liteOrder
){
boolean
noCloseWorkOrder
=
false
;
Object
cache
=
dataCache
.
getCache
(
Constants
.
CACHE_closeWorkOrder
);
if
(
cache
!=
null
){
noCloseWorkOrder
=
Boolean
.
valueOf
(
cache
.
toString
());
}
if
(
liteOrder
.
isOutOne
()){
if
(
liteOrder
.
isOutOne
()){
// setStatus(LITEORDER_STATUS.ONE_FINISHED);
if
(
noCloseWorkOrder
){
liteOrder
.
setClosed
(
true
);
liteOrder
.
setStatus
(
LITEORDER_STATUS
.
ONE_FINISHED
);
}
else
{
liteOrder
.
setClosed
(
true
);
}
}
else
if
(
liteOrder
.
isOutBom
()){
}
else
if
(
liteOrder
.
isOutBom
()){
liteOrder
.
setStatus
(
LITEORDER_STATUS
.
BOM_FINISHED
);
liteOrder
.
setStatus
(
LITEORDER_STATUS
.
BOM_FINISHED
);
}
else
if
(
liteOrder
.
isOutTails
()){
}
else
if
(
liteOrder
.
isOutTails
()){
// setStatus(LITEORDER_STATUS.TAILS_FINISHED);
if
(
noCloseWorkOrder
){
liteOrder
.
setClosed
(
true
);
liteOrder
.
setStatus
(
LITEORDER_STATUS
.
TAILS_FINISHED
);
}
else
{
liteOrder
.
setClosed
(
true
);
}
}
}
liteOrder
.
setTaskFinishedTime
(
System
.
currentTimeMillis
());
liteOrder
.
setTaskFinishedTime
(
System
.
currentTimeMillis
());
smfApi
.
onOrderStatusChange
(
liteOrder
);
smfApi
.
onOrderStatusChange
(
liteOrder
);
}
}
...
@@ -699,7 +709,7 @@ public class LiteOrderCache {
...
@@ -699,7 +709,7 @@ public class LiteOrderCache {
}
}
public
LiteOrder
getOrderSortItems
(
String
sourceId
)
{
public
LiteOrder
getOrderSortItems
(
String
sourceId
)
{
LiteOrder
order
=
liteOrderManager
.
findByOrderNo
(
sourceId
);
LiteOrder
order
=
liteOrderManager
.
get
(
sourceId
);
if
(
order
!=
null
&&
order
.
getOrderItems
().
size
()
>
0
)
{
if
(
order
!=
null
&&
order
.
getOrderItems
().
size
()
>
0
)
{
List
<
LiteOrderItem
>
list
=
order
.
getOrderItems
();
List
<
LiteOrderItem
>
list
=
order
.
getOrderItems
();
//根据站位号排序
//根据站位号排序
...
...
src/main/java/com/neotel/smfcore/core/solder/handler/SpBoxHandler.java
查看文件 @
f90a593
...
@@ -244,13 +244,16 @@ public class SpBoxHandler extends BaseDeviceHandler {
...
@@ -244,13 +244,16 @@ public class SpBoxHandler extends BaseDeviceHandler {
serverExceptions
.
remove
(
storage
.
getCid
());
serverExceptions
.
remove
(
storage
.
getCid
());
}
catch
(
ValidateException
e
)
{
}
catch
(
ValidateException
e
)
{
log
.
warn
(
statusBean
.
getCode
()
+
"入库到"
+
storage
.
getCid
()
+
"失败:"
+
e
.
getMessage
());
// log.warn(statusBean.getCode() + "入库到" + storage.getCid() + "失败:" + e.getMessage());
statusBean
.
setMsg
(
e
.
getMessage
());
// statusBean.setMsg(e.getMessage());
statusBean
.
setMsgCode
(
e
.
getMsgKey
());
// statusBean.setMsgCode(e.getMsgKey());
String
msgEn
=
MessageUtils
.
getText
(
e
.
getMsgKey
(),
e
.
getMsgParam
(),
new
Locale
(
"en"
,
"US"
),
e
.
getMessage
());
// String msgEn = MessageUtils.getText(e.getMsgKey(), e.getMsgParam(), new Locale("en","US"), e.getMessage());
String
msgJp
=
MessageUtils
.
getText
(
e
.
getMsgKey
(),
e
.
getMsgParam
(),
new
Locale
(
"ja"
,
"JP"
),
e
.
getMessage
());
// String msgJp = MessageUtils.getText(e.getMsgKey(), e.getMsgParam(), new Locale("ja","JP"), e.getMessage());
statusBean
.
setMsgEn
(
msgEn
);
// statusBean.setMsgEn(msgEn);
statusBean
.
setMsgJp
(
msgJp
);
// statusBean.setMsgJp(msgJp);
statusBean
.
setRMsg
(
e
.
getMsgKey
(),
e
.
getMsgParam
(),
e
.
getMessage
());
log
.
warn
(
statusBean
.
getCode
()
+
"入库到"
+
storage
.
getCid
()
+
"失败:"
+
e
.
getMessage
()+
","
+
statusBean
.
getMsg
()+
","
+
statusBean
.
getMsgEn
()+
","
+
statusBean
.
getMsgJp
());
serverExceptions
.
put
(
storage
.
getCid
(),
e
);
serverExceptions
.
put
(
storage
.
getCid
(),
e
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
statusBean
.
getCode
()
+
"入库到"
+
storage
.
getCid
()
+
"失败"
,
e
);
log
.
error
(
statusBean
.
getCode
()
+
"入库到"
+
storage
.
getCid
()
+
"失败"
,
e
);
...
...
src/main/java/com/neotel/smfcore/core/system/rest/SettingsController.java
查看文件 @
f90a593
...
@@ -81,6 +81,7 @@ public class SettingsController {
...
@@ -81,6 +81,7 @@ public class SettingsController {
Integer
expiresDay
=
dataCache
.
getCache
(
Constants
.
CACHE_ExpiresDay
);
Integer
expiresDay
=
dataCache
.
getCache
(
Constants
.
CACHE_ExpiresDay
);
Integer
caWarn
=
dataCache
.
getCache
(
Constants
.
CACHE_CapacityWarn
);
Integer
caWarn
=
dataCache
.
getCache
(
Constants
.
CACHE_CapacityWarn
);
Integer
backUpMonth
=
dataCache
.
getCache
(
Constants
.
BACKUP_MONTH_KEY
);
Integer
backUpMonth
=
dataCache
.
getCache
(
Constants
.
BACKUP_MONTH_KEY
);
boolean
closeWorkOrder
=
dataCache
.
getCache
(
Constants
.
CACHE_closeWorkOrder
);
SysSettingsDto
dto
=
new
SysSettingsDto
();
SysSettingsDto
dto
=
new
SysSettingsDto
();
dto
.
setStartJob
(
startJob
);
dto
.
setStartJob
(
startJob
);
dto
.
setStopOut
(
stopOut
);
dto
.
setStopOut
(
stopOut
);
...
@@ -88,6 +89,7 @@ public class SettingsController {
...
@@ -88,6 +89,7 @@ public class SettingsController {
dto
.
setExpiresDay
(
expiresDay
);
dto
.
setExpiresDay
(
expiresDay
);
dto
.
setCapacityWarn
(
caWarn
);
dto
.
setCapacityWarn
(
caWarn
);
dto
.
setBackUpMonth
(
backUpMonth
);
dto
.
setBackUpMonth
(
backUpMonth
);
dto
.
setCloseWorkOrder
(
closeWorkOrder
);
return
dto
;
return
dto
;
}
}
...
@@ -101,8 +103,10 @@ public class SettingsController {
...
@@ -101,8 +103,10 @@ public class SettingsController {
dataCache
.
updateCache
(
Constants
.
CACHE_ExpiresDay
,
sysSettingsDto
.
getExpiresDay
());
dataCache
.
updateCache
(
Constants
.
CACHE_ExpiresDay
,
sysSettingsDto
.
getExpiresDay
());
dataCache
.
updateCache
(
Constants
.
CACHE_CapacityWarn
,
sysSettingsDto
.
getCapacityWarn
());
dataCache
.
updateCache
(
Constants
.
CACHE_CapacityWarn
,
sysSettingsDto
.
getCapacityWarn
());
dataCache
.
updateCache
(
Constants
.
BACKUP_MONTH_KEY
,
sysSettingsDto
.
getBackUpMonth
());
dataCache
.
updateCache
(
Constants
.
BACKUP_MONTH_KEY
,
sysSettingsDto
.
getBackUpMonth
());
dataCache
.
updateCache
(
Constants
.
CACHE_closeWorkOrder
,
sysSettingsDto
.
isCloseWorkOrder
());
log
.
info
(
"更改系统设置:stopout="
+
sysSettingsDto
.
isStopOut
()
+
",stopjob="
+
sysSettingsDto
.
isStartJob
()+
",sluggishDay="
+
sysSettingsDto
.
getSluggishDay
()
log
.
info
(
"更改系统设置:stopout="
+
sysSettingsDto
.
isStopOut
()
+
",stopjob="
+
sysSettingsDto
.
isStartJob
()+
",sluggishDay="
+
sysSettingsDto
.
getSluggishDay
()
+
",expiresDay="
+
sysSettingsDto
.
getExpiresDay
()+
",capacityWarn="
+
sysSettingsDto
.
getCapacityWarn
()+
",backUpMonth="
+
sysSettingsDto
.
getBackUpMonth
());
+
",expiresDay="
+
sysSettingsDto
.
getExpiresDay
()+
",capacityWarn="
+
sysSettingsDto
.
getCapacityWarn
()+
",backUpMonth="
+
sysSettingsDto
.
getBackUpMonth
()
+
",缺料不自动关闭工单="
+
sysSettingsDto
.
isCloseWorkOrder
());
return
ResultBean
.
newOkResult
(
"保存成功"
);
return
ResultBean
.
newOkResult
(
"保存成功"
);
}
}
...
...
src/main/java/com/neotel/smfcore/core/system/rest/bean/dto/SysSettingsDto.java
查看文件 @
f90a593
...
@@ -27,4 +27,7 @@ public class SysSettingsDto implements Serializable {
...
@@ -27,4 +27,7 @@ public class SysSettingsDto implements Serializable {
@ApiModelProperty
(
"备份时间"
)
@ApiModelProperty
(
"备份时间"
)
private
Integer
backUpMonth
=
0
;
private
Integer
backUpMonth
=
0
;
@ApiModelProperty
(
"缺料不自动关闭工单"
)
private
boolean
closeWorkOrder
=
false
;
}
}
src/main/java/com/neotel/smfcore/core/system/util/DevicesStatusUtil.java
查看文件 @
f90a593
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.system.util;
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.system.util;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.core.device.bean.MsgInfo
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.message.enums.MessageType
;
import
com.neotel.smfcore.core.message.enums.MessageType
;
import
com.neotel.smfcore.core.message.util.DeviceMessageUtil
;
import
com.neotel.smfcore.core.message.util.DeviceMessageUtil
;
...
@@ -44,6 +45,7 @@ public class DevicesStatusUtil {
...
@@ -44,6 +45,7 @@ public class DevicesStatusUtil {
statusBean
.
setMsgCode
(
msgBean
.
getMsgCode
());
statusBean
.
setMsgCode
(
msgBean
.
getMsgCode
());
statusBean
.
setMsgParam
(
msgBean
.
getMsgParam
());
statusBean
.
setMsgParam
(
msgBean
.
getMsgParam
());
statusBean
.
setMsgJp
(
msgBean
.
getMsgJp
());
statusBean
.
setMsgJp
(
msgBean
.
getMsgJp
());
statusBean
.
setMsgList
(
msgBean
.
getMsgList
());
}
}
}
}
return
statusBean
;
return
statusBean
;
...
@@ -55,75 +57,111 @@ public class DevicesStatusUtil {
...
@@ -55,75 +57,111 @@ public class DevicesStatusUtil {
public
static
void
updateStatusBean
(
StatusBean
statusBean
)
{
public
static
void
updateStatusBean
(
StatusBean
statusBean
)
{
statusMap
.
put
(
statusBean
.
getCid
(),
statusBean
);
statusMap
.
put
(
statusBean
.
getCid
(),
statusBean
);
}
}
//
// /**
// * 更新客户端发上来的消息(设备故障等消息)
// */
// public static StatusBean updateClientMsg(String cid,String msgCode, String clientMsg, String clientMsgEn,String clientMsgJp,String[] msgParam) {
// if (clientMsg == null) {
// clientMsg = "";
// clientMsgEn = "";
// clientMsgJp="";
// }
// if(msgCode==null){
// msgCode="";
// }
// if(clientMsg==null){
// clientMsg="";
// }
// //判断消息是否有内容
// if(ObjectUtil.isNotEmpty(msgCode)||ObjectUtil.isNotEmpty(clientMsg)){
// boolean newMsg=true;
// //和上个消息是否一样
// StatusBean msgBean=clientMsgs.get(cid);
// if(msgBean!=null) {
//// if (msgBean.msgTimeOut()) {
//// newMsg = true;
//// } else
// if (msgBean.getMsgCode().equals(msgCode) && msgBean.getMsg().equals(clientMsg)) {
// newMsg = false;
// }
// }
// if(newMsg){
//
// //判断是否有换行
// String[] msgArray=clientMsg.split("\r\n");
// if(msgArray!=null&& msgArray.length>0) {
// for (String msg :
// msgArray) {
// String msgType = MessageType.ERROR.name();
// if (msg.startsWith("A=")) {
// msgType = MessageType.ERROR.name();
// msg = msg.substring(2);
// } else if (msg.startsWith("I=")) {
// msgType = MessageType.INFO.name();
// msg = msg.substring(2);
// } else if (msg.startsWith("W=")) {
// msgType = MessageType.WARNING.name();
// msg = msg.substring(2);
// }
// DeviceMessageUtil.addDeviceMessage(cid, msgType, "", msgCode, msg, msgParam);
// }
// }
// else {
// DeviceMessageUtil.addDeviceMessage(cid, MessageType.ERROR.name(), "", msgCode, clientMsg, msgParam);
// }
// }
// }
//
// StatusBean statusBean = new StatusBean();
// statusBean.setCid(cid);
// statusBean.setTime(System.currentTimeMillis());
// statusBean.setMsg(clientMsg);
// statusBean.setMsgEn(clientMsgEn);
// statusBean.setMsgCode(msgCode);
// statusBean.setMsgParam(msgParam);
// statusBean.setMsgJp(clientMsgJp);
// clientMsgs.put(cid, statusBean);
// return statusBean;
// }
/**
/**
* 更新客户端发上来的消息(设备故障等消息)
* 更新客户端发上来的消息(设备故障等消息)
*/
*/
public
static
StatusBean
updateClientMsg
(
String
cid
,
String
msgCode
,
String
clientMsg
,
String
clientMsgEn
,
String
clientMsgJp
,
String
[]
msgParam
)
{
public
static
StatusBean
updateClientMsg
(
String
cid
,
List
<
MsgInfo
>
msgs
)
{
if
(
clientMsg
==
null
)
{
clientMsg
=
""
;
clientMsgEn
=
""
;
clientMsgJp
=
""
;
}
if
(
msgCode
==
null
){
msgCode
=
""
;
}
if
(
clientMsg
==
null
){
clientMsg
=
""
;
}
//判断消息是否有内容
//判断消息是否有内容
if
(
ObjectUtil
.
isNotEmpty
(
msgCode
)||
ObjectUtil
.
isNotEmpty
(
clientMsg
)){
if
(
msgs
!=
null
&&
msgs
.
size
()
>
0
)
{
boolean
newMsg
=
true
;
//和上个消息是否一样
StatusBean
msgBean
=
clientMsgs
.
get
(
cid
);
StatusBean
msgBean
=
clientMsgs
.
get
(
cid
);
List
<
MsgInfo
>
oldMsgs
=
msgBean
.
getMsgList
();
if
(
msgBean
!=
null
)
{
for
(
MsgInfo
msg
:
// if (msgBean.msgTimeOut()) {
msgs
)
{
// newMsg = true;
boolean
newMsg
=
true
;
// } else
if
(
msgBean
.
getMsgCode
().
equals
(
msgCode
)
&&
msgBean
.
getMsg
().
equals
(
clientMsg
))
{
if
(
oldMsgs
!=
null
)
{
newMsg
=
false
;
for
(
MsgInfo
old
:
}
oldMsgs
)
{
}
if
(
old
.
getMsgKey
().
equals
(
msg
.
getMsgKey
())
&&
old
.
getMsg
().
equals
(
msg
.
getMsg
()))
{
if
(
newMsg
){
newMsg
=
false
;
break
;
//判断是否有换行
String
[]
msgArray
=
clientMsg
.
split
(
"\r\n"
);
if
(
msgArray
!=
null
&&
msgArray
.
length
>
0
)
{
for
(
String
msg
:
msgArray
)
{
String
msgType
=
MessageType
.
ERROR
.
name
();
if
(
msg
.
startsWith
(
"A="
))
{
msgType
=
MessageType
.
ERROR
.
name
();
msg
=
msg
.
substring
(
2
);
}
else
if
(
msg
.
startsWith
(
"I="
))
{
msgType
=
MessageType
.
INFO
.
name
();
msg
=
msg
.
substring
(
2
);
}
else
if
(
msg
.
startsWith
(
"W="
))
{
msgType
=
MessageType
.
WARNING
.
name
();
msg
=
msg
.
substring
(
2
);
}
}
DeviceMessageUtil
.
addDeviceMessage
(
cid
,
msgType
,
""
,
msgCode
,
msg
,
msgParam
);
}
}
}
}
else
{
if
(
newMsg
)
{
DeviceMessageUtil
.
addDeviceMessage
(
cid
,
MessageType
.
ERROR
.
name
(),
""
,
msg
Code
,
clientMsg
,
msgParam
);
DeviceMessageUtil
.
addDeviceMessage
(
cid
,
MessageType
.
ERROR
.
name
(),
""
,
msg
.
getMsgKey
(),
msg
.
getMsg
(),
msg
.
getMsgParam
(),
msg
.
getAlarmType
(),
msg
.
getAlarmCode
()
);
}
}
}
}
}
}
StatusBean
statusBean
=
new
StatusBean
();
StatusBean
statusBean
=
new
StatusBean
();
statusBean
.
setCid
(
cid
);
statusBean
.
setCid
(
cid
);
statusBean
.
setTime
(
System
.
currentTimeMillis
());
statusBean
.
setTime
(
System
.
currentTimeMillis
());
statusBean
.
setMsg
(
clientMsg
);
statusBean
.
setMsgList
(
msgs
);
statusBean
.
setMsgEn
(
clientMsgEn
);
statusBean
.
setMsgCode
(
msgCode
);
statusBean
.
setMsgParam
(
msgParam
);
statusBean
.
setMsgJp
(
clientMsgJp
);
clientMsgs
.
put
(
cid
,
statusBean
);
clientMsgs
.
put
(
cid
,
statusBean
);
return
statusBean
;
return
statusBean
;
}
}
/**
/**
* 主要用来存储感应料架库位报警信息
* 主要用来存储感应料架库位报警信息
*/
*/
...
...
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
查看文件 @
f90a593
...
@@ -941,6 +941,12 @@ public class TaskService {
...
@@ -941,6 +941,12 @@ public class TaskService {
task
.
setBarcode
(
barcode
.
getBarcode
());
task
.
setBarcode
(
barcode
.
getBarcode
());
task
.
setNum
(
barcode
.
getAmount
());
task
.
setNum
(
barcode
.
getAmount
());
//如果入库单不为空,设置入库单
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
if
(
storage
!=
null
&&
StringUtils
.
isNotBlank
(
storage
.
getInListName
())){
task
.
setSourceName
(
storage
.
getInListName
());
}
dataCache
.
updateInventory
(
pos
,
barcode
);
dataCache
.
updateInventory
(
pos
,
barcode
);
//dataCache.updateStorage(task.getCid());
//dataCache.updateStorage(task.getCid());
...
...
src/main/java/com/neotel/smfcore/custom/iriichi1081/IriichiApi.java
查看文件 @
f90a593
...
@@ -67,6 +67,7 @@ public class IriichiApi extends BaseSmfApiListener {
...
@@ -67,6 +67,7 @@ public class IriichiApi extends BaseSmfApiListener {
"?customloadmethod=IR_GetJobMaterialPickListSp"
+
"?customloadmethod=IR_GetJobMaterialPickListSp"
+
"&readonly=true"
+
"&readonly=true"
+
"&loadtype=NEXT"
+
"&loadtype=NEXT"
+
"&RowCap=0"
+
"&customloadmethodparms="
+
orderNumber
,
headerMap
,
null
);
"&customloadmethodparms="
+
orderNumber
,
headerMap
,
null
);
log
.
info
(
orderNumber
+
"fetchOrder结果为:"
+
result
);
log
.
info
(
orderNumber
+
"fetchOrder结果为:"
+
result
);
return
getOrderByResult
(
orderNumber
,
result
);
return
getOrderByResult
(
orderNumber
,
result
);
...
@@ -121,7 +122,9 @@ public class IriichiApi extends BaseSmfApiListener {
...
@@ -121,7 +122,9 @@ public class IriichiApi extends BaseSmfApiListener {
headerMap
.
put
(
"Accept"
,
IriichiConfig
.
accept
);
headerMap
.
put
(
"Accept"
,
IriichiConfig
.
accept
);
try
{
try
{
log
.
info
(
"获取token参数为:"
+
JSON
.
toJSONString
(
headerMap
));
String
result
=
HttpHelper
.
getJson
(
IriichiConfig
.
token_url
,
headerMap
,
null
);
String
result
=
HttpHelper
.
getJson
(
IriichiConfig
.
token_url
,
headerMap
,
null
);
log
.
info
(
"获取token出参为:"
+
result
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
if
(
"Success"
.
equals
(
jsonObject
.
getString
(
"Message"
)))
{
if
(
"Success"
.
equals
(
jsonObject
.
getString
(
"Message"
)))
{
return
jsonObject
.
getString
(
"Token"
);
return
jsonObject
.
getString
(
"Token"
);
...
...
src/main/java/com/neotel/smfcore/custom/iriichi1081/config/IriichiConfig.java
查看文件 @
f90a593
...
@@ -2,12 +2,10 @@ package com.neotel.smfcore.custom.iriichi1081.config;
...
@@ -2,12 +2,10 @@ package com.neotel.smfcore.custom.iriichi1081.config;
public
class
IriichiConfig
{
public
class
IriichiConfig
{
//config name
// token url 测试环境
public
static
final
String
iriichi_config_name
=
"app_neotel"
;
//public static final String token_url = "http://192.168.60.249/IDORequestService/MGRestService.svc/json/token/IRIICHI_CRP";
public
static
final
String
iriichi_crp_config_name
=
"Neotel@478*"
;
// token url
public
static
final
String
token_url
=
"http://192.168.60.249/IDORequestService/MGRestService.svc/json/token/IRIICHI"
;
public
static
final
String
token_url
=
"http://192.168.60.249/IDORequestService/MGRestService.svc/json/token/IRIICHI_CRP"
;
// Job Material Picklist url 在配置文件中,配置fetchOrderUrl 地址
// Job Material Picklist url 在配置文件中,配置fetchOrderUrl 地址
//public static final String picklist_url = "http://192.168.60.249/IDORequestService/MGRestService.svc/json/IR_SLAPIs/pick_list,job,job_suffix,job_item,job_item_desc,item_code,Rating,workcenter,vendnum,vendor_name,qty_to_pick/adv";
//public static final String picklist_url = "http://192.168.60.249/IDORequestService/MGRestService.svc/json/IR_SLAPIs/pick_list,job,job_suffix,job_item,job_item_desc,item_code,Rating,workcenter,vendnum,vendor_name,qty_to_pick/adv";
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/controller/MicronStatusController.java
查看文件 @
f90a593
...
@@ -8,6 +8,7 @@ import com.neotel.smfcore.core.device.bean.BoxStatusBean;
...
@@ -8,6 +8,7 @@ import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.message.enums.MessageType
;
import
com.neotel.smfcore.core.message.enums.MessageType
;
import
com.neotel.smfcore.core.report.bean.ChartItem
;
import
com.neotel.smfcore.core.report.bean.ChartItem
;
import
com.neotel.smfcore.core.storage.bean.UsageItem
;
import
com.neotel.smfcore.core.storage.bean.UsageItem
;
...
@@ -109,10 +110,18 @@ public class MicronStatusController {
...
@@ -109,10 +110,18 @@ public class MicronStatusController {
}
}
//料仓状态
//料仓状态
List
<
String
>
boxList
=
new
ArrayList
<>();
List
<
String
>
boxList
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
8
;
i
++
// for (int i = 1; i <= 8; i++
)
{
// ) {
boxList
.
add
(
"M"
+
i
);
// boxList.add("M" + i);
}
// }
boxList
.
add
(
"KTS-R001A"
);
boxList
.
add
(
"KTS-R001B"
);
boxList
.
add
(
"KTS-R001C"
);
boxList
.
add
(
"KTS-R001D"
);
boxList
.
add
(
"KTS-R002A"
);
boxList
.
add
(
"KTS-R002B"
);
boxList
.
add
(
"KTS-R002C"
);
boxList
.
add
(
"KTS-R002D"
);
// SBDH1, SBDH2, SBDH3, SBSH1, SBSH2
// SBDH1, SBDH2, SBDH3, SBSH1, SBSH2
boxList
.
add
(
"SBDH1-1"
);
boxList
.
add
(
"SBDH1-1"
);
boxList
.
add
(
"SBDH1-2"
);
boxList
.
add
(
"SBDH1-2"
);
...
@@ -156,7 +165,6 @@ public class MicronStatusController {
...
@@ -156,7 +165,6 @@ public class MicronStatusController {
dto
.
getMsgList
().
add
(
dtoMsg
);
dto
.
getMsgList
().
add
(
dtoMsg
);
// }
// }
}
}
return
dto
;
return
dto
;
}
}
...
@@ -165,9 +173,9 @@ public class MicronStatusController {
...
@@ -165,9 +173,9 @@ public class MicronStatusController {
Map
<
String
,
Storage
>
allStorages
=
dataCache
.
getAllStorage
();
Map
<
String
,
Storage
>
allStorages
=
dataCache
.
getAllStorage
();
for
(
Storage
storage
:
for
(
Storage
storage
:
allStorages
.
values
())
{
allStorages
.
values
())
{
if
(
storage
.
getCid
().
contains
(
boxName
))
{
if
(
storage
.
getCid
().
contains
(
boxName
.
trim
()
))
{
cids
.
add
(
storage
.
getCid
());
cids
.
add
(
storage
.
getCid
());
}
else
if
(
storage
.
getName
().
equals
(
boxName
)){
}
else
if
(
storage
.
getName
().
trim
().
equals
(
boxName
.
trim
()
)){
cids
.
add
(
storage
.
getCid
());
cids
.
add
(
storage
.
getCid
());
}
}
}
}
...
@@ -210,15 +218,20 @@ public class MicronStatusController {
...
@@ -210,15 +218,20 @@ public class MicronStatusController {
dto
.
setStatus
(
0
);
dto
.
setStatus
(
0
);
}
}
//如果状态还是0,需要改为1
//如果状态还是0,需要改为1
else
if
(
dto
.
getStatus
()==
0
)
{
else
if
(
dto
.
getStatus
()==
0
)
{
dto
.
setStatus
(
1
);
dto
.
setStatus
(
1
);
}
}
Map
<
String
,
String
>
msgMap
=
s
.
getMsgMap
();
Map
<
String
,
String
>
msgMap
=
s
.
getMsgMap
(
locale
);
if
(
msgMap
!=
null
&&
msgMap
.
size
()>
0
)
{
if
(
msgMap
!=
null
&&
msgMap
.
size
()>
0
)
{
String
name
=
cid
;
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
!=
null
){
name
=
storage
.
getName
();
}
for
(
String
msg
:
for
(
String
msg
:
msgMap
.
keySet
())
{
msgMap
.
keySet
())
{
String
type
=
msgMap
.
getOrDefault
(
msg
,
""
);
String
type
=
msgMap
.
getOrDefault
(
msg
,
""
);
dto
.
getMsgList
().
add
(
new
EquipMsg
(
cid
,
s
.
getStatus
(),
msg
,
new
Date
(
s
.
getTime
()),
type
.
toUpperCase
(),
""
,
""
,
new
String
[]{}));
dto
.
getMsgList
().
add
(
new
EquipMsg
(
name
,
s
.
getStatus
(),
msg
,
new
Date
(
s
.
getTime
()),
type
.
toUpperCase
(),
""
,
""
,
new
String
[]{}));
}
}
}
}
// String msg=s.getErrorMsg(locale);
// String msg=s.getErrorMsg(locale);
...
@@ -245,6 +258,7 @@ public class MicronStatusController {
...
@@ -245,6 +258,7 @@ public class MicronStatusController {
for
(
String
cid
:
for
(
String
cid
:
cids
)
{
cids
)
{
Storage
storage
=
dataCache
.
getStorage
(
cid
);
Storage
storage
=
dataCache
.
getStorage
(
cid
);
String
name
=
storage
.
getName
();
for
(
UsageItem
item
:
storage
.
getUsageMap
().
values
()
for
(
UsageItem
item
:
storage
.
getUsageMap
().
values
()
)
{
)
{
useCount
+=
item
.
getUsedCount
();
useCount
+=
item
.
getUsedCount
();
...
@@ -259,21 +273,21 @@ public class MicronStatusController {
...
@@ -259,21 +273,21 @@ public class MicronStatusController {
dto
.
setHumidity
(
humidity
);
dto
.
setHumidity
(
humidity
);
dto
.
setTemperature
(
temperature
);
dto
.
setTemperature
(
temperature
);
}
}
dto
.
getStatuMap
().
put
(
cid
,
boxStatus
.
getStatus
());
dto
.
getStatuMap
().
put
(
name
,
boxStatus
.
getStatus
());
dto
.
getMsgMap
().
put
(
cid
,
statusBean
.
getErrorMsg
(
servletRequest
.
getLocale
()));
dto
.
getMsgMap
().
put
(
name
,
statusBean
.
getErrorMsg
(
servletRequest
.
getLocale
()));
}
}
}
else
{
}
else
{
dto
.
getStatuMap
().
put
(
cid
,
0
);
dto
.
getStatuMap
().
put
(
name
,
0
);
dto
.
getMsgMap
().
put
(
cid
,
""
);
dto
.
getMsgMap
().
put
(
name
,
""
);
}
}
//出入库报表 默认过去一周到现在的
//出入库报表 默认过去一周到现在的
Calendar
time
=
Calendar
.
getInstance
();
Calendar
time
=
Calendar
.
getInstance
();
time
.
setTime
(
new
Date
());
time
.
setTime
(
new
Date
());
time
.
add
(
Calendar
.
DAY_OF_YEAR
,
-
6
);
time
.
add
(
Calendar
.
DAY_OF_YEAR
,
-
6
);
String
today
=
DateUtil
.
toDate
TimeString
(
new
Date
()
);
String
today
=
DateUtil
.
toDate
String
(
new
Date
(),
"MM/dd/yyyy"
);
List
<
ChartItem
>
chartItems
=
storageManager
.
getRunStatusData
(
time
.
getTime
(),
new
Date
(),
""
,
cids
);
List
<
ChartItem
>
chartItems
=
storageManager
.
getRunStatusData
(
time
.
getTime
(),
new
Date
(),
""
,
cids
);
for
(
ChartItem
chartItem
:
for
(
ChartItem
chartItem
:
...
@@ -313,10 +327,12 @@ public class MicronStatusController {
...
@@ -313,10 +327,12 @@ public class MicronStatusController {
String
[]
nameList
=
new
String
[]{};
String
[]
nameList
=
new
String
[]{};
String
robotName
=
"R1"
;
String
robotName
=
"R1"
;
if
(
boxName
.
equals
(
"MI1"
))
{
if
(
boxName
.
equals
(
"MI1"
))
{
nameList
=
new
String
[]{
"M3"
,
"M4"
,
"M7"
,
"M8"
};
// nameList = new String[]{"M3", "M4", "M7", "M8"};
nameList
=
new
String
[]{
"KTS-R001A"
,
"KTS-R001B"
,
"KTS-R001C"
,
"KTS-R001D"
};
robotName
=
"R1"
;
robotName
=
"R1"
;
}
else
if
(
boxName
.
equals
(
"MI2"
))
{
}
else
if
(
boxName
.
equals
(
"MI2"
))
{
nameList
=
new
String
[]{
"M1"
,
"M2"
,
"M5"
,
"M6"
};
// nameList = new String[]{"M1", "M2", "M5", "M6"};
nameList
=
new
String
[]{
"KTS-R002A"
,
"KTS-R002B"
,
"KTS-R002C"
,
"KTS-R002D"
};
robotName
=
"R2"
;
robotName
=
"R2"
;
}
}
...
@@ -430,7 +446,7 @@ public class MicronStatusController {
...
@@ -430,7 +446,7 @@ public class MicronStatusController {
// if (ObjectUtil.isNotEmpty(msg)) {
// if (ObjectUtil.isNotEmpty(msg)) {
// count += 1;
// count += 1;
// }
// }
Map
<
String
,
String
>
msgMap
=
statusBean
.
getMsgMap
();
Map
<
String
,
String
>
msgMap
=
statusBean
.
getMsgMap
(
MessageUtils
.
getDefaultLocal
()
);
if
(
msgMap
!=
null
&&
msgMap
.
size
()
>
0
)
{
if
(
msgMap
!=
null
&&
msgMap
.
size
()
>
0
)
{
for
(
String
msg
:
for
(
String
msg
:
msgMap
.
keySet
())
{
msgMap
.
keySet
())
{
...
...
src/main/java/com/neotel/smfcore/custom/nanrui/NanRuiApi.java
0 → 100644
查看文件 @
f90a593
package
com
.
neotel
.
smfcore
.
custom
.
nanrui
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.exception.ApiException
;
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.listener.BaseSmfApiListener
;
import
com.neotel.smfcore.core.inList.service.po.InList
;
import
com.neotel.smfcore.core.inList.service.po.InListItem
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Service
public
class
NanRuiApi
extends
BaseSmfApiListener
{
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
return
"nanrui"
.
equals
(
apiName
);
}
@Override
public
InList
fetchInList
(
String
fetchInListUrl
,
String
number
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"api"
,
NanRuiConfig
.
api
);
paramMap
.
put
(
"format"
,
NanRuiConfig
.
format
);
Map
<
String
,
String
>
dataParamMap
=
new
HashMap
<>();
dataParamMap
.
put
(
"number"
,
number
);
String
dataStr
=
JSON
.
toJSONString
(
dataParamMap
);
//dataStr = URLEncoder.encode(dataStr);
paramMap
.
put
(
"data"
,
dataStr
);
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
headerMap
.
put
(
"X-DB"
,
NanRuiConfig
.
X_DB_PROD
);
headerMap
.
put
(
"Content-Type"
,
NanRuiConfig
.
contentType
);
try
{
log
.
info
(
"调用获取入库单接口,参数"
+
JsonUtil
.
toJsonStr
(
paramMap
));
String
result
=
HttpHelper
.
postParam
(
fetchInListUrl
,
paramMap
,
headerMap
);
log
.
info
(
number
+
"获取入库单接口返回"
+
result
);
ApiResult
apiResult
=
JsonUtil
.
toObj
(
result
,
ApiResult
.
class
);
if
(
apiResult
.
isOk
())
{
Map
<
String
,
Object
>
dataMap
=
(
Map
<
String
,
Object
>)
apiResult
.
getData
();
String
returnNumber
=
dataMap
.
get
(
"number"
).
toString
();
InList
inList
=
new
InList
();
inList
.
setName
(
returnNumber
);
List
<
InListItem
>
items
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
itemList
=
(
List
<
Map
<
String
,
Object
>>)
dataMap
.
get
(
"items"
);
for
(
Map
<
String
,
Object
>
itemMap
:
itemList
)
{
String
partNum
=
itemMap
.
get
(
"partNum"
).
toString
();
Object
qtyStr
=
itemMap
.
get
(
"qty"
);
Object
reelCountStr
=
itemMap
.
get
(
"reelCount"
);
InListItem
item
=
new
InListItem
();
item
.
setPN
(
partNum
);
if
(
qtyStr
!=
null
&&
!
qtyStr
.
toString
().
isEmpty
())
{
item
.
setNum
(
Integer
.
valueOf
(
qtyStr
.
toString
()));
}
if
(
reelCountStr
!=
null
&&
!
qtyStr
.
toString
().
isEmpty
())
{
item
.
setInReelCount
(
Integer
.
valueOf
(
reelCountStr
.
toString
()));
}
//判断list里边有没有数据
boolean
hasSample
=
false
;
for
(
int
i
=
0
;
i
<
items
.
size
();
i
++)
{
InListItem
listItem
=
items
.
get
(
i
);
if
(
listItem
.
getPN
().
equals
(
item
.
getPN
())){
hasSample
=
true
;
log
.
info
(
partNum
+
"存在相同的partNumber,上一条数量为:"
+
listItem
.
getNum
()+
",当前数量为:"
+
item
.
getNum
());
listItem
.
setNum
(
listItem
.
getNum
()
+
item
.
getNum
());
//listItem.setInReelCount();
items
.
set
(
i
,
listItem
);
log
.
info
(
partNum
+
"合并后的数量为:"
+
listItem
.
getNum
());
}
}
if
(!
hasSample
)
{
items
.
add
(
item
);
}
}
inList
.
setInListItems
(
items
);
log
.
info
(
"获取到入库单:"
+
inList
.
getName
()
+
",共"
+
items
.
size
()
+
"条工单详情"
);
inList
=
inListManager
.
createWithItems
(
inList
);
inListCache
.
addInListToMap
(
inList
);
return
inList
;
}
else
{
throw
new
ApiException
(
"smfcore.fetchInList.ng"
,
"获取入库单MES返回NG:"
+
apiResult
.
getMsg
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
number
+
"获取入库单接口出错:"
+
e
.
getMessage
());
return
null
;
}
}
}
src/main/java/com/neotel/smfcore/custom/nanrui/NanRuiConfig.java
0 → 100644
查看文件 @
f90a593
package
com
.
neotel
.
smfcore
.
custom
.
nanrui
;
public
class
NanRuiConfig
{
public
static
final
String
X_DB_TEST
=
"nari-wms-test"
;
public
static
final
String
X_DB_PROD
=
"nari-wms-prod"
;
public
static
final
String
contentType
=
"application/x-www-form-urlencoded"
;
public
static
final
String
api
=
"wms.task.replenishment"
;
public
static
final
String
format
=
"json"
;
}
src/main/java/com/neotel/smfcore/custom/siemens/bean/LotCheckInfo.java
查看文件 @
f90a593
...
@@ -27,7 +27,7 @@ public class LotCheckInfo implements Serializable {
...
@@ -27,7 +27,7 @@ public class LotCheckInfo implements Serializable {
public
static
LotCheckInfo
toObj
(
String
lotId
,
String
result
)
{
public
static
LotCheckInfo
toObj
(
String
lotId
,
String
result
)
{
try
{
try
{
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
);
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
);
Object
statusStr
=
map
.
containsKey
(
"Status"
);
Object
statusStr
=
map
.
get
(
"Status"
);
if
(
statusStr
!=
null
)
{
if
(
statusStr
!=
null
)
{
boolean
s
=
Boolean
.
parseBoolean
(
statusStr
.
toString
());
boolean
s
=
Boolean
.
parseBoolean
(
statusStr
.
toString
());
LotCheckInfo
lotCheckInfo
=
new
LotCheckInfo
();
LotCheckInfo
lotCheckInfo
=
new
LotCheckInfo
();
...
...
src/main/resources/messages.properties
查看文件 @
f90a593
...
@@ -379,4 +379,5 @@ smfcore.agv.pickup=AGV\u5DF2\u88AB\u53EB\u6765\u53D6\u8D27
...
@@ -379,4 +379,5 @@ smfcore.agv.pickup=AGV\u5DF2\u88AB\u53EB\u6765\u53D6\u8D27
smfcore.agv.dispatch
=
\u
8D27
\u7269\u
5DF2
\u
7ECF
\u
53D1
\u9001\u5230\u
5B58
\u
50A8
\u
7CFB
\u
7EDF
smfcore.agv.dispatch
=
\u
8D27
\u7269\u
5DF2
\u
7ECF
\u
53D1
\u9001\u5230\u
5B58
\u
50A8
\u
7CFB
\u
7EDF
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.operation
=
AGV
\u5728\u
8FD0
\u
884C
\u
4E2D
smfcore.agv.operation
=
AGV
\u5728\u
8FD0
\u
884C
\u
4E2D
smfcore.boxmimokanban
=
\u
4E91
\u6599\u
4ED3
\u
770B
\u
677F
\ No newline at end of file
\ No newline at end of file
smfcore.boxmimokanban
=
\u
4E91
\u6599\u
4ED3
\u
770B
\u
677F
smfcore.neoai
=
Neo Ai
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_en_US.properties
查看文件 @
f90a593
...
@@ -370,4 +370,5 @@ smfcore.agv.pickup=AGV has been called to pick up goods
...
@@ -370,4 +370,5 @@ smfcore.agv.pickup=AGV has been called to pick up goods
smfcore.agv.dispatch
=
Goods dispatched to storage system
smfcore.agv.dispatch
=
Goods dispatched to storage system
smfcore.agv.awaitingInstruction
=
Awaiting instruction
smfcore.agv.awaitingInstruction
=
Awaiting instruction
smfcore.agv.operation
=
AGV is in operation
smfcore.agv.operation
=
AGV is in operation
smfcore.boxmimokanban
=
SMD BOX KANBAN
\ No newline at end of file
\ No newline at end of file
smfcore.boxmimokanban
=
SMD BOX KANBAN
smfcore.neoai
=
Neo Ai
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_ja_JP.properties
查看文件 @
f90a593
...
@@ -366,4 +366,5 @@ smfcore.agv.dispatch=\u4FDD\u7BA1\u30B7\u30B9\u30C6\u30E0\u306B\u767A\u9001\u305
...
@@ -366,4 +366,5 @@ smfcore.agv.dispatch=\u4FDD\u7BA1\u30B7\u30B9\u30C6\u30E0\u306B\u767A\u9001\u305
smfcore.agv.awaitingInstruction
=
\u6307\u
793A
\u
5F85
\u3061
smfcore.agv.awaitingInstruction
=
\u6307\u
793A
\u
5F85
\u3061
smfcore.agv.operation
=
AGV
\u
52D5
\u
4F5C
\u
4E2D
\u3067\u3059
smfcore.agv.operation
=
AGV
\u
52D5
\u
4F5C
\u
4E2D
\u3067\u3059
smfcore.boxmimokanban
=
\u
30AF
\u
30E9
\u
30A6
\u
30C9
\u5009\u
5EAB
\u
30AB
\u
30F3
\u
30D0
\u
30F3
\ No newline at end of file
\ No newline at end of file
smfcore.boxmimokanban
=
\u
30AF
\u
30E9
\u
30A6
\u
30C9
\u5009\u
5EAB
\u
30AB
\u
30F3
\u
30D0
\u
30F3
smfcore.neoai
=
Neo Ai
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_zh_CN.properties
查看文件 @
f90a593
...
@@ -366,4 +366,5 @@ smfcore.agv.dispatch=\u8D27\u7269\u5DF2\u7ECF\u53D1\u9001\u5230\u5B58\u50A8\u7CF
...
@@ -366,4 +366,5 @@ smfcore.agv.dispatch=\u8D27\u7269\u5DF2\u7ECF\u53D1\u9001\u5230\u5B58\u50A8\u7CF
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.operation
=
AGV
\u5728\u
8FD0
\u
884C
\u
4E2D
smfcore.agv.operation
=
AGV
\u5728\u
8FD0
\u
884C
\u
4E2D
smfcore.boxmimokanban
=
\u
4E91
\u6599\u
4ED3
\u
770B
\u
677F
\ No newline at end of file
\ No newline at end of file
smfcore.boxmimokanban
=
\u
4E91
\u6599\u
4ED3
\u
770B
\u
677F
smfcore.neoai
=
Neo Ai
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_zh_TW.properties
查看文件 @
f90a593
...
@@ -366,4 +366,5 @@ smfcore.agv.dispatch=\u8CA8\u7269\u767C\u9001\u5230\u5B58\u5132\u7CFB\u7D71
...
@@ -366,4 +366,5 @@ smfcore.agv.dispatch=\u8CA8\u7269\u767C\u9001\u5230\u5B58\u5132\u7CFB\u7D71
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.operation
=
AGV
\u
6B63
\u5728\u
904B
\u
884C
smfcore.agv.operation
=
AGV
\u
6B63
\u5728\u
904B
\u
884C
smfcore.boxmimokanban
=
\u
96F2
\u6599\u5009\u
770B
\u
677F
\ No newline at end of file
\ No newline at end of file
smfcore.boxmimokanban
=
\u
96F2
\u6599\u5009\u
770B
\u
677F
smfcore.neoai
=
Neo Ai
\ No newline at end of file
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论