提交 | 用户 | 时间
|
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> |
768498
|
37 |
<el-descriptions-item label="产品型号"> |
e57a89
|
38 |
<span>{{workpieceInformation.productCode}}</span> |
懒 |
39 |
</el-descriptions-item> |
768498
|
40 |
<el-descriptions-item label="小车码"> |
A |
41 |
<span>{{headContent.cardCode}}</span> |
e57a89
|
42 |
</el-descriptions-item> |
768498
|
43 |
<el-descriptions-item label="开始时间"> |
A |
44 |
<span>{{workpieceInformation.inboundTime}}</span> |
|
45 |
</el-descriptions-item> |
e57a89
|
46 |
</el-descriptions> |
懒 |
47 |
<el-divider></el-divider> |
|
48 |
<el-row> |
|
49 |
<el-col :span="12"> |
|
50 |
<el-button class="circle-button" :class="cakeLamp.plcState ? 'circle-green-animate':'circle-red'" circle></el-button> |
|
51 |
<span style="display: none">{{cakeLamp.plcState}}</span> |
|
52 |
<span> PLC状态</span> |
|
53 |
</el-col> |
|
54 |
<el-col :span="12"> |
|
55 |
<el-button class="circle-button" :class="cakeLamp.scannerState ? 'circle-green-animate':'circle-red'" circle></el-button> |
|
56 |
<span style="display: none">{{cakeLamp.scannerState}}</span> |
|
57 |
<span> 扫码枪状态</span> |
|
58 |
</el-col> |
|
59 |
</el-row> |
|
60 |
<el-row style="margin-top: 20px"> |
|
61 |
<el-col :span="12"> |
|
62 |
<el-button class="circle-button" :class="cakeLamp.InPlace ? 'circle-green':'circle-red'" circle></el-button> |
|
63 |
<span style="display: none">{{cakeLamp.InPlace}}</span> |
|
64 |
<span> 工件到位</span> |
|
65 |
</el-col> |
|
66 |
<el-col :span="12"> |
|
67 |
<el-button class="circle-button" :class="cakeLamp.scanFinish ? 'circle-green':'circle-red'" circle></el-button> |
|
68 |
<span style="display: none">{{cakeLamp.scanFinish}}</span> |
|
69 |
<span> 扫码完成</span> |
|
70 |
</el-col> |
|
71 |
</el-row> |
|
72 |
<el-row style="margin-top: 20px"> |
|
73 |
<el-col :span="12"> |
|
74 |
<el-button class="circle-button" :class="cakeLamp.startWork ? 'circle-green':'circle-red'" circle></el-button> |
|
75 |
<span style="display: none">{{cakeLamp.startWork}}</span> |
|
76 |
<span> 开始作业</span> |
|
77 |
</el-col> |
|
78 |
<el-col :span="12"> |
|
79 |
<el-button class="circle-button" :class="cakeLamp.release ? 'circle-green':'circle-red'" circle></el-button> |
|
80 |
<span style="display: none">{{cakeLamp.release}}</span> |
|
81 |
<span> 允许放行</span> |
|
82 |
</el-col> |
|
83 |
|
|
84 |
</el-row> |
a75d86
|
85 |
|
9f636f
|
86 |
<el-row v-show="goOnlineFlag" style="margin-top: 20px"> |
A |
87 |
<el-button @click="getWorkOrders" type="primary">接收工单</el-button> |
|
88 |
|
|
89 |
<div style="display: none"> |
|
90 |
<div id="getWorkOrdersPrintPrintMe" style="width: 500px;"> |
|
91 |
<div ref="canvasWrapper" id="canvasWrapper3" style="display: flex;justify-content: center;"></div> |
|
92 |
<p style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;">{{packCode}}</p> |
|
93 |
</div> |
391c41
|
94 |
<!-- <el-button @click="print">打印</el-button>--> |
9f636f
|
95 |
<el-button @click="test1">生成二维码</el-button> |
A |
96 |
</div> |
|
97 |
</el-row> |
|
98 |
|
|
99 |
<el-row v-show="offlineFlag" style="margin-top: 20px"> |
391c41
|
100 |
<el-button id="print" v-print="'#printMe'" type="primary">打印三联码</el-button> |
9f636f
|
101 |
<el-button style="display: none" @click="test1">生成二维码</el-button> |
391c41
|
102 |
<el-button style="display: none" @click="test2">生成 |
A |
103 |
<span style="font-size: 10px;margin-left: 52px">MADE IN CHINA</span><br> |
|
104 |
<br> |
|
105 |
<br>二维码</el-button> |
|
106 |
<div style="display: none"> |
|
107 |
<div id="printMe"> |
9f636f
|
108 |
<br> |
391c41
|
109 |
<p style="margin-left: 53px">{{printInfoData.partNumber}}</p> |
A |
110 |
<p style="margin-left: 53px">{{printInfoData.hardwareVersion}}</p> |
|
111 |
<p style="margin-left: 53px">{{printInfoData.softwareVersion}}</p> |
9f636f
|
112 |
<br> |
A |
113 |
<br> |
391c41
|
114 |
<br> |
A |
115 |
<br> |
|
116 |
<img style="width: 140px;height: 20px;margin-left: 30px" :src="require('@/assets/images/a8963a24920640508e96150a053fc41.png')"/> |
|
117 |
<span style="margin-left: 72px">{{printInfoData.printModel}}</span><br> |
682919
|
118 |
<span style="margin-left: 73px">{{printInfoData.supplierCode}}</span><br> |
A |
119 |
<span style="margin-left: 55px">{{printInfoData.partNumber}}</span><br> |
|
120 |
<span style="font-size: 10px;margin-left: 28px;">{{headContent.sfcCode}}</span><br> |
|
121 |
<span style="font-size: 10px;margin-left: 60px">MADE IN CHINA</span><br> |
|
122 |
|
9f636f
|
123 |
<br> |
A |
124 |
<br> |
|
125 |
<br> |
|
126 |
<div ref="canvasWrapper" id="canvasWrapper1" style="display: flex;justify-content: center;margin-top: -27px;"></div> |
682919
|
127 |
<span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 20px;margin-top: 3px">P{{printInfoData.partNumber}}#T{{headContent.sfcCode}}#V{{printInfoData.supplierCode}}#S{{printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span> |
9f636f
|
128 |
<br> |
A |
129 |
<br> |
|
130 |
<div ref="canvasWrapper" id="canvasWrapper2" style="display: flex;justify-content: center;margin-top: -27px"></div> |
682919
|
131 |
<span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 20px;margin-top: 3px">P{{printInfoData.partNumber}}#T{{headContent.sfcCode}}#V{{printInfoData.supplierCode}}#S{{printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span> |
9f636f
|
132 |
</div> |
391c41
|
133 |
</div> |
9f636f
|
134 |
</el-row> |
e57a89
|
135 |
</el-card> |
懒 |
136 |
|
|
137 |
</el-col> |
c2944a
|
138 |
<el-col :span="17"> |
e57a89
|
139 |
<el-tabs type="border-card" style="height: 600px" v-model="activeName" @tab-click="changeMenu"> |
懒 |
140 |
<el-tab-pane name="first"> |
|
141 |
<span slot="label"> <a class="el-icon-date"></a>首页</span> |
b77c7b
|
142 |
<el-col :span="24"> |
0caf87
|
143 |
<el-table height="500" :cell-style="rowStyle" :data="formulaChildList"> |
768498
|
144 |
<el-table-column label="拧紧步号" width="80" align="center" prop="stepSort"> |
e57a89
|
145 |
</el-table-column> |
8cfe20
|
146 |
<el-table-column label="操作内容" align="center" prop="operationSteps"> |
e57a89
|
147 |
</el-table-column> |
768498
|
148 |
<el-table-column label="产品编号" width="80" align="center" prop="productCode"> |
b77c7b
|
149 |
</el-table-column> |
4e83fa
|
150 |
<el-table-column label="物料编码" width="140" align="center" prop="materialCode"> |
5316c5
|
151 |
</el-table-column> |
b77303
|
152 |
<el-table-column label="采集值" align="center" prop="collectData"> |
b77c7b
|
153 |
</el-table-column> |
768498
|
154 |
<el-table-column label="结果" width="60" align="center" prop="results"> |
b77c7b
|
155 |
</el-table-column> |
8cfe20
|
156 |
|
e57a89
|
157 |
</el-table> |
懒 |
158 |
</el-col> |
|
159 |
</el-tab-pane> |
|
160 |
</el-tabs> |
|
161 |
</el-col> |
|
162 |
</el-row> |
c2944a
|
163 |
<el-dialog v-dialogpop-up :title="title" :visible.sync="open1" width="1000" append-to-body> |
懒 |
164 |
<el-row |
|
165 |
type="flex" |
|
166 |
class="row-bg" |
|
167 |
justify="center" |
|
168 |
v-show="portsList.length === 0" |
|
169 |
> |
|
170 |
<el-col :span="7"> |
|
171 |
<div style="margin-top: 400px"> |
|
172 |
<span style="display: block"> |
|
173 |
仅支持Chrome 89+或者Edge 89+浏览器(安全上下文(HTTPS)中可用) |
|
174 |
</span> |
|
175 |
<el-button type="primary" @click="obtainAuthorization">授权</el-button> |
|
176 |
</div> |
|
177 |
</el-col> |
|
178 |
</el-row> |
|
179 |
<el-form |
|
180 |
v-show="portsList.length > 0" |
|
181 |
ref="form1" |
|
182 |
:model="form1" |
|
183 |
label-width="100px"> |
|
184 |
<el-row> |
|
185 |
<el-col :span="24" |
|
186 |
><div> |
|
187 |
<el-form-item label="串口"> |
|
188 |
<el-select |
|
189 |
v-model="form1.port" |
|
190 |
filterable |
|
191 |
placeholder="请选择串口" |
|
192 |
:disabled="isDisable" |
|
193 |
> |
|
194 |
<el-option |
|
195 |
v-for="item in portsList" |
|
196 |
:key="item.value" |
|
197 |
:label="item.label" |
|
198 |
:value="item.value" |
|
199 |
> |
|
200 |
</el-option> |
|
201 |
</el-select> |
|
202 |
</el-form-item> |
|
203 |
<el-form-item label="波特率"> |
|
204 |
<el-autocomplete |
|
205 |
popper-class="my-autocomplete" |
|
206 |
v-model="form1.baudRate" |
|
207 |
:fetch-suggestions="querySearch" |
|
208 |
placeholder="请输入波特率" |
|
209 |
:disabled="isDisable" |
|
210 |
> |
|
211 |
<i class="el-icon-edit el-input__icon" slot="suffix"> </i> |
|
212 |
<template slot-scope="{ item }"> |
|
213 |
<div class="name">{{ item.value }}</div> |
|
214 |
<span class="addr">{{ item.address }}</span> |
|
215 |
</template> |
|
216 |
</el-autocomplete> |
|
217 |
</el-form-item> |
|
218 |
<el-form-item label="数据位"> |
|
219 |
<el-select |
|
220 |
v-model="form1.dataBits" |
|
221 |
placeholder="请选择数据位" |
|
222 |
:disabled="isDisable" |
|
223 |
> |
|
224 |
<el-option label="7" value="7"></el-option> |
|
225 |
<el-option label="8" value="8"></el-option> |
|
226 |
</el-select> |
|
227 |
</el-form-item> |
|
228 |
<el-form-item label="停止位"> |
|
229 |
<el-select |
|
230 |
v-model="form1.stopBits" |
|
231 |
placeholder="请选择停止位" |
|
232 |
:disabled="isDisable" |
|
233 |
> |
|
234 |
<el-option label="1" value="1"></el-option> |
|
235 |
<el-option label="2" value="2"></el-option> |
|
236 |
</el-select> |
|
237 |
</el-form-item> |
|
238 |
|
|
239 |
<el-form-item label="校验位"> |
|
240 |
<el-select |
|
241 |
v-model="form1.parity" |
|
242 |
placeholder="请选择校验位" |
|
243 |
:disabled="isDisable" |
|
244 |
> |
|
245 |
<el-option label="None" value="none"></el-option> |
|
246 |
<el-option label="Even" value="even"></el-option> |
|
247 |
<el-option label="Odd" value="odd"></el-option> |
|
248 |
</el-select> |
|
249 |
</el-form-item> |
|
250 |
|
|
251 |
<el-form-item label="流控制"> |
|
252 |
<el-select |
|
253 |
v-model="form1.flowControl" |
|
254 |
placeholder="请选择流控制" |
|
255 |
:disabled="isDisable" |
|
256 |
> |
|
257 |
<el-option label="None" value="none"></el-option> |
|
258 |
<el-option label="HardWare" value="hardware"></el-option> |
|
259 |
</el-select> |
|
260 |
</el-form-item> |
|
261 |
<el-form-item label="显示历史"> |
|
262 |
<el-switch |
|
263 |
v-model="form1.isShowHistory" |
|
264 |
@change="loadHistory" |
|
265 |
></el-switch> |
|
266 |
<el-button |
|
267 |
type="danger" |
|
268 |
icon="el-icon-delete" |
|
269 |
circle |
|
270 |
title="清空历史" |
|
271 |
@click="clearHistory" |
|
272 |
></el-button> |
|
273 |
</el-form-item> |
|
274 |
<el-form-item label="发送区设置" v-show="isShowSendArea"> |
|
275 |
<el-form-item label="发送格式"> |
|
276 |
<el-radio-group v-model="form1.type"> |
|
277 |
<el-radio label="1">ASCII</el-radio> |
|
278 |
<el-radio label="2">HEX</el-radio> |
|
279 |
</el-radio-group> |
|
280 |
</el-form-item> |
|
281 |
<el-form-item label="发送信息"> |
|
282 |
<el-input type="textarea" v-model="form1.sendMsg"></el-input> |
|
283 |
</el-form-item> |
|
284 |
<el-button type="primary" @click="sendCommon">发送</el-button> |
|
285 |
</el-form-item> |
|
286 |
|
|
287 |
<el-form-item> |
|
288 |
<el-button :type="btnType" @click="connectBtn">{{ |
|
289 |
btnText |
|
290 |
}}</el-button> |
|
291 |
<el-button type="info" @click="obtainAuthorization" |
|
292 |
>新增授权</el-button |
|
293 |
> |
|
294 |
</el-form-item> |
|
295 |
</div> |
|
296 |
</el-col> |
|
297 |
</el-row> |
|
298 |
</el-form> |
|
299 |
</el-dialog> |
e57a89
|
300 |
</div> |
懒 |
301 |
</template> |
|
302 |
<script> |
|
303 |
import {listWorkReport} from "@/api/main/om/workReport/workReport"; |
|
304 |
import {listStationConf,getIpv4} from "@/api/main/sc/stationConf"; |
b77303
|
305 |
import { |
8cfe20
|
306 |
clearWorkpieceRelease, |
273d64
|
307 |
fistSetpNumber, inPlaceInspection, |
A |
308 |
listFormulaChild, manualNgOffline, |
0caf87
|
309 |
noPageListFormulaChild, |
273d64
|
310 |
releaseCheck, unfinishedProcess, |
b77303
|
311 |
updateResults, |
懒 |
312 |
updateTighteningFormula, |
|
313 |
workpieceRelease |
|
314 |
} from "@/api/main/bs/formulaChild/formulaChild"; |
c2944a
|
315 |
import MySerialPort from "@/utils/MySerialPort"; |
懒 |
316 |
import USBDevice from "@/utils/usb.json"; |
a75d86
|
317 |
import { |
237733
|
318 |
bindYzSfcFlag, |
A |
319 |
checkCarCode, checkYzSfcCode, |
a75d86
|
320 |
findBytrolleyYardGetOne, |
A |
321 |
listProductionOrde, |
|
322 |
receivingWorkOrders, |
|
323 |
trolleyYardBinDing |
|
324 |
} from "@/api/main/om/productionOrde/productionOrde"; |
b64ed2
|
325 |
import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection"; |
49c784
|
326 |
import { |
懒 |
327 |
addBasicParameters, |
|
328 |
addParamCollection, |
32483a
|
329 |
addTighteningParameters, |
ddb300
|
330 |
saveCampaignTimeParameters, |
0aaaba
|
331 |
replaceAssemblyCode, checkRecordDataDone, enterWeighing, |
49c784
|
332 |
} from "@/api/main/da/paramCollection/paramCollection"; |
9f636f
|
333 |
import QRCode from "qrcodejs2"; |
391c41
|
334 |
import {listEquipmentArchives} from "@/api/main/em/equipmentArchives/equipmentArchives"; |
e57a89
|
335 |
|
懒 |
336 |
export default { |
|
337 |
name: "stationTerminal", |
|
338 |
data() { |
|
339 |
return { |
9f636f
|
340 |
printInfoData: { |
A |
341 |
softwareVersion: 'SW001.001', //软件版本号 |
|
342 |
hardwareVersion: 'HW001.001', //硬件版本号 |
|
343 |
printModel: 'H2155D', //型号 |
|
344 |
partNumber: '9900200136', //零部件号 |
|
345 |
supplierCode: '993983', //供应商编码 |
|
346 |
}, |
a75d86
|
347 |
carCode: '', |
9f636f
|
348 |
goOnlineFlag: false, |
A |
349 |
offlineFlag: false, |
|
350 |
|
a75d86
|
351 |
|
e57a89
|
352 |
serialPortContent: '', |
懒 |
353 |
// 查询参数 |
|
354 |
formulaChildParams: { |
|
355 |
pageNum: 1, |
|
356 |
pageSize: 10, |
|
357 |
productCode: null, |
|
358 |
processesCode: null, |
0aaaba
|
359 |
artificialNgFlag: null, |
A |
360 |
sfcBarcode: null, |
e57a89
|
361 |
}, |
懒 |
362 |
// 配方配置子信息表格数据 |
|
363 |
formulaChildList: [], |
|
364 |
ipAddress: '', |
|
365 |
imgSrc: '', |
|
366 |
headContent: { |
|
367 |
processesCode: 'OP1010', |
|
368 |
processesName: '贴标机-贴码', |
49c784
|
369 |
sfcCode: '', |
ddb300
|
370 |
yzSfcCode: '', |
a75d86
|
371 |
cardCode: '', |
e57a89
|
372 |
}, |
懒 |
373 |
workpieceInformation: { |
b64ed2
|
374 |
workOrderNo: null, |
e57a89
|
375 |
productCode: null, |
懒 |
376 |
productModel: null, |
|
377 |
productName: null, |
768498
|
378 |
inboundTime: null, |
e57a89
|
379 |
}, |
懒 |
380 |
// 查询参数 |
|
381 |
queryParams: { |
|
382 |
pageNum: 1, |
|
383 |
pageSize: 10, |
|
384 |
sfcCode: null, |
|
385 |
}, |
|
386 |
// 查询参数 |
|
387 |
StationConfQueryParams: { |
|
388 |
pageNum: 1, |
|
389 |
pageSize: 10, |
|
390 |
ipAddress: null, |
|
391 |
}, |
|
392 |
cakeLamp: { |
|
393 |
plcState: 1, //plc |
|
394 |
scannerState: 1, //扫码枪 |
|
395 |
InPlace: 0, //工件到位 |
|
396 |
scanFinish: 0, |
|
397 |
startWork: 0, |
|
398 |
release: 0 //允许放行 |
|
399 |
}, |
|
400 |
content: '', |
|
401 |
activeName: 'first', |
4e83fa
|
402 |
// url: "ws://192.168.2.248:8080/websocket/message/", |
682919
|
403 |
// url: "ws://10.103.210.248:8080/websocket/message/", |
A |
404 |
url: "ws://192.168.2.76:8080/websocket/message/", |
e57a89
|
405 |
message: "", |
懒 |
406 |
text_content: "", |
|
407 |
ws: null, |
c2944a
|
408 |
inputValue: '9', |
懒 |
409 |
|
|
410 |
open1: false, |
|
411 |
input: "", |
|
412 |
keepReading: true, |
|
413 |
form1: { |
b5fcd8
|
414 |
baudRate: "115200", |
c2944a
|
415 |
dataBits: "8", |
懒 |
416 |
stopBits: "1", |
|
417 |
parity: "none", |
|
418 |
flowControl: "none", |
|
419 |
desc: "", |
|
420 |
type: "1", |
|
421 |
isShowHistory: false, |
|
422 |
}, |
|
423 |
btnType: "primary", |
|
424 |
btnText: "连接串口", |
|
425 |
restaurants: [], |
|
426 |
portsList: [], |
|
427 |
isShowSendArea: false, |
|
428 |
readType: 1, |
|
429 |
title: "", |
b64ed2
|
430 |
|
懒 |
431 |
passingStationForm: {}, |
49c784
|
432 |
originalArray: [], |
237733
|
433 |
yzSfcFlag: 1, |
768498
|
434 |
endYz: false, |
391c41
|
435 |
packCode: 'test111' |
e57a89
|
436 |
} |
懒 |
437 |
}, |
|
438 |
beforeDestroy() { |
|
439 |
this.exit(); |
|
440 |
}, |
|
441 |
created() { |
|
442 |
this.initStation(); |
|
443 |
// this.getStationConfList(); |
|
444 |
// setTimeout(() => { |
|
445 |
// this.connectWebsocket(); |
|
446 |
// }, 3000); |
|
447 |
}, |
|
448 |
mounted() { |
c2944a
|
449 |
if ("serial" in navigator) { |
懒 |
450 |
this.myserialport = new MySerialPort(); |
|
451 |
this.getPorts(); |
|
452 |
navigator.serial.addEventListener("connect", (e) => { |
|
453 |
this.$message.success("设备已连接"); |
|
454 |
this.getPorts(); |
|
455 |
}); |
|
456 |
navigator.serial.addEventListener("disconnect", (e) => { |
|
457 |
this.$message.error("设备已断开"); |
|
458 |
}); |
|
459 |
this.restaurants = this.loadAll(); |
|
460 |
} else { |
|
461 |
this.$message.error( |
|
462 |
"当前为HTTP模式或者浏览器版本过低,不支持网页连接串口" |
|
463 |
); |
|
464 |
} |
|
465 |
}, |
|
466 |
computed: { |
|
467 |
isDisable() { |
|
468 |
return this.btnType === "danger"; |
391c41
|
469 |
} |
e57a89
|
470 |
}, |
懒 |
471 |
methods: { |
9f636f
|
472 |
|
A |
473 |
//接收工单-------开始 |
|
474 |
getWorkOrdersPrint() { |
|
475 |
let newStr = document.getElementById('getWorkOrdersPrintPrintMe').innerHTML; |
|
476 |
const printFrame = document.createElement('iframe'); |
|
477 |
printFrame.style.display = 'none'; |
|
478 |
document.body.appendChild(printFrame); |
|
479 |
const content = document.getElementById('getWorkOrdersPrintPrintMe').innerHTML; |
|
480 |
printFrame.contentDocument.write(content); |
|
481 |
printFrame.contentWindow.print(); |
|
482 |
document.body.removeChild(printFrame); |
|
483 |
return false; |
|
484 |
}, |
|
485 |
async getWorkOrders(){ |
|
486 |
await receivingWorkOrders().then(response => { |
|
487 |
this.packCode = response.msg; |
|
488 |
this.getWorkOrdersTest1() |
|
489 |
}); |
|
490 |
setTimeout(() => { |
|
491 |
this.getWorkOrdersPrint() |
|
492 |
},50) |
|
493 |
}, |
|
494 |
getWorkOrdersTest1(){ |
|
495 |
document.getElementById('canvasWrapper3').innerHTML = '' |
|
496 |
this.$nextTick(() => { |
|
497 |
let qrCode = new QRCode('canvasWrapper3',{ |
|
498 |
width: 80, |
|
499 |
height: 80, |
|
500 |
padding: 0, |
|
501 |
margin: 0, |
|
502 |
text: this.packCode, |
|
503 |
colorDark: '#000', |
|
504 |
colorLight: '#fff' |
|
505 |
}) |
|
506 |
}) |
|
507 |
}, |
|
508 |
//接收工单-------结束 |
|
509 |
|
|
510 |
//下线打印-------开始 |
391c41
|
511 |
initializePrintInfoData(){ |
A |
512 |
listEquipmentArchives().then(response => { |
|
513 |
this.printInfoData.softwareVersion = response.rows[0].equipmentCode |
|
514 |
this.printInfoData.hardwareVersion = response.rows[0].equipmentName |
|
515 |
this.printInfoData.supplierCode = response.rows[0].equipmentSpec |
|
516 |
this.printInfoData.printModel = response.rows[0].equipmentBrand |
|
517 |
this.printInfoData.partNumber = response.rows[0].equipmentTypeName |
|
518 |
console.log(response.rows[0]) |
|
519 |
}); |
|
520 |
}, |
9f636f
|
521 |
test1(){ |
A |
522 |
document.getElementById('canvasWrapper1').innerHTML = ''; |
|
523 |
this.$nextTick(() => { |
|
524 |
let qrCode = new QRCode('canvasWrapper1',{ |
|
525 |
width: 120, |
|
526 |
height: 120, |
|
527 |
text: 'P'+this.printInfoData.partNumber+'#T'+ this.headContent.sfcCode +'#V'+this.printInfoData.supplierCode+'#S'+this.printInfoData.softwareVersion+'#H'+this.printInfoData.hardwareVersion+'#NBMS#', |
|
528 |
colorDark: '#000', |
|
529 |
colorLight: '#fff' |
|
530 |
}) |
|
531 |
} |
|
532 |
) |
|
533 |
}, |
|
534 |
test2(){ |
|
535 |
document.getElementById('canvasWrapper2').innerHTML = ''; |
|
536 |
this.$nextTick(() => { |
|
537 |
let qrCode = new QRCode('canvasWrapper2',{ |
|
538 |
width: 120, |
|
539 |
height: 120, |
|
540 |
text: 'P'+this.printInfoData.partNumber+'#T'+ this.headContent.sfcCode +'#V'+this.printInfoData.supplierCode+'#S'+this.printInfoData.softwareVersion+'#H'+this.printInfoData.hardwareVersion+'#NBMS#', |
|
541 |
colorDark: '#000', |
|
542 |
colorLight: '#fff' |
|
543 |
}) |
|
544 |
} |
|
545 |
) |
|
546 |
}, |
|
547 |
print1() { |
391c41
|
548 |
// 使用插件打印方式 |
A |
549 |
// this.$print(this.$refs.printMe) |
|
550 |
// this.initializePrintInfoData() |
|
551 |
// if(this.headContent.sfcCode){ |
|
552 |
// //新页面打印 |
|
553 |
// // let newStr = document.getElementById('printMe').innerHTML; |
|
554 |
// // let newWin = window.open('', '_blank',st); |
|
555 |
// // newWin.document.body.innerHTML = newStr; |
|
556 |
// // newWin.print(); |
|
557 |
// // 本页面打印 |
|
558 |
// let newStr = document.getElementById('printMe').innerHTML; |
|
559 |
// const printFrame = document.createElement('iframe'); |
|
560 |
// printFrame.style.display = 'none'; |
|
561 |
// document.body.appendChild(printFrame); |
|
562 |
// const content = document.getElementById('printMe').innerHTML; |
|
563 |
// printFrame.contentDocument.write(content); |
|
564 |
// printFrame.contentWindow.print(); |
|
565 |
// console.log(printFrame) |
|
566 |
// // document.body.removeChild(printFrame); |
|
567 |
// console.log(printFrame) |
|
568 |
// return false; |
|
569 |
// }else { |
|
570 |
// this.$message.error('未扫描总成码禁止打印!'); |
|
571 |
// } |
9f636f
|
572 |
}, |
A |
573 |
//下线打印-------截止 |
768498
|
574 |
bindcardCode(scanValue){ |
A |
575 |
// this.$message('绑定成功!'); |
a75d86
|
576 |
let param = { |
A |
577 |
productNum: this.headContent.sfcCode, |
768498
|
578 |
trolleyYard: scanValue, |
a75d86
|
579 |
} |
A |
580 |
trolleyYardBinDing(param).then(response => { |
|
581 |
}); |
|
582 |
|
|
583 |
}, |
c2944a
|
584 |
serialLink() { |
懒 |
585 |
this.open1 = true |
ddb300
|
586 |
}, |
A |
587 |
bindYzSfc(){ |
|
588 |
if(this.headContent.sfcCode!==""&&this.headContent.yzSfcCode!==""){ |
|
589 |
let param = { |
|
590 |
sfcCode: this.headContent.sfcCode, |
|
591 |
locationCode: this.headContent.processesCode, |
|
592 |
yzSfcCode: this.headContent.yzSfcCode |
|
593 |
} |
237733
|
594 |
const orderParam = { |
A |
595 |
productNum: this.headContent.sfcCode, |
|
596 |
} |
ddb300
|
597 |
replaceAssemblyCode(param).then(response => { |
68f0c8
|
598 |
this.$message('绑定成功!'); |
237733
|
599 |
bindYzSfcFlag(orderParam).then(response => { |
A |
600 |
this.yzSfcFlag = 1 |
|
601 |
}); |
ddb300
|
602 |
}); |
A |
603 |
} |
c2944a
|
604 |
}, |
e57a89
|
605 |
Release(){ |
93feb8
|
606 |
// this.$message('portsList!'+this.portsList.length); |
懒 |
607 |
if(this.btnType === "danger"){ |
|
608 |
this.$message('连接了!'); |
|
609 |
|
|
610 |
}else { |
|
611 |
this.$message('mei连接了!'); |
|
612 |
|
e57a89
|
613 |
} |
懒 |
614 |
}, |
c2944a
|
615 |
serialPortMethod(value){ |
b77303
|
616 |
let formulaChildParams = { |
懒 |
617 |
scanBarcode: value, |
|
618 |
sfcBarcode: this.headContent.sfcCode, |
|
619 |
workOrderNo: this.workpieceInformation.workOrderNo, |
|
620 |
productCode: this.workpieceInformation.productCode, |
|
621 |
locationCode: this.headContent.processesCode, |
|
622 |
collectionTime: new Date() |
|
623 |
} |
|
624 |
updateResults(formulaChildParams).then(response => { |
c5e9c5
|
625 |
console.log(response) |
懒 |
626 |
if(response.msg === "3"){ |
|
627 |
this.cakeLamp.release= 1 //允许放行 |
2fbce7
|
628 |
}else if(response.msg === "2"){ |
A |
629 |
this.$message.error('扫码重复请重新扫码!'); |
c5e9c5
|
630 |
} |
b77303
|
631 |
this.getListFormulaChild() |
懒 |
632 |
}); |
e57a89
|
633 |
}, |
懒 |
634 |
rowStyle({ row }) { |
|
635 |
if (row.results === 'OK') { |
|
636 |
return 'background-color: PaleGreen'; |
|
637 |
} else if (row.results === 'NG') { |
|
638 |
return 'background-color: LightSalmon'; |
|
639 |
} |
|
640 |
return ''; |
|
641 |
}, |
|
642 |
/** 查询配方配置子信息列表 */ |
|
643 |
getListFormulaChild() { |
11cc36
|
644 |
// this.formulaChildList = [] |
e57a89
|
645 |
this.formulaChildParams.productCode = this.workpieceInformation.productCode |
懒 |
646 |
this.formulaChildParams.processesCode = this.headContent.processesCode |
6e3e50
|
647 |
if(this.formulaChildParams.artificialNgFlag !== null){ |
0aaaba
|
648 |
this.formulaChildParams.sfcBarcode = this.headContent.sfcCode |
A |
649 |
} |
6e3e50
|
650 |
console.log("getListFormulaChild"+this.formulaChildParams.artificialNgFlag) |
0caf87
|
651 |
noPageListFormulaChild(this.formulaChildParams).then(response => { |
e57a89
|
652 |
this.formulaChildList = response.rows; |
6a462f
|
653 |
if (this.formulaChildList.length >0){ |
W |
654 |
let pos = 0 |
|
655 |
const tempArr = this.formulaChildList.filter(x=> 'OK' === x.results) |
|
656 |
if (tempArr.length>0){ |
|
657 |
pos = tempArr.length |
|
658 |
this.$nextTick(() => { |
|
659 |
let temp33 = document.getElementsByClassName('el-table__row') |
|
660 |
console.log('temp33',temp33) |
|
661 |
console.log('len',temp33.item(pos)) |
|
662 |
if (temp33.length > 0){ |
|
663 |
console.log('1111111111111111') |
|
664 |
let arr = temp33[pos-1] |
|
665 |
console.log('srr',arr) |
|
666 |
arr.scrollIntoView({ block: 'center' }) |
|
667 |
} |
|
668 |
}) |
|
669 |
} |
|
670 |
|
|
671 |
} |
|
672 |
|
e57a89
|
673 |
}); |
懒 |
674 |
}, |
1df825
|
675 |
endClear(){ |
懒 |
676 |
this.cakeLamp.InPlace= 0 //工件到位 |
|
677 |
this.cakeLamp.scanFinish= 0 |
|
678 |
this.cakeLamp.startWork= 0 |
|
679 |
this.cakeLamp.release= 0 //允许放行 |
b77c7b
|
680 |
|
1df825
|
681 |
this.formulaChildList = [] |
c5e9c5
|
682 |
this.workpieceInformation.productCode = null; |
懒 |
683 |
this.workpieceInformation.workOrderNo = null; |
|
684 |
this.workpieceInformation.productModel = null; |
|
685 |
this.workpieceInformation.productName = null; |
768498
|
686 |
this.workpieceInformation.inboundTime = null; |
5316c5
|
687 |
this.headContent.sfcCode = ''; |
288790
|
688 |
this.headContent.yzSfcCode = ''; |
A |
689 |
this.headContent.cardCode = ''; |
0aaaba
|
690 |
this.formulaChildParams.artificialNgFlag = null |
A |
691 |
this.formulaChildParams.sfcBarcode = null |
1df825
|
692 |
}, |
e57a89
|
693 |
changeMenu(tab, event) { |
懒 |
694 |
console.log(tab, event); |
|
695 |
}, |
|
696 |
clearClick(){ |
8cfe20
|
697 |
const param = { |
A |
698 |
workOrderNo: this.workpieceInformation.workOrderNo, |
|
699 |
productCode: this.workpieceInformation.productCode, |
|
700 |
locationCode: this.headContent.processesCode, |
|
701 |
productBarcode: this.headContent.sfcCode, |
|
702 |
} |
|
703 |
this.endClear() |
|
704 |
clearWorkpieceRelease(param).then(response => {}); |
|
705 |
this.headContent.sfcCode = '' |
bdb404
|
706 |
this.$message('清除成功!'); |
e57a89
|
707 |
}, |
懒 |
708 |
scanCompleted(){ |
|
709 |
this.$message('扫码完成'+this.content); |
|
710 |
this.headContent.sfcCode = this.content |
|
711 |
this.queryParams.sfcCode = this.content |
|
712 |
this.getList() |
|
713 |
this.getListFormulaChild() |
|
714 |
this.cakeLamp.scanFinish = 1 |
|
715 |
this.cakeLamp.startWork = 1 |
|
716 |
|
|
717 |
}, |
b64ed2
|
718 |
/** 查询工单列表 */ |
e57a89
|
719 |
async getList() { |
391c41
|
720 |
this.initializePrintInfoData() |
b64ed2
|
721 |
await listProductionOrde(this.queryParams).then(response => { |
e57a89
|
722 |
let rowsData = response.rows[0]; |
懒 |
723 |
console.log(rowsData) |
b64ed2
|
724 |
this.workpieceInformation.workOrderNo = rowsData.workOrderNo; |
e57a89
|
725 |
this.workpieceInformation.productCode = rowsData.productCode; |
懒 |
726 |
this.workpieceInformation.productModel = rowsData.productModel; |
|
727 |
this.workpieceInformation.productName = rowsData.productName; |
768498
|
728 |
this.headContent.cardCode = rowsData.trolleyYard; |
6e3e50
|
729 |
this.formulaChildParams.artificialNgFlag = rowsData.artificialNgFlag; |
e57a89
|
730 |
}); |
9f636f
|
731 |
if(this.headContent.processesCode === 'POP430'){ |
A |
732 |
this.test1() |
|
733 |
this.test2() |
|
734 |
} |
e57a89
|
735 |
this.getListFormulaChild() |
768498
|
736 |
// this.addOverStationCollection() |
A |
737 |
this.workpieceInformation.inboundTime = this.getCurrentTime() |
bdb404
|
738 |
const param = { |
A |
739 |
processesCode: this.headContent.processesCode, |
6e3e50
|
740 |
productCode: this.workpieceInformation.productCode |
bdb404
|
741 |
} |
A |
742 |
fistSetpNumber(param).then(response => { |
|
743 |
console.log("fistSetpNumber------"+response.msg) |
|
744 |
}); |
b64ed2
|
745 |
}, |
懒 |
746 |
|
768498
|
747 |
getCurrentTime() { |
A |
748 |
const now = new Date(); |
|
749 |
const year = now.getFullYear(); |
|
750 |
const month = this.padTimeUnit(now.getMonth() + 1); // 月份是从0开始的 |
|
751 |
const day = this.padTimeUnit(now.getDate()); |
|
752 |
const hours = this.padTimeUnit(now.getHours()); |
|
753 |
const minutes = this.padTimeUnit(now.getMinutes()); |
|
754 |
const seconds = this.padTimeUnit(now.getSeconds()); |
|
755 |
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
|
756 |
}, |
|
757 |
padTimeUnit(value) { |
|
758 |
return value.toString().padStart(2, '0'); |
|
759 |
}, |
8cfe20
|
760 |
addBaseData(){ |
A |
761 |
addBasicParameters(this.passingStationForm).then(response => {}); |
|
762 |
}, |
|
763 |
|
b64ed2
|
764 |
/** 入站增加过站采集记录 **/ |
懒 |
765 |
addOverStationCollection(){ |
|
766 |
this.passingStationForm = { |
|
767 |
id: null, |
|
768 |
workOrderNo: this.workpieceInformation.workOrderNo, |
|
769 |
productCode: this.workpieceInformation.productCode, |
|
770 |
locationCode: this.headContent.processesCode, |
|
771 |
model: this.workpieceInformation.productModel, |
|
772 |
productBarcode: this.headContent.sfcCode, |
32483a
|
773 |
sfcCode: this.headContent.sfcCode, |
b64ed2
|
774 |
inboundTime: new Date() |
懒 |
775 |
} |
b77c7b
|
776 |
addPassingStationCollection(this.passingStationForm).then(response => {}); |
4a5f2a
|
777 |
// addBasicParameters(this.passingStationForm).then(response => {}); |
e57a89
|
778 |
}, |
懒 |
779 |
exit() { |
|
780 |
if (this.ws) { |
|
781 |
this.ws.close(); |
|
782 |
this.ws = null; |
|
783 |
} |
|
784 |
}, |
|
785 |
send() { |
|
786 |
if (this.ws) { |
|
787 |
this.ws.send(this.message); |
|
788 |
} else { |
|
789 |
alert("未连接到服务器"); |
|
790 |
} |
|
791 |
}, |
1df825
|
792 |
|
49c784
|
793 |
initStation: async function () { |
e57a89
|
794 |
await getIpv4().then(response => { |
懒 |
795 |
this.StationConfQueryParams.ipAddress = response.msg |
49c784
|
796 |
console.log('查询到本工位IP为' + this.StationConfQueryParams.ipAddress) |
e57a89
|
797 |
}); |
懒 |
798 |
await listStationConf(this.StationConfQueryParams).then(response => { |
|
799 |
let rows = response.rows[0] |
49c784
|
800 |
if (response.rows.length === 0) { |
e57a89
|
801 |
this.$message('该工位没有配置IP,请联系管理员配置IP'); |
懒 |
802 |
return |
|
803 |
} |
|
804 |
this.headContent.processesName = rows.processesName |
|
805 |
this.headContent.processesCode = rows.processesCode |
a75d86
|
806 |
console.log('设置工位编码' + this.headContent.processesCode) |
273d64
|
807 |
inPlaceInspection({processesCode: this.headContent.processesCode}).then(response => { |
A |
808 |
console.log(response) |
|
809 |
this.cakeLamp.InPlace = response.data |
|
810 |
}); |
a320dc
|
811 |
|
9f636f
|
812 |
if(this.headContent.processesCode === 'POP230'){ |
A |
813 |
this.goOnlineFlag = true |
|
814 |
} |
|
815 |
if(this.headContent.processesCode === 'POP430'){ |
|
816 |
this.offlineFlag = true |
|
817 |
} |
|
818 |
|
e57a89
|
819 |
}); |
f17d8c
|
820 |
this.conCom() |
49c784
|
821 |
console.log('websocket连接工位为' + this.headContent.processesCode) |
e57a89
|
822 |
const wsuri = this.url + this.headContent.processesCode; |
懒 |
823 |
this.ws = new WebSocket(wsuri); |
|
824 |
const self = this; |
|
825 |
this.ws.onopen = function (event) { |
391c41
|
826 |
self.$message('websocket连接成功!'); |
a320dc
|
827 |
|
e57a89
|
828 |
}; |
懒 |
829 |
this.ws.onmessage = function (event) { |
c2e92c
|
830 |
if (event.data === "reportError") { |
A |
831 |
self.$message.error('下线报工异常失败!'); |
|
832 |
}else if (event.data === "reportSuccess") { |
|
833 |
self.$message('下线报工成功!'); |
|
834 |
}else if (event.data === "print") { |
391c41
|
835 |
self.$message('postman调用打印方法打印!'); |
A |
836 |
// self.print1() |
|
837 |
document.getElementById('print').click(); |
|
838 |
}else if (event.data === "IN") { |
49c784
|
839 |
self.cakeLamp.InPlace = 1; |
273d64
|
840 |
} else if (event.data === "NG") { |
A |
841 |
//给plc发下线信号 |
|
842 |
//清除数据 |
0aaaba
|
843 |
self.$confirm('拧紧三次NG,请确认下线!!!', '消息', { |
273d64
|
844 |
confirmButtonText: '确定', |
0aaaba
|
845 |
cancelButtonText: '取消', |
A |
846 |
showCancelButton: false, |
273d64
|
847 |
type: 'warning' |
A |
848 |
}).then(() => { |
|
849 |
self.ngFunction(); |
0aaaba
|
850 |
this.$message({ |
A |
851 |
type: 'success', |
|
852 |
message: '确认成功!' |
|
853 |
}); |
|
854 |
}); |
273d64
|
855 |
|
49c784
|
856 |
} else if (event.data === "OUT") { |
懒 |
857 |
self.cakeLamp.release = 1; |
32483a
|
858 |
} else if (event.data === "END") { |
768498
|
859 |
|
A |
860 |
const formulaChildIndex = self.formulaChildList.length-1 |
237733
|
861 |
|
16714e
|
862 |
if(self.headContent.sfcCode=== ''||self.headContent.sfcCode=== null){ |
273d64
|
863 |
unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 26}).then(response => {}); |
2fbce7
|
864 |
self.$message('总成码为空,请扫码!') |
768498
|
865 |
return; |
16714e
|
866 |
} |
A |
867 |
|
768498
|
868 |
if(self.formulaChildList[formulaChildIndex].results !== 'OK'){ |
A |
869 |
self.$message('未做完工序禁止放行'); |
273d64
|
870 |
unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 25}).then(response => {}); |
768498
|
871 |
return; |
A |
872 |
} |
|
873 |
|
|
874 |
const param = { |
|
875 |
workOrderNo: self.workpieceInformation.workOrderNo, |
|
876 |
productCode: self.workpieceInformation.productCode, |
|
877 |
locationCode: self.headContent.processesCode, |
|
878 |
productBarcode: self.headContent.sfcCode, |
|
879 |
inboundTime: self.workpieceInformation.inboundTime, |
|
880 |
formulaChildEntity: self.formulaChildList[formulaChildIndex] |
|
881 |
} |
0aaaba
|
882 |
|
768498
|
883 |
console.log("进入最终方法") |
A |
884 |
self.endSaveData(param) |
49c784
|
885 |
} else if (event.data.includes("[")) { |
b77c7b
|
886 |
let formulaChilds = ""; |
3c2299
|
887 |
self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort); |
懒 |
888 |
self.formulaChildList |
|
889 |
.filter((formulaChild) => formulaChild.operationType === '1'); |
|
890 |
for (let i = 0; i < self.formulaChildList.length; i++) { |
|
891 |
let formulaChild = self.formulaChildList[i]; |
b77c7b
|
892 |
let results = formulaChild.results; |
2fbce7
|
893 |
|
3c2299
|
894 |
if (results === '' || results === null || results === 'NG') { |
b77303
|
895 |
formulaChilds = formulaChild; |
3c2299
|
896 |
break; |
b77c7b
|
897 |
} |
3c2299
|
898 |
} |
2fbce7
|
899 |
if(formulaChilds === ""){ |
A |
900 |
self.$message.error('本工位已工作完成!'); |
|
901 |
return; |
|
902 |
} |
49c784
|
903 |
const param = { |
2fbce7
|
904 |
id: formulaChilds.id, |
49c784
|
905 |
tightenTheArray: event.data, |
b77c7b
|
906 |
paramCode: formulaChilds.paramCode, |
49c784
|
907 |
workOrderNo: self.workpieceInformation.workOrderNo, |
懒 |
908 |
productCode: self.workpieceInformation.productCode, |
|
909 |
locationCode: self.headContent.processesCode, |
|
910 |
productBarcode: self.headContent.sfcCode, |
2fbce7
|
911 |
spareField1: formulaChilds.spareField1, |
A |
912 |
spareField2: formulaChilds.spareField2, |
|
913 |
spareField3: formulaChilds.spareField3, |
|
914 |
spareField4: formulaChilds.spareField4, |
273d64
|
915 |
stepSort: formulaChilds.stepSort, |
A |
916 |
ngTimes: formulaChilds.ngTimes, |
49c784
|
917 |
} |
16714e
|
918 |
if(formulaChilds.paramCode === null||formulaChilds.paramCode ===''){ |
A |
919 |
self.$message('未找到参数码,请检查参数码是否正确'); |
|
920 |
return; |
|
921 |
} |
6e3e50
|
922 |
self.formulaChildParams.artificialNgFlag = null |
A |
923 |
console.log("self.formulaChildParams.artificialNgFlag"+self.formulaChildParams.artificialNgFlag) |
16714e
|
924 |
if(self.headContent.sfcCode!==null||self.headContent.sfcCode!==''){ |
A |
925 |
updateTighteningFormula(param).then(response => { |
2fbce7
|
926 |
//addTighteningParameters(param).then(response => {}); |
16714e
|
927 |
self.getListFormulaChild() |
A |
928 |
}).catch(error =>{ |
|
929 |
self.getListFormulaChild() |
|
930 |
}); |
|
931 |
} |
e57a89
|
932 |
} |
懒 |
933 |
}; |
|
934 |
}, |
c2944a
|
935 |
|
768498
|
936 |
endSaveData(param){ |
A |
937 |
saveCampaignTimeParameters(param).then(response => { |
|
938 |
this.cakeLamp.release = 1; |
|
939 |
this.endClear() |
|
940 |
workpieceRelease(param).then(response => {}); |
|
941 |
}); |
|
942 |
}, |
1df825
|
943 |
|
273d64
|
944 |
ngFunction(){ |
A |
945 |
const param = { |
|
946 |
locationCode: this.headContent.processesCode, |
|
947 |
sfcBarcode: this.headContent.sfcCode, |
|
948 |
productCode: this.workpieceInformation.productCode, |
|
949 |
} |
|
950 |
manualNgOffline(param).then(response => {}); |
|
951 |
clearWorkpieceRelease(param).then(releaseCheck =>{}); |
|
952 |
this.endClear() |
|
953 |
}, |
|
954 |
|
c2944a
|
955 |
//接受数据的回调 |
懒 |
956 |
callBack(value) { |
|
957 |
if (this.form1.isShowHistory) this.form1.desc = this.readLi().join(""); |
|
958 |
else { |
|
959 |
const scanValue = this.myserialport.hex2atostr(value).replace(/[\r\n]/g, ''); |
11cc36
|
960 |
console.log("串口收到数据-------------------"+scanValue) |
2fbce7
|
961 |
console.log("sfc=--"+this.headContent.sfcCode+"--") |
bdb404
|
962 |
if(this.headContent.sfcCode !== '' && this.headContent.sfcCode !== null |
A |
963 |
&& this.headContent.sfcCode !== undefined){ |
273d64
|
964 |
if(scanValue.includes("0RSP1TE") && this.headContent.processesCode === 'POP230'){ |
a75d86
|
965 |
this.headContent.cardCode = scanValue |
768498
|
966 |
this.bindcardCode(scanValue); |
A |
967 |
this.serialPortMethod(scanValue) |
ddb300
|
968 |
}else { |
a52d08
|
969 |
this.$message('工位终端扫描物料编码'+scanValue); |
3c2299
|
970 |
console.log(scanValue) |
懒 |
971 |
this.serialPortMethod(scanValue) |
|
972 |
} |
ddb300
|
973 |
} else { |
273d64
|
974 |
if(this.headContent.processesCode === 'POP230'){ |
a75d86
|
975 |
this.headContent.sfcCode = scanValue; |
A |
976 |
this.queryParams.productNum = scanValue; |
4a5f2a
|
977 |
this.getList() |
A |
978 |
this.cakeLamp.scanFinish = 1 |
|
979 |
this.cakeLamp.startWork = 1 |
a75d86
|
980 |
}else { |
A |
981 |
let param = { |
|
982 |
trolleyYard: scanValue |
|
983 |
} |
|
984 |
findBytrolleyYardGetOne(param).then(response => { |
4a5f2a
|
985 |
if(response.msg !== '2'){ |
A |
986 |
this.headContent.sfcCode = response.msg; |
|
987 |
this.queryParams.productNum = response.msg; |
|
988 |
this.$message('扫码识别产品序列号'+scanValue); |
|
989 |
// this.headContent.sfcCode = scanValue; |
|
990 |
// this.queryParams.productNum = scanValue; |
|
991 |
this.getList() |
|
992 |
this.cakeLamp.scanFinish = 1 |
|
993 |
this.cakeLamp.startWork = 1 |
|
994 |
}else { |
|
995 |
this.$message('没有序列号'+scanValue); |
|
996 |
return |
|
997 |
} |
a75d86
|
998 |
}); |
A |
999 |
} |
4a5f2a
|
1000 |
|
ddb300
|
1001 |
} |
A |
1002 |
|
e57a89
|
1003 |
} |
c2944a
|
1004 |
}, |
懒 |
1005 |
clearHistory() { |
|
1006 |
this.form1.desc = ""; |
|
1007 |
this.myserialport.state.readValue = []; |
|
1008 |
}, |
|
1009 |
loadHistory() { |
|
1010 |
if (this.form1.isShowHistory) this.form1.desc = this.readLi().join(""); |
|
1011 |
else { |
|
1012 |
let temp = this.readLi(); |
|
1013 |
if (temp.length > 0) this.form1.desc = temp[temp.length - 1].join(""); |
|
1014 |
} |
|
1015 |
}, |
|
1016 |
readLi() { |
|
1017 |
let readType = this.readType; |
|
1018 |
return this.myserialport.state.readValue.map((items, index) => { |
|
1019 |
const item = items.value; |
|
1020 |
const type = items.type; // 1接收,2发送 |
|
1021 |
let body = []; |
|
1022 |
if (item !== undefined) { |
|
1023 |
let strArr = []; |
|
1024 |
for (let hex of Array.from(item)) { |
|
1025 |
strArr.push(hex.toString(16).toLocaleUpperCase()); |
|
1026 |
} |
|
1027 |
if (strArr.includes("D") && strArr.includes("A")) { |
|
1028 |
if (strArr.indexOf("A") - strArr.indexOf("D") === 1) { |
|
1029 |
strArr.splice(strArr.indexOf("D"), 1); |
|
1030 |
strArr.splice(strArr.indexOf("A"), 1, <br key={0} />); |
|
1031 |
} |
|
1032 |
} |
|
1033 |
strArr = strArr.map((item) => { |
|
1034 |
if (typeof item === "string") { |
|
1035 |
if (readType === 1) { |
|
1036 |
return this.myserialport.hex2a(parseInt(item, 16)); |
|
1037 |
} else if (readType === 2) { |
|
1038 |
return item + " "; |
|
1039 |
} |
|
1040 |
} |
|
1041 |
return item; |
|
1042 |
}); |
|
1043 |
if (typeof strArr[strArr.length - 1] === "string") { |
|
1044 |
strArr.push("\r\n"); |
|
1045 |
} |
|
1046 |
body.push(strArr.join("")); |
|
1047 |
} |
|
1048 |
return body; |
|
1049 |
}); |
|
1050 |
}, |
640ff8
|
1051 |
conCom(){ |
懒 |
1052 |
try { |
|
1053 |
this.myserialport.state.baudRate = this.form1.baudRate; |
|
1054 |
this.myserialport.state.dataBits = this.form1.dataBits; |
|
1055 |
this.myserialport.state.stopBits = this.form1.stopBits; |
|
1056 |
this.myserialport.state.parity = this.form1.parity; |
|
1057 |
this.myserialport.state.flowControl = this.form1.flowControl; |
|
1058 |
this.myserialport.openPort(0, true, this.callBack); |
|
1059 |
console.log(this.form1.port) |
|
1060 |
} catch (error) { |
|
1061 |
this.$message.error("串口连接失败!请检查串口是否已被占用"); |
|
1062 |
} |
|
1063 |
if (this.myserialport.state.isOpen) { |
|
1064 |
this.$message.success("串口连接成功"); |
|
1065 |
} |
|
1066 |
}, |
c2944a
|
1067 |
//连接 |
懒 |
1068 |
async connectBtn() { |
|
1069 |
if (this.btnType === "primary") { |
|
1070 |
try { |
|
1071 |
this.myserialport.state.baudRate = this.form1.baudRate; |
|
1072 |
this.myserialport.state.dataBits = this.form1.dataBits; |
|
1073 |
this.myserialport.state.stopBits = this.form1.stopBits; |
|
1074 |
this.myserialport.state.parity = this.form1.parity; |
|
1075 |
this.myserialport.state.flowControl = this.form1.flowControl; |
|
1076 |
await this.myserialport.openPort(this.form1.port, true, this.callBack); |
11cc36
|
1077 |
console.log(this.form1.port) |
c2944a
|
1078 |
} catch (error) { |
懒 |
1079 |
this.$message.error("串口连接失败!请检查串口是否已被占用"); |
|
1080 |
} |
|
1081 |
if (this.myserialport.state.isOpen) { |
|
1082 |
this.$message.success("串口连接成功"); |
|
1083 |
this.open1 = false |
|
1084 |
this.btnType = "danger"; |
|
1085 |
this.btnText = "关闭串口"; |
|
1086 |
} |
|
1087 |
} else { |
|
1088 |
this.myserialport.openPort(this.form1.port, false, this.callBack); |
|
1089 |
this.$message.success("串口关闭成功"); |
|
1090 |
this.btnType = "primary"; |
|
1091 |
this.btnText = "连接串口"; |
|
1092 |
} |
|
1093 |
}, |
|
1094 |
//授权 |
|
1095 |
async obtainAuthorization() { |
|
1096 |
if ("serial" in navigator) { |
|
1097 |
console.log("The Web Serial API is supported."); |
|
1098 |
if (!this.myserialport) this.myserialport = new MySerialPort(); |
|
1099 |
try { |
|
1100 |
await this.myserialport.handleRequestPort(); |
|
1101 |
this.$message.success("串口授权成功"); |
|
1102 |
this.getPortInfo(this.myserialport.state.ports); |
|
1103 |
} catch (error) { |
|
1104 |
this.$message.warning("未选择新串口授权!"); |
|
1105 |
} |
|
1106 |
} else { |
|
1107 |
this.$message.error( |
|
1108 |
"当前为HTTP模式或者浏览器版本过低,不支持网页连接串口" |
|
1109 |
); |
|
1110 |
} |
|
1111 |
}, |
|
1112 |
//串口列表初始化 |
|
1113 |
getPortInfo(portList) { |
|
1114 |
this.portsList = []; |
|
1115 |
portList.map((port, index) => { |
|
1116 |
const { usbProductId, usbVendorId } = port.getInfo(); |
|
1117 |
if (usbProductId === undefined || usbVendorId === undefined) { |
|
1118 |
this.portsList.push({ label: "未知设备" + index, value: index }); |
|
1119 |
} else { |
|
1120 |
const usbVendor = USBDevice.filter( |
|
1121 |
(item) => parseInt(item.vendor, 16) === usbVendorId |
|
1122 |
); |
|
1123 |
let usbProduct = []; |
|
1124 |
if (usbVendor.length === 1) { |
|
1125 |
usbProduct = usbVendor[0].devices.filter( |
|
1126 |
(item) => parseInt(item.devid, 16) === usbProductId |
|
1127 |
); |
|
1128 |
} |
|
1129 |
this.portsList.push({ label: usbProduct[0].devname, value: index }); |
|
1130 |
} |
|
1131 |
}); |
|
1132 |
}, |
|
1133 |
// 发送 |
|
1134 |
async sendCommon() { |
|
1135 |
if (this.myserialport.state.isOpen) { |
|
1136 |
if (this.form1.sendMsg.length !== 0) { |
|
1137 |
const writeType = this.form1.type; |
|
1138 |
let value = this.form1.sendMsg; |
|
1139 |
let arr = []; |
|
1140 |
if (writeType === 1) { |
|
1141 |
// ASCII |
|
1142 |
for (let i = 0; i < value.length; i++) { |
|
1143 |
arr.push(this.myserialport.a2hex(value[i])); |
|
1144 |
} |
|
1145 |
} else if (writeType === 2) { |
|
1146 |
// HEX |
|
1147 |
if (/^[0-9A-Fa-f]+$/.test(value) && value.length % 2 === 0) { |
|
1148 |
for (let i = 0; i < value.length; i = i + 2) { |
|
1149 |
arr.push(parseInt(value.substring(i, i + 2), 16)); |
|
1150 |
} |
|
1151 |
} else { |
|
1152 |
this.$message.error("格式错误"); |
|
1153 |
return; |
|
1154 |
} |
|
1155 |
} |
|
1156 |
this.myserialport.writeText(arr); |
|
1157 |
} else { |
|
1158 |
this.$message.warning("请输入发送的信息"); |
|
1159 |
} |
|
1160 |
} else { |
|
1161 |
this.$message.warning("串口处于关闭状态,请连接串口"); |
|
1162 |
} |
|
1163 |
}, |
|
1164 |
async getPorts() { |
|
1165 |
await this.myserialport.getPorts(); |
|
1166 |
this.getPortInfo(this.myserialport.state.ports); |
|
1167 |
}, |
|
1168 |
querySearch(queryString, cb) { |
|
1169 |
var restaurants = this.restaurants; |
|
1170 |
var results = queryString |
|
1171 |
? restaurants.filter(this.createFilter(queryString)) |
|
1172 |
: restaurants; |
|
1173 |
// 调用 callback 返回建议列表的数据 |
|
1174 |
cb(results); |
|
1175 |
}, |
|
1176 |
createFilter(queryString) { |
|
1177 |
return (restaurant) => { |
|
1178 |
return ( |
|
1179 |
restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === |
|
1180 |
0 |
|
1181 |
); |
|
1182 |
}; |
|
1183 |
}, |
|
1184 |
loadAll() { |
|
1185 |
return [ |
|
1186 |
{ value: "110" }, |
|
1187 |
{ value: "300" }, |
|
1188 |
{ value: "600" }, |
|
1189 |
{ value: "1200" }, |
|
1190 |
{ value: "2400" }, |
|
1191 |
{ value: "4800" }, |
|
1192 |
{ value: "7200" }, |
|
1193 |
{ value: "9600" }, |
|
1194 |
{ value: "14400" }, |
|
1195 |
{ value: "19200" }, |
|
1196 |
{ value: "28800" }, |
|
1197 |
{ value: "38400" }, |
|
1198 |
{ value: "56000" }, |
|
1199 |
{ value: "57600" }, |
|
1200 |
{ value: "76800" }, |
|
1201 |
{ value: "115200" }, |
|
1202 |
{ value: "230400" }, |
|
1203 |
{ value: "460800" }, |
|
1204 |
]; |
|
1205 |
}, |
e57a89
|
1206 |
} |
懒 |
1207 |
} |
|
1208 |
|
|
1209 |
</script> |
|
1210 |
<style scoped> |
|
1211 |
.bottom-card{ |
|
1212 |
height: 600px; |
|
1213 |
} |
|
1214 |
.circle-button{ |
|
1215 |
height: 30px; |
|
1216 |
width: 30px; |
|
1217 |
} |
|
1218 |
.circle-red { |
|
1219 |
background-color: #e01a4f; |
|
1220 |
} |
|
1221 |
.circle-green { |
|
1222 |
background-color: green; |
|
1223 |
} |
|
1224 |
.circle-green-animate { |
|
1225 |
background-color: green; |
|
1226 |
animation: circle-green-animate 2s infinite; |
|
1227 |
} |
|
1228 |
@keyframes circle-green-animate { |
|
1229 |
50% { |
|
1230 |
opacity: 0.6; |
|
1231 |
} |
|
1232 |
0% { |
|
1233 |
opacity: 0.2; |
|
1234 |
} |
|
1235 |
} |
|
1236 |
.head-font{ |
c2944a
|
1237 |
/*font-weight: bold;*/ |
懒 |
1238 |
/*font-size: 25px;*/ |
e57a89
|
1239 |
} |
懒 |
1240 |
span{ |
|
1241 |
font-size: 15px; |
|
1242 |
} |
|
1243 |
.el-table .warning-row { |
|
1244 |
background: oldlace; |
|
1245 |
} |
|
1246 |
|
|
1247 |
.el-table .success-row { |
|
1248 |
background: #f0f9eb; |
|
1249 |
} |
|
1250 |
</style> |
|
1251 |
|