Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
QisdaNew
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 40272ac3
由
sunke
编写于
2023-02-01 16:54:23 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加查询托盘状态接口
去除查询禁用托盘接口
1 个父辈
22306c42
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
131 行增加
和
28 行删除
myproject/src/main/java/com/myproject/bean/qisda/TrayInfo.java
myproject/src/main/java/com/myproject/webapp/controller/webService/QisdaDisabledTrayController.java
myproject/src/main/webapp/WEB-INF/pages/updateHistory.jsp
myproject/src/main/webapp/decorators/metro.jsp
myproject/src/main/java/com/myproject/bean/qisda/TrayInfo.java
0 → 100644
查看文件 @
40272ac
package
com
.
myproject
.
bean
.
qisda
;
import
java.util.Date
;
/**
* @author sunke
* @date 2023/2/1 2:28 PM
*/
public
class
TrayInfo
{
/**
* 托盘号
*/
private
String
trayId
;
/**
* 更新时间,如果托盘已禁用, 那么时间为禁用时间
*/
private
String
date
;
/**
* 屏蔽位置, 如果未屏蔽,值为空
*/
private
String
disabledLoc
=
""
;
public
String
getTrayId
()
{
return
trayId
;
}
public
void
setTrayId
(
String
trayId
)
{
this
.
trayId
=
trayId
;
}
public
String
getDisabledLoc
()
{
return
disabledLoc
;
}
public
void
setDisabledLoc
(
String
disabledLoc
)
{
this
.
disabledLoc
=
disabledLoc
;
}
public
String
getDate
()
{
return
date
;
}
public
void
setDate
(
String
date
)
{
this
.
date
=
date
;
}
}
myproject/src/main/java/com/myproject/webapp/controller/webService/QisdaDisabledTrayController.java
查看文件 @
40272ac
...
...
@@ -2,6 +2,7 @@ package com.myproject.webapp.controller.webService;
import
com.google.common.collect.Lists
;
import
com.myproject.bean.qisda.ResultBean
;
import
com.myproject.bean.qisda.TrayInfo
;
import
com.myproject.bean.update.Barcode
;
import
com.myproject.bean.update.Component
;
import
com.myproject.bean.update.StoragePos
;
...
...
@@ -27,57 +28,88 @@ import java.util.*;
public
class
QisdaDisabledTrayController
{
/**
* 环形线禁用托盘信息
*/
protected
String
disabledTray
=
""
;
/**
* 禁用托盘缓存信息,key为托盘号,value为禁用时间
*/
protected
Map
<
String
,
String
>
disabledT
rayMap
=
new
HashMap
<>();
protected
Map
<
String
,
TrayInfo
>
t
rayMap
=
new
HashMap
<>();
protected
final
static
Logger
log
=
LogManager
.
getLogger
(
QisdaDisabledTrayController
.
class
);
/**
* 获取工单的小料盘绑定数量
*/
@RequestMapping
(
value
=
"/getDisabledTray"
)
@RequestMapping
(
value
=
"/getTrayInfo"
)
@ResponseBody
public
Collection
<
TrayInfo
>
getDisabledTray
(
HttpServletRequest
request
){
return
trayMap
.
values
();
}
@RequestMapping
(
value
=
"/updateTray"
)
@ResponseBody
public
Map
<
String
,
String
>
smallBindCount
(
HttpServletRequest
request
){
return
disabledTrayMap
;
public
ResultBean
updateTray
(
HttpServletRequest
request
)
{
try
{
String
trayId
=
request
.
getParameter
(
"trayId"
);
updateTrayInfo
(
trayId
,
null
);
return
ResultBean
.
newOkResult
(
""
);
}
catch
(
Exception
e
){
log
.
error
(
"更新托盘信息出错"
,
e
);
return
ResultBean
.
newErrorResult
(
500
,
e
.
getMessage
());
}
}
private
synchronized
void
updateTrayInfo
(
String
trayId
,
String
disableLoc
){
TrayInfo
trayInfo
=
trayMap
.
get
(
trayId
);
if
(
trayInfo
==
null
){
trayInfo
=
new
TrayInfo
();
trayInfo
.
setTrayId
(
trayId
);
}
if
(
Strings
.
isBlank
(
trayInfo
.
getDisabledLoc
())){
//已禁用托盘,不更新使用时间
String
dateStr
=
DateUtil
.
toDateString
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
trayInfo
.
setDate
(
dateStr
);
}
if
(
disableLoc
!=
null
){
//更新托盘使用状态时不更新禁用信息
if
(
Strings
.
isBlank
(
trayInfo
.
getDisabledLoc
())){
log
.
info
(
"托盘["
+
trayId
+
"]被禁用,禁用位置["
+
disableLoc
+
"]"
);
}
trayInfo
.
setDisabledLoc
(
disableLoc
);
}
trayMap
.
put
(
trayId
,
trayInfo
);
}
@RequestMapping
(
value
=
"/updateDisabledTray"
)
@ResponseBody
public
ResultBean
getReelSize
(
HttpServletRequest
request
)
{
public
ResultBean
updateDisabledTray
(
HttpServletRequest
request
)
{
try
{
String
trayList
=
request
.
getParameter
(
"disabledTray"
);
if
(
Strings
.
isBlank
(
trayList
)){
trayList
=
""
;
}
if
(!
disabledTray
.
equals
(
trayList
)){
log
.
info
(
"收到禁用托盘更新信息:"
+
trayList
);
}
if
(
Strings
.
isNotBlank
(
trayList
)){
Map
<
String
,
String
>
disableMap
=
new
HashMap
<>();
List
<
String
>
newDisabeldTrayList
=
Lists
.
newArrayList
(
trayList
.
split
(
","
));
Collection
<
String
>
existDisabedTrayList
=
disabledTrayMap
.
keySet
();
for
(
String
existDisabedTray
:
existDisabedTrayList
)
{
if
(!
newDisabeldTrayList
.
contains
(
existDisabedTray
)){
//已经启用
log
.
info
(
"托盘["
+
existDisabedTray
+
"]已启用,从缓存中清除"
);
disabledTrayMap
.
remove
(
existDisabedTray
);
};
for
(
String
disableInfo
:
newDisabeldTrayList
)
{
String
[]
disableArr
=
disableInfo
.
split
(
"="
);
if
(
disableArr
.
length
==
2
){
String
trayId
=
disableArr
[
0
];
String
disableLoc
=
disableArr
[
1
];
disableMap
.
put
(
trayId
,
disableLoc
);
updateTrayInfo
(
trayId
,
disableLoc
);
}
}
for
(
String
newDisabeldTray
:
newDisabeldTrayList
)
{
if
(!
existDisabedTrayList
.
contains
(
newDisabeldTray
)){
String
dateTime
=
DateUtil
.
toDateString
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
log
.
info
(
"托盘["
+
newDisabeldTray
+
"]已禁用,加入缓存,禁用时间:"
+
dateTime
);
disabledTrayMap
.
put
(
newDisabeldTray
,
dateTime
);
for
(
TrayInfo
trayInfo
:
trayMap
.
values
())
{
String
trayId
=
trayInfo
.
getTrayId
();
String
disableLoc
=
disableMap
.
get
(
trayId
);
if
(
disableLoc
==
null
){
//禁用托盘未包含此托盘,如果之前已经禁用,需要解除禁用
if
(
Strings
.
isNotBlank
(
trayInfo
.
getDisabledLoc
())){
log
.
info
(
"托盘["
+
trayId
+
"]已启用,去除禁用信息["
+
trayInfo
.
getDisabledLoc
()+
"]"
);
updateTrayInfo
(
trayId
,
""
);
}
}
}
}
disabledTray
=
trayList
;
return
ResultBean
.
newOkResult
(
""
);
}
catch
(
Exception
e
){
log
.
error
(
"上传禁用托盘信息出错"
,
e
);
...
...
myproject/src/main/webapp/WEB-INF/pages/updateHistory.jsp
查看文件 @
40272ac
...
...
@@ -12,6 +12,30 @@
<div class="row">
<div class="col-md-12">
<ul class="timeline">
<li class="timeline-grey">
<div class="timeline-time">
<span class="date">2023</span>
<span class="time">02-02</span>
</div>
<div class="timeline-icon">
<i class="fa fa-clock-o"></i>
</div>
<div class="timeline-body">
<h2>版本: V2023020210</h2>
<div class="timeline-content">
<ul>
<li>增加查询托盘状态接口,接口地址: http://ip/myproject/rest/api/qisda/device/getTrayInfo
返回示例:[{"trayId":"E25","date":"2023-02-01 16:38:26","disabledLoc":"5"},{"trayId":"E38","date":"2023-02-01 16:40:11","disabledLoc":""}]
返回说明:
trayId: 托盘编号
disabledLoc: 如果值为空表示托盘正常,未被禁用; 如果不为空,表示禁用该托盘的位置
date: 如果托盘禁用,此时间为禁用托盘的时间; 如果托盘未被禁用,此时间为托盘上次经过检测点的时间
</li>
<li>去除查询禁用托盘接口</li>
</ul>
</div>
</div>
</li>
<li class="timeline-purple">
<div class="timeline-time">
<span class="date">2023</span>
...
...
myproject/src/main/webapp/decorators/metro.jsp
查看文件 @
40272ac
...
...
@@ -239,7 +239,7 @@
<div
class=
"page-footer-inner"
>
2016
©
<a
href=
"${ctx}/updateHistory.html"
>
SMD BOX
</a>
</div>
<span
class=
"right"
style=
"color: #a3a3a3;"
>
Version:
2023.01.10
10
</span>
<span
class=
"right"
style=
"color: #a3a3a3;"
>
Version:
V20230202
10
</span>
<div
class=
"scroll-to-top"
>
<i
class=
"icon-arrow-up"
></i>
</div>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论