admin
2024-09-14 dd9383914ca8d446518ad5bf6faf5a6806bb7c7c
提交 | 用户 | 时间
b78728 1 <template>
A 2   <div class="app-container">
3    <el-row :gutter="5">
bf111f 4      <el-col :span="7">
A 5        <el-card style="height: 71px;padding-top: 6px" shadow="never">
6           <span class="head-font">工位编号 : {{headContent.processesCode}}</span>
b78728 7        </el-card>
A 8      </el-col>
dd5d35 9      <el-col :span="17">
b78728 10        <el-card shadow="never">
dd5d35 11          <span class="head-font">物料编码 : </span>
3c3c4d 12          <el-input style="width: 50%" ref="inputData" v-model="materialCode" @change="handleEnter" placeholder="请扫描物料编码"></el-input>
dd5d35 13          <el-button @click="clearClick" style="float: right" type="danger" >清除</el-button>
b78728 14        </el-card>
A 15      </el-col>
16
17    </el-row>
18    <el-row :gutter="5" style="margin-top: 5px">
19      <el-col :span="7" >
20        <el-card class="bottom-card">
21          <div slot="header" class="clearfix">
22            <i class="el-icon-tickets"></i>
23            <span style="font-weight: bold">当前工件信息</span>
24          </div>
25          <el-descriptions :column="1" border :content-style="{'min-width': '140px'}">
dd5d35 26            <el-descriptions-item label="产品序列号">
A 27              <span>{{headContent.sfcCode}}</span>
28            </el-descriptions-item>
b78728 29            <el-descriptions-item label="工单编号">
A 30                <span>{{workpieceInformation.workOrderNo}}</span>
31            </el-descriptions-item>
aec421 32            <el-descriptions-item label="产品编码">
C 33              <span>{{workpieceInformation.productCode}}</span>
b78728 34            </el-descriptions-item>
A 35            <el-descriptions-item label="计划数量">
36              <span>{{workpieceInformation.planQty}}</span>
37            </el-descriptions-item>
38            <el-descriptions-item label="开始时间">
39              <span>{{workpieceInformation.inboundTime}}</span>
40            </el-descriptions-item>
41          </el-descriptions>
42          <el-divider></el-divider>
43          <el-row>
44            <el-col :span="12">
45              <el-button class="circle-button" :class="cakeLamp.plcState ? 'circle-green-animate':'circle-red'" circle></el-button>
46              <span style="display: none">{{cakeLamp.plcState}}</span>
47              <span>&nbsp;PLC状态</span>
48            </el-col>
49            <el-col :span="12">
50              <el-button class="circle-button" :class="cakeLamp.scannerState ? 'circle-green-animate':'circle-red'" circle></el-button>
51              <span style="display: none">{{cakeLamp.scannerState}}</span>
52              <span>&nbsp;扫码枪状态</span>
53            </el-col>
54          </el-row>
55          <el-row style="margin-top: 20px">
56            <el-col :span="12">
57              <el-button class="circle-button" :class="cakeLamp.InPlace ? 'circle-green':'circle-red'" circle></el-button>
58              <span style="display: none">{{cakeLamp.InPlace}}</span>
59              <span>&nbsp;工件到位</span>
60            </el-col>
61            <el-col :span="12">
62              <el-button class="circle-button" :class="cakeLamp.scanFinish ? 'circle-green':'circle-red'" circle></el-button>
63              <span style="display: none">{{cakeLamp.scanFinish}}</span>
64              <span>&nbsp;扫码完成</span>
65            </el-col>
66          </el-row>
67          <el-row style="margin-top: 20px">
68            <el-col :span="12">
69              <el-button class="circle-button" :class="cakeLamp.startWork ? 'circle-green':'circle-red'" circle></el-button>
70              <span style="display: none">{{cakeLamp.startWork}}</span>
71              <span>&nbsp;开始作业</span>
72            </el-col>
73            <el-col :span="12">
74              <el-button class="circle-button" :class="cakeLamp.release ? 'circle-green':'circle-red'" circle></el-button>
75              <span style="display: none">{{cakeLamp.release}}</span>
76              <span>&nbsp;允许放行</span>
77            </el-col>
78          </el-row>
039f89 79          <el-row v-show="printFlag" style="margin-top: 20px">
A 80            <el-button id="print" v-print="'#printMe'" type="primary">打印</el-button>
81            <div style="display: none">
82              <div id="printMe">
83                <div style="text-align: center;margin-top: 64px">
84                  <span style="font-size: 29px;">电驱系统总成</span>
85                </div>
2bbc7c 86                <div style="display: flex;margin-top: 2px;margin-left: 39px;font-size: 15px">
039f89 87                  <div class="div1">
A 88                    <div >
89                      <span>电机型号:</span><span>TZ180XSDSZX01</span><br>
90                    </div>
91                    <div style="margin-top: 4px">
92                      <span>额定功率:</span><span>30KW</span><br>
93                    </div>
94                    <div style="margin-top: 4px">
95                      <span>额定扭矩:</span><span>70N.m</span><br>
96                    </div>
97                    <div style="margin-top: 4px">
98                      <span>额定电压:</span><span>336VDS</span><br>
99                    </div>
100                    <div style="margin-top: 4px">
101                      <span>额工作制:</span><span>S9</span><br>
102                    </div>
103                    <div style="margin-top: 4px">
104                      <span>持续工作电流:</span><span>115A</span><br>
105                    </div>
106                    <div style="margin-top: 4px">
107                      <span>相数:</span><span>3</span><br>
108                    </div>
109                    <div style="margin-top: 4px">
110                      <span>零件号:</span><span>9900200461</span><br>
111                    </div>
112                  </div>
113
2bbc7c 114                  <div class="div2" style="font-size: 15px;margin-left: 4px">
039f89 115                    <div>
A 116                      <span>控制器型号:</span><span>KTZ34X23SZX07</span><br>
117                    </div>
118                    <div style="margin-top: 4px">
119                      <span>峰值功率:</span><span>60KW</span><br>
120                    </div>
121                    <div style="margin-top: 4px">
122                      <span>峰值转矩:</span><span>175N.m</span><br>
123                    </div>
124                    <div style="margin-top: 4px">
125                      <span>最高转速:</span><span>12000rpm</span><br>
126                    </div>
127                    <div style="margin-top: 4px">
128                      <span>防护等级:</span><span>IP68</span><br>
129                    </div>
130                    <div style="margin-top: 4px">
131                      <span>峰值工作电流:</span><span>230A</span><br>
132                    </div>
133                    <div style="margin-top: 4px">
134                      <span>绝缘等级:</span><span>H</span><br>
135                    </div>
136                    <div style="margin-top: 4px">
137                      <span>出厂编号:</span><span>2407190000002</span><br>
138                    </div>
139                  </div>
140                </div>
2bbc7c 141                <div style="margin-top: 2px;margin-left: 70px">
6f85c8 142                  <span style="font-size: 26px;">湖州智芯动力系统发展有限公司</span>
039f89 143                </div>
A 144
145
afc51f 146                <div style="text-align: center;margin-top: 101px;font-size: 20px">
039f89 147                  <div style="margin-top: 8px">
A 148                    <span style="font-size: 22px">TZ180XSDSZX01</span><br>
149
150                  </div>
151                  <div style="margin-top: 4px">
152                    <span style="font-size: 22px">KTZ34X23SZX07</span><br>
153
154                  </div>
155                  <div style="margin-top: 4px">
156                    <span style="font-size: 22px">993083</span><br>
157
158                  </div>
159                  <div style="margin-top: 4px">
160                    <span style="font-size: 22px">9900166410</span><br>
161
162                  </div>
163                  <div style="margin-top: 4px">
164                    <span style="font-size: 22px">2407190000002</span>
165
166                  </div>
167                </div>
168
2bbc7c 169                <div style="margin-top: 61px;display: flex;margin-left: 40px">
6f85c8 170                  <div style="width: 30%;flex: 1">
A 171                    <VueQr :size='80' :margin='0' :text='this.text'></VueQr>
172                  </div>
2bbc7c 173                  <div style="width: 70%;flex: 1;margin-top: 18px;margin-right: 29px">
6f85c8 174                         <span style="margin-left: -80px;font-size: 20px;font-family: FangSong;letter-spacing: -0.8px">
dd9383 175                           P9900200461#T{{headContent.sfcCode}}
039f89 176                         </span><br>
6f85c8 177                    <span style="margin-left: -80px;font-size: 20px;font-family: FangSong;letter-spacing: -0.8px">
039f89 178                           #V993983#SSW002.005#HHW001.001#NMCU
A 179                         </span>
180                    <!--                      <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P9900166410#T{{text1}}#V993983#SSW002.005#HHW001.001#NBMS#</span>-->
181                  </div>
182                </div>
183
2bbc7c 184                <div style="margin-top: 48px;display: flex;margin-left: 40px">
6f85c8 185                  <div style="width: 30%;flex: 1">
A 186                    <VueQr :size='80' :margin='0' :text='this.text'></VueQr>
187                  </div>
2bbc7c 188                  <div style="width: 70%;flex: 1;margin-top: 18px;margin-right: 29px">
6f85c8 189                         <span style="margin-left: -80px;font-size: 20px;font-family: FangSong;letter-spacing: -0.8px">
dd9383 190                           P9900200461#T{{headContent.sfcCode}}
039f89 191                         </span><br>
6f85c8 192                    <span style="margin-left: -80px;font-size: 20px;font-family: FangSong;letter-spacing: -0.8px">
039f89 193                           #V993983#SSW002.005#HHW001.001#NMCU
A 194                         </span>
195                    <!--                      <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P9900166410#T{{text1}}#V993983#SSW002.005#HHW001.001#NBMS#</span>-->
196                  </div>
197                </div>
198
afc51f 199                <div style="text-align: center;margin-left: -190px;margin-top: 35px">
039f89 200                  <div style="margin-top: 4px">
A 201                    <span>9900200461</span><br>
202                  </div>
203                  <div style="margin-top: 8px">
204                    <span>MCU</span><br>
205                  </div>
206                  <div style="margin-top: 8px">
207                    <span>HW 001.001</span><br>
208                  </div>
209                  <div style="margin-top: 8px">
210                    <span>SW 001.001</span><br>
211                  </div>
212                </div>
213
214              </div>
215            </div>
216          </el-row>
b78728 217          <el-row v-show="orderFlag" style="margin-top: 20px">
4280d7 218 <!--           <el-button @click="getWorkOrders" type="warning" size="mini">接收工单</el-button>-->
b78728 219          </el-row>
A 220        </el-card>
221
222      </el-col>
223      <el-col :span="17">
777422 224        <el-tabs type="border-card"  style="height: 600px" v-model="activeName">
b78728 225          <el-tab-pane name="first">
A 226            <span slot="label"> <a class="el-icon-date"></a>首页</span>
227            <el-col :span="24">
228              <el-table height="500" :cell-style="rowStyle" :data="formulaChildList">
229                <el-table-column label="拧紧步号" width="80" align="center" prop="stepSort">
230                </el-table-column>
231                <el-table-column label="操作内容" align="center" prop="operationSteps">
232                </el-table-column>
233                <el-table-column label="产品编号" width="80" align="center" prop="productCode">
234                </el-table-column>
235                <el-table-column label="物料编码" width="110" align="center" prop="materialCode">
236                </el-table-column>
237                <el-table-column label="采集值" align="center" prop="collectData">
238                </el-table-column>
239                <el-table-column label="结果" width="60" align="center" prop="results">
240                </el-table-column>
241
242              </el-table>
243            </el-col>
244          </el-tab-pane>
245        </el-tabs>
246      </el-col>
247    </el-row>
248   </div>
249 </template>
250 <script>
251 import {listWorkReport} from "@/api/main/om/workReport/workReport";
252 import {listStationConf,getIpv4} from "@/api/main/sc/stationConf";
253 import {
254   clearWorkpieceRelease,
255   fistSetpNumber, initializedData,
256   listFormulaChild,
257   noPageListFormulaChild,
258   releaseCheck, unfinishedProcess,
259   updateResults,
260   updateTighteningFormula,
261   workpieceRelease
262 } from "@/api/main/bs/formulaChild/formulaChild";
263 import MySerialPort from "@/utils/MySerialPort";
264 import USBDevice from "@/utils/usb.json";
265 import {
266   bindYzSfcFlag,
267   checkCarCode, checkYzSfcCode,
268   findBytrolleyYardGetOne,
dd9383 269   listProductionOrde, listProductionOrdeLoopLine, mozuReceivingWorkOrders,
b78728 270   receivingWorkOrders,
A 271   trolleyYardBinDing
272 } from "@/api/main/om/productionOrde/productionOrde";
273 import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection";
274 import {
275   addBasicParameters,
276   addParamCollection,
277   addTighteningParameters,
278   saveCampaignTimeParameters,
279   replaceAssemblyCode, checkRecordDataDone,
280 } from "@/api/main/da/paramCollection/paramCollection";
281 import {addFormula} from "@/api/main/bs/formula/formula";
039f89 282 import QRCode from "qrcodejs2";
6f85c8 283 import VueQr from "vue-qr";
b78728 284
A 285 export default {
6f85c8 286   components: {
A 287     VueQr
288   },
b78728 289   name: "stationTerminal",
A 290   data() {
291     return {
5d1c1c 292       text: 'P9900200461#T2408170000004 #V993983#SSW001.001#HHW001.001#NMCU',
dd5d35 293       materialCode: '', // 物料编码
b78728 294       carCode: '',
A 295       showInput: false,
296       onLineBinDing: false,
297
298       serialPortContent: '',
299       // 查询参数
300       formulaChildParams: {
301         pageNum: 1,
302         pageSize: 10,
303         productCode: null,
304         processesCode: null,
305       },
306       // 配方配置子信息表格数据
307       formulaChildList: [],
308       ipAddress: '',
309       imgSrc: '',
310       headContent: {
311         processesCode: 'OP1010',
312         processesName: '贴标机-贴码',
313         sfcCode: '',
314         yzSfcCode: '',
315         cardCode: '',
316       },
317       workpieceInformation: {
318         workOrderNo: null,
319         productCode: null,
320         productModel: null,
321         productName: null,
322         inboundTime: null,
323         materialCode: null,
324         planQty: null,
325       },
326       // 查询参数
327       queryParams: {
328         pageNum: 1,
329         pageSize: 10,
330         sfcCode: null,
331       },
332       // 查询参数
333       StationConfQueryParams: {
334         pageNum: 1,
335         pageSize: 10,
336         ipAddress: null,
337       },
338       cakeLamp: {
339         plcState: 1, //plc
340         scannerState: 1, //扫码枪
341         InPlace: 0, //工件到位
342         scanFinish: 0,
343         startWork: 0,
344         release: 0 //允许放行
345       },
346       content: '',
dd9383 347       // url: "ws://10.103.214.26:8080/websocket/message/",
5442bc 348       url: "ws://192.168.20.250:8080/websocket/message/",
b78728 349
A 350       passingStationForm: {},
351       originalArray: [],
777422 352       orderFlag: true,
039f89 353       printFlag: false,
777422 354       activeName: 'first',
A 355
b78728 356     }
d5a701 357   },
C 358   mounted() {
359     this.setFocus()
b78728 360   },
A 361   beforeDestroy() {
362     this.exit();
363   },
364   created() {
365     this.initStation();
366   },
367   computed: {
368     isDisable() {
369       return this.btnType === "danger";
370     },
371   },
372   methods: {
d5a701 373     setFocus(){
C 374       this.$nextTick(()=>{
375         this.$refs.inputData.focus()
376       })
377     },
777422 378     changeMenu(tab, event) {
A 379       console.log(tab, event);
380     },
dd5d35 381     handleEnter() {
f2a963 382       console.log("物料码:"+this.materialCode);
eec569 383       if(this.materialCode.includes("9900200461") || this.materialCode.includes("9900207783")){
aba702 384         if(this.headContent.processesCode === "OP170" || this.headContent.processesCode === "OP180" ||
C 385            this.headContent.processesCode === "OP190" || this.headContent.processesCode === "OP200" ||
386            this.headContent.processesCode === "OP210" || this.headContent.processesCode === "OP220" ||
6f1a28 387           this.headContent.processesCode === "OP230"
c95d41 388         ){
f2a963 389           if(this.materialCode.length>25){
eec569 390             let code = this.materialCode.substring(13,26);
dd9383 391             // this.headContent.sfcCode = code;
eec569 392             this.queryParams.productNum = code;
A 393             this.getList();
394             this.cakeLamp.scanFinish = 1
395             this.cakeLamp.startWork = 1
396             this.cakeLamp.InPlace = 1
397             const param = {
398               processesCode: this.headContent.processesCode,
4cba4a 399               productCode: this.workpieceInformation.productCode,
C 400               sfcBarcode:code,
eec569 401             }
A 402             fistSetpNumber(param).then(response => {
403               console.log("fistSetpNumber------"+response.msg)
404             });
405             this.$message("扫描物料编码"+this.materialCode);
406             this.materialCode="";
aec421 407             this.setFocus();
eec569 408           }else{
A 409             this.$message("扫描物料编码错误!"+this.materialCode);
f2a963 410             this.materialCode="";
C 411             this.setFocus();
c95d41 412           }
eec569 413
A 414         }
415       }else{
416         if(this.headContent.sfcCode === '' || this.headContent.sfcCode === null){
417           this.$message("请先扫描产品条码!");
418         }else{
419           this.serialPortMethod(this.materialCode);
ecddff 420           this.$message("扫描物料编码"+this.materialCode);
C 421           this.setFocus();
422           this.materialCode="";
c95d41 423         }
eec569 424
c95d41 425       }
dd5d35 426     },
b78728 427     serialLink() {
A 428       this.open1 = true
429     },
430     serialPortMethod(value){
431       let formulaChildParams = {
432         scanBarcode: value,
433         sfcBarcode: this.headContent.sfcCode,
434         workOrderNo: this.workpieceInformation.workOrderNo,
435         productCode: this.workpieceInformation.productCode,
436         locationCode: this.headContent.processesCode,
437         collectionTime: new Date()
438       }
439       updateResults(formulaChildParams).then(response => {
440         console.log(response)
441         if(response.msg === "3"){
442           this.cakeLamp.release= 1 //允许放行
443         }else if(response.msg === "2"){
444           this.$message.error('扫码重复请重新扫码!');
445         }
446         this.getListFormulaChild()
447       });
448     },
449     rowStyle({ row }) {
450       if (row.results === 'OK') {
451         return 'background-color: PaleGreen';
452       } else if (row.results === 'NG') {
453         return 'background-color: LightSalmon';
454       }
455       return '';
456     },
457     /** 查询配方配置子信息列表 */
458     getListFormulaChild() {
459       // this.formulaChildList = []
460       this.formulaChildParams.productCode = this.workpieceInformation.productCode
461       this.formulaChildParams.processesCode = this.headContent.processesCode
462       console.log(this.formulaChildParams)
463       noPageListFormulaChild(this.formulaChildParams).then(response => {
464         this.formulaChildList = response.rows;
465         if (this.formulaChildList.length >0){
466           let pos = 0
467           const tempArr = this.formulaChildList.filter(x=> 'OK' === x.results)
468           if (tempArr.length>0){
469             pos = tempArr.length
470             this.$nextTick(() => {
471               let temp33 = document.getElementsByClassName('el-table__row')
472               console.log('temp33',temp33)
473               console.log('len',temp33.item(pos))
474               if (temp33.length > 0){
475                 console.log('1111111111111111')
476                 let arr = temp33[pos-1]
477                 console.log('srr',arr)
478                 arr.scrollIntoView({ block: 'center' })
479               }
480             })
481           }
482
483         }
484
485       });
486     },
487     endClear(){
488       this.cakeLamp.InPlace= 0 //工件到位
489       this.cakeLamp.scanFinish= 0
490       this.cakeLamp.startWork= 0
491       this.cakeLamp.release= 0 //允许放行
492
493       this.formulaChildList = []
494       this.workpieceInformation.productCode = null;
495       this.workpieceInformation.workOrderNo = null;
496       this.workpieceInformation.productModel = null;
497       this.workpieceInformation.productName = null;
498       this.workpieceInformation.inboundTime = null;
499       this.headContent.sfcCode = '';
500       this.headContent.yzSfcCode = '';
501       this.headContent.cardCode = '';
777422 502       this.workpieceInformation.planQty = ''
b78728 503     },
A 504     clearClick(){
505       const param = {
506         workOrderNo: this.workpieceInformation.workOrderNo,
507         productCode: this.workpieceInformation.productCode,
508         locationCode: this.headContent.processesCode,
509         productBarcode: this.headContent.sfcCode,
510       }
039f89 511       // this.endClear()
b78728 512       clearWorkpieceRelease(param).then(response => {});
039f89 513       // this.headContent.sfcCode = ''
b78728 514       this.$message('清除成功!');
039f89 515       this.setFocus();
A 516       this.getList()
517
b78728 518     },
A 519     /** 查询工单列表 */
520     async getList() {
dd9383 521       await listProductionOrdeLoopLine(this.queryParams).then(response => {
b78728 522         let rowsData = response.rows[0];
5d1c1c 523         if(rowsData){
dd9383 524           if(this.headContent.processesCode === 'OP170'
A 525             ||this.headContent.processesCode === 'OP180'||
526             this.headContent.processesCode === 'OP190'||
527             this.headContent.processesCode === 'OP200'||
528             this.headContent.processesCode === 'OP210'||
529             this.headContent.processesCode === 'OP220'){
530             this.headContent.sfcCode = rowsData.productNum
531           }
5d1c1c 532           this.workpieceInformation.workOrderNo = rowsData.workOrderNo;
A 533           this.workpieceInformation.productCode = rowsData.productCode;
534           this.workpieceInformation.materialCode = rowsData.materialCode;
535           this.workpieceInformation.planQty = rowsData.planQty;
536           this.headContent.cardCode = rowsData.trolleyYard;
537           this.getListFormulaChild()
538           this.workpieceInformation.inboundTime = this.getCurrentTime()
539         }else {
540           this.$message.error('系统没有此工单,请重新扫码!');
541         }
b78728 542       });
A 543     },
544
545     initializedData(){
546       const param = {
547         locationCode: this.headContent.processesCode,
548       }
549       initializedData(param).then(response => {
550         if(response.msg !== ''){
551           this.headContent.sfcCode = response.msg;
552           this.queryParams.productNum = response.msg;
553           this.getList()
554           this.cakeLamp.scanFinish = 1
555           this.cakeLamp.startWork = 1
556           this.cakeLamp.InPlace = 1
6f85c8 557           // this.test1()
A 558           // this.test2()
5d1c1c 559           this.text = 'P9900200461#T'+this.headContent.sfcCode+' #V993983#SSW001.001#HHW001.001#NMCU'
b78728 560         }
A 561       });
562     },
563
564     getCurrentTime() {
565       const now = new Date();
566       const year = now.getFullYear();
567       const month = this.padTimeUnit(now.getMonth() + 1); // 月份是从0开始的
568       const day = this.padTimeUnit(now.getDate());
569       const hours = this.padTimeUnit(now.getHours());
570       const minutes = this.padTimeUnit(now.getMinutes());
571       const seconds = this.padTimeUnit(now.getSeconds());
572       return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
573     },
574     padTimeUnit(value) {
575       return value.toString().padStart(2, '0');
576     },
577
578     exit() {
579       if (this.ws) {
580         this.ws.close();
581         this.ws = null;
582       }
583     },
039f89 584     test1(){
A 585       document.getElementById('canvasWrapper1').innerHTML = '';
586       this.$nextTick(() => {
587           let qrCode = new QRCode('canvasWrapper1',{
588             width: 83,
589             height: 83,
5d1c1c 590             text: 'P9900200461#T'+this.headContent.sfcCode+' #V993983#SSW001.001#HHW001.001#NMCU',
039f89 591             colorDark: '#000',
A 592             colorLight: '#fff'
593           })
594         }
595       )
596     },
597     test2(){
598       document.getElementById('canvasWrapper2').innerHTML = '';
599       this.$nextTick(() => {
600           let qrCode = new QRCode('canvasWrapper2',{
601             width: 83,
602             height: 83,
5d1c1c 603             text: 'P9900200461#T'+this.headContent.sfcCode+' #V993983#SSW001.001#HHW001.001#NMCU',
039f89 604             colorDark: '#000',
A 605             colorLight: '#fff'
606           })
607         }
608       )
609     },
b78728 610     send() {
A 611       if (this.ws) {
612         this.ws.send(this.message);
613       } else {
614         alert("未连接到服务器");
615       }
616     },
617
618     initStation: async function () {
619       await getIpv4().then(response => {
620         this.StationConfQueryParams.ipAddress = response.msg
621         console.log('查询到本工位IP为' + this.StationConfQueryParams.ipAddress)
622       });
623       await listStationConf(this.StationConfQueryParams).then(response => {
624         let rows = response.rows[0]
625         if (response.rows.length === 0) {
626           this.$message('该工位没有配置IP,请联系管理员配置IP');
627           return
628         }
629         this.headContent.processesName = rows.processesName
630         this.headContent.processesCode = rows.processesCode
631         this.initializedData()
ccd8e7 632         if(this.headContent.processesCode === 'OP165'){
039f89 633           this.printFlag = true
A 634         }
b78728 635
A 636       });
637       console.log('websocket连接工位为' + this.headContent.processesCode)
638       const wsuri = this.url + this.headContent.processesCode;
639       this.ws = new WebSocket(wsuri);
640       const self = this;
641       this.ws.onopen = function (event) {
dd5d35 642         self.$message('websocket连接成功!');
b78728 643       };
A 644
645
646       //socket从后台向前台推送数据
647       this.ws.onmessage = function (event) {
039f89 648         if (event.data === "print") {
A 649           document.getElementById('print').click();
2bbc7c 650           unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 21}).then(response => {});
039f89 651         }else if (event.data === "IN") {
b78728 652           self.cakeLamp.InPlace = 1;
A 653         } else if (event.data === "OUT") {
654           self.cakeLamp.release = 1;
655         } else if (event.data === "END") {
656
657           const formulaChildIndex = self.formulaChildList.length-1
658
659           const orderParam = {
660             productNum: self.headContent.sfcCode,
661           }
662
663           if(self.headContent.sfcCode=== ''||self.headContent.sfcCode=== null){
664             self.$message('总成码为空,请扫码!')
665             unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 26}).then(response => {});
666             return;
667           }
668
669           if(self.formulaChildList[formulaChildIndex].results !== 'OK'){
670             self.$message('未做完工序禁止放行');
671             unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 25}).then(response => {});
672             return;
673           }
674
675
676           const param = {
677             workOrderNo: self.workpieceInformation.workOrderNo,
678             productCode: self.workpieceInformation.productCode,
679             locationCode: self.headContent.processesCode,
680             productBarcode: self.headContent.sfcCode,
681             inboundTime: self.workpieceInformation.inboundTime,
682             formulaChildEntity: self.formulaChildList[formulaChildIndex]
683           }
684
685           console.log("进入最终方法")
686           self.endSaveData(param)
687
fd4ea6 688         } else if(event.data.includes("productNum")){//产品序列号
b78728 689           let productNum = event.data.split(',')[1];
2bbc7c 690           if(self.headContent.processesCode === 'OP165'){
dd9383 691             console.log("进去截取总成码方法165工站原始值是"+productNum+"截取之后的是"+productNum.substring(13,26))
2bbc7c 692             self.headContent.sfcCode = productNum.substring(13,26)
dd9383 693             console.log("self.headContent.sfcCode"+self.headContent.sfcCode)
2bbc7c 694           }else {
A 695             self.headContent.sfcCode = productNum;
696           }
b78728 697           self.queryParams.productNum = productNum;
A 698           self.getList()
699           self.cakeLamp.scanFinish = 1
700           self.cakeLamp.startWork = 1
701           self.cakeLamp.InPlace = 1
702
4280d7 703           const param = {
A 704             processesCode: self.headContent.processesCode,
705             productCode: self.workpieceInformation.productCode
706           }
707           fistSetpNumber(param).then(response => {
708             console.log("fistSetpNumber------"+response.msg)
709           });
c95d41 710
C 711           //打印
712           if(self.headContent.processesCode === "OP165"){
6f85c8 713             // self.test1()
A 714             // self.test2()
dd9383 715             self.text = 'P9900200461#T'+self.headContent.sfcCode+' #V993983#SSW002.005#HHW001.001#NMCU#'
c95d41 716           }
4280d7 717
fd4ea6 718         }else if (event.data.includes("[")) {//拧紧
C 719           let formulaChilds = "";
720           self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort);
721           self.formulaChildList
722             .filter((formulaChild) => formulaChild.operationType === '1');
723           for (let i = 0; i < self.formulaChildList.length; i++) {
724             let formulaChild = self.formulaChildList[i];
725             let results = formulaChild.results;
726
727             if (results === '' || results === null || results === 'NG') {
728               formulaChilds = formulaChild;
729               break;
730             }
731           }
732           if(formulaChilds === ""){
733             self.$message.error('本工位已工作完成!');
734             return;
735           }
736           const param = {
737             id: formulaChilds.id,
738             tightenTheArray: event.data,
739             paramCode: formulaChilds.paramCode,
740             workOrderNo: self.workpieceInformation.workOrderNo,
741             productCode: self.workpieceInformation.productCode,
742             locationCode: self.headContent.processesCode,
743             productBarcode: self.headContent.sfcCode,
744             spareField1: formulaChilds.spareField1,
745             spareField2: formulaChilds.spareField2,
746             spareField3: formulaChilds.spareField3,
747             spareField4: formulaChilds.spareField4,
748             stepSort: formulaChilds.stepSort,
749             ngTimes: formulaChilds.ngTimes,
750           }
751           if(formulaChilds.paramCode === null||formulaChilds.paramCode ===''){
752             self.$message('未找到参数码,请检查参数码是否正确');
753             return;
754           }
755           self.formulaChildParams.artificialNgFlag = null
756           console.log("self.formulaChildParams.artificialNgFlag"+self.formulaChildParams.artificialNgFlag)
757           if(self.headContent.sfcCode!==null||self.headContent.sfcCode!==''){
758             updateTighteningFormula(param).then(response => {
759               //addTighteningParameters(param).then(response => {});
760               self.getListFormulaChild()
761             }).catch(error =>{
762               self.getListFormulaChild()
763             });
764           }
b78728 765         }
A 766       };
767     },
768
769     endSaveData(param){
770       saveCampaignTimeParameters(param).then(response => {
771       this.cakeLamp.release = 1;
772       this.endClear()
773       workpieceRelease(param).then(response => {});
774       });
775     },
776   }
777 }
778
779 </script>
780 <style scoped>
039f89 781 .div1, .div2 {
A 782   flex: 1; /* 两个div平分容器宽度 */
783 }
784 .span{
785   font-family: 'Microsoft YaHei', sans-serif;
786 }
787 .div2{
788   margin-left: 30px;
789 }
b78728 790 .bottom-card{
A 791   height: 600px;
792 }
793 .circle-button{
794   height: 30px;
795   width: 30px;
796 }
797 .circle-red {
798   background-color: #e01a4f;
799 }
800 .circle-green {
801   background-color: green;
802 }
803 .circle-green-animate {
804   background-color: green;
805   animation: circle-green-animate 2s infinite;
806 }
807   @keyframes circle-green-animate {
808     50% {
809       opacity: 0.6;
810     }
811     0% {
812       opacity: 0.2;
813     }
814   }
815 .head-font{
816   /*font-weight: bold;*/
817   /*font-size: 25px;*/
818 }
819 span{
820   font-size: 15px;
821 }
822 .el-table .warning-row {
823   background: oldlace;
824 }
825
826 .el-table .success-row {
827   background: #f0f9eb;
828 }
829 </style>
830