Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0968732a
由
zshaohui
编写于
2024-11-28 11:10:12 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
呼叫空箱 功能提交
1 个父辈
104c4745
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
102 行增加
和
54 行删除
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
src/main/java/com/neotel/smfcore/custom/lizhen/agvBox/bean/dto/WareHouseCodeDto.java
src/main/java/com/neotel/smfcore/custom/lizhen/agvBox/rest/CodeController.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/bean/CallEmpty.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/manual/CallEmptyBoxController.java
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
查看文件 @
0968732
...
...
@@ -148,7 +148,11 @@ public class DataCache {
*/
public
void
updateCache
(
String
cacheKey
,
Object
value
){
cacheItemDao
.
updateCacheItem
(
cacheKey
,
value
);
cacheMap
.
put
(
cacheKey
,
value
);
if
(
value
==
null
){
cacheMap
.
remove
(
cacheKey
);
}
else
{
cacheMap
.
put
(
cacheKey
,
value
);
}
if
(
cacheKey
.
equals
(
Constants
.
CACHE_CodeRule
)){
List
<
String
>
ruleList
=(
List
<
String
>)
value
;
codeResolve
.
updateBarcodeRuleList
(
ruleList
);
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/agvBox/bean/dto/WareHouseCodeDto.java
查看文件 @
0968732
...
...
@@ -24,4 +24,6 @@ public class WareHouseCodeDto implements Serializable {
@ApiModelProperty
(
"描述"
)
private
String
description
;
private
boolean
choose
=
false
;
}
src/main/java/com/neotel/smfcore/custom/lizhen/agvBox/rest/CodeController.java
查看文件 @
0968732
...
...
@@ -112,6 +112,9 @@ public class CodeController {
for
(
WareHouseCode
code
:
codes
)
{
WareHouseCodeDto
codeDto
=
codeMapper
.
toDto
(
code
);
codeDto
.
setId
(
code
.
getId
());
if
(
"W10B"
.
equals
(
code
.
getWareHouseCode
())){
codeDto
.
setChoose
(
true
);
}
codeDtos
.
add
(
codeDto
);
}
return
new
PageData
(
codeDtos
,
codePageData
.
getTotalElements
());
...
...
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/bean/CallEmpty.java
0 → 100644
查看文件 @
0968732
package
com
.
neotel
.
smfcore
.
custom
.
luxsan
.
factory_c
.
rawstor
.
bean
;
import
lombok.Data
;
@Data
public
class
CallEmpty
{
private
String
warehouseCode
;
private
String
size
;
private
int
needCount
;
}
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/manual/CallEmptyBoxController.java
查看文件 @
0968732
...
...
@@ -14,6 +14,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.CallEmpty
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BinCacheUtil
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil
;
...
...
@@ -28,10 +29,15 @@ import org.springframework.data.mongodb.core.query.Query;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.PostConstruct
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
...
...
@@ -50,34 +56,78 @@ public class CallEmptyBoxController {
@Autowired
private
TaskService
taskService
;
static
boolean
isCall
=
false
;
public
static
final
String
CACHE_CALL_EMPTY
=
"CACHE_CALL_EMPTY"
;
@ApiOperation
(
"呼叫空箱"
)
@RequestMapping
(
"/uploadInfo"
)
@AnonymousAccess
public
ResultBean
uploadInfo
(
String
warehouseCode
,
String
size
,
Integer
needCount
)
{
if
(
isCall
){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"有正在计算的出库任务"
);
}
ScheduledExecutorService
scheduledThreadPool
=
Executors
.
newScheduledThreadPool
(
1
);
@PostConstruct
private
void
initCallEmptyBox
()
{
scheduledThreadPool
.
scheduleAtFixedRate
(()
->
{
callEmptyBox
();
},
30
,
10
,
TimeUnit
.
SECONDS
);
}
isCall
=
true
;
if
(
StringUtils
.
isEmpty
(
warehouseCode
))
{
isCall
=
false
;
@ApiOperation
(
"呼叫空箱"
)
@RequestMapping
(
"/uploadInfo"
)
//@AnonymousAccess
public
ResultBean
uploadInfo
(
String
warehouseCode
,
String
size
,
Integer
needCount
)
{
log
.
info
(
"收到呼叫空箱任务,库位为:"
+
warehouseCode
+
",尺寸为:"
+
size
+
",需求隔口数量为:"
+
needCount
);
if
(
StringUtils
.
isEmpty
(
warehouseCode
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"库别不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
size
))
{
isCall
=
false
;
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"尺寸不能为空"
);
}
if
(
needCount
==
null
||
needCount
==
0
)
{
isCall
=
false
;
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"需求隔口数量不能为空"
);
}
CallEmpty
cacheCallEmpty
=
dataCache
.
getCache
(
CACHE_CALL_EMPTY
);
if
(
cacheCallEmpty
!=
null
){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"有正在执行的任务,库位为:"
+
warehouseCode
+
",尺寸为:"
+
size
+
",需求隔口数量为:"
+
needCount
);
}
CallEmpty
callEmpty
=
new
CallEmpty
();
callEmpty
.
setSize
(
size
);
callEmpty
.
setNeedCount
(
needCount
);
callEmpty
.
setWarehouseCode
(
warehouseCode
);
dataCache
.
updateCache
(
CACHE_CALL_EMPTY
,
callEmpty
);
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"获取所有手动线任务"
)
@RequestMapping
(
"/getManualTask"
)
//@AnonymousAccess
public
ResultBean
getManualTask
()
{
List
<
DataLog
>
resultList
=
new
ArrayList
<>();
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
dataLog
:
allTasks
)
{
if
(
dataLog
.
isCheckOutTask
()
&&
!
dataLog
.
isFinished
()
&&
!
dataLog
.
isCancel
()){
if
(
TaskCurrentLoc
.
Manual_FeedingInlet
.
equals
(
dataLog
.
getLoc
())){
resultList
.
add
(
dataLog
);
}
}
}
return
ResultBean
.
newOkResult
(
resultList
);
}
private
void
callEmptyBox
()
{
CallEmpty
cacheCallEmpty
=
dataCache
.
getCache
(
CACHE_CALL_EMPTY
);
if
(
cacheCallEmpty
==
null
)
{
return
;
}
String
size
=
cacheCallEmpty
.
getSize
();
String
warehouseCode
=
cacheCallEmpty
.
getWarehouseCode
();
int
needCount
=
cacheCallEmpty
.
getNeedCount
();
//判断partNumber
String
box
=
""
;
if
(
"7"
.
equals
(
size
))
{
...
...
@@ -89,12 +139,11 @@ public class CallEmptyBoxController {
}
//判断有没有可用的料箱
/*
List<String> boxList = BinCacheUtil.getBoxList(warehouseCode, "");
List
<
String
>
boxList
=
BinCacheUtil
.
getBoxList
(
warehouseCode
,
""
);
if
(
boxList
==
null
||
boxList
.
isEmpty
())
{
log
.
info
(
warehouseCode
+
"未找到可用料箱"
);
isCall = false;
return ResultBean.newErrorResult(-1,"","没有可用的料箱");
}*/
return
;
}
//排除掉正在使用的仓位
Criteria
c
=
Criteria
.
where
(
"barcode"
).
exists
(
true
).
and
(
"enabled"
).
is
(
true
);
//可用
...
...
@@ -104,7 +153,7 @@ public class CallEmptyBoxController {
}
c
.
and
(
"barcode.partNumber"
).
regex
(
Pattern
.
compile
(
QueryHelp
.
escapeExprSpecialWord
(
box
),
Pattern
.
CASE_INSENSITIVE
));
c
.
and
(
"barcode.status"
).
is
(
BARCODE_STATUS
.
IN_STORE
);
//
c.and("barcode.barcode").in(boxList);
c
.
and
(
"barcode.barcode"
).
in
(
boxList
);
List
<
String
>
storageIdList
=
new
ArrayList
<>();
for
(
Storage
storage
:
dataCache
.
getAllStorage
().
values
())
{
...
...
@@ -116,23 +165,23 @@ public class CallEmptyBoxController {
int
count
=
0
;
boolean
hasTask
=
false
;
List
<
StoragePos
>
storagePosList
=
storagePosManager
.
findByQuery
(
new
Query
(
c
).
with
(
Sort
.
by
(
Sort
.
Direction
.
DE
SC
,
"barcode.amount"
)));
List
<
StoragePos
>
storagePosList
=
storagePosManager
.
findByQuery
(
new
Query
(
c
).
with
(
Sort
.
by
(
Sort
.
Direction
.
A
SC
,
"barcode.amount"
)));
for
(
StoragePos
pos
:
storagePosList
)
{
if
(
count
>=
needCount
){
if
(
count
>=
needCount
)
{
break
;
}
Barcode
barcode
=
pos
.
getBarcode
();
List
<
Barcode
>
subCodeList
=
barcode
.
getSubCodeList
();
if
(
subCodeList
==
null
||
subCodeList
.
isEmpty
())
{
if
(
"C07"
.
equals
(
box
)){
if
(
"C07"
.
equals
(
box
))
{
count
+=
6
;
}
else
{
count
+=
1
;
}
//生成出库任务
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
log
.
info
(
"生成出库任务,料箱为:"
+
barcode
.
getBarcode
()+
",库别为:"
+
warehouseCode
+
",尺寸为:"
+
size
+
",库位号为:"
+
pos
.
getPosName
()+
",隔口数量为:6/1"
);
BoxHandleUtil
.
generateTask
(
storage
,
barcode
,
pos
,
OP
.
CHECKOUT
,
OP_STATUS
.
WAIT
.
name
(),
TaskCurrentLoc
.
Manual_FeedingInlet
,
ExtendType
.
STORAGE_CHECKOUT
,
999
);
log
.
info
(
"生成出库任务,料箱为:"
+
barcode
.
getBarcode
()
+
",库别为:"
+
warehouseCode
+
",尺寸为:"
+
size
+
",库位号为:"
+
pos
.
getPosName
()
+
",隔口数量为:6/1"
);
BoxHandleUtil
.
generateTask
(
storage
,
barcode
,
pos
,
OP
.
CHECKOUT
,
OP_STATUS
.
WAIT
.
name
(),
TaskCurrentLoc
.
Manual_FeedingInlet
,
ExtendType
.
STORAGE_CHECKOUT
,
999
);
hasTask
=
true
;
}
else
{
Map
<
String
,
Long
>
countMap
=
subCodeList
.
stream
().
collect
(
Collectors
.
groupingBy
(
Barcode:
:
getPosName
,
Collectors
.
counting
()));
...
...
@@ -145,11 +194,11 @@ public class CallEmptyBoxController {
noReelNum
=
noReelNum
+
1
;
}
}
if
(
noReelNum
>
0
){
if
(
noReelNum
>
0
)
{
count
=
count
+
noReelNum
;
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
log
.
info
(
"生成出库任务,料箱为:"
+
barcode
.
getBarcode
()+
",库别为:"
+
warehouseCode
+
",尺寸为:"
+
size
+
",库位号为:"
+
pos
.
getPosName
()+
",隔口数量为:"
+
noReelNum
);
BoxHandleUtil
.
generateTask
(
storage
,
barcode
,
pos
,
OP
.
CHECKOUT
,
OP_STATUS
.
WAIT
.
name
(),
TaskCurrentLoc
.
Manual_FeedingInlet
,
ExtendType
.
STORAGE_CHECKOUT
,
999
);
log
.
info
(
"生成出库任务,料箱为:"
+
barcode
.
getBarcode
()
+
",库别为:"
+
warehouseCode
+
",尺寸为:"
+
size
+
",库位号为:"
+
pos
.
getPosName
()
+
",隔口数量为:"
+
noReelNum
);
BoxHandleUtil
.
generateTask
(
storage
,
barcode
,
pos
,
OP
.
CHECKOUT
,
OP_STATUS
.
WAIT
.
name
(),
TaskCurrentLoc
.
Manual_FeedingInlet
,
ExtendType
.
STORAGE_CHECKOUT
,
999
);
hasTask
=
true
;
}
}
else
if
(
"13"
.
equals
(
size
)
||
"15"
.
equals
(
size
))
{
...
...
@@ -157,38 +206,14 @@ public class CallEmptyBoxController {
if
(
countMap
.
get
(
binCode
)
==
null
||
countMap
.
get
(
binCode
)
==
0
)
{
count
=
count
+
1
;
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
log
.
info
(
"生成出库任务,料箱为:"
+
barcode
.
getBarcode
()+
",库别为:"
+
warehouseCode
+
",尺寸为:"
+
size
+
",库位号为:"
+
pos
.
getPosName
()+
",隔口数量为:1"
);
BoxHandleUtil
.
generateTask
(
storage
,
barcode
,
pos
,
OP
.
CHECKOUT
,
OP_STATUS
.
WAIT
.
name
(),
TaskCurrentLoc
.
Manual_FeedingInlet
,
ExtendType
.
STORAGE_CHECKOUT
,
999
);
log
.
info
(
"生成出库任务,料箱为:"
+
barcode
.
getBarcode
()
+
",库别为:"
+
warehouseCode
+
",尺寸为:"
+
size
+
",库位号为:"
+
pos
.
getPosName
()
+
",隔口数量为:1"
);
BoxHandleUtil
.
generateTask
(
storage
,
barcode
,
pos
,
OP
.
CHECKOUT
,
OP_STATUS
.
WAIT
.
name
(),
TaskCurrentLoc
.
Manual_FeedingInlet
,
ExtendType
.
STORAGE_CHECKOUT
,
999
);
hasTask
=
true
;
}
}
}
}
if
(
hasTask
){
isCall
=
false
;
return
ResultBean
.
newOkResult
(
""
);
}
isCall
=
false
;
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未找到符合条件的料箱"
);
}
@ApiOperation
(
"获取所有手动线任务"
)
@RequestMapping
(
"/getManualTask"
)
@AnonymousAccess
public
ResultBean
getManualTask
()
{
List
<
DataLog
>
resultList
=
new
ArrayList
<>();
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
dataLog
:
allTasks
)
{
if
(
dataLog
.
isCheckOutTask
()
&&
!
dataLog
.
isFinished
()
&&
!
dataLog
.
isCancel
()){
if
(
TaskCurrentLoc
.
Manual_FeedingInlet
.
equals
(
dataLog
.
getLoc
())){
resultList
.
add
(
dataLog
);
}
}
}
return
ResultBean
.
newOkResult
(
resultList
);
dataCache
.
updateCache
(
CACHE_CALL_EMPTY
,
null
);
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论