提交 | 用户 | 时间
|
b0742c
|
1 |
<template> |
C |
2 |
<div class="app-container"> |
589dc7
|
3 |
<el-row :gutter="5"> |
懒 |
4 |
<el-col :span="6"> |
49ac5c
|
5 |
<el-card shadow="never"> |
懒 |
6 |
<span class="head-font">工位编号 : {{headContent.processesCode}}</span> |
589dc7
|
7 |
</el-card> |
懒 |
8 |
</el-col> |
|
9 |
<el-col :span="6"> |
49ac5c
|
10 |
<el-card shadow="never"> |
懒 |
11 |
<span class="head-font">工位名称 : {{headContent.processesName}}</span> |
589dc7
|
12 |
</el-card> |
懒 |
13 |
</el-col> |
8586e1
|
14 |
<el-col :span="12"> |
49ac5c
|
15 |
<el-card shadow="never"> |
懒 |
16 |
<span class="head-font">总成编码 : {{headContent.sfcCode}}</span> |
5a6d6b
|
17 |
<el-input v-model="content" style="float: right;width: 150px;" placeholder="请输入内容"></el-input> |
49ac5c
|
18 |
<el-button @click="scanCompleted" style="float: right" type="primary">扫码完成</el-button> |
懒 |
19 |
<el-button @click="clearClick" style="float: right" type="danger">清除</el-button> |
589dc7
|
20 |
</el-card> |
懒 |
21 |
</el-col> |
8586e1
|
22 |
|
589dc7
|
23 |
</el-row> |
懒 |
24 |
<el-row :gutter="5" style="margin-top: 5px"> |
|
25 |
<el-col :span="6" > |
|
26 |
<el-card class="bottom-card"> |
|
27 |
<div slot="header" class="clearfix"> |
49ac5c
|
28 |
<i class="el-icon-tickets"></i> |
懒 |
29 |
<span style="font-weight: bold">当前工件信息</span> |
589dc7
|
30 |
</div> |
49ac5c
|
31 |
<el-descriptions :column="1" :label-style="{'font-size': '15px'}" border :content-style="{'min-width': '150px'}"> |
懒 |
32 |
<el-descriptions-item label="工单编号"> |
|
33 |
<span>{{workpieceInformation.workOrderCode}}</span> |
589dc7
|
34 |
</el-descriptions-item> |
49ac5c
|
35 |
<el-descriptions-item label="产品编号"> |
懒 |
36 |
<span>{{workpieceInformation.productCode}}</span> |
589dc7
|
37 |
</el-descriptions-item> |
49ac5c
|
38 |
<el-descriptions-item label="产品型号"> |
懒 |
39 |
<span>{{workpieceInformation.productModel}}</span> |
589dc7
|
40 |
</el-descriptions-item> |
49ac5c
|
41 |
<el-descriptions-item label="产品名称"> |
懒 |
42 |
<span>{{workpieceInformation.productName}}</span> |
589dc7
|
43 |
</el-descriptions-item> |
49ac5c
|
44 |
<el-descriptions-item label="节拍"> |
懒 |
45 |
<span>{{workpieceInformation.beat}}</span> |
589dc7
|
46 |
</el-descriptions-item> |
懒 |
47 |
</el-descriptions> |
|
48 |
<el-divider></el-divider> |
|
49 |
<el-row> |
|
50 |
<el-col :span="12"> |
49ac5c
|
51 |
<el-button class="circle-button" :class="cakeLamp.plcState ? 'circle-green-animate':'circle-red'" circle></el-button> |
懒 |
52 |
<span style="display: none">{{cakeLamp.plcState}}</span> |
8586e1
|
53 |
<span> PLC状态</span> |
589dc7
|
54 |
</el-col> |
懒 |
55 |
<el-col :span="12"> |
49ac5c
|
56 |
<el-button class="circle-button" :class="cakeLamp.scannerState ? 'circle-green-animate':'circle-red'" circle></el-button> |
懒 |
57 |
<span style="display: none">{{cakeLamp.scannerState}}</span> |
8586e1
|
58 |
<span> 扫码枪状态</span> |
589dc7
|
59 |
</el-col> |
懒 |
60 |
</el-row> |
|
61 |
<el-row style="margin-top: 20px"> |
|
62 |
<el-col :span="12"> |
49ac5c
|
63 |
<el-button class="circle-button" :class="cakeLamp.InPlace ? 'circle-green':'circle-red'" circle></el-button> |
懒 |
64 |
<span style="display: none">{{cakeLamp.InPlace}}</span> |
8586e1
|
65 |
<span> 工件到位</span> |
589dc7
|
66 |
</el-col> |
懒 |
67 |
<el-col :span="12"> |
49ac5c
|
68 |
<el-button class="circle-button" :class="cakeLamp.scanFinish ? 'circle-green':'circle-red'" circle></el-button> |
懒 |
69 |
<span style="display: none">{{cakeLamp.scanFinish}}</span> |
8586e1
|
70 |
<span> 扫码完成</span> |
589dc7
|
71 |
</el-col> |
懒 |
72 |
</el-row> |
|
73 |
<el-row style="margin-top: 20px"> |
|
74 |
<el-col :span="12"> |
49ac5c
|
75 |
<el-button class="circle-button" :class="cakeLamp.startWork ? 'circle-green':'circle-red'" circle></el-button> |
懒 |
76 |
<span style="display: none">{{cakeLamp.startWork}}</span> |
8586e1
|
77 |
<span> 开始作业</span> |
589dc7
|
78 |
</el-col> |
懒 |
79 |
<el-col :span="12"> |
49ac5c
|
80 |
<el-button class="circle-button" :class="cakeLamp.release ? 'circle-green':'circle-red'" circle></el-button> |
懒 |
81 |
<span style="display: none">{{cakeLamp.release}}</span> |
8586e1
|
82 |
<span> 允许放行</span> |
589dc7
|
83 |
</el-col> |
49138a
|
84 |
|
懒 |
85 |
</el-row> |
|
86 |
<el-row style="margin-top: 20px"> |
|
87 |
<el-col :span="12"> |
|
88 |
<el-input v-model="serialPortContent" style="width: 150px;" placeholder="请输入内容"></el-input> |
|
89 |
|
|
90 |
</el-col> |
|
91 |
<el-col :span="12"> |
|
92 |
<el-button @click="serialPortMethod" type="primary">串口获取数据</el-button> |
|
93 |
|
|
94 |
</el-col> |
589dc7
|
95 |
</el-row> |
a36b83
|
96 |
<el-row style="margin-top: 20px"> |
懒 |
97 |
<el-button @click="Release" type="primary">放行</el-button> |
|
98 |
</el-row> |
589dc7
|
99 |
</el-card> |
b0742c
|
100 |
|
589dc7
|
101 |
</el-col> |
懒 |
102 |
<el-col :span="18"> |
5a6d6b
|
103 |
<el-tabs type="border-card" style="height: 600px" v-model="activeName" @tab-click="changeMenu"> |
懒 |
104 |
<el-tab-pane name="first"> |
589dc7
|
105 |
<span slot="label"> <a class="el-icon-date"></a>首页</span> |
懒 |
106 |
<el-col :span="8"> |
a36b83
|
107 |
<el-table :cell-style="rowStyle" :data="formulaChildList"> |
d3409e
|
108 |
<el-table-column label="排序" width="60" align="center" prop="stepSort"> |
懒 |
109 |
</el-table-column> |
|
110 |
<el-table-column label="操作内容" :show-overflow-tooltip='true' align="center" prop="operationSteps"> |
|
111 |
</el-table-column> |
589dc7
|
112 |
</el-table> |
懒 |
113 |
</el-col> |
|
114 |
<el-col :span="16"> |
|
115 |
<el-image style="height: 520px;width: 100%" :src="imgSrc"></el-image> |
|
116 |
</el-col> |
|
117 |
</el-tab-pane> |
5a6d6b
|
118 |
<el-tab-pane name="second"> |
589dc7
|
119 |
<span slot="label"> <b class="el-icon-date"></b>物料BOM</span> |
5a6d6b
|
120 |
<el-empty> |
589dc7
|
121 |
<span slot="description">暂无数据</span> |
懒 |
122 |
</el-empty> |
|
123 |
</el-tab-pane> |
5a6d6b
|
124 |
<el-tab-pane name="third"> |
懒 |
125 |
<span slot="label"> <b class="el-icon-date"></b>采集清单</span> |
|
126 |
<el-empty> |
589dc7
|
127 |
<span slot="description">暂无数据</span> |
懒 |
128 |
</el-empty> |
|
129 |
</el-tab-pane> |
5a6d6b
|
130 |
<el-tab-pane name="fourth"> |
懒 |
131 |
<span slot="label"> <b class="el-icon-date"></b>安灯状态</span> |
|
132 |
<el-empty> |
589dc7
|
133 |
<span slot="description">暂无数据</span> |
懒 |
134 |
</el-empty> |
|
135 |
</el-tab-pane> |
5a6d6b
|
136 |
<el-tab-pane name="fifth"> |
懒 |
137 |
<span slot="label"> <b class="el-icon-date"></b>工艺配方</span> |
|
138 |
<el-empty> |
589dc7
|
139 |
<span slot="description">暂无数据</span> |
懒 |
140 |
</el-empty> |
|
141 |
</el-tab-pane> |
|
142 |
</el-tabs> |
|
143 |
</el-col> |
|
144 |
</el-row> |
b0742c
|
145 |
</div> |
C |
146 |
</template> |
|
147 |
<script> |
49ac5c
|
148 |
import {listWorkReport} from "@/api/main/om/workReport/workReport"; |
懒 |
149 |
import {listStationConf,getIpv4} from "@/api/main/sc/stationConf"; |
a36b83
|
150 |
import {listFormulaChild, releaseCheck, updateResults} from "@/api/main/bs/formulaChild/formulaChild"; |
49ac5c
|
151 |
|
b0742c
|
152 |
export default { |
49ac5c
|
153 |
name: "stationTerminal", |
b0742c
|
154 |
data() { |
C |
155 |
return { |
49138a
|
156 |
serialPortContent: '', |
d3409e
|
157 |
// 查询参数 |
懒 |
158 |
formulaChildParams: { |
|
159 |
pageNum: 1, |
|
160 |
pageSize: 10, |
|
161 |
productCode: null, |
|
162 |
}, |
|
163 |
// 配方配置子信息表格数据 |
|
164 |
formulaChildList: [], |
49ac5c
|
165 |
ipAddress: '', |
589dc7
|
166 |
imgSrc: '', |
49ac5c
|
167 |
headContent: { |
懒 |
168 |
processesCode: 'OP1010', |
|
169 |
processesName: '贴标机-贴码', |
|
170 |
sfcCode: '1000000000000001', |
|
171 |
}, |
|
172 |
workpieceInformation: { |
|
173 |
workOrderCode: null, |
|
174 |
productCode: null, |
|
175 |
productModel: null, |
|
176 |
productName: null, |
|
177 |
beat: null, |
|
178 |
}, |
|
179 |
// 查询参数 |
|
180 |
queryParams: { |
|
181 |
pageNum: 1, |
|
182 |
pageSize: 10, |
|
183 |
sfcCode: null, |
|
184 |
}, |
5f3a2e
|
185 |
// 查询参数 |
懒 |
186 |
StationConfQueryParams: { |
|
187 |
pageNum: 1, |
|
188 |
pageSize: 10, |
|
189 |
ipAddress: null, |
|
190 |
}, |
49ac5c
|
191 |
cakeLamp: { |
懒 |
192 |
plcState: 1, //plc |
|
193 |
scannerState: 1, //扫码枪 |
|
194 |
InPlace: 0, //工件到位 |
|
195 |
scanFinish: 0, |
|
196 |
startWork: 0, |
|
197 |
release: 0 //允许放行 |
5a6d6b
|
198 |
}, |
懒 |
199 |
content: '', |
5f3a2e
|
200 |
activeName: 'first', |
a36b83
|
201 |
url: "ws://192.168.11.60:8080/websocket/message/", |
5f3a2e
|
202 |
message: "", |
懒 |
203 |
text_content: "", |
|
204 |
ws: null, |
d3409e
|
205 |
inputValue: '9' |
b0742c
|
206 |
} |
5f3a2e
|
207 |
}, |
懒 |
208 |
beforeDestroy() { |
|
209 |
this.exit(); |
b0742c
|
210 |
}, |
49ac5c
|
211 |
created() { |
5f3a2e
|
212 |
this.initStation(); |
懒 |
213 |
// this.getStationConfList(); |
|
214 |
// setTimeout(() => { |
|
215 |
// this.connectWebsocket(); |
|
216 |
// }, 3000); |
|
217 |
}, |
|
218 |
mounted() { |
|
219 |
|
49ac5c
|
220 |
}, |
懒 |
221 |
methods: { |
a36b83
|
222 |
Release(){ |
懒 |
223 |
releaseCheck().then(response => { |
|
224 |
if(response.data === 0){ |
|
225 |
//改变状态 |
|
226 |
this.$message('放行成功!'); |
49138a
|
227 |
|
a36b83
|
228 |
}else { |
懒 |
229 |
this.$message('步骤未完成不许放行!'); |
|
230 |
} |
|
231 |
}); |
|
232 |
}, |
|
233 |
serialPortMethod(){ |
|
234 |
let formulaChildParams = { |
|
235 |
materialCode: this.serialPortContent |
|
236 |
} |
|
237 |
updateResults(formulaChildParams).then(response => { |
|
238 |
this.getListFormulaChild() |
|
239 |
}); |
|
240 |
}, |
|
241 |
rowStyle({ row }) { |
|
242 |
if (row.results === 'OK') { |
|
243 |
return 'background-color: PaleGreen'; |
|
244 |
} else if (row.results === 'NG') { |
|
245 |
return 'background-color: LightSalmon'; |
|
246 |
} |
|
247 |
return ''; |
49138a
|
248 |
}, |
d3409e
|
249 |
/** 查询配方配置子信息列表 */ |
懒 |
250 |
getListFormulaChild() { |
|
251 |
this.formulaChildParams.productCode = this.workpieceInformation.productCode |
|
252 |
listFormulaChild(this.formulaChildParams).then(response => { |
|
253 |
this.formulaChildList = response.rows; |
|
254 |
}); |
|
255 |
}, |
5a6d6b
|
256 |
changeMenu(tab, event) { |
懒 |
257 |
console.log(tab, event); |
|
258 |
}, |
49ac5c
|
259 |
clearClick(){ |
懒 |
260 |
this.$message('这是一条清除消息提示'); |
|
261 |
this.headContent.sfcCode = null |
|
262 |
}, |
|
263 |
scanCompleted(){ |
5a6d6b
|
264 |
this.$message('扫码完成'+this.content); |
懒 |
265 |
this.headContent.sfcCode = this.content |
|
266 |
this.queryParams.sfcCode = this.content |
49ac5c
|
267 |
this.getList() |
a36b83
|
268 |
this.getListFormulaChild() |
49ac5c
|
269 |
this.cakeLamp.scanFinish = 1 |
49138a
|
270 |
this.cakeLamp.startWork = 1 |
懒 |
271 |
|
49ac5c
|
272 |
}, |
懒 |
273 |
/** 查询报工记录 表列表 */ |
49138a
|
274 |
async getList() { |
懒 |
275 |
await listWorkReport(this.queryParams).then(response => { |
49ac5c
|
276 |
let rowsData = response.rows[0]; |
a36b83
|
277 |
console.log(rowsData) |
49ac5c
|
278 |
this.workpieceInformation.workOrderCode = rowsData.workOrderCode; |
懒 |
279 |
this.workpieceInformation.productCode = rowsData.productCode; |
|
280 |
this.workpieceInformation.productModel = rowsData.productModel; |
|
281 |
this.workpieceInformation.productName = rowsData.productName; |
|
282 |
this.timer = setInterval(() => { |
|
283 |
this.workpieceInformation.beat++; |
|
284 |
}, 1000); |
|
285 |
}); |
49138a
|
286 |
this.getListFormulaChild() |
懒 |
287 |
|
49ac5c
|
288 |
}, |
懒 |
289 |
allowRelease(){ |
|
290 |
clearInterval(this.timer); |
|
291 |
this.$message('保存节拍为'+this.workpieceInformation.beat+'秒'); |
|
292 |
}, |
|
293 |
/** 查询工位终端配置列表 */ |
49138a
|
294 |
// async getStationConfList() { |
懒 |
295 |
// await getIpv4().then(response => { |
|
296 |
// this.StationConfQueryParams.ipAddress = response.msg |
|
297 |
// console.log('查询到本工位IP为'+this.StationConfQueryParams.ipAddress) |
|
298 |
// }); |
|
299 |
// listStationConf(this.StationConfQueryParams).then(response => { |
|
300 |
// let rows = response.rows[0] |
|
301 |
// if(response.rows.length===0){ |
|
302 |
// this.$message('该工位没有配置IP,请联系管理员配置IP'); |
|
303 |
// return |
|
304 |
// } |
|
305 |
// this.headContent.processesName = rows.processesName |
|
306 |
// this.headContent.processesCode = rows.processesCode |
|
307 |
// console.log('设置工位编码'+this.headContent.processesCode) |
|
308 |
// |
|
309 |
// }); |
|
310 |
// }, |
|
311 |
// connectWebsocket() { |
|
312 |
// console.log('websocket连接工位为'+this.headContent.processesCode) |
|
313 |
// const wsuri = this.url + this.headContent.processesCode; |
|
314 |
// this.ws = new WebSocket(wsuri); |
|
315 |
// const self = this; |
|
316 |
// this.ws.onopen = function (event) { |
|
317 |
// // self.text_content = self.text_content + "已经打开连接!" + "\n"; |
|
318 |
// this.$message('websocket连接成功!'); |
|
319 |
// }; |
|
320 |
// this.ws.onmessage = function (event) { |
|
321 |
// self.text_content = event.data + "\n"; |
|
322 |
// console.log(event.data) |
|
323 |
// if(event.data === "IN"){ |
|
324 |
// self.cakeLamp.InPlace = "1" |
|
325 |
// }else if(event.data === "OUT"){ |
|
326 |
// self.cakeLamp.outRsSign = "1" |
|
327 |
// } |
|
328 |
// }; |
|
329 |
// }, |
5f3a2e
|
330 |
exit() { |
懒 |
331 |
if (this.ws) { |
|
332 |
this.ws.close(); |
|
333 |
this.ws = null; |
|
334 |
} |
|
335 |
}, |
|
336 |
send() { |
|
337 |
if (this.ws) { |
|
338 |
this.ws.send(this.message); |
|
339 |
} else { |
|
340 |
alert("未连接到服务器"); |
|
341 |
} |
|
342 |
}, |
|
343 |
async initStation(){ |
|
344 |
await getIpv4().then(response => { |
|
345 |
this.StationConfQueryParams.ipAddress = response.msg |
|
346 |
console.log('查询到本工位IP为'+this.StationConfQueryParams.ipAddress) |
|
347 |
}); |
|
348 |
await listStationConf(this.StationConfQueryParams).then(response => { |
|
349 |
let rows = response.rows[0] |
|
350 |
if(response.rows.length===0){ |
|
351 |
this.$message('该工位没有配置IP,请联系管理员配置IP'); |
|
352 |
return |
|
353 |
} |
|
354 |
this.headContent.processesName = rows.processesName |
|
355 |
this.headContent.processesCode = rows.processesCode |
|
356 |
console.log('设置工位编码'+this.headContent.processesCode) |
|
357 |
|
|
358 |
}); |
|
359 |
console.log('websocket连接工位为'+this.headContent.processesCode) |
|
360 |
const wsuri = this.url + this.headContent.processesCode; |
|
361 |
this.ws = new WebSocket(wsuri); |
|
362 |
const self = this; |
|
363 |
this.ws.onopen = function (event) { |
|
364 |
this.$message('websocket连接成功!'); |
|
365 |
}; |
|
366 |
this.ws.onmessage = function (event) { |
|
367 |
self.text_content = event.data + "\n"; |
|
368 |
console.log(event.data) |
49138a
|
369 |
if(event.data === "IN"){ |
懒 |
370 |
self.cakeLamp.InPlace = 1 |
|
371 |
}else if(event.data === "OUT"){ |
|
372 |
self.cakeLamp.release = 1 |
|
373 |
setTimeout(() => { |
|
374 |
this.resetting() |
|
375 |
}, 2000); // 延时2秒触发 |
a36b83
|
376 |
}else if(event.data === 'TIGHTEN'){ |
懒 |
377 |
console.log('开始拧紧') |
|
378 |
self.getListFormulaChild() |
5f3a2e
|
379 |
} |
懒 |
380 |
}; |
49138a
|
381 |
}, |
懒 |
382 |
resetting() { |
|
383 |
this.cakeLamp = { |
|
384 |
InPlace: 0, |
|
385 |
release: 0, |
|
386 |
startWork: 0, |
|
387 |
scanFinish: 0, |
|
388 |
} |
5f3a2e
|
389 |
} |
49ac5c
|
390 |
} |
b0742c
|
391 |
} |
C |
392 |
|
|
393 |
</script> |
589dc7
|
394 |
<style scoped> |
懒 |
395 |
.bottom-card{ |
|
396 |
height: 600px; |
b0742c
|
397 |
} |
589dc7
|
398 |
.circle-button{ |
8586e1
|
399 |
height: 30px; |
A |
400 |
width: 30px; |
|
401 |
} |
49ac5c
|
402 |
.circle-red { |
懒 |
403 |
background-color: #e01a4f; |
|
404 |
} |
|
405 |
.circle-green { |
|
406 |
background-color: green; |
|
407 |
} |
|
408 |
.circle-green-animate { |
|
409 |
background-color: green; |
|
410 |
animation: circle-green-animate 2s infinite; |
|
411 |
} |
|
412 |
@keyframes circle-green-animate { |
|
413 |
50% { |
|
414 |
opacity: 0.6; |
|
415 |
} |
|
416 |
0% { |
|
417 |
opacity: 0.2; |
|
418 |
} |
|
419 |
} |
|
420 |
.head-font{ |
|
421 |
font-weight: bold; |
|
422 |
font-size: 25px; |
|
423 |
} |
8586e1
|
424 |
span{ |
A |
425 |
font-size: 15px; |
b0742c
|
426 |
} |
a36b83
|
427 |
.el-table .warning-row { |
懒 |
428 |
background: oldlace; |
|
429 |
} |
|
430 |
|
|
431 |
.el-table .success-row { |
|
432 |
background: #f0f9eb; |
|
433 |
} |
b0742c
|
434 |
</style> |
5a6d6b
|
435 |
|