Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b7df5340
由
LN
编写于
2024-03-06 14:41:52 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
扫码亮灯修改
1 个父辈
b8d58d48
全部展开
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
239 行增加
和
41 行删除
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
src/main/java/com/neotel/smfcore/core/shelf/bean/ShelfInfo.java
src/main/java/com/neotel/smfcore/core/shelf/bean/ShelfLoc.java
src/main/java/com/neotel/smfcore/core/shelf/rest/AgvShelfController.java
src/main/java/com/neotel/smfcore/core/shelf/rest/TaskShelfController.java
src/main/java/com/neotel/smfcore/core/shelf/util/TaskShelfUtil.java
src/main/java/com/neotel/smfcore/custom/gree20242/CodeLightController.java
src/main/java/com/neotel/smfcore/custom/gree20242/dto/ShelfDto.java
src/main/java/com/neotel/smfcore/custom/gree20242/dto/ShelfReelDto.java
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
查看文件 @
b7df534
...
...
@@ -25,6 +25,7 @@ import java.util.*;
@Component
public
class
DataInitManager
{
public
static
boolean
Debug
=
false
;
public
static
Date
startRunTime
=
new
Date
();
public
static
Set
<
String
>
allPermissionSet
;
...
...
src/main/java/com/neotel/smfcore/core/shelf/bean/ShelfInfo.java
查看文件 @
b7df534
...
...
@@ -63,18 +63,44 @@ public class ShelfInfo {
private
int
maxLocCount
=
0
;
/**
* 如果已绑定任务都放完成,可以离开
*/
private
boolean
needLeave
=
false
;
/**
* 是否所有位置都已扫码亮灯
*/
private
boolean
lightEnd
=
false
;
/**
* 线体,目标位置
*/
private
String
line
;
/**
* 料架状态。0=等待放料。
* 1=绑定任务已完成,离开
* 2.已到达line
* 3=所有料盘已扫码灭灯,agv可以拉空料架离开
*/
private
int
shelfState
=
0
;
public
void
NeedLeave
(){
shelfState
=
1
;
log
.
info
(
"RFID["
+
realRfid
+
"] 设置shelfState= "
+
shelfState
);
}
public
void
ArriveLine
(
String
line
)
{
shelfState
=
2
;
this
.
line
=
line
;
log
.
info
(
"RFID["
+
realRfid
+
"] 设置shelfState= "
+
shelfState
+
", line="
+
line
);
}
public
void
NeedLeaveLine
()
{
shelfState
=
3
;
log
.
info
(
"RFID["
+
realRfid
+
"] 设置shelfState= "
+
shelfState
);
}
// /**
// * 如果已绑定任务都放完成,可以离开
// */
// private boolean needLeave=false;
//
// /**
// * 是否所有位置都已扫码亮灯
// */
// private boolean lightEnd=false;
// /**
// * 线体,目标位置
// */
// private boolean inLine =false;
public
static
ShelfInfo
newFShelf
()
{
return
new
ShelfInfo
(
SHELF_TYPE
.
F
,
31
);
...
...
@@ -106,6 +132,10 @@ public class ShelfInfo {
return
false
;
}
public
List
<
ShelfLoc
>
getLocList
(){
List
<
ShelfLoc
>
list
=
new
ArrayList
<>(
locMap
.
values
());
return
list
;
}
/**
* 根据条码获取库位信息
*/
...
...
@@ -247,11 +277,11 @@ public class ShelfInfo {
}
}
if
(
lCount
==
0
)
{
needLeave
=
true
;
NeedLeave
()
;
}
// }
log
.
info
(
"料盘["
+
barcode
+
"]放入位置"
+
rfid
+
"["
+
loc
+
"]成功,料架是否需要离开="
+
needLeave
);
log
.
info
(
"料盘["
+
barcode
+
"]放入位置"
+
rfid
+
"["
+
loc
+
"]成功,料架是否需要离开="
+
(
shelfState
==
1
)
);
return
putInResult
;
}
else
{
log
.
error
(
"料盘["
+
barcode
+
"]放入位置"
+
rfid
+
"["
+
loc
+
"]失败,此位置料盘已放入"
);
...
...
src/main/java/com/neotel/smfcore/core/shelf/bean/ShelfLoc.java
查看文件 @
b7df534
...
...
@@ -51,12 +51,12 @@ public class ShelfLoc {
*/
private
boolean
isLock
=
false
;
private
String
shelfLocation
=
null
;
//
private String shelfLocation=null;
/**
*
是否已经扫码亮灯,料架所有料都扫码亮灯后,料架可离开
*
料盘是否已拿走
*/
private
boolean
codeLight
=
false
;
private
boolean
reelLeave
=
false
;
/**
* 判断该架位锁定的条码是否与给定的条码一样
...
...
@@ -94,4 +94,16 @@ public class ShelfLoc {
public
boolean
isBigLoc
()
{
return
reelType
==
REEL_TYPE
.
BIG
;
}
public
String
getPosName
(
String
lineLoc
)
{
String
reLoc
=
lineLoc
+
"-B1-"
+
loc
;
if
(
loc
<=
13
)
{
reLoc
=
lineLoc
+
"-A1-"
+
loc
;
}
else
if
(
loc
<=
26
)
{
reLoc
=
lineLoc
+
"-A2-"
+
(
loc
-
13
);
}
else
{
reLoc
=
lineLoc
+
"-B1-"
+
(
loc
-
26
);
}
return
reLoc
;
}
}
src/main/java/com/neotel/smfcore/core/shelf/rest/AgvShelfController.java
查看文件 @
b7df534
...
...
@@ -82,11 +82,13 @@ public class AgvShelfController {
//更新记录
TaskShelfUtil
.
updateShelfLoc
(
rfid
,
loc
);
log
.
info
(
"updateShelfLoc 更新料架【"
+
rfid
+
"】位置=【"
+
loc
+
"】"
);
if
(!
shelfInfo
.
getLine
().
equals
(
loc
)){
shelfInfo
.
setLine
(
loc
);
TaskShelfUtil
.
OpenShelfLed
(
shelfInfo
);
log
.
info
(
"updateShelfLoc 更新料架【"
+
rfid
+
"】位置=【"
+
loc
+
"】,并所有库位亮灯"
);
// if(!shelfInfo.getLine().equals(loc)){
// shelfInfo.setLine(loc);
shelfInfo
.
ArriveLine
(
loc
);
TaskShelfUtil
.
updateShelfInfo
(
shelfInfo
);
}
//
}
String
orderNo
=
shelfInfo
.
getOrderNo
();
LiteOrder
order
=
liteOrderCache
.
getLiteOrder
(
orderNo
);
if
(
order
!=
null
)
{
...
...
@@ -112,20 +114,30 @@ public class AgvShelfController {
)
{
for
(
ShelfInfo
shelf
:
map
.
values
())
{
if
(
shelf
.
isLightEnd
()
)
{
if
(
shelf
.
getShelfState
()==
3
)
{
Map
<
String
,
String
>
shelfMap
=
new
HashMap
<>();
shelfMap
.
put
(
"realRfid"
,
shelf
.
getRealRfid
());
shelfMap
.
put
(
"orderNo"
,
shelf
.
getOrderNo
());
shelfMap
.
put
(
"rfidIndex"
,
shelf
.
getRfidIndex
()
+
""
);
shelfMap
.
put
(
"line"
,
shelf
.
getLine
());
String
loc
=
TaskShelfUtil
.
getShelfLoc
(
shelf
.
getRealRfid
());
shelfMap
.
put
(
"line"
,
loc
);
result
.
add
(
shelfMap
);
}
}
}
ResultBean
resultBean
=
ResultBean
.
newOkResult
(
"ok"
);
// if(result.size()<=0){
// for (int i=1;i<=2;i++){
// Map<String, String> shelfMap = new HashMap<>();
// shelfMap.put("realRfid","F001"+i);
// shelfMap.put("orderNo", "OrderNo"+i);
// shelfMap.put("rfidIndex","index"+i);
// shelfMap.put("line", "L1-00"+i);
//
// result.add(shelfMap);
// }
// }
resultBean
.
setData
(
result
);
return
resultBean
;
}
...
...
src/main/java/com/neotel/smfcore/core/shelf/rest/TaskShelfController.java
查看文件 @
b7df534
...
...
@@ -95,7 +95,8 @@ public class TaskShelfController {
ShelfLoc
loc
=
TaskShelfUtil
.
lockShelfLoc
(
opTask
,
rfid
);
if
(
loc
==
null
)
{
return
ResultBean
.
newErrorResult
(
304
,
"smfcore.taskLoc.lockLoc.fail"
,
"{0}获取位置{1}失败"
,
new
String
[]{
opTask
.
getBarcode
(),
rfid
},
resultMap
);
return
ResultBean
.
newErrorResult
(
304
,
"smfcore.taskLoc.lockLoc.fail"
,
"{0}获取位置{1}失败"
,
new
String
[]{
opTask
.
getBarcode
()+
"-"
+
opTask
.
getTempRfid
()+
"-"
+
opTask
.
getRfidLoc
(),
rfid
},
resultMap
);
}
String
rfidSave
=
loc
.
getRealRfid
();
if
(
ObjectUtil
.
isEmpty
(
rfidSave
))
{
...
...
@@ -405,7 +406,7 @@ public class TaskShelfController {
for
(
String
tempRfid
:
map2
.
keySet
())
{
ShelfInfo
shelfInfo
=
map2
.
get
(
tempRfid
);
msg
+=
"hSerial="
+
hSerial
+
",tempRfid="
+
tempRfid
+
",realRfid="
+
shelfInfo
.
getRealRfid
()+
",
needLeave="
+
shelfInfo
.
isNeedLeav
e
()+
"\r\n"
;
msg
+=
"hSerial="
+
hSerial
+
",tempRfid="
+
tempRfid
+
",realRfid="
+
shelfInfo
.
getRealRfid
()+
",
ShelfState="
+
shelfInfo
.
getShelfStat
e
()+
"\r\n"
;
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/shelf/util/TaskShelfUtil.java
查看文件 @
b7df534
...
...
@@ -6,11 +6,15 @@ import com.neotel.smfcore.core.device.util.DataCache;
import
com.neotel.smfcore.core.shelf.bean.ShelfInfo
;
import
com.neotel.smfcore.core.shelf.bean.ShelfLoc
;
import
com.neotel.smfcore.core.shelf.enums.SHELF_TYPE
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.awt.*
;
import
java.util.*
;
import
java.util.List
;
import
java.util.concurrent.ConcurrentHashMap
;
@Slf4j
public
class
TaskShelfUtil
{
...
...
@@ -49,12 +53,28 @@ public class TaskShelfUtil {
initShelfLocMap
();
}
public
static
String
getCid
(
String
loc
){
return
loc
;
}
private
static
void
initShelfLocMap
()
{
if
(
lineShelfLocMap
==
null
)
{
lineShelfLocMap
=
dataCache
.
getCache
(
LINE_SHELF_LOC_MAP_KEY
);
if
(
lineShelfLocMap
==
null
){
lineShelfLocMap
=
new
ConcurrentHashMap
<>();
}
else
{
for
(
String
rfid
:
lineShelfLocMap
.
keySet
())
{
ShelfInfo
shelfInfo
=
TaskShelfUtil
.
findShelfByRealRfid
(
rfid
);
if
(
shelfInfo
!=
null
)
{
String
loc
=
lineShelfLocMap
.
get
(
rfid
);
log
.
info
(
"initShelfLocMap 料架 rfid=["
+
rfid
+
"] loc["
+
loc
+
"] 库位亮灯"
);
OpenShelfLed
(
shelfInfo
);
}
else
{
log
.
info
(
"initShelfLocMap 未找到料架 ,rfid=["
+
rfid
+
"]"
);
}
}
}
}
...
...
@@ -68,10 +88,10 @@ public class TaskShelfUtil {
private
static
void
saveLineShelfMap
(
Map
<
String
,
ShelfInfo
>
map
)
{
dataCache
.
updateCache
(
LINE_SHELF_MAP_KEY
,
map
);
}
private
static
void
AddShelfToLineMap
(
ShelfInfo
shelfInfo
){
lineShelfMap
.
put
(
shelfInfo
.
getRealRfid
(),
shelfInfo
);
saveLineShelfMap
(
lineShelfMap
);
}
//
private static void AddShelfToLineMap(ShelfInfo shelfInfo){
//
lineShelfMap.put(shelfInfo.getRealRfid(),shelfInfo);
//
saveLineShelfMap(lineShelfMap);
//
}
private
static
void
saveLineShelfLocMap
(
Map
<
String
,
String
>
map
)
{
dataCache
.
updateCache
(
LINE_SHELF_LOC_MAP_KEY
,
map
);
}
...
...
@@ -172,12 +192,13 @@ public class TaskShelfUtil {
int
maxIndex
=
0
;
if
(
shelfMap
!=
null
)
{
for
(
ShelfInfo
shelfInfo
:
shelfMap
.
values
())
{
if
(
shelfInfo
.
isNeedLeave
()){
continue
;
}
if
(
shelfInfo
.
getRfidIndex
()
>
maxIndex
)
{
maxIndex
=
shelfInfo
.
getRfidIndex
();
}
if
(
shelfInfo
.
getShelfState
()>=
1
){
continue
;
}
targetLoc
=
shelfInfo
.
addUnLimitLoc
(
task
);
if
(
targetLoc
!=
-
1
)
{
//添加成功
...
...
@@ -328,7 +349,7 @@ public class TaskShelfUtil {
});
ShelfInfo
minIndexShelf
=
null
;
for
(
ShelfInfo
shelf
:
shelfList
)
{
if
(
shelf
.
isFull
()||
shelf
.
isNeedLeave
()
)
{
if
(
shelf
.
isFull
()||
shelf
.
getShelfState
()>=
1
)
{
//已经放满,查找下一个
continue
;
}
...
...
@@ -513,7 +534,7 @@ public class TaskShelfUtil {
public
static
void
updateShelfLoc
(
String
rfid
,
String
loc
){
if
(
ObjectUtil
.
isEmpty
(
loc
)){
lineShelfMap
.
remove
(
rfid
);
lineShelf
Loc
Map
.
remove
(
rfid
);
}
else
{
lineShelfLocMap
.
put
(
rfid
,
loc
);
...
...
@@ -530,23 +551,98 @@ public class TaskShelfUtil {
return
line
;
}
//
// /**
// * 扫码亮灯,获取库位号
// * @param barcode
// * @return
// */
// public static ShelfLoc codeLightGetLoc(String barcode) {
// for (Map<String, ShelfInfo> shelfInfoMap : taskShelfMap.values()) {
// for (ShelfInfo shelf : shelfInfoMap.values()) {
//
// ShelfLoc shelfLoc = shelf.getBarcodeLoc(barcode);
// if (shelfLoc != null && (!shelfLoc.isEmpty())) {
// //获取料架位置
// String line = getShelfLoc(shelfLoc.getRealRfid());
// shelfLoc.setShelfLocation(line);
//
// shelfLoc.setReelLeave(true);
// //TODO 标记此料已扫码
// Map<Integer, ShelfLoc> locMap = shelf.getLocMap();
// locMap.put(shelfLoc.getLoc(), shelfLoc);
// shelf.setLocMap(locMap);
//
// boolean lightEnd=true;
// for (ShelfLoc loc : locMap.values()){
// if(!loc.isEmpty()){
// if(!loc.isReelLeave()){
// lightEnd=false;
// break;
// }
// }
// }
//
// shelf.setLightEnd(lightEnd);
//
// updateShelfInfo(shelf);
// log.info("标记料架[" + shelf.getRealRfid() + "]位置[" + shelfLoc.getLoc() + "]条码[" + shelfLoc.getBarcode() + "]为已扫码亮灯,料架是否亮灯完成["+lightEnd+"]");
// return shelfLoc;
//
// }
//
// }
// }
// return null;
// }
public
static
boolean
OpenShelfLed
(
ShelfInfo
shelfInfo
)
{
List
<
ShelfLoc
>
locs
=
shelfInfo
.
getLocList
();
String
shelfLoc
=
getShelfLoc
(
shelfInfo
.
getRealRfid
());
String
cid
=
getCid
(
shelfLoc
);
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
==
null
)
{
log
.
error
(
"OpenShelfLed 料架"
+
shelfInfo
.
getRealRfid
()
+
" , 位置:"
+
shelfLoc
+
",cid "
+
cid
+
" 未找到对应的亮灯料架"
);
return
false
;
}
for
(
ShelfLoc
loc
:
locs
)
{
String
posname
=
loc
.
getPosName
(
shelfLoc
);
if
(
loc
.
isEmpty
()
||
ObjectUtil
.
isEmpty
(
loc
.
getBarcode
()))
{
continue
;
}
if
(
loc
.
isReelLeave
())
{
continue
;
}
else
{
DevicesStatusUtil
.
appendOp
(
storage
.
getCid
(),
"open"
,
posname
+
"="
+
Color
.
GREEN
.
toString
());
log
.
info
(
"亮灯料架CID:"
+
storage
.
getCid
()
+
",料架RFID:"
+
shelfInfo
.
getRealRfid
()
+
" ,库位: "
+
posname
+
" 亮灯 :"
+
Color
.
GREEN
.
toString
());
}
}
return
true
;
}
/**
* 扫码亮灯,获取库位号
* @param barcode
* @return
*/
public
static
ShelfLoc
codeLightGetLoc
(
String
barcode
)
{
public
static
List
<
Object
>
ReelLeave
(
String
barcode
)
{
List
<
Object
>
list
=
new
ArrayList
<>();
for
(
Map
<
String
,
ShelfInfo
>
shelfInfoMap
:
taskShelfMap
.
values
())
{
for
(
ShelfInfo
shelf
:
shelfInfoMap
.
values
())
{
if
(!(
shelf
.
getShelfState
()==
2
)){
return
null
;
}
ShelfLoc
shelfLoc
=
shelf
.
getBarcodeLoc
(
barcode
);
if
(
shelfLoc
!=
null
&&
(!
shelfLoc
.
isEmpty
()))
{
//获取料架位置
String
line
=
getShelfLoc
(
shelfLoc
.
getRealRfid
());
shelfLoc
.
setShelfLocation
(
line
);
//
String line = getShelfLoc(shelfLoc.getRealRfid());
//
shelfLoc.setShelfLocation(line);
shelfLoc
.
set
CodeLight
(
true
);
shelfLoc
.
set
ReelLeave
(
true
);
//TODO 标记此料已扫码
Map
<
Integer
,
ShelfLoc
>
locMap
=
shelf
.
getLocMap
();
locMap
.
put
(
shelfLoc
.
getLoc
(),
shelfLoc
);
...
...
@@ -555,18 +651,20 @@ public class TaskShelfUtil {
boolean
lightEnd
=
true
;
for
(
ShelfLoc
loc
:
locMap
.
values
()){
if
(!
loc
.
isEmpty
()){
if
(!
loc
.
is
CodeLight
()){
if
(!
loc
.
is
ReelLeave
()){
lightEnd
=
false
;
break
;
}
}
}
shelf
.
setLightEnd
(
lightEnd
);
shelf
.
NeedLeaveLine
(
);
updateShelfInfo
(
shelf
);
log
.
info
(
"标记料架["
+
shelf
.
getRealRfid
()
+
"]位置["
+
shelfLoc
.
getLoc
()
+
"]条码["
+
shelfLoc
.
getBarcode
()
+
"]为已扫码亮灯,料架是否亮灯完成["
+
lightEnd
+
"]"
);
return
shelfLoc
;
log
.
info
(
"标记料架["
+
shelf
.
getRealRfid
()
+
"]位置["
+
shelfLoc
.
getLoc
()
+
"]条码["
+
shelfLoc
.
getBarcode
()
+
"]已扫码灭灯,料盘已离开,料架是否亮灯完成["
+
lightEnd
+
"]"
);
list
.
add
(
shelf
);
list
.
add
(
shelfLoc
);
// return shelfLoc;
}
...
...
src/main/java/com/neotel/smfcore/custom/gree20242/CodeLightController.java
查看文件 @
b7df534
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/custom/gree20242/dto/ShelfDto.java
0 → 100644
查看文件 @
b7df534
package
com
.
neotel
.
smfcore
.
custom
.
gree20242
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
ShelfDto
{
@ApiModelProperty
(
"料架rfid"
)
private
String
rfid
;
@ApiModelProperty
(
"位置"
)
private
String
loc
;
@ApiModelProperty
(
"工单信息"
)
private
String
orderNo
;
@ApiModelProperty
(
"物料列表"
)
private
List
<
ShelfReelDto
>
reelList
;
}
src/main/java/com/neotel/smfcore/custom/gree20242/dto/ShelfReelDto.java
0 → 100644
查看文件 @
b7df534
package
com
.
neotel
.
smfcore
.
custom
.
gree20242
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
ShelfReelDto
implements
Serializable
{
@ApiModelProperty
(
"PN"
)
private
String
pn
;
@ApiModelProperty
(
"RI"
)
private
String
ri
;
@ApiModelProperty
(
"库位号"
)
private
String
posName
;
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论