schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
 
namespace XImaging.Automation.Library.HxDriverLib.Tools
{
    public class PlateInfo
    {
        public int Colums { get; set; }
        public int Rows { get; set; }
 
        internal PlateInfo(int cols, int rows)
        {
            this.Colums = cols;
            this.Rows = rows;
        }
    }
 
    public class PlateHelper
    {
        /// <summary>
        /// 通过SBS板的数字编号获取对应孔的标准编号
        /// </summary>
        /// <param name="well_count">孔位数,一般有1孔板、6孔板、24孔板、96孔板、384孔板、1596孔板</param>
        /// <param name="well_index">孔位的数字编号</param>
        /// <returns>孔位的标准编号,如:A1, P12</returns>
        public static string GetWellName(int well_count, int well_index)
        {
            if (well_index > well_count || well_index < 0)
                return "";
 
            char row;
            int col;
 
            switch (well_count)
            {
                case 1:
                    return "A1";
                case 6:
                    row = Convert.ToChar((int)((well_index - 1) / 3) + 65);
                    col = well_index % 3 + 1;
                    return string.Format("{0}{1}", row, col);
                case 12:
                    row = Convert.ToChar((int)((well_index - 1) / 4) + 65);
                    col = well_index % 4 + 1;
                    return string.Format("{0}{1}", row, col);
                case 24:
                    row = Convert.ToChar((int)((well_index - 1) / 6) + 65);
                    col = well_index % 6 + 1;
                    return string.Format("{0}{1}", row, col);
                case 48:
                    row = Convert.ToChar((int)((well_index - 1) / 8) + 65);
                    col = well_index % 8 + 1;
                    return string.Format("{0}{1}", row, col);
                case 96:
                    row = Convert.ToChar((int)((well_index - 1) / 12) + 65);
                    col = well_index % 12 + 1;
                    return string.Format("{0}{1}", row, col);
                case 384:
                    row = Convert.ToChar((int)((well_index - 1) / 24) + 65);
                    col = well_index % 24 + 1;
                    return string.Format("{0}{1}", row, col);
                case 1536:
                    return string.Format("{0}", well_index);
                default:
                    return "";
            }
        }
 
        /// <summary>
        /// 获取SBS板的行列信息
        /// </summary>
        /// <param name="well_count">孔位数,一般有1孔板、6孔板、24孔板、96孔板、384孔板、1596孔板</param>
        /// <returns></returns>
        public static PlateInfo Info(int well_count)
        {
            switch (well_count)
            {
                case 1:
                    return new PlateInfo(1, 1);
                case 6:
                    return new PlateInfo(3, 2);
                case 12:
                    return new PlateInfo(4, 3);
                case 24:
                    return new PlateInfo(6, 4);
                case 48:
                    return new PlateInfo(8, 6);
                case 96:
                    return new PlateInfo(12, 8);
                case 384:
                    return new PlateInfo(24, 16);
                case 1536:
                    return new PlateInfo(48, 32);
                default:
                    return new PlateInfo(0, 0); ;
            }
        }
    }
}