Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 87b62c8d
由
zshaohui
编写于
2025-09-08 10:26:53 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.中英文返回问题
2.获取库位,排除外侧有料,里侧没有料的库位
1 个父辈
b5b93d76
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
108 行增加
和
37 行删除
src/main/java/com/neotel/smfcore/core/language/util/MessageUtils.java
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.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/system/util/TaskService.java
src/main/java/com/neotel/smfcore/custom/Jkem21481/controller/JkemController.java
src/main/java/com/neotel/smfcore/core/language/util/MessageUtils.java
查看文件 @
87b62c8
...
@@ -90,7 +90,7 @@ public class MessageUtils {
...
@@ -90,7 +90,7 @@ public class MessageUtils {
public
static
final
String
smfcore
=
"smfcore"
;
public
static
final
String
smfcore
=
"smfcore"
;
private
static
String
defLanguage
=
""
;
private
static
String
defLanguage
=
""
;
@Value
(
"${app.defLanguage:
en}"
)
@Value
(
"${app.defLanguage:en}"
)
public
void
setDefLanguage
(
String
defLanguage
)
{
public
void
setDefLanguage
(
String
defLanguage
)
{
MessageUtils
.
defLanguage
=
defLanguage
;
MessageUtils
.
defLanguage
=
defLanguage
;
}
}
...
...
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
查看文件 @
87b62c8
...
@@ -973,12 +973,20 @@ public class LiteOrderCache {
...
@@ -973,12 +973,20 @@ public class LiteOrderCache {
int
countTask
=
0
;
int
countTask
=
0
;
if
(
remainNum
>
0
||
remainReelCount
>
0
)
{
if
(
remainNum
>
0
||
remainReelCount
>
0
)
{
Collection
<
String
>
excludePosIds
=
excludeOutPosIds
();
//查询
List
<
StoragePos
>
allPosList
=
storagePosManager
.
findAllPartNumberInStorages
(
availableStorageIds
,
orderItem
.
getPn
(),
excludePosIds
,
checkoutType
);
if
(
allPosList
==
null
||
allPosList
.
isEmpty
()){
continue
;
}
//已经分配的数量和料盘
//已经分配的数量和料盘
int
assignNum
=
0
;
int
assignNum
=
0
;
int
assignReelCount
=
0
;
int
assignReelCount
=
0
;
while
(
assignNum
<
remainNum
||
assignReelCount
<
remainReelCount
)
{
while
(
assignNum
<
remainNum
||
assignReelCount
<
remainReelCount
)
{
Collection
<
String
>
excludePosIds
=
excludeOutPosIds
();
//
Collection<String> excludePosIds = excludeOutPosIds();
String
partNumber
=
orderItem
.
getPn
();
String
partNumber
=
orderItem
.
getPn
();
//根据站位号,分配到不同出料口
//根据站位号,分配到不同出料口
...
@@ -992,6 +1000,7 @@ public class LiteOrderCache {
...
@@ -992,6 +1000,7 @@ public class LiteOrderCache {
for
(
String
storageId
:
availableStorageIds
)
{
for
(
String
storageId
:
availableStorageIds
)
{
taskPosIdMap
.
put
(
storageId
,
0
);
taskPosIdMap
.
put
(
storageId
,
0
);
}
}
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
task
:
allTasks
)
{
for
(
DataLog
task
:
allTasks
)
{
if
(!
task
.
isFinished
()
&&
!
task
.
isCancel
()
&&
task
.
isCheckOutTask
()){
if
(!
task
.
isFinished
()
&&
!
task
.
isCancel
()
&&
task
.
isCheckOutTask
()){
...
@@ -1018,46 +1027,44 @@ public class LiteOrderCache {
...
@@ -1018,46 +1027,44 @@ public class LiteOrderCache {
));
));
StoragePos
pos
=
null
;
StoragePos
pos
=
null
;
for
(
String
storageId
:
taskPosIdMap
.
keySet
())
{
for
(
String
storageId
:
taskPosIdMap
.
keySet
())
{
try
{
for
(
StoragePos
storagePos
:
allPosList
)
{
log
.
info
(
"休眠200毫秒"
);
if
(
pos
!=
null
)
{
Thread
.
sleep
(
200
);
break
;
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
//判断当前库存中,有没有可用的料盘信息,没有直接跳过
Map
<
String
,
InventoryItem
>
allInventory
=
dataCache
.
getAllInventory
(
Arrays
.
asList
(
storageId
),
null
);
if
(
allInventory
==
null
||
allInventory
.
isEmpty
()){
log
.
info
(
storageId
+
"没有可用的库存,跳过"
);
continue
;
}
else
{
InventoryItem
inventoryItem
=
allInventory
.
get
(
partNumber
);
if
(
inventoryItem
==
null
){
log
.
info
(
storageId
+
"没有可用的库存,跳过,对应的PartNumber为:"
+
partNumber
);
continue
;
}
}
}
if
(
storagePos
.
getStorageId
().
equals
(
storageId
))
{
pos
=
storagePosManager
.
findPartNumberInStorages
(
Arrays
.
asList
(
storageId
),
partNumber
,
excludePosIds
,
checkoutType
);
Barcode
barcode
=
storagePos
.
getBarcode
();
if
(
pos
!=
null
){
if
(
barcode
==
null
){
Barcode
barcode
=
pos
.
getBarcode
();
continue
;
if
(
barcode
!=
null
){
}
if
(!
storagePos
.
isEnabled
()){
continue
;
}
Collection
<
String
>
excludeOutPosIds
=
excludeOutPosIds
();
if
(
excludeOutPosIds
.
contains
(
storagePos
.
getId
())){
continue
;
}
boolean
hasTask
=
false
;
boolean
hasTask
=
false
;
String
barcodeStr
=
barcode
.
getBarcode
();
//判断有没有任务
List
<
DataLog
>
dataLogList
=
taskService
.
getAllTasks
();
for
(
DataLog
dataLog
:
taskService
.
getAllTasks
())
{
for
(
DataLog
dataLog
:
dataLogList
)
{
if
(!
dataLog
.
isFinished
()
&&
!
dataLog
.
isCancel
()){
if
(
barcodeStr
.
equals
(
dataLog
.
getBarcode
())){
if
(
barcode
.
getBarcode
().
equals
(
dataLog
.
getBarcode
())){
if
(!
dataLog
.
isFinished
()
&&
!
dataLog
.
isCancel
()){
hasTask
=
true
;
break
;
}
if
(
storagePos
.
getId
().
equals
(
dataLog
.
getPosId
())){
hasTask
=
true
;
hasTask
=
true
;
break
;
break
;
}
}
}
}
}
}
if
(
hasTask
){
if
(
hasTask
){
pos
=
null
;
continue
;
}
}
pos
=
storagePos
;
}
}
}
}
if
(
pos
!=
null
){
if
(
pos
!=
null
)
{
break
;
break
;
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/storage/service/manager/IStoragePosManager.java
查看文件 @
87b62c8
...
@@ -50,7 +50,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
...
@@ -50,7 +50,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
)
throws
ValidateException
;
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
)
throws
ValidateException
;
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
,
String
needMovePosName
,
String
endStr
)
throws
ValidateException
;
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
,
String
needMovePosName
,
String
endStr
,
List
<
String
>
needExcludePosNameList
)
throws
ValidateException
;
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
int
size
,
int
height
,
Collection
<
String
>
excludePosIds
)
throws
ValidateException
;
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
int
size
,
int
height
,
Collection
<
String
>
excludePosIds
)
throws
ValidateException
;
...
@@ -103,4 +103,6 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
...
@@ -103,4 +103,6 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
Sort
getSortByCheckOutType
(
CHECKOUT_TYPE
checkoutType
);
Sort
getSortByCheckOutType
(
CHECKOUT_TYPE
checkoutType
);
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
;
List
<
StoragePos
>
findAllPartNumberInStorages
(
List
<
String
>
availableStorageIds
,
String
pn
,
Collection
<
String
>
excludePosIds
,
CHECKOUT_TYPE
checkoutType
);
}
}
src/main/java/com/neotel/smfcore/core/storage/service/manager/impl/StoragePosManagerImpl.java
查看文件 @
87b62c8
...
@@ -465,11 +465,14 @@ public class StoragePosManagerImpl implements IStoragePosManager {
...
@@ -465,11 +465,14 @@ public class StoragePosManagerImpl implements IStoragePosManager {
@Override
@Override
public
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
)
throws
ValidateException
{
public
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
)
throws
ValidateException
{
return
getEmptyPosByStorage
(
storage
,
barcode
,
excludePosIds
,
lastPosId
,
""
,
""
);
return
getEmptyPosByStorage
(
storage
,
barcode
,
excludePosIds
,
lastPosId
,
""
,
""
,
new
ArrayList
<>()
);
}
}
private
static
boolean
max
=
true
;
@Override
@Override
public
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
,
String
needMovePosName
,
String
endStr
)
throws
ValidateException
{
public
StoragePos
getEmptyPosByStorage
(
Storage
storage
,
Barcode
barcode
,
Collection
<
String
>
excludePosIds
,
String
lastPosId
,
String
needMovePosName
,
String
endStr
,
List
<
String
>
needExcludePosNameList
)
throws
ValidateException
{
Criteria
c
=
Criteria
.
where
(
"storageId"
).
is
(
storage
.
getId
());
Criteria
c
=
Criteria
.
where
(
"storageId"
).
is
(
storage
.
getId
());
...
@@ -499,13 +502,24 @@ public class StoragePosManagerImpl implements IStoragePosManager {
...
@@ -499,13 +502,24 @@ public class StoragePosManagerImpl implements IStoragePosManager {
c
.
andOperator
(
posNameCriteria
);
c
.
andOperator
(
posNameCriteria
);
}
}
if
(
needExcludePosNameList
!=
null
&&
!
needExcludePosNameList
.
isEmpty
()){
c
.
and
(
"posName"
).
nin
(
needExcludePosNameList
);
}
Query
query
=
new
Query
(
c
);
Query
query
=
new
Query
(
c
);
String
msg
=
""
;
String
msg
=
""
;
// if (lastPosId == null || lastPosId.equals("")) {
// if (lastPosId == null || lastPosId.equals("")) {
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
if
(
max
){
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"w"
).
and
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"h"
)).
and
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"priority"
)));
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"w"
).
and
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"h"
)).
and
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"priority"
)));
max
=
true
;
}
else
{
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"w"
).
and
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"h"
)).
and
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"priority"
)));
max
=
false
;
}
// } else {
// } else {
// Point point = PointUtil.getPosPoint(lastPosId, false);
// Point point = PointUtil.getPosPoint(lastPosId, false);
// query.addCriteria(Criteria.where("coordinate").nearSphere(point));
// query.addCriteria(Criteria.where("coordinate").nearSphere(point));
...
@@ -920,4 +934,23 @@ public class StoragePosManagerImpl implements IStoragePosManager {
...
@@ -920,4 +934,23 @@ public class StoragePosManagerImpl implements IStoragePosManager {
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"w"
).
and
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"h"
)).
and
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"priority"
)));
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"w"
).
and
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"h"
)).
and
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"priority"
)));
return
storagePosDao
.
countByQuery
(
query
);
return
storagePosDao
.
countByQuery
(
query
);
}
}
@Override
public
List
<
StoragePos
>
findAllPartNumberInStorages
(
List
<
String
>
storageIdList
,
String
pn
,
Collection
<
String
>
excludePosIds
,
CHECKOUT_TYPE
checkOutType
)
{
Criteria
c
=
Criteria
.
where
(
"barcode.partNumber"
).
is
(
pn
)
.
and
(
"id"
).
nin
(
excludePosIds
)
.
and
(
"enabled"
).
is
(
true
)
//可用
.
and
(
"barcode.lockId"
).
is
(
null
);
//没有被锁定的仓位;
if
(
storageIdList
!=
null
)
{
c
=
c
.
and
(
"storageId"
).
in
(
storageIdList
);
}
Query
q
=
new
Query
(
c
);
Sort
sort
=
getSortByCheckOutType
(
checkOutType
);
q
.
with
(
sort
);
List
<
StoragePos
>
list
=
storagePosDao
.
findByQuery
(
q
);
if
(
list
==
null
||
list
.
isEmpty
())
{
log
.
info
(
"使用"
+
checkOutType
+
" 策略出库 partNumber="
+
pn
+
",未找到可以出库的物料 "
);
}
return
list
;
}
}
}
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
查看文件 @
87b62c8
...
@@ -959,6 +959,34 @@ public class TaskService {
...
@@ -959,6 +959,34 @@ public class TaskService {
private
synchronized
StoragePos
findEmptyPosInStorages
(
Barcode
barcode
,
List
<
Storage
>
availbleStorageList
,
final
Set
<
String
>
hasOutTaskStorageIds
,
String
lastPosId
,
String
needMovePosName
,
String
endStr
)
{
private
synchronized
StoragePos
findEmptyPosInStorages
(
Barcode
barcode
,
List
<
Storage
>
availbleStorageList
,
final
Set
<
String
>
hasOutTaskStorageIds
,
String
lastPosId
,
String
needMovePosName
,
String
endStr
)
{
List
<
String
>
needExcludePosName
=
new
ArrayList
<>();
//新增外侧有料,里侧没料,排除里侧的库位信息
List
<
StoragePos
>
allUsePosList
=
new
ArrayList
<>();
List
<
Map
<
String
,
StoragePos
>>
allUsedPosMapList
=
dataCache
.
getAllUsedPosMap
();
for
(
Map
<
String
,
StoragePos
>
map
:
allUsedPosMapList
)
{
for
(
StoragePos
pos
:
map
.
values
())
{
allUsePosList
.
add
(
pos
);
}
}
for
(
StoragePos
pos
:
allUsePosList
)
{
String
posName
=
pos
.
getPosName
();
if
(
posName
.
endsWith
(
"_F"
))
{
boolean
hasEndBPos
=
false
;
String
posName_B
=
posName
.
substring
(
0
,
posName
.
length
()
-
1
)
+
"B"
;
for
(
StoragePos
usePos
:
allUsePosList
)
{
if
(
usePos
.
getPosName
().
equals
(
posName_B
)){
hasEndBPos
=
true
;
break
;
}
}
if
(!
hasEndBPos
){
needExcludePosName
.
add
(
posName_B
);
}
}
}
//第一遍查找,先不查找有出库任务的料仓
//第一遍查找,先不查找有出库任务的料仓
for
(
Storage
storage
:
availbleStorageList
)
{
for
(
Storage
storage
:
availbleStorageList
)
{
if
(!
storage
.
isSmdDuo
()){
//DUO料仓无论是否有出库任务,都可以查找空库位
if
(!
storage
.
isSmdDuo
()){
//DUO料仓无论是否有出库任务,都可以查找空库位
...
@@ -969,7 +997,7 @@ public class TaskService {
...
@@ -969,7 +997,7 @@ public class TaskService {
try
{
try
{
Collection
<
String
>
operatingPosIds
=
excludePosIds
();
Collection
<
String
>
operatingPosIds
=
excludePosIds
();
log
.
debug
(
"尝试从["
+
storage
.
getCid
()
+
"]中为["
+
barcode
.
getBarcode
()
+
"]查找空位"
);
log
.
debug
(
"尝试从["
+
storage
.
getCid
()
+
"]中为["
+
barcode
.
getBarcode
()
+
"]查找空位"
);
StoragePos
pos
=
storagePosManager
.
getEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
,
lastPosId
,
needMovePosName
,
endStr
);
StoragePos
pos
=
storagePosManager
.
getEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
,
lastPosId
,
needMovePosName
,
endStr
,
needExcludePosName
);
if
(
pos
!=
null
)
{
if
(
pos
!=
null
)
{
return
pos
;
return
pos
;
}
}
...
@@ -982,7 +1010,7 @@ public class TaskService {
...
@@ -982,7 +1010,7 @@ public class TaskService {
try
{
try
{
Collection
<
String
>
operatingPosIds
=
excludePosIds
();
Collection
<
String
>
operatingPosIds
=
excludePosIds
();
log
.
debug
(
"尝试从["
+
storage
.
getCid
()
+
"]中为["
+
barcode
.
getBarcode
()
+
"]查找空位"
);
log
.
debug
(
"尝试从["
+
storage
.
getCid
()
+
"]中为["
+
barcode
.
getBarcode
()
+
"]查找空位"
);
StoragePos
pos
=
storagePosManager
.
getEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
,
lastPosId
,
needMovePosName
,
endStr
);
StoragePos
pos
=
storagePosManager
.
getEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
,
lastPosId
,
needMovePosName
,
endStr
,
needExcludePosName
);
if
(
pos
!=
null
)
{
if
(
pos
!=
null
)
{
return
pos
;
return
pos
;
}
}
...
...
src/main/java/com/neotel/smfcore/custom/Jkem21481/controller/JkemController.java
查看文件 @
87b62c8
...
@@ -414,9 +414,10 @@ public class JkemController {
...
@@ -414,9 +414,10 @@ public class JkemController {
}
}
}
catch
(
ValidateException
ve
)
{
}
catch
(
ValidateException
ve
)
{
errorMsg
=
ve
.
getMessage
();
errorMsg
=
ve
.
getMessage
();
errorMsg
=
MessageUtils
.
getText
(
ve
.
getMsgKey
(),
ve
.
getMsgParam
(),
MessageUtils
.
getDefaultLocal
(),
ve
.
getDefaultMsg
());
log
.
info
(
"查找空库位失败:"
+
errorMsg
);
log
.
info
(
"查找空库位失败:"
+
errorMsg
);
resultMap
.
put
(
"result"
,
"105"
);
resultMap
.
put
(
"result"
,
"105"
);
resultMap
.
put
(
"msg"
,
MessageUtils
.
getText
(
ve
.
getMsgKey
(),
ve
.
getMsgParam
(),
request
.
getLocale
(),
ve
.
getDefaultMsg
())
);
resultMap
.
put
(
"msg"
,
errorMsg
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
errorMsg
=
e
.
getMessage
();
errorMsg
=
e
.
getMessage
();
log
.
info
(
"查找空库位失败,"
,
e
);
log
.
info
(
"查找空库位失败,"
,
e
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论