Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 7155d3d7
由
LN
编写于
2024-05-20 10:02:08 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
科博达移库问题修改
1 个父辈
5778df7a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
144 行增加
和
16 行删除
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
查看文件 @
7155d3d
...
@@ -818,11 +818,21 @@ public class DeviceController {
...
@@ -818,11 +818,21 @@ public class DeviceController {
// return ResultBean.newOkResult("");
// return ResultBean.newOkResult("");
// }
// }
private
String
getLockPosSKey
(
String
storageId
){
return
Constants
.
XLR_lockPosS
+
"_"
+
storageId
;
}
private
String
getLockPosKey
(
String
storageId
){
return
Constants
.
XLR_lockPos
+
"_"
+
storageId
;
}
@ApiOperation
(
"获取需要移动的库位是否有料"
)
@ApiOperation
(
"获取需要移动的库位是否有料"
)
@RequestMapping
(
"/service/store/needMovePosHasReel"
)
@RequestMapping
(
"/service/store/needMovePosHasReel"
)
@ResponseBody
@ResponseBody
@AnonymousAccess
@AnonymousAccess
public
ResultBean
needMovePosHasReel
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
needMovePosHasReel
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
// 2024-05-18 16:55:46.581 INFO [DeviceController.java:828] - 出库的库位为:20768A_02_A01_001S,需要移动的库位为:20768A_02_A01_001
// 2024-05-18 16:55:46.593 INFO [DeviceController.java:862] - 查找到锁定的外侧库位为目标库位:20768B_02_B01_008
String
checkOutPosName
=
paramMap
.
get
(
"checkOutPosName"
);
String
checkOutPosName
=
paramMap
.
get
(
"checkOutPosName"
);
String
needMovePosName
=
paramMap
.
get
(
"needMovePosName"
);
String
needMovePosName
=
paramMap
.
get
(
"needMovePosName"
);
log
.
info
(
"出库的库位为:"
+
checkOutPosName
+
",需要移动的库位为:"
+
needMovePosName
);
log
.
info
(
"出库的库位为:"
+
checkOutPosName
+
",需要移动的库位为:"
+
needMovePosName
);
...
@@ -850,13 +860,13 @@ public class DeviceController {
...
@@ -850,13 +860,13 @@ public class DeviceController {
// log.info("提前锁定库位:" + checkOutPos.getPosName() + ",barcode为:" + barcode.getBarcode());
// log.info("提前锁定库位:" + checkOutPos.getPosName() + ",barcode为:" + barcode.getBarcode());
//有料,先查找锁定的lockS库位,有的话返回
//有料,先查找锁定的lockS库位,有的话返回
ReelLockPosInfo
lockPosInfo
=
ReelLockPosUtil
.
getLockPosInfoByCode
(
Constants
.
XLR_lockPosS
);
ReelLockPosInfo
lockPosInfo
=
ReelLockPosUtil
.
getLockPosInfoByCode
(
getLockPosSKey
(
needMovePos
.
getStorageId
())
);
if
(
lockPosInfo
!=
null
&&
ObjectUtil
.
isNotEmpty
(
lockPosInfo
.
getLockPosName
())){
if
(
lockPosInfo
!=
null
&&
ObjectUtil
.
isNotEmpty
(
lockPosInfo
.
getLockPosName
())){
posName
=
lockPosInfo
.
getLockPosName
();
posName
=
lockPosInfo
.
getLockPosName
();
log
.
info
(
"查找到锁定的内侧库位为目标库位:"
+
posName
+
" "
);
log
.
info
(
"查找到锁定的内侧库位为目标库位:"
+
posName
+
" "
);
}
}
else
{
else
{
lockPosInfo
=
ReelLockPosUtil
.
getLockPosInfoByCode
(
Constants
.
XLR_lockPos
);
lockPosInfo
=
ReelLockPosUtil
.
getLockPosInfoByCode
(
getLockPosKey
(
needMovePos
.
getStorageId
())
);
if
(
lockPosInfo
!=
null
&&
ObjectUtil
.
isNotEmpty
(
lockPosInfo
.
getLockPosName
())){
if
(
lockPosInfo
!=
null
&&
ObjectUtil
.
isNotEmpty
(
lockPosInfo
.
getLockPosName
())){
posName
=
lockPosInfo
.
getLockPosName
();
posName
=
lockPosInfo
.
getLockPosName
();
log
.
info
(
"查找到锁定的外侧库位为目标库位:"
+
posName
+
" "
);
log
.
info
(
"查找到锁定的外侧库位为目标库位:"
+
posName
+
" "
);
...
@@ -874,7 +884,7 @@ public class DeviceController {
...
@@ -874,7 +884,7 @@ public class DeviceController {
if
(
loopCount
>=
10
){
if
(
loopCount
>=
10
){
log
.
info
(
barcode
.
getBarcode
()+
"已循环查找10次 直接跳出循环"
);
log
.
info
(
barcode
.
getBarcode
()+
"已循环查找10次 直接跳出循环"
);
}
}
pos
=
taskService
.
findEmptyPosFor
Put
In
(
storageList
,
barcode
,
""
,
""
);
pos
=
taskService
.
findEmptyPosFor
Move
In
(
storageList
,
barcode
,
""
,
""
);
if
(
pos
==
null
){
if
(
pos
==
null
){
break
;
break
;
}
}
...
@@ -899,18 +909,19 @@ public class DeviceController {
...
@@ -899,18 +909,19 @@ public class DeviceController {
pos
=
null
;
pos
=
null
;
posName
=
""
;
posName
=
""
;
}
else
{
}
else
{
log
.
info
(
"查找到目标库位:"
+
pos
.
getPosName
()+
" 且外侧库位"
+
wPosName
+
"无料,锁定两个库位 :"
+
pos
.
getPosName
()
+
"="
+
Constants
.
XLR_lockPosS
+
",wPosName="
+
Constants
.
XLR_lockPos
);
log
.
info
(
"查找到目标库位:"
+
pos
.
getPosName
()+
" 且外侧库位"
+
wPosName
+
"无料,锁定两个库位 :"
+
pos
.
getPosName
()
+
"="
+
getLockPosSKey
(
needMovePos
.
getStorageId
())
+
",wPosName="
+
getLockPosKey
(
needMovePos
.
getStorageId
()));
//是内侧库位,且外侧库位也无料,锁定两个库位
//是内侧库位,且外侧库位也无料,锁定两个库位
AddLock
(
pos
,
Constants
.
XLR_lockPosS
,
cidList
);
AddLock
(
pos
,
getLockPosSKey
(
needMovePos
.
getStorageId
())
,
cidList
);
AddLock
(
storagePos
,
Constants
.
XLR_lockPos
,
cidList
);
AddLock
(
storagePos
,
getLockPosKey
(
needMovePos
.
getStorageId
())
,
cidList
);
}
}
}
}
}
else
{
}
else
{
//是外侧库位,直接锁定外侧库位
//是外侧库位,直接锁定外侧库位
log
.
info
(
"查找到外侧库位作为目标库位,锁定库位 :"
+
pos
.
getPosName
()
+
"="
+
Constants
.
XLR_lockPos
);
log
.
info
(
"查找到外侧库位作为目标库位,锁定库位 :"
+
pos
.
getPosName
()
+
"="
+
getLockPosKey
(
needMovePos
.
getStorageId
())
);
AddLock
(
pos
,
Constants
.
XLR_lockPos
,
cidList
);
AddLock
(
pos
,
getLockPosKey
(
needMovePos
.
getStorageId
())
,
cidList
);
}
}
}
}
}
}
...
@@ -1008,20 +1019,20 @@ public class DeviceController {
...
@@ -1008,20 +1019,20 @@ public class DeviceController {
targetPos
.
setUsed
(
true
);
targetPos
.
setUsed
(
true
);
targetPos
.
setCanCheckOutTime
(
System
.
currentTimeMillis
());
targetPos
.
setCanCheckOutTime
(
System
.
currentTimeMillis
());
storagePosManager
.
save
(
targetPos
);
storagePosManager
.
save
(
targetPos
);
log
.
info
(
barcode
.
getBarcode
()
+
"转移库位,入库库位: "
+
needMovePos
.
getId
()
+
"["
+
needMove
Pos
.
getPosName
()
+
"]"
);
log
.
info
(
barcode
.
getBarcode
()
+
"转移库位,入库库位: "
+
targetPos
.
getId
()
+
"["
+
target
Pos
.
getPosName
()
+
"]"
);
dataCache
.
updateInventory
(
targetPos
,
barcode
);
dataCache
.
updateInventory
(
targetPos
,
barcode
);
//解除库位绑定
//解除库位绑定
ReelLockPosUtil
.
removeReelLockPosInfo
(
barcode
.
getBarcode
());
ReelLockPosUtil
.
removeReelLockPosInfo
(
barcode
.
getBarcode
());
ReelLockPosInfo
lockS
=
ReelLockPosUtil
.
getLockPosInfoByCode
(
Constants
.
XLR_lockPosS
);
ReelLockPosInfo
lockS
=
ReelLockPosUtil
.
getLockPosInfoByCode
(
getLockPosSKey
(
needMovePos
.
getStorageId
())
);
if
(
lockS
!=
null
&&
ObjectUtil
.
isNotEmpty
(
lockS
.
getLockPosName
())
&&
lockS
.
getLockPosName
().
equals
(
targetPosName
))
{
if
(
lockS
!=
null
&&
ObjectUtil
.
isNotEmpty
(
lockS
.
getLockPosName
())
&&
lockS
.
getLockPosName
().
equals
(
targetPosName
))
{
ReelLockPosUtil
.
removeReelLockPosInfo
(
Constants
.
XLR_lockPosS
);
ReelLockPosUtil
.
removeReelLockPosInfo
(
getLockPosSKey
(
needMovePos
.
getStorageId
())
);
}
else
{
}
else
{
ReelLockPosInfo
lock
=
ReelLockPosUtil
.
getLockPosInfoByCode
(
Constants
.
XLR_lockPos
);
ReelLockPosInfo
lock
=
ReelLockPosUtil
.
getLockPosInfoByCode
(
getLockPosKey
(
needMovePos
.
getStorageId
())
);
if
(
lock
!=
null
&&
ObjectUtil
.
isNotEmpty
(
lock
.
getLockPosName
())
&&
lock
.
getLockPosName
().
equals
(
targetPosName
))
{
if
(
lock
!=
null
&&
ObjectUtil
.
isNotEmpty
(
lock
.
getLockPosName
())
&&
lock
.
getLockPosName
().
equals
(
targetPosName
))
{
ReelLockPosUtil
.
removeReelLockPosInfo
(
Constants
.
XLR_lockPos
);
ReelLockPosUtil
.
removeReelLockPosInfo
(
getLockPosKey
(
needMovePos
.
getStorageId
())
);
lock
=
null
;
lock
=
null
;
}
}
...
@@ -1039,12 +1050,12 @@ public class DeviceController {
...
@@ -1039,12 +1050,12 @@ public class DeviceController {
List
<
String
>
cidList
=
new
ArrayList
<>();
List
<
String
>
cidList
=
new
ArrayList
<>();
cidList
.
add
(
cid
);
cidList
.
add
(
cid
);
//如果两个库位锁定都为空了,将当前库位锁定为缓存库位
//如果两个库位锁定都为空了,将当前库位锁定为缓存库位
log
.
info
(
"重新锁定两个缓存库位 :"
+
sPos
.
getPosName
()
+
"="
+
Constants
.
XLR_lockPosS
+
","
+
needMovePos
.
getPosName
()+
"="
+
Constants
.
XLR_lockPos
);
log
.
info
(
"重新锁定两个缓存库位 :"
+
sPos
.
getPosName
()
+
"="
+
getLockPosSKey
(
needMovePos
.
getStorageId
())
+
","
+
needMovePos
.
getPosName
()+
"="
+
getLockPosKey
(
needMovePos
.
getStorageId
())
);
//是内侧库位,且外侧库位也无料,锁定两个库位
//是内侧库位,且外侧库位也无料,锁定两个库位
AddLock
(
sPos
,
Constants
.
XLR_lockPosS
,
cidList
);
AddLock
(
sPos
,
getLockPosSKey
(
needMovePos
.
getStorageId
())
,
cidList
);
AddLock
(
needMovePos
,
Constants
.
XLR_lockPos
,
cidList
);
AddLock
(
needMovePos
,
getLockPosKey
(
needMovePos
.
getStorageId
())
,
cidList
);
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
查看文件 @
7155d3d
...
@@ -796,6 +796,123 @@ public class TaskService {
...
@@ -796,6 +796,123 @@ public class TaskService {
return
findEmptyPosInStorages
(
barcode
,
availbleStorageList
,
hasOutTaskStorageIds
,
lastPosId
);
return
findEmptyPosInStorages
(
barcode
,
availbleStorageList
,
hasOutTaskStorageIds
,
lastPosId
);
}
}
/**
* 查找可以移库的目标库位
*
* @param storageList
* @param barcode
* @return
*/
public
StoragePos
findEmptyPosForMoveIn
(
List
<
Storage
>
storageList
,
Barcode
barcode
,
String
inRFID
,
String
lastPosId
)
throws
ValidateException
{
Collection
<
DataLog
>
queueTasks
=
getQueueTasks
();
List
<
DataLog
>
allTasksa
=
getFinishedTasks
();
if
(!
queueTasks
.
isEmpty
())
{
allTasksa
.
addAll
(
queueTasks
);
}
for
(
DataLog
task
:
allTasksa
)
{
if
(
task
.
isPutInTask
())
{
if
(
task
.
getBarcode
().
equals
(
barcode
.
getBarcode
()))
{
//同一个条码的入库任务
for
(
Storage
storage
:
storageList
)
{
if
(
task
.
getStorageId
().
equals
(
storage
.
getId
())
&&
task
.
isPutInTask
())
{
log
.
error
(
"料盘["
+
barcode
.
getBarcode
()+
"]的操作未完成,无法执行入库操作"
);
throw
new
ValidateException
(
"smfcore.error.barcode.taskNotEnd"
,
"料盘[{0}}]的操作未完成,无法执行入库操作"
,
new
String
[]{
barcode
.
getBarcode
()});
}
}
}
}
}
List
<
String
>
storageIds
=
new
ArrayList
<>();
//查找任务数最少的料仓
final
Map
<
String
,
Integer
>
storageTaskCountMap
=
new
HashMap
<>();
for
(
Storage
storage
:
storageList
)
{
storageTaskCountMap
.
put
(
storage
.
getId
(),
0
);
storageIds
.
add
(
storage
.
getId
());
}
Set
<
String
>
hasOutTaskStorageIds
=
new
HashSet
<>();
//如果有正在执行的任务,把库位发过去
Collection
<
DataLog
>
allTasks
=
taskMap
.
values
();
for
(
DataLog
task
:
allTasks
)
{
if
(
barcode
.
getBarcode
().
equals
(
task
.
getBarcode
()))
{
String
posId
=
task
.
getPosId
();
log
.
info
(
barcode
.
getBarcode
()
+
" 已有任务,返回任务中的库位:"
+
task
.
getPosName
());
return
storagePosManager
.
get
(
posId
);
}
String
storageId
=
task
.
getStorageId
();
if
(!
Strings
.
isNullOrEmpty
(
storageId
))
{
Integer
taskCount
=
storageTaskCountMap
.
get
(
storageId
);
if
(
taskCount
!=
null
)
{
taskCount
=
taskCount
+
1
;
storageTaskCountMap
.
put
(
storageId
,
taskCount
);
}
if
(
task
.
isCheckOutTask
())
{
hasOutTaskStorageIds
.
add
(
storageId
);
}
}
}
String
lockPosId
=
ReelLockPosUtil
.
getReelLockPosId
(
barcode
.
getBarcode
());
StoragePos
pos
=
null
;
if
(!
Strings
.
isNullOrEmpty
(
lockPosId
))
{
//已有锁定库位
pos
=
storagePosManager
.
get
(
lockPosId
);
if
(
pos
!=
null
)
{
if
(!
storageIds
.
contains
(
pos
.
getStorageId
())){
log
.
info
(
"条码["
+
barcode
.
getBarcode
()
+
"]已有锁定库位["
+
pos
.
getPosName
()
+
"],料仓ID["
+
pos
.
getStorageId
()+
"]不在请求列表["
+
String
.
join
(
","
,
storageIds
)+
"]中,重新查找库位"
);
pos
=
null
;
}
else
if
(
pos
.
getW
()
<
barcode
.
getPlateSize
()
||
pos
.
getH
()
<
barcode
.
getHeight
())
{
log
.
info
(
"条码["
+
barcode
.
getBarcode
()
+
"]尺寸已改变,无法放入已锁定库位["
+
pos
.
getPosName
()
+
"],重新查找库位"
);
pos
=
null
;
}
else
{
Barcode
posBarcode
=
pos
.
getBarcode
();
if
(
posBarcode
==
null
)
{
log
.
info
(
"条码["
+
barcode
.
getBarcode
()
+
"]已锁定库位["
+
pos
.
getPosName
()
+
"],返回锁定中的库位"
);
}
else
{
log
.
info
(
"条码["
+
barcode
.
getBarcode
()
+
"]已锁定库位["
+
pos
.
getPosName
()
+
"]中已有物料["
+
posBarcode
.
getBarcode
()
+
"],重新查找库位"
);
pos
=
null
;
}
}
}
}
if
(
pos
!=
null
)
{
return
pos
;
}
//可用的料仓(在线,且可以放入)
List
<
Storage
>
availbleStorageList
=
new
ArrayList
<>();
for
(
Storage
storage
:
storageList
)
{
if
(
storage
.
canPutIn
(
barcode
.
getPlateSize
(),
barcode
.
getHeight
()))
{
availbleStorageList
.
add
(
storage
);
}
}
if
(
availbleStorageList
.
isEmpty
())
{
throw
new
ValidateException
(
"smfcore.noValidStorage"
,
"料仓列表中未找到可用的料仓"
);
}
availbleStorageList
.
sort
(
new
Comparator
<
Storage
>()
{
@Override
public
int
compare
(
Storage
o1
,
Storage
o2
)
{
Integer
taskCount1
=
storageTaskCountMap
.
get
(
o1
.
getId
());
Integer
taskCount2
=
storageTaskCountMap
.
get
(
o2
.
getId
());
return
taskCount1
.
compareTo
(
taskCount2
);
}
});
return
findEmptyPosInStorages
(
barcode
,
availbleStorageList
,
hasOutTaskStorageIds
,
lastPosId
);
}
private
synchronized
StoragePos
findEmptyPosInStorages
(
Barcode
barcode
,
List
<
Storage
>
availbleStorageList
,
final
Set
<
String
>
hasOutTaskStorageIds
,
String
lastPosId
)
{
private
synchronized
StoragePos
findEmptyPosInStorages
(
Barcode
barcode
,
List
<
Storage
>
availbleStorageList
,
final
Set
<
String
>
hasOutTaskStorageIds
,
String
lastPosId
)
{
//第一遍查找,先不查找有出库任务的料仓
//第一遍查找,先不查找有出库任务的料仓
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论