zhl-methods 1.1.2 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/js/ScanUDI.js +46 -1202
  2. package/js/index.js +4 -4
  3. package/package.json +1 -1
package/js/ScanUDI.js CHANGED
@@ -1,1200 +1,6 @@
1
1
  import dayjs from "dayjs";
2
2
 
3
- const rule = [
4
- {
5
- id: 1,
6
- rule_name: "69开头13位69码",
7
- length: 13,
8
- start_value: "69",
9
- upc_rule: {
10
- start: 0,
11
- length: 13,
12
- },
13
- batch_no_rule: "",
14
- manufacture_rule: "",
15
- expiry_rule: "",
16
- serial_no_rule: "",
17
- example: "6923604493068",
18
- state: 0,
19
- create_at: "2023-08-27 16:32:10",
20
- update_at: "2023-08-27 16:32:10",
21
- },
22
- {
23
- id: 2,
24
- rule_name: "95开头13位69码",
25
- length: 13,
26
- start_value: "95",
27
- upc_rule: {
28
- start: 0,
29
- length: 13,
30
- },
31
- batch_no_rule: "",
32
- manufacture_rule: "",
33
- expiry_rule: "",
34
- serial_no_rule: "",
35
- example: "9555650176267",
36
- state: 0,
37
- create_at: "2023-08-27 16:32:10",
38
- update_at: "2023-08-27 16:32:10",
39
- },
40
- {
41
- id: 3,
42
- rule_name: "47开头13位69码",
43
- length: 13,
44
- start_value: "47",
45
- upc_rule: {
46
- start: 0,
47
- length: 13,
48
- },
49
- batch_no_rule: "",
50
- manufacture_rule: "",
51
- expiry_rule: "",
52
- serial_no_rule: "",
53
- example: "4719890466389",
54
- state: 0,
55
- create_at: "2023-08-27 16:32:10",
56
- update_at: "2023-08-27 16:32:10",
57
- },
58
- {
59
- id: 4,
60
- rule_name: "01开头50位二维码",
61
- length: 50,
62
- start_value: "01",
63
- upc_rule: {
64
- start: 3,
65
- length: 13,
66
- },
67
- batch_no_rule: {
68
- start: 34,
69
- length: 9,
70
- },
71
- manufacture_rule: {
72
- start: 18,
73
- length: 6,
74
- },
75
- expiry_rule: {
76
- start: 26,
77
- length: 6,
78
- },
79
- serial_no_rule: {
80
- start: 45,
81
- length: 5,
82
- },
83
- example: "0106921041462845112312051726120410B232032942100522",
84
- state: 0,
85
- create_at: "2023-08-27 16:32:10",
86
- update_at: "2023-08-27 16:32:10",
87
- },
88
- {
89
- id: 5,
90
- rule_name: "01开头35位二维码",
91
- length: 35,
92
- start_value: "01",
93
- upc_rule: {
94
- start: 3,
95
- length: 13,
96
- },
97
- batch_no_rule: {
98
- start: 26,
99
- length: 9,
100
- },
101
- manufacture_rule: "",
102
- expiry_rule: {
103
- start: 18,
104
- length: 6,
105
- },
106
- serial_no_rule: "",
107
- example: "01069418331930611728040010U23505521",
108
- state: 0,
109
- create_at: "2023-08-27 16:32:10",
110
- update_at: "2023-08-27 16:32:10",
111
- },
112
- {
113
- id: 6,
114
- rule_name: "49开头13位69码",
115
- length: 13,
116
- start_value: "49",
117
- upc_rule: {
118
- start: 0,
119
- length: 13,
120
- },
121
- batch_no_rule: "",
122
- manufacture_rule: "",
123
- expiry_rule: "",
124
- serial_no_rule: "",
125
- example: "4950055207694",
126
- state: 0,
127
- create_at: "2023-08-27 16:32:10",
128
- update_at: "2023-08-27 16:32:10",
129
- },
130
- {
131
- id: 7,
132
- rule_name: "73开头13位69码",
133
- length: 13,
134
- start_value: "73",
135
- upc_rule: {
136
- start: 0,
137
- length: 13,
138
- },
139
- batch_no_rule: "",
140
- manufacture_rule: "",
141
- expiry_rule: "",
142
- serial_no_rule: "",
143
- example: "7391899855714",
144
- state: 0,
145
- create_at: "2023-08-27 16:32:10",
146
- update_at: "2023-08-27 16:32:10",
147
- },
148
- {
149
- id: 8,
150
- rule_name: "80开头13位69码",
151
- length: 13,
152
- start_value: "80",
153
- upc_rule: {
154
- start: 0,
155
- length: 13,
156
- },
157
- batch_no_rule: "",
158
- manufacture_rule: "",
159
- expiry_rule: "",
160
- serial_no_rule: "",
161
- example: "8032507708488",
162
- state: 0,
163
- create_at: "2023-08-27 16:32:10",
164
- update_at: "2023-08-27 16:32:10",
165
- },
166
- {
167
- id: 9,
168
- rule_name: "88开头13位69码",
169
- length: 13,
170
- start_value: "88",
171
- upc_rule: {
172
- start: 0,
173
- length: 13,
174
- },
175
- batch_no_rule: "",
176
- manufacture_rule: "",
177
- expiry_rule: "",
178
- serial_no_rule: "",
179
- example: "8809806609644",
180
- state: 0,
181
- create_at: "2023-08-27 16:32:10",
182
- update_at: "2023-08-27 16:32:10",
183
- },
184
- {
185
- id: 10,
186
- rule_name: "25开头9位69码",
187
- length: 9,
188
- start_value: "25",
189
- upc_rule: {
190
- start: 0,
191
- length: 9,
192
- },
193
- batch_no_rule: "",
194
- manufacture_rule: "",
195
- expiry_rule: "",
196
- serial_no_rule: "",
197
- example: "259910001",
198
- state: 0,
199
- create_at: "2023-08-27 16:32:10",
200
- update_at: "2023-08-27 16:32:10",
201
- },
202
- {
203
- id: 11,
204
- rule_name: "87开头9位69码",
205
- length: 9,
206
- start_value: "87",
207
- upc_rule: {
208
- start: 0,
209
- length: 9,
210
- },
211
- batch_no_rule: "",
212
- manufacture_rule: "",
213
- expiry_rule: "",
214
- serial_no_rule: "",
215
- example: "874112000",
216
- state: 0,
217
- create_at: "2023-08-27 16:32:10",
218
- update_at: "2023-08-27 16:32:10",
219
- },
220
- {
221
- id: 12,
222
- rule_name: "47开头11位69码",
223
- length: 11,
224
- start_value: "47",
225
- upc_rule: {
226
- start: 0,
227
- length: 11,
228
- },
229
- batch_no_rule: "",
230
- manufacture_rule: "",
231
- expiry_rule: "",
232
- serial_no_rule: "",
233
- example: "47144054346",
234
- state: 0,
235
- create_at: "2023-08-27 16:32:10",
236
- update_at: "2023-08-27 16:32:10",
237
- },
238
- {
239
- id: 13,
240
- rule_name: "19开头11位69码",
241
- length: 11,
242
- start_value: "19",
243
- upc_rule: {
244
- start: 0,
245
- length: 11,
246
- },
247
- batch_no_rule: "",
248
- manufacture_rule: "",
249
- expiry_rule: "",
250
- serial_no_rule: "",
251
- example: "19652700167",
252
- state: 0,
253
- create_at: "2023-08-27 16:32:10",
254
- update_at: "2023-08-27 16:32:10",
255
- },
256
- {
257
- id: 14,
258
- rule_name: "19开头12位69码",
259
- length: 12,
260
- start_value: "19",
261
- upc_rule: {
262
- start: 0,
263
- length: 12,
264
- },
265
- batch_no_rule: "",
266
- manufacture_rule: "",
267
- expiry_rule: "",
268
- serial_no_rule: "",
269
- example: "196527095152",
270
- state: 0,
271
- create_at: "2023-08-27 16:32:10",
272
- update_at: "2023-08-27 16:32:10",
273
- },
274
- {
275
- id: 15,
276
- rule_name: "30开头12位69码",
277
- length: 12,
278
- start_value: "30",
279
- upc_rule: {
280
- start: 0,
281
- length: 12,
282
- },
283
- batch_no_rule: "",
284
- manufacture_rule: "",
285
- expiry_rule: "",
286
- serial_no_rule: "",
287
- example: "300651362145",
288
- state: 0,
289
- create_at: "2023-08-27 16:32:10",
290
- update_at: "2023-08-27 16:32:10",
291
- },
292
- {
293
- id: 16,
294
- rule_name: "31开头12位69码",
295
- length: 12,
296
- start_value: "31",
297
- upc_rule: {
298
- start: 0,
299
- length: 12,
300
- },
301
- batch_no_rule: "",
302
- manufacture_rule: "",
303
- expiry_rule: "",
304
- serial_no_rule: "",
305
- example: "310119071892",
306
- state: 0,
307
- create_at: "2023-08-27 16:32:10",
308
- update_at: "2023-08-27 16:32:10",
309
- },
310
- {
311
- id: 17,
312
- rule_name: "73开头12位69码",
313
- length: 12,
314
- start_value: "73",
315
- upc_rule: {
316
- start: 0,
317
- length: 12,
318
- },
319
- batch_no_rule: "",
320
- manufacture_rule: "",
321
- expiry_rule: "",
322
- serial_no_rule: "",
323
- example: "733905981470",
324
- state: 0,
325
- create_at: "2023-08-27 16:32:10",
326
- update_at: "2023-08-27 16:32:10",
327
- },
328
- {
329
- id: 18,
330
- rule_name: "78开头12位69码",
331
- length: 12,
332
- start_value: "78",
333
- upc_rule: {
334
- start: 0,
335
- length: 12,
336
- },
337
- batch_no_rule: "",
338
- manufacture_rule: "",
339
- expiry_rule: "",
340
- serial_no_rule: "",
341
- example: "785810073672",
342
- state: 0,
343
- create_at: "2023-08-27 16:32:10",
344
- update_at: "2023-08-27 16:32:10",
345
- },
346
- {
347
- id: 19,
348
- rule_name: "88开头12位69码",
349
- length: 12,
350
- start_value: "88",
351
- upc_rule: {
352
- start: 0,
353
- length: 12,
354
- },
355
- batch_no_rule: "",
356
- manufacture_rule: "",
357
- expiry_rule: "",
358
- serial_no_rule: "",
359
- example: "888290403363",
360
- state: 0,
361
- create_at: "2023-08-27 16:32:10",
362
- update_at: "2023-08-27 16:32:10",
363
- },
364
- {
365
- id: 20,
366
- rule_name: "69开头14位69码",
367
- length: 14,
368
- start_value: "69",
369
- upc_rule: {
370
- start: 0,
371
- length: 14,
372
- },
373
- batch_no_rule: "",
374
- manufacture_rule: "",
375
- expiry_rule: "",
376
- serial_no_rule: "",
377
- example: "69413032221942",
378
- state: 0,
379
- create_at: "2023-08-27 16:32:10",
380
- update_at: "2023-08-27 16:32:10",
381
- },
382
- {
383
- id: 21,
384
- rule_name: "50开头16位69码",
385
- length: 16,
386
- start_value: "50",
387
- upc_rule: {
388
- start: 0,
389
- length: 16,
390
- },
391
- batch_no_rule: "",
392
- manufacture_rule: "",
393
- expiry_rule: "",
394
- serial_no_rule: "",
395
- example: "5061400304040000",
396
- state: 0,
397
- create_at: "2023-08-27 16:32:10",
398
- update_at: "2023-08-27 16:32:10",
399
- },
400
- {
401
- id: 22,
402
- rule_name: "01开头44位二维码",
403
- length: 44,
404
- start_value: "01",
405
- upc_rule: {
406
- start: 3,
407
- length: 13,
408
- },
409
- batch_no_rule: {
410
- start: 34,
411
- length: 10,
412
- },
413
- manufacture_rule: {
414
- start: 18,
415
- length: 6,
416
- },
417
- expiry_rule: {
418
- start: 26,
419
- length: 6,
420
- },
421
- serial_no_rule: "",
422
- example: "0106941851527237112303271728032610A230327007",
423
- state: 0,
424
- create_at: "2023-08-27 16:32:10",
425
- update_at: "2023-08-27 16:32:10",
426
- },
427
- {
428
- id: 24,
429
- rule_name: "01开头34位二维码",
430
- length: 34,
431
- start_value: "01",
432
- upc_rule: {
433
- start: 3,
434
- length: 13,
435
- },
436
- batch_no_rule: {
437
- start: 26,
438
- length: 8,
439
- },
440
- manufacture_rule: "",
441
- expiry_rule: {
442
- start: 18,
443
- length: 6,
444
- },
445
- serial_no_rule: "",
446
- example: "01069418331606121726010010U2320339",
447
- state: 0,
448
- create_at: "2023-08-27 16:32:10",
449
- update_at: "2023-08-27 16:32:10",
450
- },
451
- {
452
- id: 25,
453
- rule_name: "01开头54位二维码",
454
- length: 54,
455
- start_value: "01",
456
- upc_rule: {
457
- start: 3,
458
- length: 13,
459
- },
460
- batch_no_rule: {
461
- start: 34,
462
- length: 10,
463
- },
464
- manufacture_rule: {
465
- start: 18,
466
- length: 6,
467
- },
468
- expiry_rule: {
469
- start: 26,
470
- length: 6,
471
- },
472
- serial_no_rule: {
473
- start: 46,
474
- length: 8,
475
- },
476
- example: "0106941891837686112305011728040110HN2305L0012100100089",
477
- state: 0,
478
- create_at: "2023-08-27 16:32:10",
479
- update_at: "2023-08-27 16:32:10",
480
- },
481
- {
482
- id: 26,
483
- rule_name: "01开头46位二维码",
484
- length: 46,
485
- start_value: "01",
486
- upc_rule: {
487
- start: 3,
488
- length: 13,
489
- },
490
- batch_no_rule: {
491
- start: 34,
492
- length: 6,
493
- },
494
- manufacture_rule: {
495
- start: 18,
496
- length: 6,
497
- },
498
- expiry_rule: {
499
- start: 26,
500
- length: 6,
501
- },
502
- serial_no_rule: {
503
- start: 42,
504
- length: 4,
505
- },
506
- example: "0104719887018997112301031727120310NB2121210211",
507
- state: 0,
508
- create_at: "2023-08-27 16:32:10",
509
- update_at: "2023-08-27 16:32:10",
510
- },
511
- {
512
- id: 28,
513
- rule_name: "01开头53位二维码",
514
- length: 53,
515
- start_value: "01",
516
- upc_rule: {
517
- start: 3,
518
- length: 13,
519
- },
520
- batch_no_rule: {
521
- start: 34,
522
- length: 10,
523
- },
524
- manufacture_rule: {
525
- start: 18,
526
- length: 6,
527
- },
528
- expiry_rule: {
529
- start: 26,
530
- length: 6,
531
- },
532
- serial_no_rule: {
533
- start: 46,
534
- length: 7,
535
- },
536
- example: "0104719886059250112209191728091810II00128452210000625",
537
- state: 0,
538
- create_at: "2023-08-27 16:32:10",
539
- update_at: "2023-08-27 16:32:10",
540
- },
541
- {
542
- id: 30,
543
- rule_name: "01开头52位二维码",
544
- length: 52,
545
- start_value: "01",
546
- upc_rule: {
547
- start: 3,
548
- length: 13,
549
- },
550
- batch_no_rule: {
551
- start: 34,
552
- length: 11,
553
- },
554
- manufacture_rule: {
555
- start: 18,
556
- length: 6,
557
- },
558
- expiry_rule: {
559
- start: 26,
560
- length: 6,
561
- },
562
- serial_no_rule: {
563
- start: 47,
564
- length: 5,
565
- },
566
- example: "0106941792737542112503241730032310RM2503243072101961",
567
- state: 0,
568
- create_at: "2023-08-27 16:32:10",
569
- update_at: "2023-08-27 16:32:10",
570
- },
571
- {
572
- id: 31,
573
- rule_name: "45开头13位69码",
574
- length: 13,
575
- start_value: "45",
576
- upc_rule: {
577
- start: 0,
578
- length: 13,
579
- },
580
- batch_no_rule: "",
581
- manufacture_rule: "",
582
- expiry_rule: "",
583
- serial_no_rule: "",
584
- example: "4571521845969",
585
- state: 0,
586
- create_at: "2023-08-27 16:32:10",
587
- update_at: "2023-08-27 16:32:10",
588
- },
589
- {
590
- id: 32,
591
- rule_name: "75开头11位69码",
592
- length: 11,
593
- start_value: "75",
594
- upc_rule: {
595
- start: 0,
596
- length: 11,
597
- },
598
- batch_no_rule: "",
599
- manufacture_rule: "",
600
- expiry_rule: "",
601
- serial_no_rule: "",
602
- example: "75609201042",
603
- state: 0,
604
- create_at: "2023-08-27 16:32:10",
605
- update_at: "2023-08-27 16:32:10",
606
- },
607
- {
608
- id: 33,
609
- rule_name: "33开头13位69码",
610
- length: 13,
611
- start_value: "33",
612
- upc_rule: {
613
- start: 0,
614
- length: 13,
615
- },
616
- batch_no_rule: "",
617
- manufacture_rule: "",
618
- expiry_rule: "",
619
- serial_no_rule: "",
620
- example: "3337875746236",
621
- state: 0,
622
- create_at: "2023-08-27 16:32:10",
623
- update_at: "2023-08-27 16:32:10",
624
- },
625
- {
626
- id: 34,
627
- rule_name: "25开头14位69码",
628
- length: 14,
629
- start_value: "25",
630
- upc_rule: {
631
- start: 0,
632
- length: 14,
633
- },
634
- batch_no_rule: "",
635
- manufacture_rule: "",
636
- expiry_rule: "",
637
- serial_no_rule: "",
638
- example: "25111201000004",
639
- state: 0,
640
- create_at: "2023-08-27 16:32:10",
641
- update_at: "2023-08-27 16:32:10",
642
- },
643
- {
644
- id: 35,
645
- rule_name: "63开头12位69码",
646
- length: 12,
647
- start_value: "63",
648
- upc_rule: {
649
- start: 0,
650
- length: 12,
651
- },
652
- batch_no_rule: "",
653
- manufacture_rule: "",
654
- expiry_rule: "",
655
- serial_no_rule: "",
656
- example: "630175475565",
657
- state: 0,
658
- create_at: "2023-08-27 16:32:10",
659
- update_at: "2023-08-27 16:32:10",
660
- },
661
- {
662
- id: 36,
663
- rule_name: "84开头12位69码",
664
- length: 12,
665
- start_value: "84",
666
- upc_rule: {
667
- start: 0,
668
- length: 12,
669
- },
670
- batch_no_rule: "",
671
- manufacture_rule: "",
672
- expiry_rule: "",
673
- serial_no_rule: "",
674
- example: "846566916863",
675
- state: 0,
676
- create_at: "2023-08-27 16:32:10",
677
- update_at: "2023-08-27 16:32:10",
678
- },
679
- {
680
- id: 37,
681
- rule_name: "00开头8位69码",
682
- length: 8,
683
- start_value: "00",
684
- upc_rule: {
685
- start: 0,
686
- length: 8,
687
- },
688
- batch_no_rule: "",
689
- manufacture_rule: "",
690
- expiry_rule: "",
691
- serial_no_rule: "",
692
- example: "00000000",
693
- state: 0,
694
- create_at: "2023-08-27 16:32:10",
695
- update_at: "2023-08-27 16:32:10",
696
- },
697
- {
698
- id: 38,
699
- rule_name: "36开头13位69码",
700
- length: 13,
701
- start_value: "36",
702
- upc_rule: {
703
- start: 0,
704
- length: 13,
705
- },
706
- batch_no_rule: "",
707
- manufacture_rule: "",
708
- expiry_rule: "",
709
- serial_no_rule: "",
710
- example: "3614273430272",
711
- state: 0,
712
- create_at: "2023-08-27 16:32:10",
713
- update_at: "2023-08-27 16:32:10",
714
- },
715
- {
716
- id: 39,
717
- rule_name: "00开头9位69码",
718
- length: 9,
719
- start_value: "00",
720
- upc_rule: {
721
- start: 0,
722
- length: 9,
723
- },
724
- batch_no_rule: "",
725
- manufacture_rule: "",
726
- expiry_rule: "",
727
- serial_no_rule: "",
728
- example: "000000000",
729
- state: 0,
730
- create_at: "2023-08-27 16:32:10",
731
- update_at: "2023-08-27 16:32:10",
732
- },
733
- {
734
- id: 40,
735
- rule_name: "01开头51位二维码",
736
- length: 51,
737
- start_value: "01",
738
- upc_rule: {
739
- start: 3,
740
- length: 13,
741
- },
742
- batch_no_rule: {
743
- start: 34,
744
- length: 10,
745
- },
746
- manufacture_rule: {
747
- start: 18,
748
- length: 6,
749
- },
750
- expiry_rule: {
751
- start: 26,
752
- length: 6,
753
- },
754
- serial_no_rule: {
755
- start: 46,
756
- length: 5,
757
- },
758
- example: "010471989049619511230403172803311023D032958521NAAJK",
759
- state: 0,
760
- create_at: "2023-08-27 16:32:10",
761
- update_at: "2023-08-27 16:32:10",
762
- },
763
- {
764
- id: 41,
765
- rule_name: "01开头48位二维码",
766
- length: 48,
767
- start_value: "01",
768
- upc_rule: {
769
- start: 3,
770
- length: 13,
771
- },
772
- batch_no_rule: {
773
- start: 34,
774
- length: 8,
775
- },
776
- manufacture_rule: {
777
- start: 18,
778
- length: 6,
779
- },
780
- expiry_rule: {
781
- start: 26,
782
- length: 6,
783
- },
784
- serial_no_rule: {
785
- start: 44,
786
- length: 4,
787
- },
788
- example: "010471989049651511230410172803311010341050210567",
789
- state: 0,
790
- create_at: "2023-08-27 16:32:10",
791
- update_at: "2023-08-27 16:32:10",
792
- },
793
- {
794
- id: 42,
795
- rule_name: "01开头49位二维码",
796
- length: 49,
797
- start_value: "01",
798
- upc_rule: {
799
- start: 3,
800
- length: 13,
801
- },
802
- batch_no_rule: {
803
- start: 34,
804
- length: 8,
805
- },
806
- manufacture_rule: {
807
- start: 18,
808
- length: 6,
809
- },
810
- expiry_rule: {
811
- start: 26,
812
- length: 6,
813
- },
814
- serial_no_rule: {
815
- start: 44,
816
- length: 5,
817
- },
818
- example: "0106931150122684112303101725030910202303102118836",
819
- state: 0,
820
- create_at: "2023-08-27 16:32:10",
821
- update_at: "2023-08-27 16:32:10",
822
- },
823
- {
824
- id: 43,
825
- rule_name: "47开头20位二维码",
826
- length: 20,
827
- start_value: "47",
828
- upc_rule: {
829
- start: 0,
830
- length: 13,
831
- },
832
- batch_no_rule: "",
833
- manufacture_rule: "",
834
- expiry_rule: "",
835
- serial_no_rule: "",
836
- example: "47198860589250000037",
837
- state: 0,
838
- create_at: "2023-08-27 16:32:10",
839
- update_at: "2023-08-27 16:32:10",
840
- },
841
- {
842
- id: 44,
843
- rule_name: "01开头42位二维码",
844
- length: 42,
845
- start_value: "01",
846
- upc_rule: {
847
- start: 3,
848
- length: 13,
849
- },
850
- batch_no_rule: {
851
- start: 34,
852
- length: 8,
853
- },
854
- manufacture_rule: {
855
- start: 18,
856
- length: 6,
857
- },
858
- expiry_rule: {
859
- start: 26,
860
- length: 6,
861
- },
862
- serial_no_rule: "",
863
- example: "010693548538897511230826172508251023082601",
864
- state: 0,
865
- create_at: "2023-08-27 16:32:10",
866
- update_at: "2023-08-27 16:32:10",
867
- },
868
- {
869
- id: 45,
870
- rule_name: "50开头36位二维码",
871
- length: 36,
872
- start_value: "50",
873
- upc_rule: {
874
- start: 0,
875
- length: 16,
876
- },
877
- batch_no_rule: "",
878
- manufacture_rule: "",
879
- expiry_rule: "",
880
- serial_no_rule: "",
881
- example: "5093100302160000016022A31171761QAABH",
882
- state: 0,
883
- create_at: "2023-08-27 16:32:10",
884
- update_at: "2023-08-27 16:32:10",
885
- },
886
- {
887
- id: 46,
888
- rule_name: "24开头14位69码",
889
- length: 14,
890
- start_value: "24",
891
- upc_rule: {
892
- start: 0,
893
- length: 14,
894
- },
895
- batch_no_rule: "",
896
- manufacture_rule: "",
897
- expiry_rule: "",
898
- serial_no_rule: "",
899
- example: "24010400000001",
900
- state: 0,
901
- create_at: "2023-08-27 16:32:10",
902
- update_at: "2023-08-27 16:32:10",
903
- },
904
- {
905
- id: 47,
906
- rule_name: "23开头14位69码",
907
- length: 14,
908
- start_value: "23",
909
- upc_rule: {
910
- start: 0,
911
- length: 14,
912
- },
913
- batch_no_rule: "",
914
- manufacture_rule: "",
915
- expiry_rule: "",
916
- serial_no_rule: "",
917
- example: "23101201000002",
918
- state: 0,
919
- create_at: "2023-08-27 16:32:10",
920
- update_at: "2023-08-27 16:32:10",
921
- },
922
- {
923
- id: 48,
924
- rule_name: "15开头16位69码",
925
- length: 15,
926
- start_value: "16",
927
- upc_rule: {
928
- start: 0,
929
- length: 15,
930
- },
931
- batch_no_rule: "",
932
- manufacture_rule: "",
933
- expiry_rule: "",
934
- serial_no_rule: "",
935
- example: "161031385340001",
936
- state: 0,
937
- create_at: "2023-08-27 16:32:10",
938
- update_at: "2023-08-27 16:32:10",
939
- },
940
- {
941
- id: 49,
942
- rule_name: "36开头13位69码",
943
- length: 13,
944
- start_value: "34",
945
- upc_rule: {
946
- start: 0,
947
- length: 13,
948
- },
949
- batch_no_rule: "",
950
- manufacture_rule: "",
951
- expiry_rule: "",
952
- serial_no_rule: "",
953
- example: "3474636883240",
954
- state: 0,
955
- create_at: "2023-08-27 16:32:10",
956
- update_at: "2023-08-27 16:32:10",
957
- },
958
- {
959
- id: 50,
960
- rule_name: "48开头13位69码",
961
- length: 13,
962
- start_value: "48",
963
- upc_rule: {
964
- start: 0,
965
- length: 13,
966
- },
967
- batch_no_rule: "",
968
- manufacture_rule: "",
969
- expiry_rule: "",
970
- serial_no_rule: "",
971
- example: "4891338004527",
972
- state: 0,
973
- create_at: "2023-08-27 16:32:10",
974
- update_at: "2023-08-27 16:32:10",
975
- },
976
- {
977
- id: 51,
978
- rule_name: "32开头13位69码",
979
- length: 13,
980
- start_value: "32",
981
- upc_rule: {
982
- start: 0,
983
- length: 13,
984
- },
985
- batch_no_rule: "",
986
- manufacture_rule: "",
987
- expiry_rule: "",
988
- serial_no_rule: "",
989
- example: "3253581359280",
990
- state: 0,
991
- create_at: "2023-08-27 16:32:10",
992
- update_at: "2023-08-27 16:32:10",
993
- },
994
- {
995
- id: 52,
996
- rule_name: "01开头41位二维码",
997
- length: 41,
998
- start_value: "01",
999
- upc_rule: {
1000
- start: 3,
1001
- length: 13,
1002
- },
1003
- batch_no_rule: {
1004
- start: 34,
1005
- length: 7,
1006
- },
1007
- manufacture_rule: {
1008
- start: 18,
1009
- length: 6,
1010
- },
1011
- expiry_rule: {
1012
- start: 26,
1013
- length: 6,
1014
- },
1015
- serial_no_rule: "",
1016
- example: "0106941792737542112503241730032310RM01961",
1017
- state: 0,
1018
- create_at: "2023-08-27 16:32:10",
1019
- update_at: "2023-08-27 16:32:10",
1020
- },
1021
- {
1022
- id: 53,
1023
- rule_name: "69开头12位69码",
1024
- length: 12,
1025
- start_value: "69",
1026
- upc_rule: {
1027
- start: 0,
1028
- length: 12,
1029
- },
1030
- batch_no_rule: "",
1031
- manufacture_rule: "",
1032
- expiry_rule: "",
1033
- serial_no_rule: "",
1034
- example: "694798560010",
1035
- state: 0,
1036
- create_at: "2023-08-27 16:32:10",
1037
- update_at: "2023-08-27 16:32:10",
1038
- },
1039
- {
1040
- id: 54,
1041
- rule_name: "01开头40位二维码",
1042
- length: 40,
1043
- start_value: "01",
1044
- upc_rule: {
1045
- start: 3,
1046
- length: 13,
1047
- },
1048
- batch_no_rule: {
1049
- start: 34,
1050
- length: 6,
1051
- },
1052
- manufacture_rule: {
1053
- start: 18,
1054
- length: 6,
1055
- },
1056
- expiry_rule: {
1057
- start: 26,
1058
- length: 6,
1059
- },
1060
- serial_no_rule: "",
1061
- example: "0109555650149179112306011728053110586036",
1062
- state: 0,
1063
- create_at: "2023-08-27 16:32:10",
1064
- update_at: "2023-08-27 16:32:10",
1065
- },
1066
- {
1067
- id: 55,
1068
- rule_name: "77开头12位69码",
1069
- length: 12,
1070
- start_value: "77",
1071
- upc_rule: {
1072
- start: 0,
1073
- length: 12,
1074
- },
1075
- batch_no_rule: "",
1076
- manufacture_rule: "",
1077
- expiry_rule: "",
1078
- serial_no_rule: "",
1079
- example: "773602237197",
1080
- state: 0,
1081
- create_at: "2023-08-27 16:32:10",
1082
- update_at: "2023-08-27 16:32:10",
1083
- },
1084
- {
1085
- id: 56,
1086
- rule_name: "01开头57位二维码",
1087
- length: 57,
1088
- start_value: "01",
1089
- upc_rule: {
1090
- start: 3,
1091
- length: 13,
1092
- },
1093
- batch_no_rule: {
1094
- start: 34,
1095
- length: 10,
1096
- },
1097
- manufacture_rule: {
1098
- start: 18,
1099
- length: 6,
1100
- },
1101
- expiry_rule: {
1102
- start: 26,
1103
- length: 6,
1104
- },
1105
- serial_no_rule: {
1106
- start: 49,
1107
- length: 8,
1108
- },
1109
- example: "0106941891825065112307011728060110F32307K0020292100200123",
1110
- state: 0,
1111
- create_at: "2023-08-27 16:32:10",
1112
- update_at: "2023-08-27 16:32:10",
1113
- },
1114
- {
1115
- id: 57,
1116
- rule_name: "01开头43位二维码",
1117
- length: 43,
1118
- start_value: "01",
1119
- upc_rule: {
1120
- start: 3,
1121
- length: 13,
1122
- },
1123
- batch_no_rule: {
1124
- start: 34,
1125
- length: 9,
1126
- },
1127
- manufacture_rule: {
1128
- start: 18,
1129
- length: 6,
1130
- },
1131
- expiry_rule: {
1132
- start: 26,
1133
- length: 6,
1134
- },
1135
- serial_no_rule: "",
1136
- example: "0106941833160285112408231729082210U24802061",
1137
- state: 0,
1138
- create_at: "2023-08-27 16:32:10",
1139
- update_at: "2023-08-27 16:32:10",
1140
- },
1141
- {
1142
- id: 58,
1143
- rule_name: "01开头45位二维码",
1144
- length: 45,
1145
- start_value: "01",
1146
- upc_rule: {
1147
- start: 3,
1148
- length: 13,
1149
- },
1150
- batch_no_rule: {
1151
- start: 34,
1152
- length: 11,
1153
- },
1154
- manufacture_rule: {
1155
- start: 18,
1156
- length: 6,
1157
- },
1158
- expiry_rule: {
1159
- start: 26,
1160
- length: 6,
1161
- },
1162
- serial_no_rule: "",
1163
- example: "0106925845697496112505111730051010XC250511010",
1164
- state: 0,
1165
- create_at: "2023-08-27 16:32:10",
1166
- update_at: "2023-08-27 16:32:10",
1167
- },
1168
- {
1169
- id: 59,
1170
- rule_name: "01开头39位二维码",
1171
- length: 39,
1172
- start_value: "01",
1173
- upc_rule: {
1174
- start: 3,
1175
- length: 13,
1176
- },
1177
- batch_no_rule: {
1178
- start: 26,
1179
- length: 5,
1180
- },
1181
- manufacture_rule: {
1182
- start: 33,
1183
- length: 6,
1184
- },
1185
- expiry_rule: {
1186
- start: 18,
1187
- length: 6,
1188
- },
1189
- serial_no_rule: "",
1190
- example: "0100300651364026172701311012PC011250125",
1191
- state: 0,
1192
- create_at: "2023-08-27 16:32:10",
1193
- update_at: "2023-08-27 16:32:10",
1194
- },
1195
- ];
1196
-
1197
- class ScanUDI {
3
+ export default class ScanUDI {
1198
4
  constructor({ rules }) {
1199
5
  this.rules = rules;
1200
6
  // if (str) {
@@ -1211,6 +17,7 @@ class ScanUDI {
1211
17
  21: "serial_no",
1212
18
  };
1213
19
  parse(str) {
20
+ str = str.replace(/[^a-zA-Z0-9/()]/g, "");
1214
21
  if ((str && str.length < 8) || !str) {
1215
22
  return `请输入正确的条形码${str}`;
1216
23
  }
@@ -1245,8 +52,6 @@ class ScanUDI {
1245
52
  }
1246
53
  }
1247
54
  } else {
1248
- // let re = /[^\u4e00-\u9fa5a-zA-Z0-9]/g;
1249
- // str = str.replace(re, "");
1250
55
  if (
1251
56
  this.rules.every(
1252
57
  (v) => str.length != v.length || str.substring(0, 2) != v.start_value
@@ -1276,16 +81,55 @@ class ScanUDI {
1276
81
  }
1277
82
  });
1278
83
  }
1279
- return {
1280
- upc: this.removeFrontZeros(upc),
84
+ let obj = {
1281
85
  sku_number,
1282
- manufacture_time: this.setDateFormat(manufacture_time, "manufacture"),
1283
- expiry_time: this.setDateFormat(expiry_time, "expiry"),
1284
- batch_no,
1285
86
  serial_no,
1286
87
  };
88
+ try {
89
+ obj.upc = this.removeFrontZeros(upc);
90
+ } catch (error) {
91
+ console.log(error, "upc error");
92
+ obj.upc = upc;
93
+ }
94
+ try {
95
+ obj.manufacture_time = this.setDateFormat(
96
+ manufacture_time,
97
+ "manufacture"
98
+ );
99
+ } catch (error) {
100
+ console.log(error, "manufacture_time error");
101
+ obj.manufacture_time = manufacture_time;
102
+ }
103
+ try {
104
+ obj.manufacture_time = this.setDateFormat(
105
+ manufacture_time,
106
+ "manufacture"
107
+ );
108
+ } catch (error) {
109
+ console.log(error, "manufacture_time error");
110
+ obj.manufacture_time = manufacture_time;
111
+ }
112
+ try {
113
+ obj.expiry_time = this.setDateFormat(expiry_time, "expiry");
114
+ } catch (error) {
115
+ console.log(error, "expiry_time error");
116
+ obj.expiry_time = expiry_time;
117
+ }
118
+ try {
119
+ obj.batch_no = batch_no.toUpperCase();
120
+ } catch (error) {
121
+ console.log(error, "batch_no error");
122
+ obj.batch_no = batch_no;
123
+ }
124
+ return obj;
1287
125
  }
1288
126
  setDateFormat(date, type) {
127
+ if (date.length === 8 && data.substr(data.length - 2) == "00") {
128
+ if (type === "expiry") {
129
+ return dayjs(date).endOf("month").format("YYYYMMDD");
130
+ }
131
+ return dayjs(date).startOf("month").format("YYYYMMDD");
132
+ }
1289
133
  if (date.length === 6) {
1290
134
  // 年月(6位) - 202507
1291
135
  if (date.substring(0, 2) === "20") {
package/js/index.js CHANGED
@@ -110,10 +110,10 @@ export const getRandomNumber = (min, max) => {
110
110
  * 传type 返回 true false
111
111
  */
112
112
  export const isType = (data, type) => {
113
- if (type) {
114
- return Object.prototype.toString.call(data) === type;
115
- }
116
- return Object.prototype.toString.call(data);
113
+ const regex = /\[object (\w+)\]/;
114
+ let str = Object.prototype.toString.call(data);
115
+ const match = regex.exec(str);
116
+ return type ? match[1] === type : match[1];
117
117
  };
118
118
  /**
119
119
  * 时间戳转换成时间
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhl-methods",
3
- "version": "1.1.2",
3
+ "version": "1.1.5",
4
4
  "license": "ISC",
5
5
  "dependencies": {
6
6
  "dayjs": "^1.11.15",