admin
2024-09-13 2bbc7c7398f59e844e942203615732dcc79de0a5
提交 | 用户 | 时间
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">
039f89 175                           P9900166410#T{{headContent.sfcCode}}
A 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">
039f89 190                           P9900166410#T{{headContent.sfcCode}}
A 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,
269   listProductionOrde, mozuReceivingWorkOrders,
270   receivingWorkOrders,
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: '',
5442bc 347       // url: "ws://10.103.210.248:8080/websocket/message/",
A 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);
A 391             this.headContent.sfcCode = code;
392             this.queryParams.productNum = code;
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() {
521       await listProductionOrde(this.queryParams).then(response => {
522         let rowsData = response.rows[0];
5d1c1c 523         if(rowsData){
A 524           this.workpieceInformation.workOrderNo = rowsData.workOrderNo;
525           this.workpieceInformation.productCode = rowsData.productCode;
526           this.workpieceInformation.materialCode = rowsData.materialCode;
527           this.workpieceInformation.planQty = rowsData.planQty;
528           this.headContent.cardCode = rowsData.trolleyYard;
529           this.getListFormulaChild()
530           this.workpieceInformation.inboundTime = this.getCurrentTime()
531         }else {
532           this.$message.error('系统没有此工单,请重新扫码!');
533         }
b78728 534       });
A 535     },
536
537     initializedData(){
538       const param = {
539         locationCode: this.headContent.processesCode,
540       }
541       initializedData(param).then(response => {
542         if(response.msg !== ''){
543           this.headContent.sfcCode = response.msg;
544           this.queryParams.productNum = response.msg;
545           this.getList()
546           this.cakeLamp.scanFinish = 1
547           this.cakeLamp.startWork = 1
548           this.cakeLamp.InPlace = 1
6f85c8 549           // this.test1()
A 550           // this.test2()
5d1c1c 551           this.text = 'P9900200461#T'+this.headContent.sfcCode+' #V993983#SSW001.001#HHW001.001#NMCU'
b78728 552         }
A 553       });
554     },
555
556     getCurrentTime() {
557       const now = new Date();
558       const year = now.getFullYear();
559       const month = this.padTimeUnit(now.getMonth() + 1); // 月份是从0开始的
560       const day = this.padTimeUnit(now.getDate());
561       const hours = this.padTimeUnit(now.getHours());
562       const minutes = this.padTimeUnit(now.getMinutes());
563       const seconds = this.padTimeUnit(now.getSeconds());
564       return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
565     },
566     padTimeUnit(value) {
567       return value.toString().padStart(2, '0');
568     },
569
570     exit() {
571       if (this.ws) {
572         this.ws.close();
573         this.ws = null;
574       }
575     },
039f89 576     test1(){
A 577       document.getElementById('canvasWrapper1').innerHTML = '';
578       this.$nextTick(() => {
579           let qrCode = new QRCode('canvasWrapper1',{
580             width: 83,
581             height: 83,
5d1c1c 582             text: 'P9900200461#T'+this.headContent.sfcCode+' #V993983#SSW001.001#HHW001.001#NMCU',
039f89 583             colorDark: '#000',
A 584             colorLight: '#fff'
585           })
586         }
587       )
588     },
589     test2(){
590       document.getElementById('canvasWrapper2').innerHTML = '';
591       this.$nextTick(() => {
592           let qrCode = new QRCode('canvasWrapper2',{
593             width: 83,
594             height: 83,
5d1c1c 595             text: 'P9900200461#T'+this.headContent.sfcCode+' #V993983#SSW001.001#HHW001.001#NMCU',
039f89 596             colorDark: '#000',
A 597             colorLight: '#fff'
598           })
599         }
600       )
601     },
b78728 602     send() {
A 603       if (this.ws) {
604         this.ws.send(this.message);
605       } else {
606         alert("未连接到服务器");
607       }
608     },
609
610     initStation: async function () {
611       await getIpv4().then(response => {
612         this.StationConfQueryParams.ipAddress = response.msg
613         console.log('查询到本工位IP为' + this.StationConfQueryParams.ipAddress)
614       });
615       await listStationConf(this.StationConfQueryParams).then(response => {
616         let rows = response.rows[0]
617         if (response.rows.length === 0) {
618           this.$message('该工位没有配置IP,请联系管理员配置IP');
619           return
620         }
621         this.headContent.processesName = rows.processesName
622         this.headContent.processesCode = rows.processesCode
623         this.initializedData()
ccd8e7 624         if(this.headContent.processesCode === 'OP165'){
039f89 625           this.printFlag = true
A 626         }
b78728 627
A 628       });
629       console.log('websocket连接工位为' + this.headContent.processesCode)
630       const wsuri = this.url + this.headContent.processesCode;
631       this.ws = new WebSocket(wsuri);
632       const self = this;
633       this.ws.onopen = function (event) {
dd5d35 634         self.$message('websocket连接成功!');
b78728 635       };
A 636
637
638       //socket从后台向前台推送数据
639       this.ws.onmessage = function (event) {
039f89 640         if (event.data === "print") {
A 641           document.getElementById('print').click();
2bbc7c 642           unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 21}).then(response => {});
039f89 643         }else if (event.data === "IN") {
b78728 644           self.cakeLamp.InPlace = 1;
A 645         } else if (event.data === "OUT") {
646           self.cakeLamp.release = 1;
647         } else if (event.data === "END") {
648
649           const formulaChildIndex = self.formulaChildList.length-1
650
651           const orderParam = {
652             productNum: self.headContent.sfcCode,
653           }
654
655           if(self.headContent.sfcCode=== ''||self.headContent.sfcCode=== null){
656             self.$message('总成码为空,请扫码!')
657             unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 26}).then(response => {});
658             return;
659           }
660
661           if(self.formulaChildList[formulaChildIndex].results !== 'OK'){
662             self.$message('未做完工序禁止放行');
663             unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 25}).then(response => {});
664             return;
665           }
666
667
668           const param = {
669             workOrderNo: self.workpieceInformation.workOrderNo,
670             productCode: self.workpieceInformation.productCode,
671             locationCode: self.headContent.processesCode,
672             productBarcode: self.headContent.sfcCode,
673             inboundTime: self.workpieceInformation.inboundTime,
674             formulaChildEntity: self.formulaChildList[formulaChildIndex]
675           }
676
677           console.log("进入最终方法")
678           self.endSaveData(param)
679
fd4ea6 680         } else if(event.data.includes("productNum")){//产品序列号
b78728 681           let productNum = event.data.split(',')[1];
2bbc7c 682           if(self.headContent.processesCode === 'OP165'){
A 683             self.headContent.sfcCode = productNum.substring(13,26)
684           }else {
685             self.headContent.sfcCode = productNum;
686           }
b78728 687           self.queryParams.productNum = productNum;
A 688           self.getList()
689           self.cakeLamp.scanFinish = 1
690           self.cakeLamp.startWork = 1
691           self.cakeLamp.InPlace = 1
692
4280d7 693           const param = {
A 694             processesCode: self.headContent.processesCode,
695             productCode: self.workpieceInformation.productCode
696           }
697           fistSetpNumber(param).then(response => {
698             console.log("fistSetpNumber------"+response.msg)
699           });
c95d41 700
C 701           //打印
702           if(self.headContent.processesCode === "OP165"){
6f85c8 703             // self.test1()
A 704             // self.test2()
2bbc7c 705             self.text = 'P9900166410#T'+self.headContent.sfcCode+' #V993983#SSW002.005#HHW001.001#NMCU#'
c95d41 706           }
4280d7 707
fd4ea6 708         }else if (event.data.includes("[")) {//拧紧
C 709           let formulaChilds = "";
710           self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort);
711           self.formulaChildList
712             .filter((formulaChild) => formulaChild.operationType === '1');
713           for (let i = 0; i < self.formulaChildList.length; i++) {
714             let formulaChild = self.formulaChildList[i];
715             let results = formulaChild.results;
716
717             if (results === '' || results === null || results === 'NG') {
718               formulaChilds = formulaChild;
719               break;
720             }
721           }
722           if(formulaChilds === ""){
723             self.$message.error('本工位已工作完成!');
724             return;
725           }
726           const param = {
727             id: formulaChilds.id,
728             tightenTheArray: event.data,
729             paramCode: formulaChilds.paramCode,
730             workOrderNo: self.workpieceInformation.workOrderNo,
731             productCode: self.workpieceInformation.productCode,
732             locationCode: self.headContent.processesCode,
733             productBarcode: self.headContent.sfcCode,
734             spareField1: formulaChilds.spareField1,
735             spareField2: formulaChilds.spareField2,
736             spareField3: formulaChilds.spareField3,
737             spareField4: formulaChilds.spareField4,
738             stepSort: formulaChilds.stepSort,
739             ngTimes: formulaChilds.ngTimes,
740           }
741           if(formulaChilds.paramCode === null||formulaChilds.paramCode ===''){
742             self.$message('未找到参数码,请检查参数码是否正确');
743             return;
744           }
745           self.formulaChildParams.artificialNgFlag = null
746           console.log("self.formulaChildParams.artificialNgFlag"+self.formulaChildParams.artificialNgFlag)
747           if(self.headContent.sfcCode!==null||self.headContent.sfcCode!==''){
748             updateTighteningFormula(param).then(response => {
749               //addTighteningParameters(param).then(response => {});
750               self.getListFormulaChild()
751             }).catch(error =>{
752               self.getListFormulaChild()
753             });
754           }
b78728 755         }
A 756       };
757     },
758
759     endSaveData(param){
760       saveCampaignTimeParameters(param).then(response => {
761       this.cakeLamp.release = 1;
762       this.endClear()
763       workpieceRelease(param).then(response => {});
764       });
765     },
766   }
767 }
768
769 </script>
770 <style scoped>
039f89 771 .div1, .div2 {
A 772   flex: 1; /* 两个div平分容器宽度 */
773 }
774 .span{
775   font-family: 'Microsoft YaHei', sans-serif;
776 }
777 .div2{
778   margin-left: 30px;
779 }
b78728 780 .bottom-card{
A 781   height: 600px;
782 }
783 .circle-button{
784   height: 30px;
785   width: 30px;
786 }
787 .circle-red {
788   background-color: #e01a4f;
789 }
790 .circle-green {
791   background-color: green;
792 }
793 .circle-green-animate {
794   background-color: green;
795   animation: circle-green-animate 2s infinite;
796 }
797   @keyframes circle-green-animate {
798     50% {
799       opacity: 0.6;
800     }
801     0% {
802       opacity: 0.2;
803     }
804   }
805 .head-font{
806   /*font-weight: bold;*/
807   /*font-size: 25px;*/
808 }
809 span{
810   font-size: 15px;
811 }
812 .el-table .warning-row {
813   background: oldlace;
814 }
815
816 .el-table .success-row {
817   background: #f0f9eb;
818 }
819 </style>
820