提交 | 用户 | 时间
|
e57a89
|
1 |
<template> |
懒 |
2 |
<div class="app-container"> |
|
3 |
<el-row :gutter="5"> |
c2944a
|
4 |
<el-col :span="7"> |
e57a89
|
5 |
<el-card shadow="never"> |
懒 |
6 |
<span class="head-font">工位编号 : {{headContent.processesCode}}</span> |
|
7 |
</el-card> |
|
8 |
</el-col> |
c2944a
|
9 |
<el-col :span="7"> |
e57a89
|
10 |
<el-card shadow="never"> |
懒 |
11 |
<span class="head-font">工位名称 : {{headContent.processesName}}</span> |
|
12 |
</el-card> |
|
13 |
</el-col> |
c2944a
|
14 |
<el-col :span="10"> |
e57a89
|
15 |
<el-card shadow="never"> |
b64ed2
|
16 |
<span class="head-font">产品序列号 : {{headContent.sfcCode}}</span> |
c2944a
|
17 |
<!-- <el-input v-model="content" style="float: right;width: 150px;" placeholder="请输入内容"></el-input>--> |
懒 |
18 |
<!-- <el-button @click="scanCompleted" style="float: right" type="primary">扫码完成</el-button>--> |
|
19 |
<el-button type="primary" style="float: right" icon="el-icon-search" size="mini" @click="serialLink">串口连接</el-button> |
|
20 |
<el-button @click="clearClick" style="float: right" type="danger" size="mini">清除</el-button> |
e57a89
|
21 |
</el-card> |
懒 |
22 |
</el-col> |
|
23 |
|
|
24 |
</el-row> |
|
25 |
<el-row :gutter="5" style="margin-top: 5px"> |
c2944a
|
26 |
<el-col :span="7" > |
e57a89
|
27 |
<el-card class="bottom-card"> |
懒 |
28 |
<div slot="header" class="clearfix"> |
|
29 |
<i class="el-icon-tickets"></i> |
|
30 |
<span style="font-weight: bold">当前工件信息</span> |
|
31 |
</div> |
c2944a
|
32 |
<el-descriptions :column="1" border :content-style="{'min-width': '140px'}"> |
懒 |
33 |
<!-- <el-descriptions :column="1" :label-style="{'font-size': '15px'}" border :content-style="{'min-width': '150px'}">--> |
e57a89
|
34 |
<el-descriptions-item label="工单编号"> |
b64ed2
|
35 |
<span>{{workpieceInformation.workOrderNo}}</span> |
e57a89
|
36 |
</el-descriptions-item> |
49c784
|
37 |
<el-descriptions-item label="产品编号"> |
e57a89
|
38 |
<span>{{workpieceInformation.productCode}}</span> |
懒 |
39 |
</el-descriptions-item> |
|
40 |
<el-descriptions-item label="产品型号"> |
|
41 |
<span>{{workpieceInformation.productModel}}</span> |
|
42 |
</el-descriptions-item> |
|
43 |
<el-descriptions-item label="产品名称"> |
|
44 |
<span>{{workpieceInformation.productName}}</span> |
|
45 |
</el-descriptions-item> |
b64ed2
|
46 |
<!-- <el-descriptions-item label="节拍">--> |
懒 |
47 |
<!-- <span>{{workpieceInformation.beat}}</span>--> |
|
48 |
<!-- </el-descriptions-item>--> |
e57a89
|
49 |
</el-descriptions> |
懒 |
50 |
<el-divider></el-divider> |
|
51 |
<el-row> |
|
52 |
<el-col :span="12"> |
|
53 |
<el-button class="circle-button" :class="cakeLamp.plcState ? 'circle-green-animate':'circle-red'" circle></el-button> |
|
54 |
<span style="display: none">{{cakeLamp.plcState}}</span> |
|
55 |
<span> PLC状态</span> |
|
56 |
</el-col> |
|
57 |
<el-col :span="12"> |
|
58 |
<el-button class="circle-button" :class="cakeLamp.scannerState ? 'circle-green-animate':'circle-red'" circle></el-button> |
|
59 |
<span style="display: none">{{cakeLamp.scannerState}}</span> |
|
60 |
<span> 扫码枪状态</span> |
|
61 |
</el-col> |
|
62 |
</el-row> |
|
63 |
<el-row style="margin-top: 20px"> |
|
64 |
<el-col :span="12"> |
|
65 |
<el-button class="circle-button" :class="cakeLamp.InPlace ? 'circle-green':'circle-red'" circle></el-button> |
|
66 |
<span style="display: none">{{cakeLamp.InPlace}}</span> |
|
67 |
<span> 工件到位</span> |
|
68 |
</el-col> |
|
69 |
<el-col :span="12"> |
|
70 |
<el-button class="circle-button" :class="cakeLamp.scanFinish ? 'circle-green':'circle-red'" circle></el-button> |
|
71 |
<span style="display: none">{{cakeLamp.scanFinish}}</span> |
|
72 |
<span> 扫码完成</span> |
|
73 |
</el-col> |
|
74 |
</el-row> |
|
75 |
<el-row style="margin-top: 20px"> |
|
76 |
<el-col :span="12"> |
|
77 |
<el-button class="circle-button" :class="cakeLamp.startWork ? 'circle-green':'circle-red'" circle></el-button> |
|
78 |
<span style="display: none">{{cakeLamp.startWork}}</span> |
|
79 |
<span> 开始作业</span> |
|
80 |
</el-col> |
|
81 |
<el-col :span="12"> |
|
82 |
<el-button class="circle-button" :class="cakeLamp.release ? 'circle-green':'circle-red'" circle></el-button> |
|
83 |
<span style="display: none">{{cakeLamp.release}}</span> |
|
84 |
<span> 允许放行</span> |
|
85 |
</el-col> |
|
86 |
|
|
87 |
</el-row> |
c2944a
|
88 |
<!-- <el-row style="margin-top: 20px">--> |
懒 |
89 |
<!-- <el-col :span="12">--> |
|
90 |
<!-- <el-input v-model="serialPortContent" style="width: 150px;" placeholder="请输入内容"></el-input>--> |
e57a89
|
91 |
|
c2944a
|
92 |
<!-- </el-col>--> |
懒 |
93 |
<!-- <el-col :span="12">--> |
|
94 |
<!-- <el-button @click="serialPortMethod" type="primary">串口获取数据</el-button>--> |
e57a89
|
95 |
|
c2944a
|
96 |
<!-- </el-col>--> |
懒 |
97 |
<!-- </el-row>--> |
70cc26
|
98 |
<el-row v-show="showInput" style="margin-top: 20px"> |
ddb300
|
99 |
<el-col></el-col> |
A |
100 |
<span style="width: 130px;" class="head-font">预装总成号 : {{headContent.yzSfcCode}}</span> |
|
101 |
</el-row> |
70cc26
|
102 |
<el-row v-show="showInput" style="margin-top: 20px"> |
ddb300
|
103 |
<!-- <el-button @click="Release" type="primary">绑定</el-button>--> |
A |
104 |
<el-button @click="bindYzSfc" type="primary">绑定</el-button> |
|
105 |
|
93feb8
|
106 |
</el-row> |
e57a89
|
107 |
</el-card> |
懒 |
108 |
|
|
109 |
</el-col> |
c2944a
|
110 |
<el-col :span="17"> |
e57a89
|
111 |
<el-tabs type="border-card" style="height: 600px" v-model="activeName" @tab-click="changeMenu"> |
懒 |
112 |
<el-tab-pane name="first"> |
|
113 |
<span slot="label"> <a class="el-icon-date"></a>首页</span> |
b77c7b
|
114 |
<el-col :span="24"> |
0caf87
|
115 |
<el-table height="500" :cell-style="rowStyle" :data="formulaChildList"> |
3c2299
|
116 |
<el-table-column label="排序" width="60" align="center" type="index"> |
e57a89
|
117 |
</el-table-column> |
懒 |
118 |
<el-table-column label="操作内容" :show-overflow-tooltip='true' align="center" prop="operationSteps"> |
|
119 |
</el-table-column> |
b77303
|
120 |
<el-table-column label="产品编号" align="center" prop="productCode"> |
b77c7b
|
121 |
</el-table-column> |
5316c5
|
122 |
<el-table-column label="物料编码" align="center" prop="materialCode"> |
A |
123 |
</el-table-column> |
b77303
|
124 |
<el-table-column label="采集值" align="center" prop="collectData"> |
b77c7b
|
125 |
</el-table-column> |
b77303
|
126 |
<el-table-column label="结果" align="center" prop="results"> |
b77c7b
|
127 |
</el-table-column> |
e57a89
|
128 |
</el-table> |
懒 |
129 |
</el-col> |
b77c7b
|
130 |
<!-- <el-col :span="14">--> |
懒 |
131 |
<!-- <el-image style="height: 520px;width: 100%" :src="imgSrc"></el-image>--> |
|
132 |
<!-- </el-col>--> |
e57a89
|
133 |
</el-tab-pane> |
b77c7b
|
134 |
<!-- <el-tab-pane name="second">--> |
懒 |
135 |
<!-- <span slot="label"> <b class="el-icon-date"></b>物料BOM</span>--> |
|
136 |
<!-- <el-empty>--> |
|
137 |
<!-- <span slot="description">暂无数据</span>--> |
|
138 |
<!-- </el-empty>--> |
|
139 |
<!-- </el-tab-pane>--> |
|
140 |
<!-- <el-tab-pane name="third">--> |
|
141 |
<!-- <span slot="label"> <b class="el-icon-date"></b>采集清单</span>--> |
|
142 |
<!-- <el-empty>--> |
|
143 |
<!-- <span slot="description">暂无数据</span>--> |
|
144 |
<!-- </el-empty>--> |
|
145 |
<!-- </el-tab-pane>--> |
|
146 |
<!-- <el-tab-pane name="fourth">--> |
|
147 |
<!-- <span slot="label"> <b class="el-icon-date"></b>安灯状态</span>--> |
|
148 |
<!-- <el-empty>--> |
|
149 |
<!-- <span slot="description">暂无数据</span>--> |
|
150 |
<!-- </el-empty>--> |
|
151 |
<!-- </el-tab-pane>--> |
|
152 |
<!-- <el-tab-pane name="fifth">--> |
|
153 |
<!-- <span slot="label"> <b class="el-icon-date"></b>工艺配方</span>--> |
|
154 |
<!-- <el-empty>--> |
|
155 |
<!-- <span slot="description">暂无数据</span>--> |
|
156 |
<!-- </el-empty>--> |
|
157 |
<!-- </el-tab-pane>--> |
e57a89
|
158 |
</el-tabs> |
懒 |
159 |
</el-col> |
|
160 |
</el-row> |
c2944a
|
161 |
<el-dialog v-dialogpop-up :title="title" :visible.sync="open1" width="1000" append-to-body> |
懒 |
162 |
<el-row |
|
163 |
type="flex" |
|
164 |
class="row-bg" |
|
165 |
justify="center" |
|
166 |
v-show="portsList.length === 0" |
|
167 |
> |
|
168 |
<el-col :span="7"> |
|
169 |
<div style="margin-top: 400px"> |
|
170 |
<span style="display: block"> |
|
171 |
仅支持Chrome 89+或者Edge 89+浏览器(安全上下文(HTTPS)中可用) |
|
172 |
</span> |
|
173 |
<el-button type="primary" @click="obtainAuthorization">授权</el-button> |
|
174 |
</div> |
|
175 |
</el-col> |
|
176 |
</el-row> |
|
177 |
<el-form |
|
178 |
v-show="portsList.length > 0" |
|
179 |
ref="form1" |
|
180 |
:model="form1" |
|
181 |
label-width="100px"> |
|
182 |
<el-row> |
|
183 |
<el-col :span="24" |
|
184 |
><div> |
|
185 |
<el-form-item label="串口"> |
|
186 |
<el-select |
|
187 |
v-model="form1.port" |
|
188 |
filterable |
|
189 |
placeholder="请选择串口" |
|
190 |
:disabled="isDisable" |
|
191 |
> |
|
192 |
<el-option |
|
193 |
v-for="item in portsList" |
|
194 |
:key="item.value" |
|
195 |
:label="item.label" |
|
196 |
:value="item.value" |
|
197 |
> |
|
198 |
</el-option> |
|
199 |
</el-select> |
|
200 |
</el-form-item> |
|
201 |
<el-form-item label="波特率"> |
|
202 |
<el-autocomplete |
|
203 |
popper-class="my-autocomplete" |
|
204 |
v-model="form1.baudRate" |
|
205 |
:fetch-suggestions="querySearch" |
|
206 |
placeholder="请输入波特率" |
|
207 |
:disabled="isDisable" |
|
208 |
> |
|
209 |
<i class="el-icon-edit el-input__icon" slot="suffix"> </i> |
|
210 |
<template slot-scope="{ item }"> |
|
211 |
<div class="name">{{ item.value }}</div> |
|
212 |
<span class="addr">{{ item.address }}</span> |
|
213 |
</template> |
|
214 |
</el-autocomplete> |
|
215 |
</el-form-item> |
|
216 |
<el-form-item label="数据位"> |
|
217 |
<el-select |
|
218 |
v-model="form1.dataBits" |
|
219 |
placeholder="请选择数据位" |
|
220 |
:disabled="isDisable" |
|
221 |
> |
|
222 |
<el-option label="7" value="7"></el-option> |
|
223 |
<el-option label="8" value="8"></el-option> |
|
224 |
</el-select> |
|
225 |
</el-form-item> |
|
226 |
<el-form-item label="停止位"> |
|
227 |
<el-select |
|
228 |
v-model="form1.stopBits" |
|
229 |
placeholder="请选择停止位" |
|
230 |
:disabled="isDisable" |
|
231 |
> |
|
232 |
<el-option label="1" value="1"></el-option> |
|
233 |
<el-option label="2" value="2"></el-option> |
|
234 |
</el-select> |
|
235 |
</el-form-item> |
|
236 |
|
|
237 |
<el-form-item label="校验位"> |
|
238 |
<el-select |
|
239 |
v-model="form1.parity" |
|
240 |
placeholder="请选择校验位" |
|
241 |
:disabled="isDisable" |
|
242 |
> |
|
243 |
<el-option label="None" value="none"></el-option> |
|
244 |
<el-option label="Even" value="even"></el-option> |
|
245 |
<el-option label="Odd" value="odd"></el-option> |
|
246 |
</el-select> |
|
247 |
</el-form-item> |
|
248 |
|
|
249 |
<el-form-item label="流控制"> |
|
250 |
<el-select |
|
251 |
v-model="form1.flowControl" |
|
252 |
placeholder="请选择流控制" |
|
253 |
:disabled="isDisable" |
|
254 |
> |
|
255 |
<el-option label="None" value="none"></el-option> |
|
256 |
<el-option label="HardWare" value="hardware"></el-option> |
|
257 |
</el-select> |
|
258 |
</el-form-item> |
|
259 |
<el-form-item label="显示历史"> |
|
260 |
<el-switch |
|
261 |
v-model="form1.isShowHistory" |
|
262 |
@change="loadHistory" |
|
263 |
></el-switch> |
|
264 |
<el-button |
|
265 |
type="danger" |
|
266 |
icon="el-icon-delete" |
|
267 |
circle |
|
268 |
title="清空历史" |
|
269 |
@click="clearHistory" |
|
270 |
></el-button> |
|
271 |
</el-form-item> |
|
272 |
<el-form-item label="发送区设置" v-show="isShowSendArea"> |
|
273 |
<el-form-item label="发送格式"> |
|
274 |
<el-radio-group v-model="form1.type"> |
|
275 |
<el-radio label="1">ASCII</el-radio> |
|
276 |
<el-radio label="2">HEX</el-radio> |
|
277 |
</el-radio-group> |
|
278 |
</el-form-item> |
|
279 |
<el-form-item label="发送信息"> |
|
280 |
<el-input type="textarea" v-model="form1.sendMsg"></el-input> |
|
281 |
</el-form-item> |
|
282 |
<el-button type="primary" @click="sendCommon">发送</el-button> |
|
283 |
</el-form-item> |
|
284 |
|
|
285 |
<el-form-item> |
|
286 |
<el-button :type="btnType" @click="connectBtn">{{ |
|
287 |
btnText |
|
288 |
}}</el-button> |
|
289 |
<el-button type="info" @click="obtainAuthorization" |
|
290 |
>新增授权</el-button |
|
291 |
> |
|
292 |
</el-form-item> |
|
293 |
</div> |
|
294 |
</el-col> |
|
295 |
</el-row> |
|
296 |
</el-form> |
|
297 |
</el-dialog> |
e57a89
|
298 |
</div> |
懒 |
299 |
</template> |
|
300 |
<script> |
|
301 |
import {listWorkReport} from "@/api/main/om/workReport/workReport"; |
|
302 |
import {listStationConf,getIpv4} from "@/api/main/sc/stationConf"; |
b77303
|
303 |
import { |
懒 |
304 |
listFormulaChild, |
0caf87
|
305 |
noPageListFormulaChild, |
b77303
|
306 |
releaseCheck, |
懒 |
307 |
updateResults, |
|
308 |
updateTighteningFormula, |
|
309 |
workpieceRelease |
|
310 |
} from "@/api/main/bs/formulaChild/formulaChild"; |
c2944a
|
311 |
import MySerialPort from "@/utils/MySerialPort"; |
懒 |
312 |
import USBDevice from "@/utils/usb.json"; |
b64ed2
|
313 |
import {listProductionOrde} from "@/api/main/om/productionOrde/productionOrde"; |
懒 |
314 |
import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection"; |
49c784
|
315 |
import { |
懒 |
316 |
addBasicParameters, |
|
317 |
addParamCollection, |
32483a
|
318 |
addTighteningParameters, |
ddb300
|
319 |
saveCampaignTimeParameters, |
A |
320 |
replaceAssemblyCode, |
49c784
|
321 |
} from "@/api/main/da/paramCollection/paramCollection"; |
e57a89
|
322 |
|
懒 |
323 |
export default { |
|
324 |
name: "stationTerminal", |
|
325 |
data() { |
|
326 |
return { |
70cc26
|
327 |
showInput: true, |
e57a89
|
328 |
serialPortContent: '', |
懒 |
329 |
// 查询参数 |
|
330 |
formulaChildParams: { |
|
331 |
pageNum: 1, |
|
332 |
pageSize: 10, |
|
333 |
productCode: null, |
|
334 |
processesCode: null, |
|
335 |
}, |
|
336 |
// 配方配置子信息表格数据 |
|
337 |
formulaChildList: [], |
|
338 |
ipAddress: '', |
|
339 |
imgSrc: '', |
|
340 |
headContent: { |
|
341 |
processesCode: 'OP1010', |
|
342 |
processesName: '贴标机-贴码', |
49c784
|
343 |
sfcCode: '', |
ddb300
|
344 |
yzSfcCode: '', |
e57a89
|
345 |
}, |
懒 |
346 |
workpieceInformation: { |
b64ed2
|
347 |
workOrderNo: null, |
e57a89
|
348 |
productCode: null, |
懒 |
349 |
productModel: null, |
|
350 |
productName: null, |
|
351 |
beat: null, |
|
352 |
}, |
|
353 |
// 查询参数 |
|
354 |
queryParams: { |
|
355 |
pageNum: 1, |
|
356 |
pageSize: 10, |
|
357 |
sfcCode: null, |
|
358 |
}, |
|
359 |
// 查询参数 |
|
360 |
StationConfQueryParams: { |
|
361 |
pageNum: 1, |
|
362 |
pageSize: 10, |
|
363 |
ipAddress: null, |
|
364 |
}, |
|
365 |
cakeLamp: { |
|
366 |
plcState: 1, //plc |
|
367 |
scannerState: 1, //扫码枪 |
|
368 |
InPlace: 0, //工件到位 |
|
369 |
scanFinish: 0, |
|
370 |
startWork: 0, |
|
371 |
release: 0 //允许放行 |
|
372 |
}, |
|
373 |
content: '', |
|
374 |
activeName: 'first', |
70cc26
|
375 |
url: "ws://192.168.1.103:8080/websocket/message/", |
e57a89
|
376 |
message: "", |
懒 |
377 |
text_content: "", |
|
378 |
ws: null, |
c2944a
|
379 |
inputValue: '9', |
懒 |
380 |
|
|
381 |
open1: false, |
|
382 |
input: "", |
|
383 |
keepReading: true, |
|
384 |
form1: { |
b5fcd8
|
385 |
baudRate: "115200", |
c2944a
|
386 |
dataBits: "8", |
懒 |
387 |
stopBits: "1", |
|
388 |
parity: "none", |
|
389 |
flowControl: "none", |
|
390 |
desc: "", |
|
391 |
type: "1", |
|
392 |
isShowHistory: false, |
|
393 |
}, |
|
394 |
btnType: "primary", |
|
395 |
btnText: "连接串口", |
|
396 |
restaurants: [], |
|
397 |
portsList: [], |
|
398 |
isShowSendArea: false, |
|
399 |
readType: 1, |
|
400 |
title: "", |
b64ed2
|
401 |
|
懒 |
402 |
passingStationForm: {}, |
49c784
|
403 |
originalArray: [], |
e57a89
|
404 |
} |
懒 |
405 |
}, |
|
406 |
beforeDestroy() { |
|
407 |
this.exit(); |
|
408 |
}, |
|
409 |
created() { |
|
410 |
this.initStation(); |
|
411 |
// this.getStationConfList(); |
|
412 |
// setTimeout(() => { |
|
413 |
// this.connectWebsocket(); |
|
414 |
// }, 3000); |
|
415 |
}, |
|
416 |
mounted() { |
c2944a
|
417 |
if ("serial" in navigator) { |
懒 |
418 |
this.myserialport = new MySerialPort(); |
|
419 |
this.getPorts(); |
|
420 |
navigator.serial.addEventListener("connect", (e) => { |
|
421 |
this.$message.success("设备已连接"); |
|
422 |
this.getPorts(); |
|
423 |
}); |
|
424 |
navigator.serial.addEventListener("disconnect", (e) => { |
|
425 |
this.$message.error("设备已断开"); |
|
426 |
}); |
|
427 |
this.restaurants = this.loadAll(); |
|
428 |
} else { |
|
429 |
this.$message.error( |
|
430 |
"当前为HTTP模式或者浏览器版本过低,不支持网页连接串口" |
|
431 |
); |
|
432 |
} |
|
433 |
}, |
|
434 |
computed: { |
|
435 |
isDisable() { |
|
436 |
return this.btnType === "danger"; |
|
437 |
}, |
e57a89
|
438 |
}, |
懒 |
439 |
methods: { |
c2944a
|
440 |
serialLink() { |
懒 |
441 |
this.open1 = true |
ddb300
|
442 |
}, |
A |
443 |
bindYzSfc(){ |
|
444 |
if(this.headContent.sfcCode!==""&&this.headContent.yzSfcCode!==""){ |
|
445 |
let param = { |
|
446 |
sfcCode: this.headContent.sfcCode, |
|
447 |
locationCode: this.headContent.processesCode, |
|
448 |
yzSfcCode: this.headContent.yzSfcCode |
|
449 |
} |
|
450 |
this.$message('可以绑定!'); |
|
451 |
replaceAssemblyCode(param).then(response => { |
|
452 |
|
|
453 |
}); |
|
454 |
} |
c2944a
|
455 |
}, |
e57a89
|
456 |
Release(){ |
93feb8
|
457 |
// this.$message('portsList!'+this.portsList.length); |
懒 |
458 |
if(this.btnType === "danger"){ |
|
459 |
this.$message('连接了!'); |
|
460 |
|
|
461 |
}else { |
|
462 |
this.$message('mei连接了!'); |
|
463 |
|
e57a89
|
464 |
} |
93feb8
|
465 |
|
懒 |
466 |
// //判断是否可以释放 |
|
467 |
// let formulaChildParams = { |
|
468 |
// productCode: this.workpieceInformation.productCode, |
|
469 |
// processesCode: this.headContent.processesCode |
|
470 |
// } |
|
471 |
// releaseCheck(formulaChildParams).then(response => { |
|
472 |
// if(response.data === 0){ |
|
473 |
// //改变状态 |
|
474 |
// workpieceRelease(formulaChildParams).then(response => { |
|
475 |
// }); |
|
476 |
// this.$message('放行成功!'); |
|
477 |
// this.formulaChildList = [] |
|
478 |
// this.getListFormulaChild() |
|
479 |
// // this.resetting() |
|
480 |
// }else { |
|
481 |
// this.$message('步骤未完成不许放行!'); |
|
482 |
// } |
|
483 |
// }); |
e57a89
|
484 |
}, |
c2944a
|
485 |
serialPortMethod(value){ |
b77303
|
486 |
// let formulaChilds = ""; |
懒 |
487 |
// this.formulaChildList.forEach((formulaChild) => { |
|
488 |
// let operationType = formulaChild.operationType; |
|
489 |
// let results = formulaChild.results; |
|
490 |
// let materialCode = formulaChild.materialCode; |
|
491 |
// if(operationType === '2' && value.includes(materialCode) && (results === "" || results === null || results === 'NG')){ |
|
492 |
// formulaChilds = formulaChild; |
|
493 |
// return; // 使用return代替break |
|
494 |
// } |
b77c7b
|
495 |
// }); |
b77303
|
496 |
// console.log(formulaChilds) |
懒 |
497 |
let formulaChildParams = { |
|
498 |
scanBarcode: value, |
|
499 |
sfcBarcode: this.headContent.sfcCode, |
|
500 |
workOrderNo: this.workpieceInformation.workOrderNo, |
|
501 |
productCode: this.workpieceInformation.productCode, |
|
502 |
locationCode: this.headContent.processesCode, |
|
503 |
collectionTime: new Date() |
|
504 |
} |
|
505 |
updateResults(formulaChildParams).then(response => { |
c5e9c5
|
506 |
console.log(response) |
懒 |
507 |
if(response.msg === "3"){ |
|
508 |
this.cakeLamp.release= 1 //允许放行 |
|
509 |
} |
b77303
|
510 |
this.getListFormulaChild() |
懒 |
511 |
}); |
e57a89
|
512 |
}, |
懒 |
513 |
rowStyle({ row }) { |
|
514 |
if (row.results === 'OK') { |
|
515 |
return 'background-color: PaleGreen'; |
|
516 |
} else if (row.results === 'NG') { |
|
517 |
return 'background-color: LightSalmon'; |
|
518 |
} |
|
519 |
return ''; |
|
520 |
}, |
|
521 |
/** 查询配方配置子信息列表 */ |
|
522 |
getListFormulaChild() { |
11cc36
|
523 |
// this.formulaChildList = [] |
e57a89
|
524 |
this.formulaChildParams.productCode = this.workpieceInformation.productCode |
懒 |
525 |
this.formulaChildParams.processesCode = this.headContent.processesCode |
054a69
|
526 |
console.log(this.formulaChildParams) |
0caf87
|
527 |
noPageListFormulaChild(this.formulaChildParams).then(response => { |
e57a89
|
528 |
this.formulaChildList = response.rows; |
懒 |
529 |
}); |
|
530 |
}, |
1df825
|
531 |
endClear(){ |
懒 |
532 |
this.cakeLamp.InPlace= 0 //工件到位 |
|
533 |
this.cakeLamp.scanFinish= 0 |
|
534 |
this.cakeLamp.startWork= 0 |
|
535 |
this.cakeLamp.release= 0 //允许放行 |
b77c7b
|
536 |
|
1df825
|
537 |
this.formulaChildList = [] |
c5e9c5
|
538 |
this.workpieceInformation.productCode = null; |
懒 |
539 |
this.workpieceInformation.workOrderNo = null; |
|
540 |
this.workpieceInformation.productModel = null; |
|
541 |
this.workpieceInformation.productName = null; |
5316c5
|
542 |
this.headContent.sfcCode = ''; |
1df825
|
543 |
}, |
e57a89
|
544 |
changeMenu(tab, event) { |
懒 |
545 |
console.log(tab, event); |
|
546 |
}, |
|
547 |
clearClick(){ |
|
548 |
this.$message('这是一条清除消息提示'); |
|
549 |
this.headContent.sfcCode = null |
|
550 |
}, |
|
551 |
scanCompleted(){ |
|
552 |
this.$message('扫码完成'+this.content); |
|
553 |
this.headContent.sfcCode = this.content |
|
554 |
this.queryParams.sfcCode = this.content |
|
555 |
this.getList() |
|
556 |
this.getListFormulaChild() |
|
557 |
this.cakeLamp.scanFinish = 1 |
|
558 |
this.cakeLamp.startWork = 1 |
|
559 |
|
|
560 |
}, |
b64ed2
|
561 |
/** 查询工单列表 */ |
e57a89
|
562 |
async getList() { |
b64ed2
|
563 |
await listProductionOrde(this.queryParams).then(response => { |
e57a89
|
564 |
let rowsData = response.rows[0]; |
懒 |
565 |
console.log(rowsData) |
b64ed2
|
566 |
this.workpieceInformation.workOrderNo = rowsData.workOrderNo; |
e57a89
|
567 |
this.workpieceInformation.productCode = rowsData.productCode; |
懒 |
568 |
this.workpieceInformation.productModel = rowsData.productModel; |
|
569 |
this.workpieceInformation.productName = rowsData.productName; |
|
570 |
this.timer = setInterval(() => { |
|
571 |
this.workpieceInformation.beat++; |
|
572 |
}, 1000); |
|
573 |
}); |
|
574 |
this.getListFormulaChild() |
b64ed2
|
575 |
this.addOverStationCollection() |
懒 |
576 |
}, |
|
577 |
|
|
578 |
/** 入站增加过站采集记录 **/ |
|
579 |
addOverStationCollection(){ |
|
580 |
this.passingStationForm = { |
|
581 |
id: null, |
|
582 |
workOrderNo: this.workpieceInformation.workOrderNo, |
|
583 |
productCode: this.workpieceInformation.productCode, |
|
584 |
locationCode: this.headContent.processesCode, |
|
585 |
model: this.workpieceInformation.productModel, |
|
586 |
productBarcode: this.headContent.sfcCode, |
32483a
|
587 |
sfcCode: this.headContent.sfcCode, |
b64ed2
|
588 |
inboundTime: new Date() |
懒 |
589 |
} |
b77c7b
|
590 |
addPassingStationCollection(this.passingStationForm).then(response => {}); |
懒 |
591 |
addBasicParameters(this.passingStationForm).then(response => {}); |
e57a89
|
592 |
}, |
懒 |
593 |
exit() { |
|
594 |
if (this.ws) { |
|
595 |
this.ws.close(); |
|
596 |
this.ws = null; |
|
597 |
} |
|
598 |
}, |
|
599 |
send() { |
|
600 |
if (this.ws) { |
|
601 |
this.ws.send(this.message); |
|
602 |
} else { |
|
603 |
alert("未连接到服务器"); |
|
604 |
} |
|
605 |
}, |
1df825
|
606 |
|
49c784
|
607 |
initStation: async function () { |
e57a89
|
608 |
await getIpv4().then(response => { |
懒 |
609 |
this.StationConfQueryParams.ipAddress = response.msg |
49c784
|
610 |
console.log('查询到本工位IP为' + this.StationConfQueryParams.ipAddress) |
e57a89
|
611 |
}); |
懒 |
612 |
await listStationConf(this.StationConfQueryParams).then(response => { |
|
613 |
let rows = response.rows[0] |
49c784
|
614 |
if (response.rows.length === 0) { |
e57a89
|
615 |
this.$message('该工位没有配置IP,请联系管理员配置IP'); |
懒 |
616 |
return |
|
617 |
} |
|
618 |
this.headContent.processesName = rows.processesName |
|
619 |
this.headContent.processesCode = rows.processesCode |
49c784
|
620 |
console.log('设置工位编码' + this.headContent.processesCode) |
e57a89
|
621 |
|
懒 |
622 |
}); |
f17d8c
|
623 |
this.conCom() |
49c784
|
624 |
console.log('websocket连接工位为' + this.headContent.processesCode) |
e57a89
|
625 |
const wsuri = this.url + this.headContent.processesCode; |
懒 |
626 |
this.ws = new WebSocket(wsuri); |
|
627 |
const self = this; |
|
628 |
this.ws.onopen = function (event) { |
|
629 |
this.$message('websocket连接成功!'); |
|
630 |
}; |
|
631 |
this.ws.onmessage = function (event) { |
49c784
|
632 |
if (event.data === "IN") { |
懒 |
633 |
self.cakeLamp.InPlace = 1; |
|
634 |
} else if (event.data === "IN0") { |
|
635 |
self.cakeLamp.InPlace = 0; |
|
636 |
} else if (event.data === "OUT") { |
|
637 |
self.cakeLamp.release = 1; |
32483a
|
638 |
} else if (event.data === "END") { |
懒 |
639 |
const param = { |
|
640 |
workOrderNo: self.workpieceInformation.workOrderNo, |
|
641 |
productCode: self.workpieceInformation.productCode, |
|
642 |
locationCode: self.headContent.processesCode, |
|
643 |
productBarcode: self.headContent.sfcCode, |
|
644 |
} |
|
645 |
saveCampaignTimeParameters(param).then(response => {}); |
054a69
|
646 |
self.cakeLamp.release = 1; |
1df825
|
647 |
self.endClear() |
63b254
|
648 |
workpieceRelease(param).then(response => {}); |
49c784
|
649 |
} else if (event.data.includes("[")) { |
b77c7b
|
650 |
let formulaChilds = ""; |
3c2299
|
651 |
self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort); |
懒 |
652 |
self.formulaChildList |
|
653 |
.filter((formulaChild) => formulaChild.operationType === '1'); |
|
654 |
for (let i = 0; i < self.formulaChildList.length; i++) { |
|
655 |
let formulaChild = self.formulaChildList[i]; |
b77c7b
|
656 |
let results = formulaChild.results; |
3c2299
|
657 |
if (results === '' || results === null || results === 'NG') { |
b77303
|
658 |
formulaChilds = formulaChild; |
3c2299
|
659 |
break; |
b77c7b
|
660 |
} |
3c2299
|
661 |
} |
49c784
|
662 |
const param = { |
懒 |
663 |
tightenTheArray: event.data, |
b77c7b
|
664 |
paramCode: formulaChilds.paramCode, |
49c784
|
665 |
workOrderNo: self.workpieceInformation.workOrderNo, |
懒 |
666 |
productCode: self.workpieceInformation.productCode, |
|
667 |
locationCode: self.headContent.processesCode, |
|
668 |
productBarcode: self.headContent.sfcCode, |
|
669 |
} |
|
670 |
addTighteningParameters(param).then(response => {}); |
b77303
|
671 |
updateTighteningFormula(param).then(response => { |
32483a
|
672 |
self.getListFormulaChild() |
懒 |
673 |
}).catch(error =>{ |
11cc36
|
674 |
self.getListFormulaChild() |
b77303
|
675 |
}); |
e57a89
|
676 |
} |
懒 |
677 |
}; |
|
678 |
}, |
c2944a
|
679 |
|
1df825
|
680 |
|
懒 |
681 |
|
c2944a
|
682 |
//接受数据的回调 |
懒 |
683 |
callBack(value) { |
|
684 |
if (this.form1.isShowHistory) this.form1.desc = this.readLi().join(""); |
|
685 |
else { |
|
686 |
const scanValue = this.myserialport.hex2atostr(value).replace(/[\r\n]/g, ''); |
11cc36
|
687 |
console.log("串口收到数据-------------------"+scanValue) |
ddb300
|
688 |
|
A |
689 |
if(this.headContent.sfcCode !== ''){ |
|
690 |
if(scanValue.includes("SS")){ |
|
691 |
this.headContent.yzSfcCode = scanValue |
|
692 |
}else { |
1df825
|
693 |
this.$message('扫描物料编码'+scanValue); |
3c2299
|
694 |
console.log(scanValue) |
懒 |
695 |
this.serialPortMethod(scanValue) |
|
696 |
} |
ddb300
|
697 |
} else { |
A |
698 |
this.$message('扫码识别产品序列号'+scanValue); |
|
699 |
this.headContent.sfcCode = scanValue; |
|
700 |
this.queryParams.productNum = scanValue; |
|
701 |
this.getList() |
|
702 |
this.cakeLamp.scanFinish = 1 |
|
703 |
this.cakeLamp.startWork = 1 |
|
704 |
} |
|
705 |
|
e57a89
|
706 |
} |
c2944a
|
707 |
}, |
懒 |
708 |
clearHistory() { |
|
709 |
this.form1.desc = ""; |
|
710 |
this.myserialport.state.readValue = []; |
|
711 |
}, |
|
712 |
loadHistory() { |
|
713 |
if (this.form1.isShowHistory) this.form1.desc = this.readLi().join(""); |
|
714 |
else { |
|
715 |
let temp = this.readLi(); |
|
716 |
if (temp.length > 0) this.form1.desc = temp[temp.length - 1].join(""); |
|
717 |
} |
|
718 |
}, |
|
719 |
readLi() { |
|
720 |
let readType = this.readType; |
|
721 |
return this.myserialport.state.readValue.map((items, index) => { |
|
722 |
const item = items.value; |
|
723 |
const type = items.type; // 1接收,2发送 |
|
724 |
let body = []; |
|
725 |
if (item !== undefined) { |
|
726 |
let strArr = []; |
|
727 |
for (let hex of Array.from(item)) { |
|
728 |
strArr.push(hex.toString(16).toLocaleUpperCase()); |
|
729 |
} |
|
730 |
if (strArr.includes("D") && strArr.includes("A")) { |
|
731 |
if (strArr.indexOf("A") - strArr.indexOf("D") === 1) { |
|
732 |
strArr.splice(strArr.indexOf("D"), 1); |
|
733 |
strArr.splice(strArr.indexOf("A"), 1, <br key={0} />); |
|
734 |
} |
|
735 |
} |
|
736 |
strArr = strArr.map((item) => { |
|
737 |
if (typeof item === "string") { |
|
738 |
if (readType === 1) { |
|
739 |
return this.myserialport.hex2a(parseInt(item, 16)); |
|
740 |
} else if (readType === 2) { |
|
741 |
return item + " "; |
|
742 |
} |
|
743 |
} |
|
744 |
return item; |
|
745 |
}); |
|
746 |
if (typeof strArr[strArr.length - 1] === "string") { |
|
747 |
strArr.push("\r\n"); |
|
748 |
} |
|
749 |
body.push(strArr.join("")); |
|
750 |
} |
|
751 |
return body; |
|
752 |
}); |
|
753 |
}, |
640ff8
|
754 |
conCom(){ |
懒 |
755 |
try { |
|
756 |
this.myserialport.state.baudRate = this.form1.baudRate; |
|
757 |
this.myserialport.state.dataBits = this.form1.dataBits; |
|
758 |
this.myserialport.state.stopBits = this.form1.stopBits; |
|
759 |
this.myserialport.state.parity = this.form1.parity; |
|
760 |
this.myserialport.state.flowControl = this.form1.flowControl; |
|
761 |
this.myserialport.openPort(0, true, this.callBack); |
|
762 |
console.log(this.form1.port) |
|
763 |
} catch (error) { |
|
764 |
this.$message.error("串口连接失败!请检查串口是否已被占用"); |
|
765 |
} |
|
766 |
if (this.myserialport.state.isOpen) { |
|
767 |
this.$message.success("串口连接成功"); |
|
768 |
} |
|
769 |
}, |
c2944a
|
770 |
//连接 |
懒 |
771 |
async connectBtn() { |
|
772 |
if (this.btnType === "primary") { |
|
773 |
try { |
|
774 |
this.myserialport.state.baudRate = this.form1.baudRate; |
|
775 |
this.myserialport.state.dataBits = this.form1.dataBits; |
|
776 |
this.myserialport.state.stopBits = this.form1.stopBits; |
|
777 |
this.myserialport.state.parity = this.form1.parity; |
|
778 |
this.myserialport.state.flowControl = this.form1.flowControl; |
|
779 |
await this.myserialport.openPort(this.form1.port, true, this.callBack); |
11cc36
|
780 |
console.log(this.form1.port) |
c2944a
|
781 |
} catch (error) { |
懒 |
782 |
this.$message.error("串口连接失败!请检查串口是否已被占用"); |
|
783 |
} |
|
784 |
if (this.myserialport.state.isOpen) { |
|
785 |
this.$message.success("串口连接成功"); |
|
786 |
this.open1 = false |
|
787 |
this.btnType = "danger"; |
|
788 |
this.btnText = "关闭串口"; |
|
789 |
} |
|
790 |
} else { |
|
791 |
this.myserialport.openPort(this.form1.port, false, this.callBack); |
|
792 |
this.$message.success("串口关闭成功"); |
|
793 |
this.btnType = "primary"; |
|
794 |
this.btnText = "连接串口"; |
|
795 |
} |
|
796 |
}, |
|
797 |
//授权 |
|
798 |
async obtainAuthorization() { |
|
799 |
if ("serial" in navigator) { |
|
800 |
console.log("The Web Serial API is supported."); |
|
801 |
if (!this.myserialport) this.myserialport = new MySerialPort(); |
|
802 |
try { |
|
803 |
await this.myserialport.handleRequestPort(); |
|
804 |
this.$message.success("串口授权成功"); |
|
805 |
this.getPortInfo(this.myserialport.state.ports); |
|
806 |
} catch (error) { |
|
807 |
this.$message.warning("未选择新串口授权!"); |
|
808 |
} |
|
809 |
} else { |
|
810 |
this.$message.error( |
|
811 |
"当前为HTTP模式或者浏览器版本过低,不支持网页连接串口" |
|
812 |
); |
|
813 |
} |
|
814 |
}, |
|
815 |
//串口列表初始化 |
|
816 |
getPortInfo(portList) { |
|
817 |
this.portsList = []; |
|
818 |
portList.map((port, index) => { |
|
819 |
const { usbProductId, usbVendorId } = port.getInfo(); |
|
820 |
if (usbProductId === undefined || usbVendorId === undefined) { |
|
821 |
this.portsList.push({ label: "未知设备" + index, value: index }); |
|
822 |
} else { |
|
823 |
const usbVendor = USBDevice.filter( |
|
824 |
(item) => parseInt(item.vendor, 16) === usbVendorId |
|
825 |
); |
|
826 |
let usbProduct = []; |
|
827 |
if (usbVendor.length === 1) { |
|
828 |
usbProduct = usbVendor[0].devices.filter( |
|
829 |
(item) => parseInt(item.devid, 16) === usbProductId |
|
830 |
); |
|
831 |
} |
|
832 |
this.portsList.push({ label: usbProduct[0].devname, value: index }); |
|
833 |
} |
|
834 |
}); |
|
835 |
}, |
|
836 |
// 发送 |
|
837 |
async sendCommon() { |
|
838 |
if (this.myserialport.state.isOpen) { |
|
839 |
if (this.form1.sendMsg.length !== 0) { |
|
840 |
const writeType = this.form1.type; |
|
841 |
let value = this.form1.sendMsg; |
|
842 |
let arr = []; |
|
843 |
if (writeType === 1) { |
|
844 |
// ASCII |
|
845 |
for (let i = 0; i < value.length; i++) { |
|
846 |
arr.push(this.myserialport.a2hex(value[i])); |
|
847 |
} |
|
848 |
} else if (writeType === 2) { |
|
849 |
// HEX |
|
850 |
if (/^[0-9A-Fa-f]+$/.test(value) && value.length % 2 === 0) { |
|
851 |
for (let i = 0; i < value.length; i = i + 2) { |
|
852 |
arr.push(parseInt(value.substring(i, i + 2), 16)); |
|
853 |
} |
|
854 |
} else { |
|
855 |
this.$message.error("格式错误"); |
|
856 |
return; |
|
857 |
} |
|
858 |
} |
|
859 |
this.myserialport.writeText(arr); |
|
860 |
} else { |
|
861 |
this.$message.warning("请输入发送的信息"); |
|
862 |
} |
|
863 |
} else { |
|
864 |
this.$message.warning("串口处于关闭状态,请连接串口"); |
|
865 |
} |
|
866 |
}, |
|
867 |
async getPorts() { |
|
868 |
await this.myserialport.getPorts(); |
|
869 |
this.getPortInfo(this.myserialport.state.ports); |
|
870 |
}, |
|
871 |
querySearch(queryString, cb) { |
|
872 |
var restaurants = this.restaurants; |
|
873 |
var results = queryString |
|
874 |
? restaurants.filter(this.createFilter(queryString)) |
|
875 |
: restaurants; |
|
876 |
// 调用 callback 返回建议列表的数据 |
|
877 |
cb(results); |
|
878 |
}, |
|
879 |
createFilter(queryString) { |
|
880 |
return (restaurant) => { |
|
881 |
return ( |
|
882 |
restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === |
|
883 |
0 |
|
884 |
); |
|
885 |
}; |
|
886 |
}, |
|
887 |
loadAll() { |
|
888 |
return [ |
|
889 |
{ value: "110" }, |
|
890 |
{ value: "300" }, |
|
891 |
{ value: "600" }, |
|
892 |
{ value: "1200" }, |
|
893 |
{ value: "2400" }, |
|
894 |
{ value: "4800" }, |
|
895 |
{ value: "7200" }, |
|
896 |
{ value: "9600" }, |
|
897 |
{ value: "14400" }, |
|
898 |
{ value: "19200" }, |
|
899 |
{ value: "28800" }, |
|
900 |
{ value: "38400" }, |
|
901 |
{ value: "56000" }, |
|
902 |
{ value: "57600" }, |
|
903 |
{ value: "76800" }, |
|
904 |
{ value: "115200" }, |
|
905 |
{ value: "230400" }, |
|
906 |
{ value: "460800" }, |
|
907 |
]; |
|
908 |
}, |
e57a89
|
909 |
} |
懒 |
910 |
} |
|
911 |
|
|
912 |
</script> |
|
913 |
<style scoped> |
|
914 |
.bottom-card{ |
|
915 |
height: 600px; |
|
916 |
} |
|
917 |
.circle-button{ |
|
918 |
height: 30px; |
|
919 |
width: 30px; |
|
920 |
} |
|
921 |
.circle-red { |
|
922 |
background-color: #e01a4f; |
|
923 |
} |
|
924 |
.circle-green { |
|
925 |
background-color: green; |
|
926 |
} |
|
927 |
.circle-green-animate { |
|
928 |
background-color: green; |
|
929 |
animation: circle-green-animate 2s infinite; |
|
930 |
} |
|
931 |
@keyframes circle-green-animate { |
|
932 |
50% { |
|
933 |
opacity: 0.6; |
|
934 |
} |
|
935 |
0% { |
|
936 |
opacity: 0.2; |
|
937 |
} |
|
938 |
} |
|
939 |
.head-font{ |
c2944a
|
940 |
/*font-weight: bold;*/ |
懒 |
941 |
/*font-size: 25px;*/ |
e57a89
|
942 |
} |
懒 |
943 |
span{ |
|
944 |
font-size: 15px; |
|
945 |
} |
|
946 |
.el-table .warning-row { |
|
947 |
background: oldlace; |
|
948 |
} |
|
949 |
|
|
950 |
.el-table .success-row { |
|
951 |
background: #f0f9eb; |
|
952 |
} |
|
953 |
</style> |
|
954 |
|