1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
| <template>
| <view class="tag-list">
| <u-navbar title="标签列表" :border-bottom="false"
| :background="background"
| :title-size="40"
| :title-bold="true" title-color="#FFFFFF"
| back-icon-color="#fff">
| <view class="navbar-right" slot="right" @click="goTagListAdd" v-if="this.info.workCenter === 'ZZ-03' || this.info.workCenter === 'WK-01' && '打包'.includes(this.info.operationName)">
| 生成标签
| </view>
| </u-navbar>
| <!-- <view class="search">-->
| <!-- <u-search placeholder="请输入标签编码搜索" v-model="keyword" bgColor="#fff" placeholderColor="#999999"-->
| <!-- :showAction="false" style="margin: 35rpx;" searchIconColor="#6A6A6A" height="74"-->
| <!-- @search="search"></u-search>-->
| <!-- </view>-->
| <scroll-view class="list" scroll-y="true" :scroll-top="20">
| <view v-for="(item,index) in list" :key="'item'+index" class="list-item" @click="choose(item,index)"
| :class="{active:current==index && item.state!==1,print:item.state==1 }"><span>
| {{ item.labelNo }}
| </span>
| <span v-if="item.state==1">已打印</span>
| <u-icon class="icon_choose" size="20rpx" v-if="current==index && item.state!==1"/>
| </view>
| <u-loading mode="circle" :show="loadingList" class="loading"></u-loading>
| <p v-if="list.length===0" style="text-align: center;margin-top: 100rpx;color: rgb(96, 98, 102);font-size: 28rpx;">暂无数据</p>
| </scroll-view>
| <view class="bottom">
| <u-button type="primary" style="margin: 30rpx;" :loading="loading" @click="weighPrintHandle" class="u-button">标签打印</u-button>
| </view>
|
| <view v-if="maskShow" class="uni-mask" @touchmove.stop.prevent="moveHandle" @click="maskclose">
| <scroll-view class="uni-scroll_box" scroll-y @touchmove.stop.prevent="moveHandle" @click.stop="moveHandle">
| <view
| class="uni-list-box"
| v-for="(item, index) in listDevice"
| :key="index"
| @click="tapQuery(item)"
| >
| <view>
| <view class="uni-list_name">名称:{{ item.name }}</view>
| <view class="uni-list_item">UUID:{{ item.address }}</view>
| </view>
| </view>
| </scroll-view>
| <u-toast ref="uToast" />
| </view>
| <uni-fab :pattern="pattern" horizontal="right" vertical="bottom" :popMenu="false" @fabClick="searchDevice" :doc="doc">
| </uni-fab>
| </view>
| </template>
|
| <script>
| import UIcon from "../../../uview-ui/components/u-icon/u-icon.vue";
|
| const jcapi = uni.requireNativePlugin("JCSDK-JCApiModule");
| // 二维码类型
| const QrCodeType = {
| QrCode: 31,
| PDF417: 32,
| DataMatrix: 33,
| AZTEC: 34
| }
| // 线条类型
| const LineType = {
| Solid: 1, // 实线
| Dotted: 2, // 虚线(默认虚实1:1相间)
| }
| // 换行方式
| const LineModeType = {
| Justified: 1, // 宽高固定,内容自适应(字号/字间距/行间距按比例缩放)
| AutoHeight: 2, // 宽度固定,高度自适应
| Fixed: 4, // 宽高固定,超出部分裁剪
| Adapt: 6, // 宽高固定,内容超过时预设宽高自动缩小
| }
| export default {
| components: {UIcon},
| onLoad(options) {
| this.info = JSON.parse(decodeURIComponent(options.info))
| this.loadList();
|
| let _this = this;
| // 初始化SDK
| jcapi.initSDK()
| // 监听页码回调
| jcapi.didReadPrintCountInfo(function(r) {
| console.log(r)
| })
|
| // 监听错误回调
| jcapi.didReadPrintErrorInfo(function(r) {
| console.log(r)
| if(r.code == 23) {
| uni.showToast({
| icon: 'none',
| title: '请重新连接打印机!',
| duration: 2 * 1000
| })
| // 打印机断开连接
| _this.connectedDevice = null
| }
| })
| },
| onShow () {
| this.loadList();
| },
| data() {
| return {
| background: {
| backgroundColor: '#214DED',
| },
| keyword: '',
| list: [{
| name: '123'
| }],
| current: 0,
| currentItem: {},
| loadingList: false,
| loading: false,
| //蓝牙相关
| doc:"蓝牙",
| pattern: {
| color: '#7A7E83',
| backgroundColor: '#fff',
| selectedColor: '#007AFF',
| buttonColor: '#007AFF',
| iconColor: '#fff'
| },
| maskShow: false,
| listDevice:[],//蓝牙设备数据
| printDensity: 5,
| labelType: 1,
| printMode: 2,//printModeData: [{name : '热敏', value: 1}, {name: '热转印', value: 2}],
| info: {}
| }
| },
| methods: {
| moveHandle() {
|
| },
| maskclose() {
|
| },
| // 判断工单是否等于
| isShowWorkCenter(workCenter) {
| if(workCenter.includes(this.info.workCenter)) {
| return true
| } else {
| return false
| }
| },
| isOperationName(workCenter, operationName) {
| // 判断是否为该工作站
| if(workCenter.includes(this.info.workCenter)) {
| // 判断是否包含工序名称
| if(operationName.includes(this.info.operationName)) {
| return true
| } else {
| return false
| }
| } else {
| return false
| }
| },
| isNotOperationName(workCenter, operationName) {
| // 判断是否为该工作站
| if(workCenter.includes(this.info.workCenter)) {
| // 判断是否包含工序名称
| if(!operationName.includes(this.info.operationName)) {
| return true
| } else {
| return false
| }
| } else {
| return false
| }
| },
| // 在此加载列表
| loadList() {
| this.loadingList = true;
| let url = ''
| // 根据不同车间调取接口
| if (this.info.workCenter === 'ZZ-03') { // 成套车间(箱变)
| url = 'listReportChengtao'
| } else if ((this.info.workCenter === 'ZZ-01' && !'组装'.includes(this.info.operationName)) || (this.info.workCenter === 'ZZ-02' && !'二装,注油'.includes(this.info.operationName))) {
| url = 'listReportOther'
| } else if (this.info.workCenter === 'TX-02' && '叠装'.includes(this.info.operationName)) {
| url = 'listReportDieZhuang'
| } else if (this.info.workCenter === 'TX-01' && '纵剪'.includes(this.info.operationName)) {
| url = 'listReportZongjian'
| } else if (this.info.workCenter === 'WK-01' && '打包'.includes(this.info.operationName)) {
| url = 'listReportWaike'
| }
| this.getlistReport(url)
| this.loadingList = false
| },
| getlistReport (url) {
| this.$u.api.dailyPaper[url]({id: this.info.id}).then(res => {
| if (res.code === 0 && res.data.length > 0) {
| this.list = res.data
| this.choose(this.list[0], 0)
| }
| });
| },
| // 搜索
| search(e) {},
| choose(item, index) {
| this.current = index;
| this.currentItem = item
| },
| submit() {
| this.loading = true;
| },
| goTagListAdd(e) {
| uni.navigateTo({
| url: '/pages/daily/tag-list/add?info='+ encodeURIComponent(JSON.stringify(this.info))
| })
| },
| //打印相关
| searchDevice(){
| let _this = this
| uni.openBluetoothAdapter({ // 确认蓝牙是否打开
| success(r) {
| uni.showLoading({
| title: "搜索中..."
| })
| // 未授予蓝牙相关权限和未打开手机定位会搜索不到设备
| jcapi.getBluetoothDevices(function(r){
| // 搜索到设备回调
| uni.hideLoading()
| _this.listDevice = r;
| _this.maskShow = true
| })
| },
| fail(e) {
| uni.showModal({
| confirmText: "打开蓝牙失败"
| })
| }
| })
| },
| tapQuery(item) {
| this.maskShow = false
| // 连接打印机
| let _this = this;
| console.log(item)
| jcapi.openPrinterByDevice({
| address: item.address,
| name: item.name,
| deviceType: item.deviceType // 设备类型:0-蓝牙,1-网络
| }, function(r) {
| uni.showToast({
| title: (r.code == 0) ? "连接成功" : "连接失败",
| duration: 2 * 1000
| })
| if(r.code == 0) {
| _this.connectedDevice = item
| }
| })
| },
| weighPrintHandle() {
| let _this = this
| if (this.currentItem.state == 1) {
| this.$u.toast('请选择需要打印的标签')
| } else {
| const params = {
| operationTaskId: this.info.id + '',
| workstationId: this.info.workstationId,
| labelNo: this.currentItem.labelNo
| }
| // 外壳车间-最后一道工序
| if(this.isShowWorkCenter('WK-01') && this.info.operationId === this.info.lastOperationId) {
| params.type = 'WAIKE_PRODUCT_REPORT'
| this.$u.api.dailyPaper.labelInfo(params).then(res => {
| let print = res.data
| if(print) {
| this.WKLastOperation(print.ParamList[0])
| } else {
| this.$refs.uToast.show({
| title: '未查询到该标签信息!',
| type: 'warning '
| })
| }
| _this.printQrCode()
| })
| }
| // 铁芯车间-纵剪
| if(this.isOperationName('TX-01', '纵剪')) {
| params.type = 'ZONGJIAN_PRODUCT_REPORT'
| this.$u.api.dailyPaper.labelInfo(params).then(res => {
| let print = res.data
| if(print) {
| this.TXOperationName(print.ParamList[0], this.currentItem)
| } else {
| this.$refs.uToast.show({
| title: '未查询到该标签信息!',
| type: 'warning '
| })
| }
| _this.printQrCode()
| })
| }
| // 铁芯车间-叠装
| if(this.isOperationName('TX-02', '叠装')) {
| params.type = "DIEZHUANG_PRODUCT_REPORT"
| console.log(`output->params`,params)
| this.$u.api.dailyPaper.labelInfo(params).then(res => {
| let print = res.data
| if(print) {
| this.TXClosedAssembly(print.ParamList[0])
| } else {
| this.$refs.uToast.show({
| title: '未查询到该标签信息!',
| type: 'warning '
| })
| }
| _this.printQrCode()
| })
| }
| // 箱变车间(成套车间) 需要区分箱体还是柜体
| if(this.isShowWorkCenter('ZZ-03')) {
| params.type = "CHENGTAO_PRODUCT_REPORT"
| this.$u.api.dailyPaper.labelInfo(params).then(res => {
| let print = res.data
| if(print) {
| if(this.currentItem.labelType === 'XT' || this.currentItem.labelType === '箱体') {
| this.XTZZPrintQrCode(print.ParamList[0])
| } else { // 否则为柜体
| this.GYZZPrintQrCode(print.ParamList[0])
| }
| _this.printQrCode()
| } else {
| this.$refs.uToast.show({
| title: '未查询到该标签信息!',
| type: 'warning '
| })
| }
| })
| }
| // 套装车间
| if(this.isNotOperationName('ZZ-01,ZZ-02', '组装,二装,注油')) {
| this.$u.api.dailyPaper.taozhuangLabelInfo(params).then(res => {
| let print = res.data
| if(print) {
| this.suitWorkshop(print.ParamList[0], this.currentItem)
| _this.printQrCode()
| } else {
| this.$refs.uToast.show({
| title: '未查询到该标签信息!',
| type: 'warning '
| })
| }
| })
| }
| }
| },
| // 绘制横线 实线
| getDrawLabelLine(x, y, width, height, rotate, lineType) {
| jcapi.drawLabelLine({
| x: x,
| y: y,
| width: width,
| height: height,
| rotate: rotate,
| lineType: lineType
| });
| },
| // 填冲文字标题
| getDrawLabelText(x, y, width, height, value, fontSize, rotate, lineMode, lineSpace, letterSpace, textAlignHorizontal, textAlignVertical) {
| jcapi.drawLabelText({
| x: x,
| y: y,
| width: width,
| height: height,
| value: value,
| fontSize: fontSize,
| rotate: rotate,
| lineMode: lineMode,
| lineSpace: lineSpace,
| letterSpace: letterSpace,
| textAlignHorizontal: textAlignHorizontal,
| textAlignVertical: textAlignVertical
| })
| },
| // 外壳车间-最后一道工序
| WKLastOperation(printData) {
| // 取ID
| let json = JSON.parse(printData.body)
| // // 绘制二维码
| // var jsonString = JSON.stringify(json.ID);
| jcapi.drawLabelQrCode({
| x: 14.5,
| y: 68,
| width: 20,
| height: 20,
| value: json,
| rotate: 0,
| codeType: QrCodeType.QrCode,
| });
| // 绘制横线 实线8条
| let sum = 4;
| for(let i = 1; i < 8; i++) {
| this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 实线
| sum = (i * 10) + 4
| }
| // 二维码大框
| this.getDrawLabelLine(4, 92, 46, 0.5, 0, LineType.Solid) // 实线9
|
| //绘制竖线
| this.getDrawLabelLine(4, 4, 0.5, 88.5, 0, LineType.Solid) // 竖线1
| this.getDrawLabelLine(20, 4, 0.5, 60.5, 0, LineType.Solid) // 竖线2
| this.getDrawLabelLine(44.5, 4, 0.5, 88.5, 0, LineType.Solid) // 竖线3
|
| // 填冲文字标题
| this.getDrawLabelText(5, 8, 20, 20, '编 号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 18, 20, 20, '长宽高:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 28, 20, 20, '工单号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 38, 20, 20, '图 号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 48, 20, 20, '规格型号:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 58, 20, 20, '生产日期:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
|
| let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "")
| let operationTaskNo = JSON.stringify(printData.operationTaskNo).replace(/"/g, "")
| let lwh = JSON.stringify(printData.lwh ? printData.lwh : '').replace(/"/g, "")
| let specificationModel = JSON.stringify(printData.specificationModel ? printData.specificationModel : '').replace(/"/g, "")
| let drawNo = JSON.stringify(printData.drawNo ? printData.drawNo : '').replace(/"/g, "")
| let createTime = JSON.stringify(printData.createTime).replace(/"/g, "")
|
| // 填冲参数值
| this.getDrawLabelText(22, 8, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 18, 35, 12, lwh, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 28, 35, 12, operationTaskNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 38, 35, 12, drawNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 48, 35, 12, specificationModel, 3, 1, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 58, 35, 12, createTime, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| },
| // 铁芯车间-纵剪
| TXOperationName(printData, currentItem) {
| // 绘制二维码
| let json = JSON.parse(printData.body)
| // 取ID
| // var jsonString = JSON.stringify(json.ID);
| jcapi.drawLabelQrCode({
| x: 14.5,
| y: 74,
| width: 20,
| height: 20,
| value: json,
| rotate: 0,
| codeType: QrCodeType.QrCode,
| });
| // 绘制横线 实线8条
| let sum = 4;
| for(let i = 1; i < 13; i++) {
| this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 实线
| sum = (i * 6) + 4
| }
| // 二维码大框
| this.getDrawLabelLine(4, 97, 46, 0.5, 0, LineType.Solid) // 实线9
|
| //绘制竖线
| this.getDrawLabelLine(4, 4, 0.5, 97, 0, LineType.Solid) // 竖线1
| this.getDrawLabelLine(20, 4, 0.5, 66, 0, LineType.Solid) // 竖线2
| this.getDrawLabelLine(44.5, 4, 0.5, 97, 0, LineType.Solid) // 竖线2
|
| // 填冲文字标题
| this.getDrawLabelText(5, 5, 20, 20, '编 号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 11, 20, 20, '工单号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 17, 20, 20, '牌 号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 23, 20, 20, '片宽(mm):', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 29, 20, 20, '厚度(mm):', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 35, 20, 20, '重量(KG):', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 41, 20, 20, '长度(m):', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 47, 20, 20, '生产人:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 53, 20, 20, '生产时间:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 59, 20, 20, '厂家:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 65, 20, 20, '铁损:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
|
| let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "")
| let optaskNo = JSON.stringify(printData.optaskNo).replace(/"/g, "")
| let sliceWidth = JSON.stringify(printData.sliceWidth ? printData.sliceWidth : '').replace(/"/g, "")
| let thickness = JSON.stringify(printData.thickness ? printData.thickness : '').replace(/"/g, "")
| let wweight = JSON.stringify(printData.wweight ? printData.wweight : '').replace(/"/g, "")
| let llength = JSON.stringify(printData.llength ? printData.llength : '').replace(/"/g, "")
| let reportTime = JSON.stringify(currentItem.reportTime).replace(/"/g, "")
| let reportName = JSON.stringify(currentItem.reportName).replace(/"/g, "")
| let grade = JSON.stringify(printData.grade ? printData.grade : '').replace(/"/g, "")
| let ironLoss = JSON.stringify(printData.ironLoss ? printData.ironLoss : '').replace(/"/g, "")
| let supplierVenderName = JSON.stringify(printData.supplierVenderName ? printData.supplierVenderName : '').replace(/"/g, "")
|
| // // 填冲参数值
| this.getDrawLabelText(22, 5, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 11, 35, 12, optaskNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 17, 35, 12, grade, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 23, 35, 12, sliceWidth, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 29, 35, 12, thickness, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 35, 35, 12, wweight, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 41, 35, 12, llength, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 47, 35, 12, reportName, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 53, 35, 12, reportTime, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 59, 35, 12, supplierVenderName, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 65, 35, 12, ironLoss, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| },
| // 铁芯车间-叠装
| TXClosedAssembly(printData) {
| // 取ID
| let json = JSON.parse(printData.body)
| // 绘制二维码
| // var jsonString = JSON.stringify(json.ID);
| jcapi.drawLabelQrCode({
| x: 14.5,
| y: 68,
| width: 20,
| height: 20,
| value: json,
| rotate: 0,
| codeType: QrCodeType.QrCode,
| });
| // 绘制横线 实线8条
| let sum = 4;
| for(let i = 1; i < 8; i++) {
| this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 实线
| sum = (i * 10) + 4
| }
| // 二维码大框
| this.getDrawLabelLine(4, 92, 46, 0.5, 0, LineType.Solid) // 实线9
|
| //绘制竖线
| this.getDrawLabelLine(4, 4, 0.5, 88.5, 0, LineType.Solid) // 竖线1
| this.getDrawLabelLine(20, 4, 0.5, 60.5, 0, LineType.Solid) // 竖线2
| this.getDrawLabelLine(44.5, 4, 0.5, 88.5, 0, LineType.Solid) // 竖线2
|
| // 填冲文字标题
| this.getDrawLabelText(5, 8, 20, 20, '编 号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 18, 20, 20, '工单号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 28, 20, 20, '图 号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 38, 20, 20, '规格型号:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 48, 20, 20, '生产人:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 58, 20, 20, '生产日期:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
|
| let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "")
| let operationTaskNo = JSON.stringify(printData.operationTaskNo).replace(/"/g, "")
| let drawNo = JSON.stringify(printData.drawNo).replace(/"/g, "")
| let specificationModel = JSON.stringify(printData.specificationModel).replace(/"/g, "")
| let staffNameJoin = JSON.stringify(this.info.staffNameJoin).replace(/"/g, "")
| let createTime = JSON.stringify(printData.createTime ? printData.createTime : '').replace(/"/g, "")
|
| // 填冲参数值
| this.getDrawLabelText(22, 8, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 18, 35, 12, operationTaskNo, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 28, 35, 12, drawNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 38, 35, 12, specificationModel, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 48, 35, 12, staffNameJoin, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 58, 35, 12, createTime, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| },
| // 箱变车间(成套车间) 高压
| GYZZPrintQrCode(printData) {
| // 绘制二维码
| let json = JSON.parse(printData.body)
| // 取ID
| // var jsonString = JSON.stringify(json.ID);
| jcapi.drawLabelQrCode({
| x: 14.5,
| y: 58,
| width: 20,
| height: 20,
| value: json,
| rotate: 0,
| codeType: QrCodeType.QrCode,
| });
| // 绘制横线 实线8条
| let sum = 4;
| for(let i = 1; i < 7; i++) {
| this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 实线
| sum = (i * 10) + 4
| }
| // 二维码大框
| this.getDrawLabelLine(4, 82, 46, 0.5, 0, LineType.Solid) // 实线9
|
| //绘制竖线
| this.getDrawLabelLine(4, 4, 0.5, 78.5, 0, LineType.Solid) // 竖线1
| this.getDrawLabelLine(20, 4, 0.5, 50.5, 0, LineType.Solid) // 竖线2
| this.getDrawLabelLine(44.5, 4, 0.5, 78.5, 0, LineType.Solid) // 竖线2
|
| // 填冲文字标题
| this.getDrawLabelText(5, 8, 20, 22, '编 号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 18, 20, 22, '工单号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 28, 20, 20, '类 型:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 38, 20, 20, '规格型号:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 48, 20, 20, '生产日期:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
|
| let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "")
| let operationTaskNo = JSON.stringify(printData.operationTaskNo ? printData.operationTaskNo : '').replace(/"/g, "")
| let specificationModel = JSON.stringify(printData.specificationModel ? printData.specificationModel : '').replace(/"/g, "")
| let type = JSON.stringify(printData.type ? printData.type : '').replace(/"/g, "")
| let reportTime = JSON.stringify(printData.reportTime).replace(/"/g, "")
| // 填冲参数值
| this.getDrawLabelText(22, 8, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 18, 35, 12, operationTaskNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 28, 35, 12, type, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 38, 35, 12, specificationModel, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 48, 35, 12, reportTime, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| },
| // 箱变车间(成套车间) 箱体
| XTZZPrintQrCode(printData) {
| // 绘制二维码
| let json = JSON.parse(printData.body)
| // 取ID
| // var jsonString = JSON.stringify(json.ID);
| jcapi.drawLabelQrCode({
| x: 14.5,
| y: 65,
| width: 20,
| height: 20,
| value: json,
| rotate: 0,
| codeType: QrCodeType.QrCode,
| });
| // 绘制横线 实线8条
| let sum = 4;
| for(let i = 1; i < 9; i++) {
| this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 实线
| sum = (i * 8) + 4
| }
| // 二维码大框
| this.getDrawLabelLine(4, 90.5, 46, 0.5, 0, LineType.Solid) // 实线9
|
| //绘制竖线
| this.getDrawLabelLine(4, 4, 0.5, 86.5, 0, LineType.Solid) // 竖线1
| this.getDrawLabelLine(20, 4, 0.5, 56, 0, LineType.Solid) // 竖线2
| this.getDrawLabelLine(44.5, 4, 0.5, 86.5, 0, LineType.Solid) // 竖线2
|
| // 填冲文字标题
| this.getDrawLabelText(5, 6, 20, 20, '编 号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 14, 20, 20, '工单号:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 22, 20, 20, '规格型号:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 30, 20, 20, '高压柜体:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 38, 20, 20, '低压柜体:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 46, 20, 20, '本体:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 54, 20, 20, '生产日期:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
|
| let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "")
| let operationTaskNo = JSON.stringify(printData.operationTaskNo).replace(/"/g, "")
| let specificationModel = JSON.stringify(printData.specificationModel ? printData.specificationModel : '').replace(/"/g, "")
| let gy = JSON.stringify(printData.gy ? printData.gy : '').replace(/"/g, "")
| let dy = JSON.stringify(printData.dy ? printData.dy : '').replace(/"/g, "")
| let bt = JSON.stringify(printData.bt ? printData.bt : '').replace(/"/g, "")
| let reportTime = JSON.stringify(printData.reportTime).replace(/"/g, "")
| // // 填冲参数值
| this.getDrawLabelText(22, 6, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 14, 35, 12, operationTaskNo, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 22, 35, 12, specificationModel, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 30, 35, 12, gy, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 38, 35, 12, dy, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 46, 35, 12, bt, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 54, 35, 12, reportTime, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| },
| // 套装车间
| suitWorkshop(printData, currentItem) {
| // 绘制二维码
| let json = JSON.parse(printData.body)
| // 取ID
| // var jsonString = JSON.stringify(json.ID);
| jcapi.drawLabelQrCode({
| x: 17,
| y: 50,
| width: 20,
| height: 20,
| value: json,
| rotate: 0,
| codeType: QrCodeType.QrCode,
| });
| // 绘制横线 实线8条
| let sum = 4;
| for(let i = 1; i < 6; i++) {
| this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 实线
| sum = (i * 10) + 4
| }
| // 二维码大框
| this.getDrawLabelLine(4, 72, 46, 0.5, 0, LineType.Solid) // 实线9
|
| //绘制竖线
| this.getDrawLabelLine(4, 4, 0.5, 68.5, 0, LineType.Solid) // 竖线1
| this.getDrawLabelLine(20, 4, 0.5, 40.5, 0, LineType.Solid) // 竖线2
| this.getDrawLabelLine(44.5, 4, 0.5, 68.5, 0, LineType.Solid) // 竖线2
|
| // 填冲文字标题
| this.getDrawLabelText(5, 8, 24, 22, '铁芯编号:', 3, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 18, 12, 22, '线圈编号:', 3, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 28, 24, 20, '生产日期:', 3, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
| this.getDrawLabelText(5, 38, 24, 20, '生产人员:', 3, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
|
| let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "")
| let coilNo = JSON.stringify(printData.coilNo).replace(/"/g, "")
| let reportTime = JSON.stringify(currentItem.reportTime).replace(/"/g, "")
| let reportName = JSON.stringify(currentItem.reportName).replace(/"/g, "")
|
| // 填冲参数值
| this.getDrawLabelText(22, 8, 40, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 18, 40, 12, coilNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 28, 40, 12, reportTime, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| this.getDrawLabelText(22, 38, 40, 12, reportName, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0)
| },
| //打印二维码
| printQrCode() {
| // 初始化画板
| jcapi.initDrawingBoard({
| width: 45,
| height: 100,
| rotate: 0
| });
|
| // 生成打印数据
| let imageJsonObj = jcapi.generateLabelJson()
| // 设置打印任务
| jcapi.startJob({
| totalCount: 1,
| density: this.printDensity,
| labelType: this.labelType,
| printMode: this.printMode,
| },function(r){
| if(r.code == 0) {
| // 打印数据
| jcapi.printData(imageJsonObj, {
| "printQuantity": 1,
| }, function(r) {
| if (r.code == 0) {
| console.log("打印成功")
| } else {
| console.log("打印失败")
| }
| })
| } else {
| console.log("设置打印任务失败")
| }
| })
| }
| }
| }
| </script>
|
| <style lang="scss" scoped>
| ::v-deep .uni-fab__circle{
| position:fixed;
| bottom: 140rpx;
| }
| .tag-list {
| width: 100%;
| height: 100vh;
| background: #E6EFFF;
| overflow-y: auto;
| box-sizing: border-box;
| padding-bottom: 24rpx;
| position: relative;
| display: flex;
| flex-direction: column;
|
| ::v-deep.navbar-right {
| font-weight: 500;
| font-size: 28rpx;
| color: #FFFFFF;
| line-height: 36rpx;
| margin-right: 32rpx;
| }
| //.search {
| // //position: fixed;
| // width: 100%;
| // z-index: 99;
| // height: 140rpx;
| // background: #E6EFFF;
| //}
|
| .list {
| padding: 40rpx 32rpx 120rpx;
| width: 100%;
| height: 100%;
| overflow-y: auto;
| box-sizing: border-box;
|
| .list-item {
| background: #FFFFFF;
| border-radius: 10rpx;
| box-sizing: border-box;
| padding: 22rpx 43rpx;
| margin-bottom: 20rpx;
| font-weight: 500;
| font-size: 30rpx;
| color: #333333;
| display: flex;
| align-items: center;
| justify-content: space-between;
| .icon_choose {
| background-image: url('~@/static/custom/daily/icon_choose.png');
| background-repeat: no-repeat;
| background-size: cover;
| height: 20rpx;
| width: 20rpx;
| position: relative;
| }
|
| &.print {
| background: #F3FFF8;
| border: 1px solid #ABE3C4;
| color: #0AA04D;
| }
|
| &.active {
| background: #F4F9FF;
| border: 1px solid #ACBDF8;
| color: #214DED;
| }
| }
|
| .loading {
| position: absolute;
| top: 50%;
| left: 50%;
| transform: translate(-50%, -50%);
| }
| }
| .bottom {
| width: 100vw;
| position:fixed;
| bottom: 0;
| background: #E6EFFF;
| .u-button {
| width: 690rpx;
| height: 80rpx;
| background: #214DED;
| border-radius: 8rpx;
| font-weight: 500;
| font-size: 34rpx;
| color: #FFFFFF;
| z-index: 99;
| }
| }
|
| .uni-mask {
| position: fixed;
| top: 0;
| left: 0;
| bottom: 0;
| display: flex;
| align-items: center;
| width: 100%;
| background: rgba(0, 0, 0, 0.6);
| padding: 0 30rpx;
| box-sizing: border-box;
| }
|
|
| .uni-scroll_box {
| height: 70%;
| background: #fff;
| border-radius: 20rpx;
| }
| .uni-list-box {
| margin: 0 20rpx;
| padding: 15rpx 0;
| border-bottom: 1px #f5f5f5 solid;
| box-sizing: border-box;
| }
| .uni-list:last-child {
| border: none;
| }
| .uni-list_name {
| font-size: 30rpx;
| color: #333;
| }
| .uni-list_item {
| font-size: 24rpx;
| color: #555;
| line-height: 1.5;
| }
| }
| </style>
|
|