Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 8e43c959
由
LN
编写于
2022-02-28 09:57:40 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加设备通信接口:cidIsExists和uploadStoragePos
1 个父辈
dd226ecf
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
220 行增加
和
43 行删除
src/main/java/com/neotel/smfcore/core/device/bean/PosInfo.java
src/main/java/com/neotel/smfcore/core/device/bean/StatusBean.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/storage/rest/StorageController.java
src/main/java/com/neotel/smfcore/core/storage/service/po/StoragePos.java
src/main/java/com/neotel/smfcore/hella/handler/HellaServiceHandler.java
修改记录.txt
src/main/java/com/neotel/smfcore/core/device/bean/PosInfo.java
0 → 100644
查看文件 @
8e43c95
package
com
.
neotel
.
smfcore
.
core
.
device
.
bean
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
PosInfo
implements
Serializable
{
/**
* 库位号
*/
private
String
pos
;
/**
* 优先级
*/
private
Integer
pri
;
/**
* 高度
*/
private
Integer
h
;
/**
* 宽度
*/
private
Integer
w
;
}
\ No newline at end of file
src/main/java/com/neotel/smfcore/core/device/bean/StatusBean.java
查看文件 @
8e43c95
...
...
@@ -102,6 +102,7 @@ public class StatusBean {
*/
private
long
offlineTime
=-
1
;
private
List
<
PosInfo
>
posList
=
null
;
/**
* 获取已经结束(缓存中存在,但新的报警列表不存在)的报警列表,同时将新的报警加入到缓存中
*/
...
...
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
查看文件 @
8e43c95
...
...
@@ -12,6 +12,7 @@ import com.neotel.smfcore.common.utils.Constants;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.bean.PosInfo
;
import
com.neotel.smfcore.core.message.util.DeviceMessageUtil
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
...
...
@@ -42,7 +43,7 @@ import java.util.*;
public
class
DeviceController
{
@Autowired
private
DataCache
dataCa
h
che
;
private
DataCache
dataCache
;
@Autowired
private
TaskService
taskService
;
...
...
@@ -72,7 +73,7 @@ public class DeviceController {
public
StatusBean
communication
(
@RequestBody
final
StatusBean
statusBean
,
HttpServletRequest
request
)
{
try
{
String
cid
=
statusBean
.
getCid
();
Storage
storage
=
dataCa
h
che
.
getStorage
(
cid
);
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
==
null
)
{
log
.
error
(
"料仓cid: ["
+
cid
+
"]不存在"
);
return
null
;
...
...
@@ -116,7 +117,7 @@ public class DeviceController {
log
.
info
(
"流水线["
+
cids
+
"]获取["
+
rfid
+
"]["
+
code
+
"]的入库库位"
);
Map
<
String
,
Object
>
resultMap
=
Maps
.
newHashMap
();
if
(
dataCa
h
che
.
getCache
(
Constants
.
CACHE_StopOut
))
{
if
(
dataCache
.
getCache
(
Constants
.
CACHE_StopOut
))
{
lineMsg
=
"系统更新中,暂停出入库"
;
DeviceMessageUtil
.
updateLineMsg
(
lineMsg
,
code
,
cids
,
""
,
"smfcore.linemsg.update"
,
null
);
resultMap
.
put
(
"result"
,
"100"
);
...
...
@@ -133,14 +134,14 @@ public class DeviceController {
List
<
Storage
>
storageList
=
Lists
.
newArrayList
();
List
<
String
>
cidList
=
Lists
.
newArrayList
();
for
(
String
cid
:
cids
.
split
(
","
))
{
String
notIntoCids
=
dataCa
h
che
.
getSettings
().
getNotIntoCids
();
String
notIntoCids
=
dataCache
.
getSettings
().
getNotIntoCids
();
if
(
notIntoCids
!=
null
)
{
if
(
notIntoCids
.
contains
(
cid
))
{
log
.
info
(
"料仓["
+
cid
+
"]已被屏蔽入库"
);
continue
;
}
}
Storage
storage
=
dataCa
h
che
.
getStorage
(
cid
);
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
!=
null
)
{
storageList
.
add
(
storage
);
cidList
.
add
(
cid
);
...
...
@@ -215,7 +216,7 @@ public class DeviceController {
// }
Storage
theStorage
=
dataCa
h
che
.
getStorageById
(
pos
.
getStorageId
());
Storage
theStorage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
resultMap
.
put
(
"result"
,
"0"
);
resultMap
.
put
(
"msg"
,
""
);
...
...
@@ -389,5 +390,84 @@ public class DeviceController {
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"客户端判断CID是否存在"
)
@RequestMapping
(
value
=
"/service/store/cidIsExists"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
cidIsExists
(
HttpServletRequest
request
)
{
String
cid
=
request
.
getParameter
(
"cid"
);
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
==
null
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.valueNotFind"
,
"未找到{0}[{1}]"
,
new
String
[]{
"CID"
,
cid
});
}
return
ResultBean
.
newOkResult
(
cid
);
}
@ApiOperation
(
"客户端上传料仓库位列表"
)
@RequestMapping
(
value
=
"/service/store/uploadStoragePos"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
uploadStoragePos
(
@RequestBody
final
StatusBean
statusBean
,
HttpServletRequest
request
)
{
String
cid
=
statusBean
.
getCid
();
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
==
null
)
{
log
.
error
(
"uploadStoragePos料仓cid: ["
+
cid
+
"]不存在,默认自动创建料仓"
);
//自动创建料仓
storage
=
dataCache
.
AutoCreateStorage
(
cid
);
if
(
storage
==
null
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.valueNotFind"
,
"未找到{0}[{1}]"
,
new
String
[]{
"CID"
,
cid
});
}
}
//料仓已存在,判断料仓是否有库位
List
<
StoragePos
>
storagePosList
=
storagePosManager
.
findByStorage
(
storage
.
getId
());
if
(
storagePosList
.
size
()
>=
0
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.alreadyHasPos"
,
"料仓[{0}]已有库位数:[{1}]"
,
new
String
[]{
cid
,
storagePosList
.
size
()
+
""
});
}
//取库位
List
<
PosInfo
>
posInfoList
=
statusBean
.
getPosList
();
List
<
StoragePos
>
newList
=
new
ArrayList
<>();
List
<
String
>
posNameList
=
new
ArrayList
<>();
if
(
posInfoList
!=
null
&&
posInfoList
.
size
()>
0
){
int
row
=
1
;
int
newRowCount
=
0
;
for
(
PosInfo
pos
:
posInfoList
)
{
row
++;
if
(
ObjectUtil
.
isEmpty
(
pos
.
getPos
()))
{
log
.
warn
(
"第"
+
row
+
"条库位号中有空白内容,此行忽略"
);
continue
;
}
if
(
posNameList
.
contains
(
pos
.
getPos
()))
{
log
.
warn
(
"第"
+
row
+
"条库位号["
+
storage
+
"]重复,只保留第一条,忽略其他行"
);
}
else
{
StoragePos
posInfo
=
new
StoragePos
(
storage
.
getId
(),
pos
.
getPos
(),
pos
.
getH
(),
pos
.
getW
(),
pos
.
getPri
());
newRowCount
++;
newList
.
add
(
posInfo
);
}
}
if
(
newList
.
size
()>
0
){
storagePosManager
.
insertAll
(
newList
);
}
dataCache
.
reloadStorage
(
storage
,
""
);
String
msg
=
"读取到["
+
row
+
"]行数据:为料仓["
+
storage
.
getCid
()+
"]新增["
+
newRowCount
+
"]条库位号"
;
log
.
info
(
msg
);
}
return
ResultBean
.
newOkResult
(
cid
);
}
private
StoragePos
findFormList
(
List
<
StoragePos
>
list
,
String
posName
)
{
for
(
StoragePos
pos
:
list
)
{
if
(
pos
.
getPosName
().
equals
(
posName
)){
return
pos
;
}
}
return
null
;
}
}
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
查看文件 @
8e43c95
...
...
@@ -17,6 +17,8 @@ import com.neotel.smfcore.core.language.service.po.LanguageMsg;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.storage.bean.InventoryItem
;
import
com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE
;
import
com.neotel.smfcore.core.storage.enums.COMPATIBLE_TYPE
;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.bean.OrderSetting
;
import
com.neotel.smfcore.core.system.service.dao.ICacheItemDao
;
...
...
@@ -343,7 +345,17 @@ public class DataCache {
}
return
null
;
}
/**
* 根据 料仓名称 Name 获取料仓信息
*/
public
Storage
getStorageByName
(
String
storageName
){
for
(
Storage
storage
:
getAllStorage
().
values
()){
if
(
storage
.
getName
().
equals
(
storageName
)){
return
storage
;
}
}
return
null
;
}
public
Storage
reloadStorage
(
Storage
storage
,
String
oldCid
)
throws
ValidateException
{
if
(!
oldCid
.
equals
(
""
)
&&
allStorage
.
containsKey
(
oldCid
))
{
...
...
@@ -645,5 +657,30 @@ public class DataCache {
}
return
availableStorageIds
;
}
public
Storage
AutoCreateStorage
(
String
cid
)
{
//判断cid存在
Storage
storage
=
null
;
storage
=
getStorage
(
cid
);
if
(
storage
!=
null
)
{
return
storage
;
}
//判断cid是否和其他料仓名称重复,重复时无法自动创建
if
(
getStorageByName
(
cid
)
!=
null
)
{
return
null
;
}
storage
=
new
Storage
();
storage
.
setCid
(
cid
);
storage
.
setType
(
DeviceType
.
AUTO
.
getName
());
storage
.
setName
(
cid
);
storage
.
setCompatibleType
(
COMPATIBLE_TYPE
.
EXACT_MATCH
);
storage
.
setSourcePath
(
""
);
storage
.
setGroupId
(
""
);
storage
=
storageManager
.
save
(
storage
);
reloadStorage
(
storage
,
""
);
log
.
info
(
"AutoCreateStorage :自动创建料仓完成:cid["
+
storage
.
getCid
()+
"]name["
+
storage
.
getName
()+
"]type["
+
storage
.
getCompatibleType
().
name
()+
"]"
);
return
storage
;
}
}
src/main/java/com/neotel/smfcore/core/storage/rest/StorageController.java
查看文件 @
8e43c95
...
...
@@ -432,44 +432,11 @@ public class StorageController {
// StoragePos posInfo = storagePosManager.getByPosName(posName);
StoragePos
posInfo
=
findFormList
(
storagePosList
,
posName
);
if
(
posInfo
==
null
){
posInfo
=
new
StoragePos
();
posInfo
.
setPosName
(
posName
);
posInfo
.
setStorageId
(
storageId
);
posInfo
.
setH
(
height
);
posInfo
.
setW
(
width
);
posInfo
.
setPriority
(
priority
);
Point
point
=
PointUtil
.
getPosPoint
(
posName
);
posInfo
.
setCoordinate
(
new
double
[]{
point
.
getX
(),
point
.
getY
()});
posInfo
=
new
StoragePos
(
storageId
,
posName
,
height
,
width
,
priority
);
newRowCount
++;
newList
.
add
(
posInfo
);
}
else
{
boolean
needUpdate
=
false
;
if
(!
posInfo
.
getPosName
().
equals
(
posName
)){
needUpdate
=
true
;
posInfo
.
setPosName
(
posName
);
}
if
(!
posInfo
.
getStorageId
().
equals
(
storageId
)){
needUpdate
=
true
;
posInfo
.
setStorageId
(
storageId
);
}
if
(
posInfo
.
getH
()!=
height
){
needUpdate
=
true
;
posInfo
.
setH
(
height
);
}
if
(
posInfo
.
getW
()!=
width
){
needUpdate
=
true
;
posInfo
.
setW
(
width
);
}
if
(
posInfo
.
getPriority
()!=
priority
){
needUpdate
=
true
;
posInfo
.
setPriority
(
priority
);
}
Point
point
=
PointUtil
.
getPosPoint
(
posInfo
.
getPosName
());
if
(
posInfo
.
getCoordinate
()==
null
||
posInfo
.
getCoordinate
().
length
!=
2
||
(
posInfo
.
getCoordinate
()[
0
]!=
point
.
getX
())
||(
posInfo
.
getCoordinate
()[
1
]!=
point
.
getY
())){
needUpdate
=
true
;
posInfo
.
setCoordinate
(
new
double
[]{
point
.
getX
(),
point
.
getY
()});
}
boolean
needUpdate
=
posInfo
.
updatePosInfo
(
storageId
,
posName
,
height
,
width
,
priority
);
if
(
needUpdate
){
updateRowCount
++;
storagePosManager
.
save
(
posInfo
);
...
...
src/main/java/com/neotel/smfcore/core/storage/service/po/StoragePos.java
查看文件 @
8e43c95
...
...
@@ -2,8 +2,10 @@ package com.neotel.smfcore.core.storage.service.po;
import
com.google.common.base.Strings
;
import
com.neotel.smfcore.common.base.BasePo
;
import
com.neotel.smfcore.common.utils.PointUtil
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
lombok.Data
;
import
org.springframework.data.geo.Point
;
import
org.springframework.data.mongodb.core.index.GeoSpatialIndexType
;
import
org.springframework.data.mongodb.core.index.GeoSpatialIndexed
;
import
org.springframework.data.mongodb.core.mapping.Document
;
...
...
@@ -14,6 +16,54 @@ import java.util.List;
@Data
@Document
public
class
StoragePos
extends
BasePo
implements
Serializable
{
public
StoragePos
(){
}
public
StoragePos
(
String
storageId
,
String
posName
,
int
h
,
int
w
,
int
priority
){
setStorageId
(
storageId
);
setPosName
(
posName
);
setH
(
h
);
setW
(
w
);
setPriority
(
priority
);
Point
point
=
PointUtil
.
getPosPoint
(
posName
);
setCoordinate
(
new
double
[]{
point
.
getX
(),
point
.
getY
()});
}
public
boolean
updatePosInfo
(
String
storageId
,
String
posName
,
int
h
,
int
w
,
int
priority
){
boolean
needUpdate
=
false
;
if
(!
getPosName
().
equals
(
posName
)){
needUpdate
=
true
;
setPosName
(
posName
);
}
if
(!
getStorageId
().
equals
(
storageId
)){
needUpdate
=
true
;
setStorageId
(
storageId
);
}
if
(
getH
()!=
h
){
needUpdate
=
true
;
setH
(
h
);
}
if
(
getW
()!=
w
){
needUpdate
=
true
;
setW
(
w
);
}
if
(
getPriority
()!=
priority
){
needUpdate
=
true
;
setPriority
(
priority
);
}
Point
point
=
PointUtil
.
getPosPoint
(
getPosName
());
if
(
getCoordinate
()==
null
||
getCoordinate
().
length
!=
2
||
(
getCoordinate
()[
0
]!=
point
.
getX
())
||(
getCoordinate
()[
1
]!=
point
.
getY
())){
needUpdate
=
true
;
setCoordinate
(
new
double
[]{
point
.
getX
(),
point
.
getY
()});
}
return
needUpdate
;
}
private
String
storageId
;
private
Barcode
barcode
;
...
...
src/main/java/com/neotel/smfcore/hella/handler/HellaServiceHandler.java
查看文件 @
8e43c95
...
...
@@ -422,7 +422,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
try
{
taskService
.
addTaskToExecute
(
dataLog
);
ResultBean
okResult
=
ResultBean
.
newOkResult
(
"checking material is ok: "
+
messageText
);
WebSocketServer
.
sendMsg
(
token
,
new
SocketMsg
(
okResult
.
getMsg
(),
MsgType
.
INFO
,
""
,
new
String
[]{
messageText
}));
WebSocketServer
.
sendMsg
(
token
,
new
SocketMsg
(
okResult
.
getMsg
(),
MsgType
.
INFO
,
"
smfclient.checkingMaterialOk
"
,
new
String
[]{
messageText
}));
}
catch
(
Exception
e
){
WebSocketServer
.
sendMsg
(
token
,
new
SocketMsg
(
e
.
getMessage
(),
MsgType
.
INFO
,
"smfclient.nlp.error"
,
new
String
[]{
e
.
getMessage
()}));
}
...
...
修改记录.txt
0 → 100644
查看文件 @
8e43c95
20220225修改:
1.工单出库界面调整
2.增加:物料管理->物料入库菜 页面
3.增加:设置->料架设置 页面
20220228 增加接口:
/service/store/cidIsExists
客户端判断CID是否存在,参数:cid,返回值code=0表示存在,其他值表示不存在
/service/store/uploadStoragePos
客户端上传料仓库位列表,参数:cid,posList (库位列表)
处理:判断料仓是否存在,不存在时自动创建料仓。料仓无库位时自动上传库位,有库位时不处理。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论