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