Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
QisdaNew
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b03d6c8a
由
sunke
编写于
2022-11-29 17:10:28 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
流水线根据条码获取物料的任务信息,用于入料口料串冲过头,无法获取料盘尺寸时,从服务器获取(如果有返回尺寸,流水线添加尺寸后正常入库, 如果获取尺寸失败,放上托盘并NG处理,并复位)
1 个父辈
d43b5df5
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
131 行增加
和
24 行删除
myproject/src/main/java/com/myproject/webapp/controller/webService/DataCache.java
myproject/src/main/java/com/myproject/webapp/controller/webService/QisdaDeviceController.java
myproject/src/main/java/com/myproject/webapp/controller/webService/StorageDataController.java
myproject/src/main/java/com/myproject/webapp/controller/webService/DataCache.java
查看文件 @
b03d6c8
...
...
@@ -254,6 +254,33 @@ public class DataCache{
}
/**
* 从字符串中解析出Barcode
*/
public
Barcode
getBarcodeFromCodeStr
(
String
codeStr
){
if
(!
Strings
.
isNullOrEmpty
(
codeStr
)){
//防止规则未初始化
if
(
barcodeRuleList
==
null
){
getSettings
();
}
//双##号分割多个二维码
String
[]
barcodeItemStrs
=
codeStr
.
split
(
"##"
);
for
(
String
barcodeItemStr
:
barcodeItemStrs
){
if
(!
barcodeItemStr
.
isEmpty
()){
//每个规则尝试解析一次
for
(
BarcodeRule
codeRule
:
barcodeRuleList
){
CodeBean
codeBean
=
codeRule
.
toCodeBean
(
barcodeItemStr
);
if
(
codeBean
.
isValid
()){
return
codeBean
.
getBarcode
();
}
}
}
}
}
return
null
;
}
/**
* 解析条码为单个 Barcode
*/
public
CodeBean
resolveSingleCode
(
String
barcodeItemStr
){
...
...
myproject/src/main/java/com/myproject/webapp/controller/webService/QisdaDeviceController.java
查看文件 @
b03d6c8
...
...
@@ -224,11 +224,13 @@ public class QisdaDeviceController extends BaseController {
}
if
(
robotIndex
.
equals
(
"1"
)){
//1号位机器人
firstRobotTask
=
task
;
log
.
info
(
"将扫码任务["
+
firstRobotTask
.
getBarcode
()+
"]设置到机器人["
+
robotIndex
+
"]取料任务"
);
//firstRobotTask = task;
boolean
result
=
updateRobotTask
(
robotIndex
,
task
,
""
);
log
.
info
(
"将扫码任务["
+
firstRobotTask
.
getBarcode
()+
"]设置到机器人["
+
robotIndex
+
"]取料任务,结果:"
+
result
);
}
else
if
(
robotIndex
.
equals
(
"2"
)){
secondRobotTask
=
task
;
log
.
info
(
"将扫码任务["
+
secondRobotTask
.
getBarcode
()+
"]设置到机器人["
+
robotIndex
+
"]取料任务"
);
//secondRobotTask = task;
boolean
result
=
updateRobotTask
(
robotIndex
,
task
,
""
);
log
.
info
(
"将扫码任务["
+
secondRobotTask
.
getBarcode
()+
"]设置到机器人["
+
robotIndex
+
"]取料任务:"
+
result
);
}
}
catch
(
Exception
e
){
log
.
error
(
"料盘到达机器人出错:"
,
e
);
...
...
@@ -253,6 +255,7 @@ public class QisdaDeviceController extends BaseController {
try
{
Barcode
barcode
=
dataCache
.
resolveOneValideBarcode
(
codeStr
);
if
(
robotIndex
.
equals
(
"1"
)){
//1号位机器人
boolean
firstRobtoSame
=
isSameTask
(
barcode
,
firstRobotTask
);
...
...
@@ -261,8 +264,9 @@ public class QisdaDeviceController extends BaseController {
log
.
info
(
"机器人["
+
robotIndex
+
"]当前取料任务与条码["
+
barcode
.
getBarcode
()+
"]一致,不再更新位置任务"
);
return
"OK"
;
}
firstRobotTask
=
firstScanTask
;
log
.
info
(
"将扫码任务["
+
firstRobotTask
.
getBarcode
()+
"]设置到机器人["
+
robotIndex
+
"]取料任务"
);
//firstRobotTask = firstScanTask;
boolean
result
=
updateRobotTask
(
robotIndex
,
firstScanTask
,
""
);
log
.
info
(
"将扫码任务["
+
firstScanTask
.
getBarcode
()+
"]设置到机器人["
+
robotIndex
+
"]取料任务,结果:"
+
result
);
}
else
if
(
robotIndex
.
equals
(
"2"
)){
boolean
secondRobtoSame
=
isSameTask
(
barcode
,
secondRobotTask
);
if
(
secondRobtoSame
){
...
...
@@ -270,8 +274,9 @@ public class QisdaDeviceController extends BaseController {
log
.
info
(
"机器人["
+
robotIndex
+
"]当前取料任务与条码["
+
barcode
.
getBarcode
()+
"]一致,不再更新位置任务"
);
return
"OK"
;
}
secondRobotTask
=
secondScanTask
;
log
.
info
(
"将扫码任务["
+
secondRobotTask
.
getBarcode
()+
"]设置到机器人["
+
robotIndex
+
"]取料任务"
);
//secondRobotTask = secondScanTask;
boolean
result
=
updateRobotTask
(
robotIndex
,
secondScanTask
,
""
);
log
.
info
(
"将扫码任务["
+
secondRobotTask
.
getBarcode
()+
"]设置到机器人["
+
robotIndex
+
"]取料任务,结果:"
+
result
);
}
updateScanTask
(
robotIndex
,
null
);
}
catch
(
Exception
e
){
...
...
@@ -1081,6 +1086,39 @@ public class QisdaDeviceController extends BaseController {
return
ResultBean
.
newErrorResult
(
501
,
errorMsg
);
}
private
synchronized
boolean
updateRobotTask
(
String
robotIndex
,
DataLog
task
,
String
barcode
){
if
(
task
!=
null
){
if
(
robotIndex
.
equals
(
"1"
)){
//1号位机器人
firstRobotTask
=
task
;
}
else
if
(
robotIndex
.
equals
(
"2"
)){
secondRobotTask
=
task
;
}
log
.
info
(
"将条码["
+
task
.
getBarcode
()+
"]设置到机器人["
+
robotIndex
+
"]取料任务"
);
return
true
;
}
else
{
//清空
if
(
robotIndex
.
equals
(
"1"
)){
if
(
firstRobotTask
!=
null
){
if
(
firstRobotTask
.
getBarcode
().
equals
(
barcode
)){
firstRobotTask
=
null
;
log
.
info
(
"清空机器人[1]任务["
+
barcode
+
"]成功"
);
return
true
;
}
}
}
else
if
(
robotIndex
.
equals
(
"2"
)){
if
(
secondRobotTask
!=
null
){
if
(
secondRobotTask
.
getBarcode
().
equals
(
barcode
)){
secondRobotTask
=
null
;
log
.
info
(
"清空机器人[2]任务["
+
barcode
+
"]成功"
);
return
true
;
}
}
}
}
return
false
;
}
/**
* 放置到料架动作完成,返回当前料架还可放置的数量,用任务总数
*/
...
...
@@ -1104,17 +1142,19 @@ public class QisdaDeviceController extends BaseController {
if
(
Strings
.
isNotBlank
(
robotIndex
)){
if
(
robotIndex
.
equals
(
"1"
)
&&
firstRobotTask
!=
null
){
if
(
firstRobotTask
.
getBarcode
().
equals
(
barcode
)){
log
.
info
(
"机器人["
+
robotIndex
+
"]将料盘["
+
barcode
+
"]放入料架["
+
rfid
+
"]["
+
rfidLoc
+
"]完成,任务一致,清空机器人任务"
);
boolean
clearResult
=
updateRobotTask
(
robotIndex
,
null
,
barcode
);
log
.
info
(
"机器人["
+
robotIndex
+
"]将料盘["
+
barcode
+
"]放入料架["
+
rfid
+
"]["
+
rfidLoc
+
"]完成,任务一致,清空机器人任务,结果["
+
clearResult
+
"]"
);
//1号位机器人
firstRobotTask
=
null
;
//
firstRobotTask = null;
}
else
{
log
.
info
(
"机器人["
+
robotIndex
+
"]将料盘["
+
barcode
+
"]放入料架["
+
rfid
+
"]["
+
rfidLoc
+
"]完成,与当前任务["
+
firstRobotTask
.
getBarcode
()+
"]不一致,不清空"
);
}
}
else
if
(
robotIndex
.
equals
(
"2"
)
&&
secondRobotTask
!=
null
){
if
(
secondRobotTask
.
getBarcode
().
equals
(
barcode
)){
//1号位机器人
log
.
info
(
"机器人["
+
robotIndex
+
"]将料盘["
+
barcode
+
"]放入料架["
+
rfid
+
"]["
+
rfidLoc
+
"]完成,任务一致,清空机器人任务"
);
secondRobotTask
=
null
;
//2号位机器人
boolean
clearResult
=
updateRobotTask
(
robotIndex
,
null
,
barcode
);
log
.
info
(
"机器人["
+
robotIndex
+
"]将料盘["
+
barcode
+
"]放入料架["
+
rfid
+
"]["
+
rfidLoc
+
"]完成,任务一致,清空机器人任务,结果["
+
clearResult
+
"]"
);
//secondRobotTask = null;
}
else
{
log
.
info
(
"机器人["
+
robotIndex
+
"]将料盘["
+
barcode
+
"]放入料架["
+
rfid
+
"]["
+
rfidLoc
+
"]完成,与当前任务["
+
secondRobotTask
.
getBarcode
()+
"]不一致,不清空"
);
}
...
...
@@ -1712,4 +1752,44 @@ public class QisdaDeviceController extends BaseController {
}
}
/**
* 流水线根据条码获取物料的任务信息,用于入料口料串冲过头,无法获取料盘尺寸时,从服务器获取(如果有返回尺寸,流水线添加尺寸后正常入库, 如果获取尺寸失败,放上托盘并NG处理,并复位)
*/
@RequestMapping
(
value
=
"/getReelSize"
)
@ResponseBody
public
ResultBean
getReelSize
(
HttpServletRequest
request
)
{
try
{
String
barcodeStr
=
request
.
getParameter
(
"barcode"
);
log
.
info
(
"收到流水线获取["
+
barcodeStr
+
"]的尺寸信息"
);
Barcode
barcode
=
dataCache
.
getBarcodeFromCodeStr
(
barcodeStr
);
if
(
barcode
!=
null
){
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
dataMap
.
put
(
"barcode"
,
barcode
.
getBarcode
());
//先查找此料盘之前是否有入过库
Barcode
dbBarcode
=
barcodeManager
.
findByBarcode
(
barcode
.
getBarcode
());
if
(
dbBarcode
!=
null
){
dataMap
.
put
(
"plateW"
,
dbBarcode
.
getPlateSize
());
dataMap
.
put
(
"plateH"
,
dbBarcode
.
getHeight
());
return
ResultBean
.
newOkResult
(
dataMap
);
}
else
{
//查找
Component
component
=
componentManager
.
findProviderPn
(
barcode
.
getPartNumber
(),
barcode
.
getProvider
());
if
(
component
==
null
){
component
=
componentManager
.
findOneByPn
(
barcode
.
getPartNumber
());
}
if
(
component
!=
null
){
dataMap
.
put
(
"plateW"
,
component
.
getPlateSize
());
dataMap
.
put
(
"plateH"
,
component
.
getHeight
());
return
ResultBean
.
newOkResult
(
dataMap
);
}
}
return
ResultBean
.
newErrorResult
(
405
,
"未找到条码:"
+
barcode
.
getBarcode
()+
"PN:"
+
barcode
.
getPartNumber
()+
"的尺寸信息"
);
}
return
ResultBean
.
newErrorResult
(
404
,
"未从["
+
barcodeStr
+
"]中找到有效条码"
);
}
catch
(
Exception
e
){
log
.
error
(
"流水线获取尺寸信息出错"
,
e
);
return
ResultBean
.
newErrorResult
(
500
,
e
.
getMessage
());
}
}
}
myproject/src/main/java/com/myproject/webapp/controller/webService/StorageDataController.java
查看文件 @
b03d6c8
...
...
@@ -570,17 +570,17 @@ public class StorageDataController extends BaseController {
Map
<
String
,
Object
>
resultMap
=
Maps
.
newHashMap
();
//暂停入库时,包装料架例外,包装仓通过AGV不拉VMI线入库料架控制
if
(!
DataCache
.
isProductionFor
(
DataCache
.
CUSTOMER
.
QISDA4D
)){{
//3楼暂停入库功能
if
(
dataCache
.
getSettings
().
isStopIn
()){
if
(!
StorageConstants
.
SHEFL_TYPE
.
isAShelf
(
rfid
)){
lineMsg
=
"系统已暂停入库"
;
resultMap
.
put
(
"result"
,
"100"
);
resultMap
.
put
(
"msg"
,
lineMsg
);
return
resultMap
;
}
}
}}
//
if(!DataCache.isProductionFor(DataCache.CUSTOMER.QISDA4D)){{
//
//3楼暂停入库功能
//
if(dataCache.getSettings().isStopIn()){
//
if(!StorageConstants.SHEFL_TYPE.isAShelf(rfid)){
//
lineMsg = "系统已暂停入库";
//
resultMap.put("result","100");
//
resultMap.put("msg",lineMsg);
//
return resultMap;
//
}
//
}
//
}}
String
okMsg
=
""
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论