Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit fae12414
由
LN
编写于
2023-07-18 15:18:39 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加获取空料架接口
1 个父辈
cef4b71c
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
154 行增加
和
27 行删除
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/util/TaskShelfUtil.java
src/main/java/com/neotel/smfcore/custom/gree20242/CodeLightController.java
src/main/java/com/neotel/smfcore/core/shelf/bean/ShelfInfo.java
查看文件 @
fae1241
...
...
@@ -62,6 +62,16 @@ public class ShelfInfo {
*/
private
int
maxLocCount
=
0
;
/**
* 是否所有位置都已扫码亮灯
*/
private
boolean
lightEnd
=
false
;
/**
* 线体,目标位置
*/
private
String
line
;
public
static
ShelfInfo
newFShelf
()
{
return
new
ShelfInfo
(
SHELF_TYPE
.
F
,
31
);
}
...
...
@@ -297,4 +307,6 @@ public class ShelfInfo {
// result.add(bigEmpty);
// return result;
// }
}
src/main/java/com/neotel/smfcore/core/shelf/bean/ShelfLoc.java
查看文件 @
fae1241
...
...
@@ -54,6 +54,11 @@ public class ShelfLoc {
private
String
shelfLocation
=
null
;
/**
* 是否已经扫码亮灯,料架所有料都扫码亮灯后,料架可离开
*/
private
boolean
codeLight
=
false
;
/**
* 判断该架位锁定的条码是否与给定的条码一样
*
* @param barcode
...
...
src/main/java/com/neotel/smfcore/core/shelf/rest/AgvShelfController.java
查看文件 @
fae1241
...
...
@@ -13,12 +13,13 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@RestController
...
...
@@ -51,6 +52,11 @@ public class AgvShelfController {
liteOrderCache
.
addOrderToMap
(
order
);
}
String
line
=
order
.
getLine
();
if
(!
shelfInfo
.
getLine
().
equals
(
line
)){
shelfInfo
.
setLine
(
line
);
TaskShelfUtil
.
updateShelfInfo
(
shelfInfo
);
}
log
.
info
(
"getShelfTargetLoc 料架 ,rfid=["
+
rfid
+
"],目标位置:["
+
line
+
"]"
);
return
ResultBean
.
newOkResult
(
line
);
}
...
...
@@ -78,7 +84,10 @@ public class AgvShelfController {
//更新记录
TaskShelfUtil
.
updateShelfLoc
(
rfid
,
loc
);
log
.
info
(
"updateShelfLoc 更新料架【"
+
rfid
+
"】位置=【"
+
loc
+
"】"
);
if
(!
shelfInfo
.
getLine
().
equals
(
loc
)){
shelfInfo
.
setLine
(
loc
);
TaskShelfUtil
.
updateShelfInfo
(
shelfInfo
);
}
String
orderNo
=
shelfInfo
.
getOrderNo
();
LiteOrder
order
=
liteOrderCache
.
getLiteOrder
(
orderNo
);
if
(
order
!=
null
)
{
...
...
@@ -90,4 +99,79 @@ public class AgvShelfController {
return
ResultBean
.
newOkResult
(
"ok"
);
}
@ApiOperation
(
"获取产线可以拉回的空料架"
)
@PostMapping
(
value
=
"/emptyShelfList"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
emptyShelfList
(
HttpServletRequest
request
)
{
List
<
Map
<
String
,
String
>>
result
=
new
ArrayList
<>();
Map
<
String
,
Map
<
String
,
ShelfInfo
>>
taskShelfMap
=
TaskShelfUtil
.
taskShelfMap
;
for
(
Map
<
String
,
ShelfInfo
>
map:
taskShelfMap
.
values
()
)
{
for
(
ShelfInfo
shelf
:
map
.
values
())
{
if
(
shelf
.
isLightEnd
())
{
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
());
result
.
add
(
shelfMap
);
}
}
}
// if(result.size()<=0) {
// Map<String, String> shelfMap = new HashMap<>();
// shelfMap.put("realRfid", "rfid1");
// shelfMap.put("orderNo", "orderNo1");
// shelfMap.put("rfidIndex", "001");
// shelfMap.put("line", "L1");
//
// result.add(shelfMap);
//
// shelfMap = new HashMap<>();
// shelfMap.put("realRfid", "rfid2");
// shelfMap.put("orderNo", "orderNo2");
// shelfMap.put("rfidIndex", "002");
// shelfMap.put("line", "L2");
//
// result.add(shelfMap);
// }
ResultBean
resultBean
=
ResultBean
.
newOkResult
(
"ok"
);
resultBean
.
setData
(
result
);
return
resultBean
;
}
@ApiOperation
(
"根据rfid清空料架信息"
)
@PostMapping
(
value
=
"/clearRfid"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
clearRfid
(
HttpServletRequest
request
)
{
String
rfid
=
request
.
getParameter
(
"rfid"
);
log
.
info
(
"收到清空料架:/agv/clearRfid ,rfid=["
+
rfid
+
"]"
);
if
(
ObjectUtil
.
isNotEmpty
(
rfid
))
{
ShelfInfo
shelfInfo
=
TaskShelfUtil
.
findShelfByRealRfid
(
rfid
);
if
(
shelfInfo
==
null
)
{
log
.
info
(
"clearRfid rfid["
+
rfid
+
"]"
);
return
ResultBean
.
newErrorResult
(
99
,
"smfcore.taskShelf.notExist"
,
"未找到rfid["
+
rfid
+
"]"
,
new
String
[]{
rfid
});
}
boolean
result
=
TaskShelfUtil
.
clearShelf
(
shelfInfo
.
getOrderNo
(),
rfid
);
if
(
result
)
{
log
.
info
(
"clearRfid orderNo["
+
shelfInfo
.
getOrderNo
()
+
"],rfid["
+
rfid
+
"] OK"
);
}
return
ResultBean
.
newOkResult
(
"ok"
);
}
else
{
return
ResultBean
.
newOkResult
(
"未找到可清除的料架"
);
}
}
}
src/main/java/com/neotel/smfcore/core/shelf/util/TaskShelfUtil.java
查看文件 @
fae1241
...
...
@@ -98,7 +98,11 @@ public class TaskShelfUtil {
if
(
orderNo
!=
null
)
{
Map
<
String
,
ShelfInfo
>
shelfMap
=
taskShelfMap
.
get
(
orderNo
);
if
(
shelfMap
!=
null
)
{
log
.
info
(
"清理["
+
orderNo
+
"]使用过的料架 成功"
);
for
(
ShelfInfo
shelf
:
shelfMap
.
values
())
{
updateShelfLoc
(
shelf
.
getRealRfid
(),
""
);
log
.
info
(
"清理["
+
orderNo
+
"]使用过的料架["
+
shelf
.
getRealRfid
()+
"] 成功"
);
}
taskShelfMap
.
remove
(
orderNo
);
saveShelfMap
(
taskShelfMap
,
true
);
return
true
;
...
...
@@ -118,6 +122,7 @@ public class TaskShelfUtil {
String
tempRfid
=
shelfInfo
.
tempRfid
();
shelfMap
.
remove
(
tempRfid
);
taskShelfMap
.
put
(
orderNo
,
shelfMap
);
updateShelfLoc
(
shelfInfo
.
getRealRfid
(),
""
);
log
.
info
(
"清理["
+
orderNo
+
"]使用的过料架["
+
rfid
+
"]成功"
);
clearResult
=
true
;
saveShelfMap
(
taskShelfMap
,
true
);
...
...
@@ -134,7 +139,7 @@ public class TaskShelfUtil {
/**
* 更新料架缓存信息
*/
p
rivate
static
void
updateShelfInfo
(
ShelfInfo
shelfInfo
)
{
p
ublic
static
void
updateShelfInfo
(
ShelfInfo
shelfInfo
)
{
String
orderNo
=
shelfInfo
.
getOrderNo
();
Map
<
String
,
ShelfInfo
>
shelfMap
=
taskShelfMap
.
getOrDefault
(
orderNo
,
new
ConcurrentHashMap
<>());
shelfMap
.
put
(
shelfInfo
.
tempRfid
(),
shelfInfo
);
...
...
@@ -486,7 +491,12 @@ public class TaskShelfUtil {
public
static
void
updateShelfLoc
(
String
rfid
,
String
loc
){
lineShelfLocMap
.
put
(
rfid
,
loc
);
if
(
ObjectUtil
.
isEmpty
(
loc
)){
lineShelfMap
.
remove
(
rfid
);
}
else
{
lineShelfLocMap
.
put
(
rfid
,
loc
);
}
saveLineShelfLocMap
(
lineShelfLocMap
);
}
...
...
@@ -500,20 +510,44 @@ public class TaskShelfUtil {
}
public
static
ShelfLoc
getLastLoc
(
String
barcode
){
/**
* 扫码亮灯,获取库位号
* @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
.
setCodeLight
(
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
.
isCodeLight
()){
lightEnd
=
false
;
break
;
}
}
}
shelf
.
setLightEnd
(
lightEnd
);
ShelfLoc
shelfLoc
=
shelf
.
getBarcodeLoc
(
barcode
);
if
(
shelfLoc
!=
null
&&(!
shelfLoc
.
isEmpty
())){
//获取料架位置
String
line
=
getShelfLoc
(
shelfLoc
.
getRealRfid
());
shelfLoc
.
setShelfLocation
(
line
);
return
shelfLoc
;
updateShelfInfo
(
shelf
);
log
.
info
(
"标记料架["
+
shelf
.
getRealRfid
()
+
"]位置["
+
shelfLoc
.
getLoc
()
+
"]条码["
+
shelfLoc
.
getBarcode
()
+
"]为已扫码亮灯,料架是否亮灯完成["
+
lightEnd
+
"]"
);
return
shelfLoc
;
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/custom/gree20242/CodeLightController.java
查看文件 @
fae1241
package
com
.
neotel
.
smfcore
.
custom
.
gree20242
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.base.Strings
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.util.DataCache
;
...
...
@@ -14,20 +10,16 @@ import com.neotel.smfcore.core.shelf.util.TaskShelfUtil;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
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.DevicesStatusUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.awt.*
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
...
...
@@ -60,7 +52,7 @@ public class CodeLightController {
log
.
info
(
"codeLed 未找到有效条码["
+
code
+
"]"
);
return
ResultBean
.
newErrorResult
(
99
,
"smfcore.error.barcode.invalid"
,
"未找到有效条码"
);
}
ShelfLoc
loc
=
TaskShelfUtil
.
getLas
tLoc
(
barcode
.
getBarcode
());
ShelfLoc
loc
=
TaskShelfUtil
.
codeLightGe
tLoc
(
barcode
.
getBarcode
());
if
(
loc
==
null
)
{
return
ResultBean
.
newErrorResult
(
99
,
"smfcore.light.error.noloc"
,
"未找到亮灯位置"
);
}
...
...
@@ -119,7 +111,7 @@ public class CodeLightController {
log
.
info
(
"codeLed 未找到有效条码["
+
code
+
"]"
);
return
ResultBean
.
newErrorResult
(
99
,
"smfcore.error.barcode.invalid"
,
"未找到有效条码"
);
}
ShelfLoc
loc
=
TaskShelfUtil
.
getLas
tLoc
(
barcode
.
getBarcode
());
ShelfLoc
loc
=
TaskShelfUtil
.
codeLightGe
tLoc
(
barcode
.
getBarcode
());
if
(
loc
==
null
)
{
return
ResultBean
.
newErrorResult
(
99
,
"smfcore.light.error.noloc"
,
"未找到亮灯位置"
);
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论