Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
Gree
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 19ed1274
由
sunke
编写于
2021-03-29 09:57:47 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
料架分配逻辑修改
1 个父辈
423c514e
全部展开
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
82 行增加
和
213 行删除
myproject/src/main/java/com/myproject/bean/qisda/InquiryShelfBean.java
myproject/src/main/java/com/myproject/bean/qisda/ShelfInfo.java
myproject/src/main/java/com/myproject/bean/update/DataLog.java
myproject/src/main/java/com/myproject/util/DateUtil.java
myproject/src/main/java/com/myproject/util/StorageConstants.java
myproject/src/main/java/com/myproject/webapp/controller/qisda/util/OutInfoCache.java
myproject/src/main/java/com/myproject/webapp/controller/webService/QisdaDeviceController.java
myproject/src/main/java/com/myproject/webapp/controller/webService/TaskService.java
myproject/storageManager.iml
pom.xml
myproject/src/main/java/com/myproject/bean/qisda/InquiryShelfBean.java
查看文件 @
19ed127
此文件的差异被折叠,
点击展开。
myproject/src/main/java/com/myproject/bean/qisda/ShelfInfo.java
查看文件 @
19ed127
package
com
.
myproject
.
bean
.
qisda
;
import
com.myproject.bean.update.DataLog
;
import
com.myproject.util.StorageConstants
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -40,6 +41,19 @@ public class ShelfInfo {
}
/**
* F料架最多放26个小料
*/
private
static
int
MAX_F_SMALL_NUM
=
26
;
/**
* F料架1-26放小料, 27-31放大料
* @return
*/
public
static
ShelfInfo
newFShelf
(){
return
new
ShelfInfo
(
StorageConstants
.
SHEFL_TYPE
.
F
,
31
);
}
/**
* 需求单号
*/
private
String
hSerial
;
...
...
@@ -93,12 +107,7 @@ public class ShelfInfo {
return
emptyLocCount
;
}
/**
* 库位数
*/
public
int
getUsedLocCount
(){
return
locMap
.
size
();
}
public
void
setLocMap
(
Map
<
Integer
,
ShelfLoc
>
locMap
)
{
this
.
locMap
=
locMap
;
...
...
@@ -131,6 +140,29 @@ public class ShelfInfo {
}
/**
* 是否到达可放小料的最大数量,F料架1-26放小料, 27-31放大料
*/
public
boolean
reachMaxSmallLoc
(){
int
smallCount
=
0
;
for
(
ShelfLoc
loc
:
locMap
.
values
())
{
if
(
loc
.
getLoc
()
<=
MAX_F_SMALL_NUM
){
smallCount
++;
}
}
return
smallCount
>=
MAX_F_SMALL_NUM
;
}
public
boolean
reachMaxBigLoc
(){
int
bigCount
=
0
;
for
(
ShelfLoc
loc
:
locMap
.
values
())
{
if
(
loc
.
getLoc
()
>
MAX_F_SMALL_NUM
){
bigCount
++;
}
}
return
bigCount
>=
maxLocCount
-
MAX_F_SMALL_NUM
;
}
/**
* 料架是否放满
*/
public
boolean
isFull
(){
...
...
@@ -222,14 +254,13 @@ public class ShelfInfo {
/**
* 为补料取消一个库位
*/
public
boolean
cancelLoc
(
String
rfidType
,
String
barcode
){
public
boolean
cancelLoc
(
String
rfidType
,
DataLog
task
){
if
(
rfidType
.
equals
(
this
.
getShelfType
())){
int
usedCount
=
getUsedLocCount
();
for
(
int
i
=
usedCount
;
i
>
0
;
i
--){
for
(
int
i
=
maxLocCount
;
i
>
0
;
i
--){
ShelfLoc
shelfLoc
=
locMap
.
get
(
i
);
if
(
shelfLoc
!=
null
&&
shelfLoc
.
isEmpty
()
&&
!
shelfLoc
.
isLock
()){
if
(
shelfLoc
!=
null
&&
shelfLoc
.
isEmpty
()
&&
!
shelfLoc
.
isLock
()
&&
shelfLoc
.
getReelType
()
==
task
.
getReelType
()
){
//未放过料,且未锁定
shelfLoc
.
putIn
(
barcode
);
shelfLoc
.
putIn
(
task
.
getBarcode
()
);
return
true
;
}
}
...
...
@@ -299,176 +330,75 @@ public class ShelfInfo {
}
/**
* 为包装料锁定架位
* @param shelfLoc 架位信息
* @param packageReelId 包装料条码
* @return
*/
public
boolean
lockForPackage
(
ShelfLoc
shelfLoc
,
String
packageReelId
){
ShelfLoc
emptyLoc
=
locMap
.
get
(
shelfLoc
.
getLoc
());
if
(!
emptyLoc
.
isEmpty
()){
log
.
info
(
"为包装料["
+
packageReelId
+
"]锁定C型料架"
+
tempRfid
()+
"["
+
shelfLoc
.
getLoc
()+
"]失败,位置为不空"
);
return
false
;
}
log
.
info
(
"为包装料["
+
packageReelId
+
"]锁定架位"
+
tempRfid
()+
"["
+
shelfLoc
.
getLoc
()+
"]"
);
emptyLoc
.
setBarcode
(
packageReelId
);
return
true
;
}
/**
* 为不需要按顺序摆放的料盘锁定一个架位,如果已经锁定过,返回对应的架位
*/
public
ShelfLoc
lockOneEmptyLoc
(
String
barcode
,
int
reelType
,
String
robotIndex
){
//if(rfid.contains(shelfType)) {
//不是同一种料架的忽略
public
ShelfLoc
lockOneEmptyLoc
(
DataLog
task
){
//先看看此条码是否已经锁定过
for
(
ShelfLoc
shelfLoc
:
locMap
.
values
())
{
if
(
shelfLoc
.
isLock
()
&&
shelfLoc
.
getBarcode
().
equals
(
barcode
)){
log
.
info
(
"找到条码["
+
barcode
+
"]锁定的架位["
+
shelfLoc
.
getLoc
()+
"]"
);
return
shelfLoc
;
}
}
int
usedCount
=
getUsedLocCount
();
//1号机器人从大到小, 2号机器人从小到大,且71,72,73位不分配给2号机器人
if
(
robotIndex
.
equals
(
"1"
)){
//1号机器人优先放70,71,72三个位置
ShelfLoc
shelfLoc
=
lockLocation
(
72
,
barcode
,
reelType
);
if
(
shelfLoc
==
null
){
shelfLoc
=
lockLocation
(
71
,
barcode
,
reelType
);
if
(
shelfLoc
==
null
){
shelfLoc
=
lockLocation
(
70
,
barcode
,
reelType
);
}
}
if
(
shelfLoc
==
null
){
for
(
int
i
=
usedCount
;
i
>
0
;
i
--){
//大料12号位不分配给1号机器人
if
(
StorageConstants
.
SHEFL_TYPE
.
isCShelf
(
shelfType
)){
if
(
i
==
12
){
continue
;
}
}
shelfLoc
=
lockLocation
(
i
,
barcode
,
reelType
);
if
(
shelfLoc
!=
null
){
return
shelfLoc
;
}
}
}
if
(
shelfLoc
==
null
&&
StorageConstants
.
SHEFL_TYPE
.
isCShelf
(
shelfType
)){
//如果执行到这里还有空,说明另一个机器人停掉了只能分配了
for
(
int
i
=
usedCount
;
i
>
0
;
i
--){
shelfLoc
=
lockLocation
(
i
,
barcode
,
reelType
);
if
(
shelfLoc
!=
null
){
return
shelfLoc
;
}
}
}
return
shelfLoc
;
}
else
if
(
robotIndex
.
equals
(
"2"
)){
ShelfLoc
shelfLoc
=
null
;
if
(
StorageConstants
.
SHEFL_TYPE
.
isCShelf
(
shelfType
)){
//大料12号位分给2号机器人
shelfLoc
=
lockLocation
(
12
,
barcode
,
reelType
);
}
if
(
shelfLoc
==
null
){
for
(
int
i
=
1
;
i
<=
usedCount
;
i
++){
//小料70,71,72位不分配给2号机器人
if
(
StorageConstants
.
SHEFL_TYPE
.
isDShelf
(
shelfType
)){
if
(
i
==
70
||
i
==
71
||
i
==
72
){
continue
;
}
}
shelfLoc
=
lockLocation
(
i
,
barcode
,
reelType
);
if
(
shelfLoc
!=
null
){
if
(
shelfLoc
.
isLock
()
&&
shelfLoc
.
getBarcode
().
equals
(
task
.
getBarcode
())){
log
.
info
(
"找到条码["
+
task
.
getBarcode
()+
"]锁定的架位["
+
shelfLoc
.
getLoc
()+
"]"
);
return
shelfLoc
;
}
}
}
if
(
shelfLoc
==
null
&&
StorageConstants
.
SHEFL_TYPE
.
isDShelf
(
shelfType
)){
//如果执行到这里还有空,说明另一个机器人停掉了只能分配了
for
(
int
i
=
usedCount
;
i
>
0
;
i
--){
shelfLoc
=
lockLocation
(
i
,
barcode
,
reelType
);
if
(
shelfLoc
!=
null
){
return
shelfLoc
;
}
}
}
return
shelfLoc
;
}
else
{
//包装料
for
(
int
i
=
1
;
i
<=
usedCount
;
i
++){
ShelfLoc
shelfLoc
=
lockLocation
(
i
,
barcode
,
reelType
);
for
(
int
i
=
1
;
i
<=
maxLocCount
;
i
++){
ShelfLoc
shelfLoc
=
lockLocation
(
i
,
task
);
if
(
shelfLoc
!=
null
){
return
shelfLoc
;
}
}
}
//}
return
null
;
}
/**
* 锁定库位,如果成功返回库位,如果失败返回null
*/
private
ShelfLoc
lockLocation
(
int
loc
,
String
barcode
,
int
reelType
){
private
ShelfLoc
lockLocation
(
int
loc
,
DataLog
task
){
ShelfLoc
shelfLoc
=
locMap
.
get
(
loc
);
if
(
shelfLoc
!=
null
&&
shelfLoc
.
isEmpty
()
&&
!
shelfLoc
.
isLock
()){
log
.
info
(
"为["
+
barcode
+
"]锁定架位"
+
tempRfid
()
+
"["
+
loc
+
"]"
);
if
(
shelfLoc
!=
null
&&
shelfLoc
.
isEmpty
()
&&
!
shelfLoc
.
isLock
()
&&
task
.
getReelType
()
==
shelfLoc
.
getReelType
()
){
log
.
info
(
"为["
+
task
.
getBarcode
()
+
"]锁定架位"
+
tempRfid
()
+
"["
+
loc
+
"]"
);
//未放过料,且未锁定
shelfLoc
.
setBarcode
(
barcode
);
shelfLoc
.
setReelType
(
reelType
);
shelfLoc
.
setBarcode
(
task
.
getBarcode
()
);
shelfLoc
.
setReelType
(
task
.
getReelType
()
);
locMap
.
put
(
loc
,
shelfLoc
);
return
shelfLoc
;
}
return
null
;
}
/**
* 添加缺料空位
*/
public
int
addEmptyLoc
(){
return
addShelfLoc
(
null
,
0
);
}
/**
* 添加一个库位
*/
public
int
addLimitLoc
(
String
barcode
,
int
reelType
){
if
(
barcode
==
null
){
barcode
=
""
;
}
return
addShelfLoc
(
barcode
,
reelType
);
}
/**
* 添加一个库位,库位固定放某个条码,不限制库位时,设为空字符串,缺料库位设置为null
* @param barcode
*/
private
int
addShelfLoc
(
String
barcode
,
int
reelType
){
public
int
addUnLimitLoc
(
DataLog
task
){
for
(
int
i
=
1
;
i
<=
maxLocCount
;
i
++){
ShelfLoc
shelfLoc
=
locMap
.
get
(
i
);
if
(
shelfLoc
==
null
){
shelfLoc
=
new
ShelfLoc
();
if
(
barcode
==
null
){
barcode
=
"no code"
;
shelfLoc
.
setEmpty
(
false
);
boolean
addThis
=
false
;
if
(
task
.
isSmallReel
()){
if
(
i
<=
MAX_F_SMALL_NUM
){
addThis
=
true
;
}
}
else
{
if
(
i
>
MAX_F_SMALL_NUM
){
addThis
=
true
;
}
}
if
(
addThis
){
shelfLoc
=
new
ShelfLoc
();
shelfLoc
.
setLoc
(
i
);
shelfLoc
.
setBarcode
(
barcode
);
shelfLoc
.
setReelType
(
reelType
);
shelfLoc
.
setBarcode
(
""
);
shelfLoc
.
setReelType
(
task
.
getReelType
()
);
locMap
.
put
(
i
,
shelfLoc
);
return
i
;
}
}
}
return
-
1
;
}
public
int
getMaxLocCount
()
{
return
maxLocCount
;
}
...
...
myproject/src/main/java/com/myproject/bean/update/DataLog.java
查看文件 @
19ed127
...
...
@@ -575,9 +575,7 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ {
* @return
*/
public
int
getReelType
(){
if
(
isPackageReel
()){
return
StorageConstants
.
REEL_TYPE
.
PACKAGE
;
}
else
if
(
isSmallReel
()){
if
(
isSmallReel
()){
return
StorageConstants
.
REEL_TYPE
.
SMALL
;
}
else
{
return
StorageConstants
.
REEL_TYPE
.
BIG
;
...
...
myproject/src/main/java/com/myproject/util/DateUtil.java
查看文件 @
19ed127
...
...
@@ -203,76 +203,9 @@ public final class DateUtil {
}
public
static
void
main
(
String
args
[])
throws
Exception
{
List
<
DataLog
>
list
=
new
ArrayList
<>();
list
.
add
(
newDataLog
(
14
,
2000
));
list
.
add
(
newDataLog
(
14
,
4000
));
list
.
add
(
newDataLog
(
2
,
3000
));
list
.
add
(
newDataLog
(
2
,
1000
));
list
.
add
(
newDataLog
(
2
,
2000
));
list
.
add
(
newDataLog
(
2
,
4000
));
list
.
add
(
newDataLog
(
3
,
2000
));
list
.
add
(
newDataLog
(
1
,
1000
));
list
.
add
(
newDataLog
(
1
,
2000
));
list
.
add
(
newDataLog
(
1
,
3000
));
List
<
DataLog
>
sortList
=
sortTailTasks
(
list
);
sortList
.
sort
(
new
Comparator
<
DataLog
>()
{
@Override
public
int
compare
(
DataLog
o1
,
DataLog
o2
)
{
return
o1
.
getOutOrder
()
-
o2
.
getOutOrder
();
}
});
for
(
DataLog
d
:
sortList
)
{
System
.
out
.
println
(
"["
+
d
.
getOutOrder
()+
"]"
+
d
.
getAppendInfo
().
getSlotIndex
()+
" - "
+
d
.
getNum
());
}
}
/**
* 对补料任务进行出库排序
*/
private
static
List
<
DataLog
>
sortTailTasks
(
List
<
DataLog
>
tailTasks
){
Multimap
<
Integer
,
DataLog
>
slotTaskMap
=
HashMultimap
.
create
();
Set
<
Integer
>
slotSet
=
new
HashSet
<>();
for
(
DataLog
dataLog
:
tailTasks
)
{
slotTaskMap
.
put
(
dataLog
.
getAppendInfo
().
getSlotIndex
(),
dataLog
);
slotSet
.
add
(
dataLog
.
getAppendInfo
().
getSlotIndex
());
}
List
<
DataLog
>
sortList
=
new
ArrayList
<>();
int
outOrder
=
0
;
while
(
outOrder
<
tailTasks
.
size
()){
for
(
Integer
slot
:
slotSet
)
{
Collection
<
DataLog
>
slotTasks
=
slotTaskMap
.
get
(
slot
);
DataLog
maxNumtask
=
null
;
for
(
DataLog
slotTask
:
slotTasks
)
{
if
(
maxNumtask
==
null
||
slotTask
.
getNum
()
>
maxNumtask
.
getNum
()){
maxNumtask
=
slotTask
;
}
}
if
(
maxNumtask
!=
null
){
outOrder
=
outOrder
+
1
;
maxNumtask
.
setOutOrder
(
outOrder
);
sortList
.
add
(
maxNumtask
);
slotTaskMap
.
remove
(
slot
,
maxNumtask
);
}
}
}
return
sortList
;
}
private
static
DataLog
newDataLog
(
int
slotIndex
,
int
num
){
DataLog
d1
=
new
DataLog
();
AppendInfo
appendInfo
=
new
AppendInfo
();
appendInfo
.
setSlotIndex
(
slotIndex
);
d1
.
setAppendInfo
(
appendInfo
);
d1
.
setNum
(
num
);
return
d1
;
}
}
myproject/src/main/java/com/myproject/util/StorageConstants.java
查看文件 @
19ed127
...
...
@@ -645,6 +645,11 @@ public class StorageConstants {
public
static
String
E
=
"E"
;
/**
* F料架1-26放小料, 27-31放大料
*/
public
static
String
F
=
"F"
;
/**
* 带包装料架
*/
public
static
boolean
isAShelf
(
String
type
){
...
...
@@ -668,6 +673,12 @@ public class StorageConstants {
public
static
boolean
isDShelf
(
String
type
){
return
judgeType
(
type
,
D
);
}
/**
* 混合料架
*/
public
static
boolean
isFShelf
(
String
type
){
return
judgeType
(
type
,
F
);
}
public
static
boolean
judgeType
(
String
type
,
String
targetType
){
if
(
type
!=
null
&&
type
.
contains
(
targetType
)){
...
...
myproject/src/main/java/com/myproject/webapp/controller/qisda/util/OutInfoCache.java
查看文件 @
19ed127
此文件的差异被折叠,
点击展开。
myproject/src/main/java/com/myproject/webapp/controller/webService/QisdaDeviceController.java
查看文件 @
19ed127
此文件的差异被折叠,
点击展开。
myproject/src/main/java/com/myproject/webapp/controller/webService/TaskService.java
查看文件 @
19ed127
此文件的差异被折叠,
点击展开。
myproject/storageManager.iml
查看文件 @
19ed127
...
...
@@ -29,10 +29,6 @@
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.data:spring-data-mongodb:1.8.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.mongodb:mongo-java-driver:2.12.5"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"RUNTIME"
name=
"Maven: org.slf4j:jcl-over-slf4j:1.7.11"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.data:spring-data-commons:1.10.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: commons-lang:commons-lang:2.6"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-orm:4.1.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-beans:4.1.6.RELEASE"
level=
"project"
/>
...
...
pom.xml
查看文件 @
19ed127
...
...
@@ -30,6 +30,7 @@
<build>
<finalName>
smdbox
</finalName>
<defaultGoal>
install
</defaultGoal>
<plugins>
<plugin>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论