Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
smart-rack-base
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
smart-rack-base
Commits
00e0e9bd
Commit
00e0e9bd
authored
Oct 16, 2025
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
出入库websocket前台调整
parent
1fe1e635
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
12 deletions
+30
-12
index.vue
...base-web/src/views/pcbamanage/pcbashelflocation/index.vue
+15
-6
index.vue
...web/src/views/producemange/produceshelflocation/index.vue
+15
-6
No files found.
smart-rack-base-web/src/views/pcbamanage/pcbashelflocation/index.vue
View file @
00e0e9bd
...
...
@@ -87,6 +87,7 @@
shelfId
:
null
,
},
ws
:
null
,
heartbeatInterval
:
null
}
},
created
(){
...
...
@@ -240,19 +241,26 @@
this
.
ws
=
new
WebSocket
(
'ws://'
+
window
.
location
.
host
+
process
.
env
.
VUE_APP_BASE_API
+
'/ws/notifications'
);
this
.
ws
.
onopen
=
()
=>
{
console
.
log
(
'WebSocket Connected'
);
// 连接建立后,开始定期发送心跳
this
.
heartbeatInterval
=
setInterval
(()
=>
{
if
(
this
.
ws
.
readyState
===
WebSocket
.
OPEN
)
{
this
.
ws
.
send
(
JSON
.
stringify
({
type
:
'ping'
}));
console
.
log
(
"发送心跳"
)
}
},
30000
);
};
this
.
ws
.
onmessage
=
(
event
)
=>
{
// Add received message to the list
const
message
=
JSON
.
parse
(
event
.
data
);
if
(
message
&&
message
.
SHELFID
&&
message
.
SHELFID
==
this
.
$route
.
query
.
shelfId
){
if
(
message
&&
message
.
shelfId
&&
message
.
shelfId
==
this
.
$route
.
query
.
shelfId
){
//入库
if
(
"I"
==
message
.
OPTYPE
){
const
locationInfo
=
this
.
shelfLayoutList
.
flat
().
find
(
location
=>
location
.
location
===
message
.
LOCATION
);
locationInfo
.
rid
=
message
.
RID
;
if
(
"I"
==
message
.
optype
){
const
locationInfo
=
this
.
shelfLayoutList
.
flat
().
find
(
location
=>
location
.
location
===
message
.
location
);
locationInfo
.
rid
=
message
.
rid
;
}
//出库
if
(
"O"
==
message
.
OPTYPE
){
const
locationInfo
=
this
.
shelfLayoutList
.
flat
().
find
(
location
=>
location
.
location
===
message
.
LOCATION
);
if
(
"O"
==
message
.
optype
){
const
locationInfo
=
this
.
shelfLayoutList
.
flat
().
find
(
location
=>
location
.
location
===
message
.
location
);
locationInfo
.
rid
=
null
;
}
}
...
...
@@ -262,6 +270,7 @@
};
this
.
ws
.
onclose
=
()
=>
{
console
.
log
(
'WebSocket Closed'
);
clearInterval
(
this
.
heartbeatInterval
);
};
},
disconnect
()
{
...
...
smart-rack-base-web/src/views/producemange/produceshelflocation/index.vue
View file @
00e0e9bd
...
...
@@ -87,6 +87,7 @@
shelfId
:
null
,
},
ws
:
null
,
heartbeatInterval
:
null
}
},
created
(){
...
...
@@ -240,19 +241,26 @@
this
.
ws
=
new
WebSocket
(
'ws://'
+
window
.
location
.
host
+
process
.
env
.
VUE_APP_BASE_API
+
'/ws/notifications'
);
this
.
ws
.
onopen
=
()
=>
{
console
.
log
(
'WebSocket Connected'
);
// 连接建立后,开始定期发送心跳
this
.
heartbeatInterval
=
setInterval
(()
=>
{
if
(
this
.
ws
.
readyState
===
WebSocket
.
OPEN
)
{
this
.
ws
.
send
(
JSON
.
stringify
({
type
:
'ping'
}));
console
.
log
(
"发送心跳"
)
}
},
30000
);
};
this
.
ws
.
onmessage
=
(
event
)
=>
{
// Add received message to the list
const
message
=
JSON
.
parse
(
event
.
data
);
if
(
message
&&
message
.
SHELFID
&&
message
.
SHELFID
==
this
.
$route
.
query
.
shelfId
){
if
(
message
&&
message
.
shelfId
&&
message
.
shelfId
==
this
.
$route
.
query
.
shelfId
){
//入库
if
(
"I"
==
message
.
OPTYPE
){
const
locationInfo
=
this
.
shelfLayoutList
.
flat
().
find
(
location
=>
location
.
location
===
message
.
LOCATION
);
locationInfo
.
rid
=
message
.
RID
;
if
(
"I"
==
message
.
optype
){
const
locationInfo
=
this
.
shelfLayoutList
.
flat
().
find
(
location
=>
location
.
location
===
message
.
location
);
locationInfo
.
rid
=
message
.
rid
;
}
//出库
if
(
"O"
==
message
.
OPTYPE
){
const
locationInfo
=
this
.
shelfLayoutList
.
flat
().
find
(
location
=>
location
.
location
===
message
.
LOCATION
);
if
(
"O"
==
message
.
optype
){
const
locationInfo
=
this
.
shelfLayoutList
.
flat
().
find
(
location
=>
location
.
location
===
message
.
location
);
locationInfo
.
rid
=
null
;
}
}
...
...
@@ -262,6 +270,7 @@
};
this
.
ws
.
onclose
=
()
=>
{
console
.
log
(
'WebSocket Closed'
);
clearInterval
(
this
.
heartbeatInterval
);
};
},
disconnect
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment