自动化立体仓库 - WMS系统
#
yxFwq
2024-11-24 a7f0ee46f5a1b0ec8cf7bd3d0701bde6c09de24f
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
package com.zy.asrs.utils;
 
import java.util.regex.Pattern;
 
public class CodeDetectionUtil {
 
    /**
     * 检测货架码
     */
    public static boolean barcodeDetection(String barcode, int code) {
        Pattern pattern = Pattern.compile("\\d{" + code + "}");//位数字
        return pattern.matcher(barcode).matches();
    }
 
    /**
     * 检测小车地码
     */
    public static boolean carCodeDetection(String carCode) {
        return carCode.contains("_");
    }
 
    /**
     * 检测数组最大值及其索引
     */
    public static int[] crnCodeDetectionMax(int[] arr) {
        int max = arr[0];
        int index = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
                index = i;
            }
        }
        return new int[]{index, max};
    }
 
    /**
     * 检测数组最大值及其索引
     */
    public static int[] crnCodeDetectionMaxT(int[] arr,Integer crnNo) {
        int max = arr[0];
        int index = 0;
        for (int i = 0; i < arr.length; i++) {
            if (crnNo == i+1){
                continue;
            }
            if (arr[i] > max) {
                max = arr[i];
                index = i;
            }
        }
        return new int[]{index, max};
    }
 
    /**
     * 检测数组最小值及其索引
     */
    public static int[] crnCodeDetectionMin(int[] arr) {
        int min = arr[0];
        int index = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] < min) {
                min = arr[i];
                index = i;
            }
        }
        return new int[]{index, min};
    }
 
 
//    public static void main(String[] args) {
//        System.out.println("barcodeDetection:" + "22222222===>" + barcodeDetection("22222222", 7));
//        System.out.println("barcodeDetection:" + "222222===>" + barcodeDetection("222222", 7));
//        System.out.println("barcodeDetection:" + "111===>" + barcodeDetection("111", 7));
//        System.out.println("barcodeDetection:" + "DB_123ss===>" + barcodeDetection("DB_123ss", 7));
//        System.out.println("barcodeDetection:" + "12_1231===>" + barcodeDetection("12_1231", 7));
//        System.out.println("barcodeDetection:" + "DB_123456===>" + barcodeDetection("DB_123456", 7));
//
//        System.out.println("carCodeDetection:" + "22222222===>" + carCodeDetection("22222222"));
//        System.out.println("carCodeDetection:" + "222222===>" + carCodeDetection("222222"));
//        System.out.println("carCodeDetection:" + "111===>" + carCodeDetection("111"));
//        System.out.println("carCodeDetection:" + "DB_123ss===>" + carCodeDetection("DB_123ss"));
//        System.out.println("carCodeDetection:" + "12_1231===>" + carCodeDetection("12_1231"));
//        System.out.println("carCodeDetection:" + "DB_123456===>" + carCodeDetection("DB_123456"));
//    }
 
}