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
|
}
|
}
|