Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 44962d89
由
zshaohui
编写于
2025-11-24 09:43:35 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge remote-tracking branch 'origin/master'
2 个父辈
abe3f12a
ad711a87
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
112 行增加
和
1 行删除
src/main/java/com/neotel/smfcore/core/device/bean/StatusBean.java
src/main/java/com/neotel/smfcore/core/solder/handler/SpBoxHandler.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/bean/StatusBean.java
查看文件 @
44962d8
...
@@ -231,6 +231,17 @@ public class StatusBean {
...
@@ -231,6 +231,17 @@ public class StatusBean {
return
0
;
return
0
;
}
}
public
int
getDuoSidePos
()
{
String
duoSidePos
=
data
.
get
(
"duoSidePos"
);
if
(
ObjectUtil
.
isNotEmpty
(
duoSidePos
))
{
try
{
return
Integer
.
valueOf
(
duoSidePos
);
}
catch
(
Exception
e
)
{
}
}
return
0
;
}
/**
/**
* 获取库位信息
* 获取库位信息
*/
*/
...
...
src/main/java/com/neotel/smfcore/core/solder/handler/SpBoxHandler.java
查看文件 @
44962d8
...
@@ -313,7 +313,8 @@ public class SpBoxHandler extends BaseDeviceHandler {
...
@@ -313,7 +313,8 @@ public class SpBoxHandler extends BaseDeviceHandler {
storagePos
=
storagePosManager
.
get
(
lockPosId
);
storagePos
=
storagePosManager
.
get
(
lockPosId
);
log
.
info
(
barcodeSave
.
getBarcode
()
+
"入库时查找到锁定的库位["
+
storagePos
.
getPosName
()+
"]"
);
log
.
info
(
barcodeSave
.
getBarcode
()
+
"入库时查找到锁定的库位["
+
storagePos
.
getPosName
()+
"]"
);
}
else
{
}
else
{
storagePos
=
findLineEmptyPosForPutIn
(
storage
,
barcodeSave
);
int
isDuoSidePos
=
statusBean
.
getDuoSidePos
();
storagePos
=
findSpEmptyPosForPutIn
(
storage
,
barcodeSave
,
isDuoSidePos
);
}
}
}
}
...
@@ -321,6 +322,55 @@ public class SpBoxHandler extends BaseDeviceHandler {
...
@@ -321,6 +322,55 @@ public class SpBoxHandler extends BaseDeviceHandler {
return
taskService
.
addPutInTaskToExecute
(
storage
,
barcodeSave
,
storagePos
);
return
taskService
.
addPutInTaskToExecute
(
storage
,
barcodeSave
,
storagePos
);
}
}
}
}
/**
* 为 barcode 查找流水线料仓中空闲的仓位
*/
protected
StoragePos
findSpEmptyPosForPutIn
(
Storage
storage
,
Barcode
barcode
,
int
isDuoSidePos
)
throws
ValidateException
{
String
storageCid
=
storage
.
getCid
();
//先查找空闲 BOX同尺寸的,如果找不到,再查找可入库 BOX 同尺寸或比盘尺寸大的仓位
StatusBean
statusBean
=
DevicesStatusUtil
.
getStatusBean
(
storageCid
);
if
(
statusBean
==
null
)
{
//当前料仓不可用
throw
new
ValidateException
(
"smfcore.error.storage.offline"
,
"料仓[{0}]离线"
,
new
String
[]{
storageCid
});
}
//还需要排除掉正在队列里的仓位
StoragePos
storagePos
=
null
;
Collection
<
String
>
operatingPosIds
=
taskService
.
excludePosIds
();
boolean
hasOutTask
=
taskService
.
hasExecutingTask
(
storageCid
,
OP
.
CHECKOUT
);
if
(!
hasOutTask
)
{
if
(
isDuoSidePos
==
1
)
{
//先查找B结尾的,再查找F结尾的
log
.
info
(
"从"
+
storage
.
getName
()
+
"中为"
+
barcode
.
getBarcode
()
+
"寻找空的仓位,先查找B结尾的库位"
);
storagePos
=
storagePosManager
.
getSpEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
,
"B"
);
if
(
storagePos
==
null
)
{
log
.
info
(
"从"
+
storage
.
getName
()
+
"中为"
+
barcode
.
getBarcode
()
+
"寻找空的仓位,未找到B结尾的库位,查找F结尾库位"
);
storagePos
=
storagePosManager
.
getSpEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
,
"F"
);
}
if
(
storagePos
==
null
){
log
.
info
(
"从"
+
storage
.
getName
()
+
"中为"
+
barcode
.
getBarcode
()
+
"寻找空的仓位,查找所有库位"
);
storagePos
=
storagePosManager
.
getEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
);
}
}
else
{
log
.
info
(
"从"
+
storage
.
getName
()
+
"中为"
+
barcode
.
getBarcode
()
+
"寻找空的仓位"
);
storagePos
=
storagePosManager
.
getEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
);
}
}
else
{
log
.
info
(
"料仓"
+
storageCid
+
"有出库任务未完成,不允许入库"
);
throw
new
ValidateException
(
"smfcore.error.storage.outNotEnd"
,
"料仓{0}有出库任务未完成,不允许入库"
,
new
String
[]{
storageCid
});
}
if
(
storagePos
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.storage.noPos"
,
"{0}的料格[{1}]已满,无法继续放入"
,
new
String
[]{
storage
.
getName
(),
barcode
.
getPlateSize
()
+
"x"
+
barcode
.
getHeight
()});
}
log
.
info
(
"["
+
barcode
.
getBarcode
()
+
"]寻找到"
+
storage
.
getName
()
+
"的空仓位["
+
storagePos
.
getPosName
()
+
"]"
);
return
storagePos
;
}
/**
/**
* 处理锡膏料仓相关信息
* 处理锡膏料仓相关信息
...
...
src/main/java/com/neotel/smfcore/core/storage/service/manager/IStoragePosManager.java
查看文件 @
44962d8
...
@@ -104,4 +104,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
...
@@ -104,4 +104,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
int
getRemainPosCountByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
,
String
endStr
)
throws
ValidateException
;
int
getRemainPosCountByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
,
String
endStr
)
throws
ValidateException
;
StoragePos
dualPosNameGetEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
,
String
needMovePosName
,
String
endStr
,
List
<
String
>
needExcludePosNameList
)
throws
ValidateException
;
StoragePos
dualPosNameGetEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
,
String
needMovePosName
,
String
endStr
,
List
<
String
>
needExcludePosNameList
)
throws
ValidateException
;
StoragePos
getSpEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
endStr
)
throws
ValidateException
;
}
}
src/main/java/com/neotel/smfcore/core/storage/service/manager/impl/StoragePosManagerImpl.java
查看文件 @
44962d8
...
@@ -1129,4 +1129,51 @@ public class StoragePosManagerImpl implements IStoragePosManager {
...
@@ -1129,4 +1129,51 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
}
return
pos
;
return
pos
;
}
}
@Override
public
StoragePos
getSpEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
endStr
)
throws
ValidateException
{
boolean
warmPos
=
false
;
Criteria
c
=
Criteria
.
where
(
"storageId"
).
is
(
storage
.
getId
());
COMPATIBLE_TYPE
compatibleType
=
storage
.
getCompatibleType
();
if
(
compatibleType
==
COMPATIBLE_TYPE
.
EXACT_MATCH
){
//完全匹配
c
=
c
.
and
(
"w"
).
is
(
barcode
.
getPlateSize
()).
and
(
"h"
).
is
(
barcode
.
getHeight
());
}
else
if
(
compatibleType
==
COMPATIBLE_TYPE
.
FULLY_COMPATIBLE
){
//完全兼容
c
=
c
.
and
(
"w"
).
gte
(
barcode
.
getPlateSize
()).
and
(
"h"
).
gte
(
barcode
.
getHeight
());
//宽度大于等于料盘宽度,高度大于等于料盘高度
}
else
if
(
compatibleType
==
COMPATIBLE_TYPE
.
SIZE_COMPATIBLE
){
//同尺寸兼容
c
=
c
.
and
(
"w"
).
is
(
barcode
.
getPlateSize
()).
and
(
"h"
).
gte
(
barcode
.
getHeight
());
//宽度等于料盘宽度,高度大于等于料盘高度
}
else
if
(
compatibleType
==
COMPATIBLE_TYPE
.
W13_15_COMPATIBLE
){
//13/15寸兼容,如果是13寸盘,可以放15寸,其他按照同尺寸兼容
if
(
barcode
.
getPlateSize
()==
13
){
c
=
c
.
and
(
"w"
).
in
(
barcode
.
getPlateSize
(),
15
).
and
(
"h"
).
gte
(
barcode
.
getHeight
());
}
else
{
c
=
c
.
and
(
"w"
).
is
(
barcode
.
getPlateSize
()).
and
(
"h"
).
gte
(
barcode
.
getHeight
());
//宽度等于料盘宽度,高度大于等于料盘高度
}
}
c
=
c
.
and
(
"enabled"
).
is
(
true
)
//可用
.
and
(
"used"
).
is
(
false
);
//未使用
if
(
storage
.
isSolderPaste
()){
if
(
warmPos
){
c
=
c
.
and
(
"warmPos"
).
is
(
true
);
//回温库位
}
else
{
c
=
c
.
and
(
"warmPos"
).
ne
(
true
);
//不是回温库位
}
}
//去除的仓位
if
(
excludePosIds
!=
null
&&
!
excludePosIds
.
isEmpty
()){
c
=
c
.
and
(
"id"
).
nin
(
excludePosIds
);
}
if
(
StringUtils
.
isNotEmpty
(
endStr
))
{
String
regex
=
""
+
endStr
+
"$"
;
c
.
and
(
"posName"
).
regex
(
Pattern
.
compile
(
regex
));
}
Query
query
=
new
Query
(
c
);
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
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
;
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论