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