Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 1f484b4b
由
LN
编写于
2021-11-29 14:09:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加普通料架类型NL,及扫码入库处理
1 个父辈
e48b9be2
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
194 行增加
和
6 行删除
src/main/java/com/neotel/smfcore/common/bean/ResultBean.java
src/main/java/com/neotel/smfcore/core/device/bean/NLShelfOperateBean.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLShelfHandler.java
src/main/java/com/neotel/smfcore/core/storage/enums/DeviceType.java
src/main/java/com/neotel/smfcore/core/storage/rest/MaterialController.java
src/main/java/com/neotel/smfcore/core/storage/service/manager/IStoragePosManager.java
src/main/java/com/neotel/smfcore/core/storage/service/manager/impl/StoragePosManagerImpl.java
src/main/java/com/neotel/smfcore/core/storage/service/po/Storage.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/hella/handler/HellaServiceHandler.java
src/main/java/com/neotel/smfcore/common/bean/ResultBean.java
查看文件 @
1f484b4
...
...
@@ -33,7 +33,7 @@ public class ResultBean<T> {
result
.
setMsg
(
MessageUtils
.
getText
(
msgKey
,
params
,
new
Locale
(
SecurityUtils
.
getCurrentUserLanguage
()),
msg
));
if
(
writeLog
)
{
log
.
info
(
msg
);
log
.
info
(
result
.
getMsg
()
);
}
return
result
;
}
...
...
src/main/java/com/neotel/smfcore/core/device/bean/NLShelfOperateBean.java
0 → 100644
查看文件 @
1f484b4
package
com
.
neotel
.
smfcore
.
core
.
device
.
bean
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
public
class
NLShelfOperateBean
{
private
String
sessionId
;
private
long
updateTime
;
/**
* 当前操作库位信息
*/
private
StoragePos
opPos
;
/**
* 需要关灯的库位
*/
private
StoragePos
posToClose
;
/**
* 下一个库位的Id,用于自动推荐库位
*/
private
String
nextPosId
;
public
StoragePos
getOpPos
()
{
return
opPos
;
}
public
void
setOpPos
(
StoragePos
opPos
)
{
updateOpTime
();
this
.
opPos
=
opPos
;
}
public
StoragePos
getPosToClose
()
{
return
posToClose
;
}
public
void
setPosToClose
(
StoragePos
posToClose
)
{
updateOpTime
();
this
.
posToClose
=
posToClose
;
}
public
String
getSessionId
()
{
return
sessionId
;
}
public
void
setSessionId
(
String
sessionId
)
{
updateOpTime
();
this
.
sessionId
=
sessionId
;
}
public
long
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
long
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
private
void
updateOpTime
(){
setUpdateTime
(
System
.
currentTimeMillis
());
}
public
String
getNextPosId
()
{
return
nextPosId
;
}
public
void
setNextPosId
(
String
nextPosId
)
{
this
.
nextPosId
=
nextPosId
;
}
/**
* 1个小时没有任何操作,即认为超时
*/
public
boolean
timeOut
(){
if
(
updateTime
>
0
){
return
System
.
currentTimeMillis
()
-
updateTime
>
1
*
60
*
60
*
1000
;
}
return
false
;
}
}
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLShelfHandler.java
0 → 100644
查看文件 @
1f484b4
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/core/storage/enums/DeviceType.java
查看文件 @
1f484b4
...
...
@@ -100,7 +100,12 @@ public enum DeviceType {
SMD_XLR
(
"storage.type.smdXlr"
),
/**
* 15 (默认料仓)
* 16 智能料架/亮灯料架/普通料架 NL
*/
NL
(
"storage.type.nl"
),
/**
* 17 (默认料仓)
*/
DEFAULT
(
"storage.type.default"
)
;
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/MaterialController.java
查看文件 @
1f484b4
...
...
@@ -199,8 +199,13 @@ public class MaterialController {
if
(
posIds
==
null
||
posIds
.
size
()
<=
0
)
{
throw
new
ValidateException
(
"smfcode.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"ID"
});
}
String
labelName
=
""
;
if
(
ObjectUtil
.
isEmpty
(
labelId
))
{
labelId
=
""
;
}
else
{
Label
label
=
labelManager
.
get
(
labelId
);
labelName
=
label
.
getLabelName
();
}
String
[]
array
=
posIds
.
toArray
(
new
String
[
posIds
.
size
()]);
storagePosManager
.
updatePosLabel
(
array
,
labelId
);
...
...
@@ -231,7 +236,7 @@ public class MaterialController {
return
ResultBean
.
newOkResult
(
"smfcode.manualOut.ok"
,
"手动出库成功"
,
code
);
}
catch
(
Exception
e
)
{
return
ResultBean
.
new
OkResult
(
"smfcore.error"
,
"出错{0}"
,
new
String
[]{
e
.
getMessage
()},
cod
e
);
return
ResultBean
.
new
ErrorResult
(
1
,
"smfcore.error"
,
"出错{0}"
,
new
String
[]{
e
.
getMessage
()},
tru
e
);
}
}
else
{
throw
new
ValidateException
(
"smfcode.manualOut.notFound"
,
"仓库中未找到料盘信息"
);
...
...
src/main/java/com/neotel/smfcore/core/storage/service/manager/IStoragePosManager.java
查看文件 @
1f484b4
...
...
@@ -53,4 +53,6 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
void
updatePosLabel
(
String
[]
posIds
,
String
labelId
);
void
clearLockPos
(
String
lockId
);
StoragePos
autoFindNextEmptyPos
(
Storage
storage
,
Collection
<
String
>
excludePosIds
,
StoragePos
currentPos
);
}
src/main/java/com/neotel/smfcore/core/storage/service/manager/impl/StoragePosManagerImpl.java
查看文件 @
1f484b4
...
...
@@ -407,4 +407,38 @@ public class StoragePosManagerImpl implements IStoragePosManager {
storagePosDao
.
updateMulti
(
query
,
Update
.
update
(
"barcode.lockId"
,
""
));
}
@Override
public
StoragePos
autoFindNextEmptyPos
(
Storage
storage
,
Collection
<
String
>
excludePosIds
,
StoragePos
currentPos
)
{
Criteria
c
=
Criteria
.
where
(
"storageId"
).
is
(
storage
.
getId
());
// c.and("priority").lt(currentPos.getPriority());
COMPATIBLE_TYPE
compatibleType
=
storage
.
getCompatibleType
();
if
(
compatibleType
==
COMPATIBLE_TYPE
.
EXACT_MATCH
)
{
//完全匹配
c
=
c
.
and
(
"w"
).
is
(
currentPos
.
getW
()).
and
(
"h"
).
is
(
currentPos
.
getH
());
}
else
if
(
compatibleType
==
COMPATIBLE_TYPE
.
FULLY_COMPATIBLE
)
{
//同厚度兼容
c
=
c
.
and
(
"w"
).
gte
(
currentPos
.
getW
()).
and
(
"h"
).
gte
(
currentPos
.
getH
());
//除7寸外,完全兼容
}
else
if
(
compatibleType
==
COMPATIBLE_TYPE
.
SIZE_COMPATIBLE
)
{
//同尺寸兼容
c
=
c
.
and
(
"w"
).
is
(
currentPos
.
getW
()).
and
(
"h"
).
gte
(
currentPos
.
getH
());
//宽度等于料盘宽度,高度大于等于料盘高度
}
c
=
c
.
and
(
"enabled"
).
is
(
true
)
//可用
.
and
(
"used"
).
is
(
false
);
//未使用
//去除的仓位
if
(
excludePosIds
!=
null
&&
!
excludePosIds
.
isEmpty
())
{
c
=
c
.
and
(
"id"
).
nin
(
excludePosIds
);
}
Query
query
=
new
Query
(
c
);
String
msg
=
""
;
// if (lastPosId == null || lastPosId.equals("")) {
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"w"
).
and
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"h"
)).
and
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"priority"
)));
StoragePos
pos
=
storagePosDao
.
findOne
(
query
);
return
pos
;
}
}
src/main/java/com/neotel/smfcore/core/storage/service/po/Storage.java
查看文件 @
1f484b4
...
...
@@ -120,7 +120,12 @@ public class Storage extends BasePo implements Serializable {
public
boolean
isCodeShelf
()
{
return
DeviceType
.
CODESHELF
.
name
().
equals
(
type
);
}
/**
* 是否是普通料架
*/
public
boolean
isNLShelf
()
{
return
DeviceType
.
NL
.
name
().
equals
(
type
);
}
/**
* 是否是垂直货柜
*/
...
...
src/main/java/com/neotel/smfcore/core/system/util/DevicesStatusUtil.java
查看文件 @
1f484b4
...
...
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Created by sunke on 2021/8/4.
...
...
@@ -56,6 +57,9 @@ public class DevicesStatusUtil {
}
/**
* 主要用来存储感应料架库位报警信息
*/
private
static
Map
<
String
,
List
<
List
<
String
>>>
deviceDataMap
=
Maps
.
newConcurrentMap
();
public
static
void
updateDeviceData
(
String
cid
,
List
<
List
<
String
>>
data
)
{
...
...
@@ -66,4 +70,55 @@ public class DevicesStatusUtil {
return
deviceDataMap
.
get
(
cid
);
}
/**
*存储料仓 出入库的一些操作,KEY=cid
*/
private
static
Map
<
String
,
Map
<
String
,
String
>>
storageOpMap
=
new
ConcurrentHashMap
<>();
/**
* 添加操作
* @param cid
* @param opKey
* @param opValue
*/
public
static
void
addOp
(
String
cid
,
String
opKey
,
String
opValue
){
if
(
opValue
==
null
){
return
;
}
Map
<
String
,
String
>
opMap
=
storageOpMap
.
get
(
cid
);
if
(
opMap
==
null
){
opMap
=
new
ConcurrentHashMap
<>();
}
opMap
.
put
(
opKey
,
opValue
);
storageOpMap
.
put
(
cid
,
opMap
);
}
/**
* 追加操作
* @param cid
* @param opKey
* @param opValue
*/
public
static
void
appendOp
(
String
cid
,
String
opKey
,
String
opValue
){
Map
<
String
,
String
>
opMap
=
storageOpMap
.
get
(
cid
);
if
(
opMap
==
null
){
opMap
=
new
ConcurrentHashMap
<>();
}
String
value
=
opMap
.
get
(
opKey
);
if
(
value
!=
null
){
value
=
value
+
"|"
+
opValue
;
}
else
{
value
=
opValue
;
}
opMap
.
put
(
opKey
,
value
);
storageOpMap
.
put
(
cid
,
opMap
);
}
public
static
Map
<
String
,
String
>
getAndRemoveOp
(
String
cid
){
Map
<
String
,
String
>
opMap
=
storageOpMap
.
get
(
cid
);
opMap
.
remove
(
cid
);
return
opMap
;
}
}
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
查看文件 @
1f484b4
...
...
@@ -783,7 +783,7 @@ public class TaskService {
task
.
setPartNumber
(
barcode
.
getPartNumber
());
task
.
setBarcode
(
barcode
.
getBarcode
());
task
.
setNum
(
barcode
.
get
Initial
Amount
());
task
.
setNum
(
barcode
.
getAmount
());
dataCache
.
updateInventory
(
pos
,
barcode
);
//dataCache.updateStorage(task.getCid());
...
...
src/main/java/com/neotel/smfcore/hella/handler/HellaServiceHandler.java
查看文件 @
1f484b4
...
...
@@ -184,7 +184,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
String
groupId
=
requestCommand
.
getGroupId
();
if
(
respCommand
.
isOkResp
()){
ResultBean
okResult
=
ResultBean
.
newOkResult
(
"smfcore.loadMaterialFinished"
,
"loading material is finished: {0}"
,
new
String
[]{
messageText
});
ResultBean
okResult
=
ResultBean
.
newOkResult
(
"smfcore.loadMaterialFinished"
,
"loading material is finished: {0}"
,
new
String
[]{
messageText
}
,
""
);
WebSocketServer
.
sendGroupMsg
(
groupId
,
new
SocketMsg
(
okResult
.
getMsg
(),
MsgType
.
INFO
));
}
else
{
ResultBean
ngResult
=
ResultBean
.
newErrorResult
(
Integer
.
valueOf
(
returnCode
),
"smfcore.loadMaterialFailed"
,
"loading material failed:{0}"
,
new
String
[]{
messageText
}
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论