Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 211a0cdc
由
sunke
编写于
2022-09-02 09:37:16 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1 亮灯灭灯慢的问题
2 第一盘料没感应到又扫了第二盘物料时,取消第一盘料的入库任务
1 个父辈
c7bd53b4
全部展开
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
64 行增加
和
23 行删除
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLPShelfHandler.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/hik/rest/SingleInController.java
src/main/java/com/neotel/smfcore/core/storage/rest/StoragePosController.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/device/handler/impl/NLPShelfHandler.java
查看文件 @
211a0cd
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
查看文件 @
211a0cd
...
@@ -394,6 +394,7 @@ public class DeviceController {
...
@@ -394,6 +394,7 @@ public class DeviceController {
}
}
pos
.
setEnabled
(
false
);
pos
.
setEnabled
(
false
);
storagePosManager
.
save
(
pos
);
storagePosManager
.
save
(
pos
);
dataCache
.
updateDisablePos
(
pos
);
log
.
info
(
"屏蔽库位:库位号["
+
pos
.
getId
()
+
"]["
+
pos
.
getPosName
()
+
"]barcode["
+
barcode
+
"]"
);
log
.
info
(
"屏蔽库位:库位号["
+
pos
.
getId
()
+
"]["
+
pos
.
getPosName
()
+
"]barcode["
+
barcode
+
"]"
);
DeviceMessageUtil
.
addEnabledPosMessage
(
pos
,
""
);
DeviceMessageUtil
.
addEnabledPosMessage
(
pos
,
""
);
...
...
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
查看文件 @
211a0cd
...
@@ -64,6 +64,11 @@ public class DataCache {
...
@@ -64,6 +64,11 @@ public class DataCache {
* 库位占用Map, key为cid,value为已使用的库位列表
* 库位占用Map, key为cid,value为已使用的库位列表
*/
*/
private
static
Map
<
String
,
List
<
String
>>
usedPosNameMap
=
new
ConcurrentHashMap
<>();
private
static
Map
<
String
,
List
<
String
>>
usedPosNameMap
=
new
ConcurrentHashMap
<>();
/**
* 禁用库位名称列表
*/
private
static
Set
<
String
>
disabledPosNameSet
;
/**
/**
* 所有的料仓 key 为 cid, value 为 Storage
* 所有的料仓 key 为 cid, value 为 Storage
*/
*/
...
@@ -470,6 +475,39 @@ public class DataCache {
...
@@ -470,6 +475,39 @@ public class DataCache {
return
storageInventory
;
return
storageInventory
;
}
}
/**
* 获取禁用库位缓存
*/
public
Set
<
String
>
getDisabledPosNameSet
(){
initDisabledPosNameSet
();
return
disabledPosNameSet
;
}
/**
* 初始化禁用库位缓存
*/
private
synchronized
void
initDisabledPosNameSet
(){
if
(
disabledPosNameSet
==
null
){
disabledPosNameSet
=
new
HashSet
<>();
List
<
StoragePos
>
disabledPosList
=
storagePosManager
.
findDisabled
();
for
(
StoragePos
disabledPos
:
disabledPosList
)
{
disabledPosNameSet
.
add
(
disabledPos
.
getPosName
());
}
log
.
info
(
"加载禁用库位缓存,共"
+
disabledPosNameSet
.
size
()
+
"个"
);
}
}
/**
* 更新禁用库位缓存
*/
public
void
updateDisablePos
(
StoragePos
pos
){
initDisabledPosNameSet
();
if
(
pos
.
isEnabled
()){
disabledPosNameSet
.
remove
(
pos
.
getPosName
());
}
else
{
disabledPosNameSet
.
add
(
pos
.
getPosName
());
}
}
/**
/**
* 出库时清除使用库位列表
* 出库时清除使用库位列表
...
@@ -492,9 +530,9 @@ public class DataCache {
...
@@ -492,9 +530,9 @@ public class DataCache {
/**
/**
* 获取设备所有占用的库位名称列表
* 获取设备所有占用的库位名称列表
*/
*/
public
List
<
String
>
getUsedPosNameList
(
String
cid
)
{
public
synchronized
List
<
String
>
getUsedPosNameList
(
String
cid
)
{
if
(
cid
==
null
){
if
(
cid
==
null
||
cid
.
isEmpty
()
){
cid
=
""
;
return
new
ArrayList
<>()
;
}
}
List
<
String
>
posNameList
=
usedPosNameMap
.
get
(
cid
);
List
<
String
>
posNameList
=
usedPosNameMap
.
get
(
cid
);
if
(
posNameList
==
null
)
{
if
(
posNameList
==
null
)
{
...
...
src/main/java/com/neotel/smfcore/core/hik/rest/SingleInController.java
查看文件 @
211a0cd
...
@@ -183,13 +183,14 @@ public class SingleInController {
...
@@ -183,13 +183,14 @@ public class SingleInController {
if
(
ObjectUtils
.
isEmpty
(
code
))
{
if
(
ObjectUtils
.
isEmpty
(
code
))
{
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"code"
});
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"code"
});
}
}
Storage
storage
=
storageManager
.
get
(
storageId
);
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
==
null
)
{
if
(
storage
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.shelfNotExist"
,
"{0}对应的料架不存在"
,
new
String
[]{
storageId
});
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.shelfNotExist"
,
"{0}对应的料架不存在"
,
new
String
[]{
storageId
});
}
}
// log.info("codeInProcess , code["+code+"],storageId["+storageId+"]开始验证是否有未结束的任务");
synchronized
(
storage
){
// log.info("codeInProcess , code["+code+"],storageId["+storageId+"]开始验证是否有未结束的任务");
// WebSocketServer.sendMsg("", new SocketMsg("{0}未找到库位:{1}"+code, MsgType.INFO,"smfclient.nlp.cannotFindPos",new String[]{"消息测试","库位号"}));
// WebSocketServer.sendMsg("", new SocketMsg("{0}未找到库位:{1}"+code, MsgType.INFO,"smfclient.nlp.cannotFindPos",new String[]{"消息测试","库位号"}));
String
loginUser
=
SecurityUtils
.
getLoginUsername
();
String
loginUser
=
SecurityUtils
.
getLoginUsername
();
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
();
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
();
...
@@ -198,8 +199,10 @@ public class SingleInController {
...
@@ -198,8 +199,10 @@ public class SingleInController {
// log.info("------codeInProcess queueTask="+ JsonUtil.toJsonStr(queueTask));
// log.info("------codeInProcess queueTask="+ JsonUtil.toJsonStr(queueTask));
if
(
queueTask
.
isPutInTask
()
&&(
queueTask
.
isWait
()||
queueTask
.
isExecuting
())
)
{
if
(
queueTask
.
isPutInTask
()
&&(
queueTask
.
isWait
()||
queueTask
.
isExecuting
())
)
{
if
(!
Strings
.
isNullOrEmpty
(
storageId
)
&&
queueTask
.
getStorageId
().
equals
(
storageId
))
{
if
(!
Strings
.
isNullOrEmpty
(
storageId
)
&&
queueTask
.
getStorageId
().
equals
(
storageId
))
{
log
.
info
(
"codeIn ["
+
code
+
"]["
+
storageId
+
"]入库失败:条码["
+
queueTask
.
getBarcode
()
+
"]的任务还未结束 "
);
log
.
warn
(
"扫描条码["
+
code
+
"]时取消物料["
+
queueTask
.
getBarcode
()+
"]未完成的入库任务"
);
throw
new
ValidateException
(
"smfcore.unfinished"
,
"the task of [{0}] is unfinished"
,
new
String
[]{
queueTask
.
getBarcode
()});
taskService
.
cancelTask
(
queueTask
.
getId
());
// log.info("codeIn [" + code + "][" + storageId + "]入库失败:条码[" + queueTask.getBarcode() + "]的任务还未结束 ");
// throw new ValidateException("smfcore.unfinished", "the task of [{0}] is unfinished", new String[]{queueTask.getBarcode()});
}
}
}
}
}
}
...
@@ -212,19 +215,8 @@ public class SingleInController {
...
@@ -212,19 +215,8 @@ public class SingleInController {
}
}
for
(
DataLog
queueTask
:
queueTasks
)
{
for
(
DataLog
queueTask
:
queueTasks
)
{
if
(
queueTask
.
getBarcode
()!=
null
&&
queueTask
.
getBarcode
().
equals
(
barcode
.
getBarcode
()))
{
if
(
queueTask
.
getBarcode
()!=
null
&&
queueTask
.
getBarcode
().
equals
(
barcode
.
getBarcode
()))
{
log
.
info
(
"codeIn ["
+
code
+
"]["
+
storageId
+
"]入库失败:条码["
+
queueTask
.
getBarcode
()
+
"]在料仓["
+
queueTask
.
getStorageName
()+
"]已有入库任务 "
);
log
.
warn
(
"扫描条码["
+
code
+
"]时取消["
+
queueTask
.
getBarcode
()+
"]未完成的入库任务"
);
throw
new
ValidateException
(
"smfcore.barcode.unfinished"
,
"条码["
+
queueTask
.
getBarcode
()+
"]在料仓["
+
queueTask
.
getStorageName
()+
"]已有入库任务"
,
taskService
.
cancelTask
(
queueTask
.
getId
());
new
String
[]{
queueTask
.
getBarcode
(),
queueTask
.
getStorageName
()});
}
}
//判断料架是否有空位
for
(
UsageItem
item
:
storage
.
getUsageMap
().
values
())
{
if
(
item
.
getH
()
==
barcode
.
getHeight
()
&&
item
.
getW
()
==
barcode
.
getPlateSize
())
{
int
emptyCount
=
item
.
getTotalCount
()
-
item
.
getUsedCount
();
if
(
emptyCount
<=
0
){
log
.
info
(
"codeIn ["
+
code
+
"]["
+
storageId
+
"]入库失败:"
+
barcode
.
getPlateSize
()+
"X"
+
barcode
.
getHeight
()+
"未找到可用库位 "
);
throw
new
ValidateException
(
"smfcore.noValidPos"
,
"未找到可用仓位"
);
}
}
}
}
}
...
@@ -340,6 +332,8 @@ public class SingleInController {
...
@@ -340,6 +332,8 @@ public class SingleInController {
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
""
);
}
}
}
@ApiOperation
(
"扫码料架功能"
)
@ApiOperation
(
"扫码料架功能"
)
@PostMapping
(
"/shelfCode"
)
@PostMapping
(
"/shelfCode"
)
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/StoragePosController.java
查看文件 @
211a0cd
...
@@ -215,6 +215,7 @@ public class StoragePosController {
...
@@ -215,6 +215,7 @@ public class StoragePosController {
}
}
pos
.
setEnabled
(
enabledDto
.
isEnabled
());
pos
.
setEnabled
(
enabledDto
.
isEnabled
());
storagePosManager
.
save
(
pos
);
storagePosManager
.
save
(
pos
);
dataCache
.
updateDisablePos
(
pos
);
log
.
info
(
"启用禁用库位:库位号["
+
pos
.
getId
()
+
"]["
+
pos
.
getPosName
()
+
"]="
+
enabledDto
.
isEnabled
());
log
.
info
(
"启用禁用库位:库位号["
+
pos
.
getId
()
+
"]["
+
pos
.
getPosName
()
+
"]="
+
enabledDto
.
isEnabled
());
DeviceMessageUtil
.
addEnabledPosMessage
(
pos
,
SecurityUtils
.
getCurrentUsername
());
DeviceMessageUtil
.
addEnabledPosMessage
(
pos
,
SecurityUtils
.
getCurrentUsername
());
...
@@ -244,6 +245,7 @@ public class StoragePosController {
...
@@ -244,6 +245,7 @@ public class StoragePosController {
String
enabledStr
=
""
;
String
enabledStr
=
""
;
if
(
pos
.
isEnabled
()!=
saveDto
.
isEnabled
()){
if
(
pos
.
isEnabled
()!=
saveDto
.
isEnabled
()){
pos
.
setEnabled
(
saveDto
.
isEnabled
());
pos
.
setEnabled
(
saveDto
.
isEnabled
());
dataCache
.
updateDisablePos
(
pos
);
enabledStr
=
saveDto
.
isEnabled
()?
",启用库位"
:
",禁用库位"
;
enabledStr
=
saveDto
.
isEnabled
()?
",启用库位"
:
",禁用库位"
;
DeviceMessageUtil
.
addEnabledPosMessage
(
pos
,
SecurityUtils
.
getCurrentUsername
());
DeviceMessageUtil
.
addEnabledPosMessage
(
pos
,
SecurityUtils
.
getCurrentUsername
());
}
}
...
...
src/main/java/com/neotel/smfcore/core/storage/service/manager/IStoragePosManager.java
查看文件 @
211a0cd
...
@@ -43,6 +43,8 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
...
@@ -43,6 +43,8 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
List
<
StoragePos
>
findNotEmpty
();
List
<
StoragePos
>
findNotEmpty
();
List
<
StoragePos
>
findDisabled
();
List
<
StoragePos
>
findByStorage
(
String
storageId
);
List
<
StoragePos
>
findByStorage
(
String
storageId
);
void
insertAll
(
List
<
StoragePos
>
posList
);
void
insertAll
(
List
<
StoragePos
>
posList
);
...
...
src/main/java/com/neotel/smfcore/core/storage/service/manager/impl/StoragePosManagerImpl.java
查看文件 @
211a0cd
...
@@ -7,10 +7,8 @@ import com.google.common.collect.Maps;
...
@@ -7,10 +7,8 @@ import com.google.common.collect.Maps;
import
com.neotel.smfcore.common.base.IExcelDownLoad
;
import
com.neotel.smfcore.common.base.IExcelDownLoad
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.DateUtil
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.PointUtil
;
import
com.neotel.smfcore.common.utils.PointUtil
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.barcode.bean.PlateSizeBean
;
import
com.neotel.smfcore.core.barcode.bean.PlateSizeBean
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
...
@@ -21,7 +19,6 @@ import com.neotel.smfcore.core.storage.service.dao.IStoragePosDao;
...
@@ -21,7 +19,6 @@ import com.neotel.smfcore.core.storage.service.dao.IStoragePosDao;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.security.service.po.User
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
...
@@ -415,6 +412,13 @@ public class StoragePosManagerImpl implements IStoragePosManager {
...
@@ -415,6 +412,13 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
}
@Override
@Override
public
List
<
StoragePos
>
findDisabled
(){
Criteria
c
=
Criteria
.
where
(
"enabled"
).
is
(
false
);
//不可用;
Query
query
=
new
Query
(
c
);
return
storagePosDao
.
findByQuery
(
query
);
}
@Override
public
List
<
StoragePos
>
findByStorage
(
String
storageId
)
{
public
List
<
StoragePos
>
findByStorage
(
String
storageId
)
{
return
storagePosDao
.
findListByCondition
(
new
String
[]{
"storageId"
},
new
String
[]{
storageId
});
return
storagePosDao
.
findListByCondition
(
new
String
[]{
"storageId"
},
new
String
[]{
storageId
});
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论