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
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using XCommon;
 
namespace XImagingXhandler.XDAL
{
    /// <summary>
    /// 孔位数据检查
    /// </summary>
    public class WellCheck
    {
        #region 检查孔位号是否在某个板位上的耗材中
        /// <summary>
        /// 检查孔位号是否在某个板位上的耗材中
        /// </summary>
        /// <param name="xmlNode">台面板位xml节点对象</param>
        /// <param name="labware">耗材对象</param>
        /// <param name="lattice">板位对象</param>
        /// <param name="strWells">待验证的孔位名称数据</param>
        /// <returns></returns>
        public DataCheckResult CheckWellDataIsEnable(XmlNode xmlNode, Labware labware, Lattice lattice, string strWells)
        {
            //预处理已设置的孔位
            string[] tWells = strWells.Split(',');
            string sWell = string.Empty;
 
            DataCheckResult dataCheckResult = new DataCheckResult();
            dataCheckResult.result = 0;
            XmlNode xn = xmlNode.SelectSingleNode("platform[lattice_id=" + lattice.lattice_id + "][labware_id=" + labware.labware_id + "]");
            if (xn != null)
            {
                int row = (int)labware.number_row;
                int column = (int)labware.number_column;
 
 
                List<string> strings = GenerateAllWells(labware);
                for (int i = 0; i < tWells.Length; i++)
                {
                    if (!strings.Contains(tWells[i]))
                    {
                        dataCheckResult.result = 1;
                        sWell += tWells[i]+",";
                    }
                }
            }
            if(!string.IsNullOrEmpty(sWell))
            {
                dataCheckResult.missData = sWell;
            }
            return dataCheckResult;
        }
        #endregion
 
        #region 生成指定耗材的所有孔位名称
        /// <summary>
        /// 生成指定耗材的所有孔位名称
        /// </summary>
        /// <param name="labware">耗材实体</param>
        /// <returns>指定耗材的所有孔位名称集合</returns>
        public List<string> GenerateAllWells(Labware labware)
        {
            
            int row = (int)labware.number_row;
            int column = (int)labware.number_column;
            List<string> strWells = new List<string>();
 
            for (int i = 1; i < row + 1; i++)
            {
                string rowName = ComUtility.GetRowChar(i - 1);
 
                for (int j = 1; j < column + 1; j++)
                {
                    string wellName = rowName + j.ToString();
                    strWells.Add(wellName);
                }
            }
 
            return strWells;
        }
        #endregion
 
        #region 检查孔位是否连续的8排
        /// <summary>
        /// 检查孔位是否连续的8排
        /// </summary>
        /// <param name="labware">耗材对象</param>
        /// <param name="lattice">板位对象</param>
        /// <param name="strWells">待验证的孔位名称数据文本</param>
        /// <returns>验证结果对象</returns>
        public DataCheckResult CheckWellDataIsWhole8Line( Labware labware, Lattice lattice, string strWells)
        {
            //预处理已设置的孔位
            string[] tWells = strWells.Split(',');
            string misWells = string.Empty;//保存缺失的孔位
            DataCheckResult dataCheckResult = new DataCheckResult();
            dataCheckResult.result = 0;
 
            int row = (int)labware.number_row;
            int column = (int)labware.number_column;
 
            //竖着摆放
            for (int i = 1; i < column + 1; i++)
            {
                int countofLine = 0;//每列完整的孔位
                int countofColumn = 0;//整列全部缺少的孔位
                for (int j = 1; j < row + 1; j++)
                {
                    string rowName = ComUtility.GetRowChar(j - 1);
 
                    if(tWells.Contains(rowName))
                    {
                        countofLine += 1;
                    }
                    else
                    {
                        countofColumn += 1;
                        misWells += rowName+",";
                    }
                }
 
                if(countofLine< row && countofColumn< row)//缺少
                {
                    dataCheckResult.result = 1;
                    dataCheckResult.missData = misWells.Substring(0,misWells.Length-1);
                    return dataCheckResult;
                }
                if(countofColumn == row)//全部缺少
                {
 
                }
                if (countofLine == row)//全部完整
                {
 
                }
            }
 
            return dataCheckResult;
        }
        #endregion
    }
}