using DataEntity;
using DataEntity.Share;
using DataRWDAL;
using DriverLib.Engine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Linq;
using System.Runtime.Remoting.Channels;
using System.Xml;
using XCommon;
using XCommon.Log;
using XCore;
using XCoreBLL;
using XHandler.Controls.Run.Com;
using XHandler.View;
using XHandler.View.Liquids;
using XImagingXhandler.XDAL;
namespace XHandler.Controls
{
///
/// 文件开关盖移液执行
///
public class FileMoveLiquidControl
{
string strCurrentCulture = "";
WellCalc wellCalc = new WellCalc();
LatticeBll latticeBll = new LatticeBll();
FileMoveLiquidBll fileMoveLiquidBll = new FileMoveLiquidBll();
public RunWnd launchView = null;
LiquidAccuracyBll liquidAccuracyBll = new LiquidAccuracyBll();
PumpDispenseBll pumpDispenseBll = new PumpDispenseBll();
SwitchLidBll switchLidBll = new SwitchLidBll();
DispenseBll dispenseBll= new DispenseBll();
AspirateBll aspirateBll = new AspirateBll();
public FileMoveLiquidControl(string strCurrentCulture)
{
this.strCurrentCulture = strCurrentCulture;
}
#region 执行吸液,返回结果字符串
///
/// 执行吸液,返回结果字符串
///
/// 板位节点信息
/// 装载方法属性节点对象
/// z轴安全距离
/// 0:连接谁;1:仿真
///
public bool ExecuteFileMoveLiquid(XmlNode xmlEnv, XmlNode methodNode, float zAxisVal, bool isSimulator)
{
bool result = true;
HxResult ret = new HxResult();
if (launchView._cancelSource.IsCancellationRequested)
{
result = false;
return result;
}
#region Start Log
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strStart.ToString());
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】start:");
}
#endregion
#region 数据准备
var platformNodeList = xmlEnv.SelectNodes("platform");
MethodFileMoveLiquid methodFileMoveLiquid = fileMoveLiquidBll.GenerateMethodFileMoveLiquidDataByXmlNode(methodNode);
int recordAllCount = methodFileMoveLiquid.transferDataTable.Rows.Count; // 文件记录总数
int recordIndex = 0; // 循环控制总的切分次数
TipsTable tipsTable = new TipsTable(); // 执行的孔数据对象
int changeTipsMode = methodFileMoveLiquid.changeTipsMode;
bool bchannelTip=false;//是否更换了枪头; false: 已安装了枪头的状态;true:卸载了枪头的状态
bool bIsFirstDataWithZero = false;//是否是第一条为零体积的移液且没有要求更换枪头
#endregion
#region 数据检查
if (methodFileMoveLiquid == null)
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.RunFileMoveLiquidResource.strFileMoveLiquidDataCheckError.ToString());
result = false;
return result;
}
#endregion
#region 数据执行
//针对化学工作站,的移液枪,分别处理
//泵加液,没有安装枪头、卸载枪头步骤
if (methodFileMoveLiquid.armText.Equals("泵臂"))
{
while (recordIndex < recordAllCount)
{
string targetLattice = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.destinationLabware].ToString();
string globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, targetLattice);
if (!string.IsNullOrEmpty(globalVariableValue))
{
targetLattice = globalVariableValue;
}
XmlNode desPlatformNode = ComUtility.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), targetLattice);
if (desPlatformNode == null)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunFileMoveLiquidResource.strWithoutLattice.ToString());
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodFileMoveLiquid.name + "】progress: the lattice of dispense liquid from pump is wrong! please check!");
}
result = false;
return result;
}
else
{
XmlNode desXml = desPlatformNode.SelectSingleNode("labware[@id='" + desPlatformNode.SelectNodes("labware").Count + "']");
string desLabwareId = desXml.SelectSingleNode("labware_id").InnerText;
string desLatticeId = desPlatformNode.SelectSingleNode("lattice_id").InnerText;//被截掉"P"的板位编号名
Lattice desLattice = null;
TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断
if (tabletopTemplate == null)
{
desLattice = LatticeDB.GetLatticeDataByIdFromdb("P"+ desLatticeId, Convert.ToInt32(methodFileMoveLiquid.armValue), Shared.SoftwareInformation.software_device_number);
}
else
{
desLattice = LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb("P" + desLatticeId, Convert.ToInt32(methodFileMoveLiquid.armValue), Shared.SoftwareInformation.software_device_number, tabletopTemplate.tabletopid);
}
Labware labwares = LabwareDB.GetLabware(desLabwareId); //目标耗材
// 获取当前台面的板子吸液列的坐标
Lattice slattice = DataRWDAL.LatticeDB.GetLatticeDataByIdFromdb(desLattice.lattice_id); //目标板位
//获取板位孔的坐标数据
List dtWells = ControlCom.GenerateWellCoordinate(labwares, slattice); //目标板位孔坐标数据集
//根据循环处理孔位
string targetWell = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.destinationWell].ToString();
string targetVolume= methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.dpsVolume].ToString();
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, targetWell);
if (!string.IsNullOrEmpty(globalVariableValue))
{
targetWell = globalVariableValue;
}
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, targetVolume);
if (!string.IsNullOrEmpty(globalVariableValue))
{
targetVolume = globalVariableValue;
}
ScrewTubeCapMParam screwTubeCapMParam = new ScrewTubeCapMParam();
#region 判断执行开盖子
string dpsOpenLid = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.dpsOpenLid].ToString();
if (dpsOpenLid.Equals("1"))
{
// 获取当前台面的夹爪坐标
List gripperCoordinates = DataRWDAL.GripperCoordinateDB.GetAGripperCoordinateFromdb(Shared.SoftwareInformation.software_information_id, Convert.ToInt32(methodFileMoveLiquid.armValue) - 1, desLattice.lattice_num);
//转化成夹爪板位
Lattice glattice = new Lattice();
glattice.lattice_X = gripperCoordinates[0].lattice_X;
glattice.lattice_Y = gripperCoordinates[0].lattice_Y;
glattice.lattice_Z = gripperCoordinates[0].lattice_Z;
glattice.lattice_num = gripperCoordinates[0].lattice_num;
glattice.lattice_id = "";
// 获取板开盖位孔的坐标数据
List dtGripperWells = ControlCom.GenerateWellCoordinateForChemistry(labwares, glattice);
//离心管耗材对象
Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(labwares.piled_script);
//根据处理孔位
tipsTable = null;
tipsTable = dtGripperWells.SingleOrDefault(t => t.lattice_num.Equals(desLattice.lattice_num)
&& t.labware_id.Equals(desLabwareId)
&& t.wellname.Equals(targetWell));
screwTubeCapMParam.tubeRackNo = Convert.ToInt32(desLattice.lattice_num.Substring(1)); //板位号,数字部分
screwTubeCapMParam.tubeCol = Convert.ToInt32(targetWell.Substring(1)); //孔所在列号,数字部分
screwTubeCapMParam.tubeScrewPitch = (float)centrifugalLabware.well_helical_distance;//螺纹螺距
screwTubeCapMParam.tubeDiameter = (float)centrifugalLabware.well_mouth_out_radius * 2; //离心管主管外径
screwTubeCapMParam.tubeRow = 0;
screwTubeCapMParam.capDiameter = (float)centrifugalLabware.lid_out_radius * 2;
screwTubeCapMParam.capExpandDistance = (float)centrifugalLabware.upgripper_spread;
screwTubeCapMParam.capPushDistance = (float)centrifugalLabware.upgripper_squeeze;
screwTubeCapMParam.capPushForce = (float)centrifugalLabware.upgripper_power;
screwTubeCapMParam.capScrewAngle = new float[] { (float)centrifugalLabware.well_helical_circle * 360 };
screwTubeCapMParam.capScrewSpeed = (float)30;
screwTubeCapMParam.capScrewDistance = new float[] { (float)centrifugalLabware.well_helical_distance * (float)Math.Ceiling(centrifugalLabware.well_helical_circle) };
screwTubeCapMParam.slotNo = 1;
screwTubeCapMParam.basezAxisVal = 0;
//下夹爪
screwTubeCapMParam.x2AxisVal = 0;
screwTubeCapMParam.y2AxisVal = 0;
screwTubeCapMParam.tubePushDistance = (float)centrifugalLabware.downgripper_squeeze;
screwTubeCapMParam.tubeExpandDistance = (float)centrifugalLabware.downgripper_spread;
screwTubeCapMParam.tubePushForce = (float)centrifugalLabware.downgripper_power;
screwTubeCapMParam.isKeepLowerGripperClamped = true;
//上夹爪
screwTubeCapMParam.xAxisVal = tipsTable.axis_b_X;
screwTubeCapMParam.yAxisVal = tipsTable.axis_b_Y;
screwTubeCapMParam.zAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).labware_height) + (float)centrifugalLabware.upgripper_zoffset;//孔口
launchView.SetWaitOne();//暂停
ret = switchLidBll.ExecuteSwitchLid(screwTubeCapMParam, 0, isSimulator);
if (ret.Result != ResultType.Success)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
}
}
}
#endregion
#region 构建参数执行泵排液
tipsTable = null;
tipsTable = dtWells.SingleOrDefault(t => t.lattice_id.Equals(desLattice.lattice_id)
&& t.labware_id.Equals(desLabwareId)
&& t.wellname.Equals(targetWell));
AddLiquidMParamSH addLiquidMParamSH = new AddLiquidMParamSH();
addLiquidMParamSH.armId = Convert.ToInt32(methodFileMoveLiquid.armValue);
int[] channels = new int[methodFileMoveLiquid.channels.Length];
float[] fVolumes = new float[methodFileMoveLiquid.channels.Length];
float[] xVals = new float[methodFileMoveLiquid.channels.Length];
float[] yVals = new float[methodFileMoveLiquid.channels.Length];
addLiquidMParamSH.channelId = channels;
addLiquidMParamSH.channelCount = methodFileMoveLiquid.channels.Length;
Liquid liquid = null;
for (int i = 0; i < methodFileMoveLiquid.channels.Length; i++)
{
channels[i] = Convert.ToInt32(methodFileMoveLiquid.channels[i]);
fVolumes[i] = (float)Convert.ToDouble(targetVolume);
xVals[i] = (float)tipsTable.axis_b_X;
yVals[i] = (float)tipsTable.axis_b_Y;
// 液体参数
liquid = LiquidDB.GetALiquidFromdb(methodFileMoveLiquid.liquidpidValue);
}
addLiquidMParamSH.volume = fVolumes;
addLiquidMParamSH.xAxisVal = xVals;
addLiquidMParamSH.yAxisVal = yVals;
addLiquidMParamSH.zAxisVal = tipsTable.axis_b_Z;
addLiquidMParamSH.speed = (float)liquid.dispense_speed;
addLiquidMParamSH.addLiquidAfterDelay = liquid.after_dispense_delay;
addLiquidMParamSH.basezAxisVal = 0;
launchView.SetWaitOne();//暂停
ret = pumpDispenseBll.ExecutePumpDispense(addLiquidMParamSH, isSimulator);
if (ret.Result != ResultType.Success)
{
//添加数据进入报表
string channelTxt = string.Join(",", channels);
launchView.addDataIntoReport("泵" + channelTxt, targetVolume, new string[1] { tipsTable.wellname }, "block");//来源泵
launchView.addFinishDataIntoReport(tipsTable, slattice.lattice_num, targetVolume, new string[1] { tipsTable.wellname }, "block", new string[1] { "" });//目标孔
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseFail.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseFail.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress: Pump dispense was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress: Pump dispense was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
//添加数据进入报表
string channelTxt = string.Join(",", channels);
launchView.addDataIntoReport("泵"+channelTxt, targetVolume, new string[1] { tipsTable.wellname }, "pass");//来源泵
launchView.addFinishDataIntoReport(tipsTable, slattice.lattice_num, targetVolume, new string[1] { tipsTable.wellname },"pass",new string[1] {""});//目标孔
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress:Pump dispense was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress:Pump dispense was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
}
}
#endregion
#region 构建参数执行关盖
string dpsCloseLid = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.dpsCloseLid].ToString();
if (dpsCloseLid.Equals("1"))
{
launchView.SetWaitOne();//暂停
ret = switchLidBll.ExecuteSwitchLid(screwTubeCapMParam, 1, isSimulator);
if (ret.Result != ResultType.Success)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to close lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to close lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to closed lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to closed lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
}
}
}
#endregion
recordIndex = recordIndex + 1;
}
}
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.RunTransferFileResource.strAllStepsCompleted.ToString());
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.RunTransferFileResource.strAllStepsCompleted.ToString());
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】All steps of " + methodFileMoveLiquid.name + " have been completed;");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】All steps of " + methodFileMoveLiquid.name + " have been completed;");
}
}
else
//非泵臂加液
{
while (recordIndex < recordAllCount)
{
bool currentExecuteTargetOpenLid = false;//当前是否执行过目标孔开盖
string volumeTxt = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.aspVolume].ToString();
string volumeVariableValue = "";
float aspvolume = 0f;
volumeVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, volumeTxt);
if (!string.IsNullOrEmpty(volumeVariableValue))
{
aspvolume = (float)Convert.ToInt32(volumeVariableValue);
}
else
{
aspvolume = (float)Convert.ToInt32(volumeTxt);
}
if (aspvolume == 0f && methodFileMoveLiquid.jump0Volume)
{
#region 执行安装枪头
if (recordIndex == 0)
{
if (!bIsFirstDataWithZero)
{
// 自动计算位置安装Tip
bool bLoadTipResult = ControlCom.LoadTipAutomation(xmlEnv.SelectNodes("platform"), methodNode,
isSimulator, launchView, null, 0);
if (!bLoadTipResult)
{
return false;
}
bchannelTip = false;
}
if (changeTipsMode == 0)
{
bIsFirstDataWithZero = true;
}
}
else
{
//if (changeTipsMode == 0)
//{
//}
//else
//{
// if (bchannelTip)
// {
// // 自动计算位置安装Tip
// bool bLoadTipResult = ControlCom.LoadTipAutomation(xmlEnv.SelectNodes("platform"), methodNode,
// isSimulator, launchView, null, 0);
// if (!bLoadTipResult)
// {
// return false;
// }
// }
//}
}
#endregion
}
else
{
#region 来源过程处理
string sourceLattice = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.sourceLabware].ToString();
string tipSet = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.tipSet].ToString();
string globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, sourceLattice);
if (!string.IsNullOrEmpty(globalVariableValue))
{
sourceLattice = globalVariableValue;
}
XmlNode srcPlatformNode = ComUtility.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), sourceLattice);
if (srcPlatformNode == null)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunFileMoveLiquidResource.strWithoutAapirateOfLattice.ToString());
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodFileMoveLiquid.name + "】progress: the lattice of aspirate liquid is wrong! please check!");
}
result = false;
return result;
}
else
{
XmlNode srcXml = srcPlatformNode.SelectSingleNode("labware[@id='" + srcPlatformNode.SelectNodes("labware").Count + "']");
string srcLabwareId = srcXml.SelectSingleNode("labware_id").InnerText;
string srcLatticeId = srcPlatformNode.SelectSingleNode("lattice_id").InnerText;//被截掉"P"的板位编号名
Lattice srcLattice = null;
TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断
if (tabletopTemplate == null)
{
srcLattice = LatticeDB.GetLatticeDataByIdFromdb("P" + srcLatticeId, Convert.ToInt32(methodFileMoveLiquid.armValue), Shared.SoftwareInformation.software_device_number);
}
else
{
srcLattice = LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb("P" + srcLatticeId, Convert.ToInt32(methodFileMoveLiquid.armValue), Shared.SoftwareInformation.software_device_number, tabletopTemplate.tabletopid);
}
Labware labwares = LabwareDB.GetLabware(srcLabwareId); //目标耗材
// 获取当前台面的板子吸液列的坐标
Lattice slattice = DataRWDAL.LatticeDB.GetLatticeDataByIdFromdb(srcLattice.lattice_id); //目标板位
//获取板位孔的坐标数据
//根据循环处理孔位
string sourceWell = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.sourceWell].ToString();
string souceVolume = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.aspVolume].ToString();
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, sourceWell);
if (!string.IsNullOrEmpty(globalVariableValue))
{
sourceWell = globalVariableValue;
}
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, souceVolume);
if (!string.IsNullOrEmpty(globalVariableValue))
{
souceVolume = globalVariableValue;
}
#region 执行安装枪头
if (recordIndex == 0)
{
// 自动计算位置安装Tip
bool bLoadTipResult = ControlCom.LoadTipAutomation(xmlEnv.SelectNodes("platform"), methodNode,
isSimulator, launchView, null, 0);
if (!bLoadTipResult)
{
return false;
}
bchannelTip = false;
}
else
{
if (changeTipsMode == 0)
{
}
else
{
if (bchannelTip)
{
// 自动计算位置安装Tip
bool bLoadTipResult = ControlCom.LoadTipAutomation(xmlEnv.SelectNodes("platform"), methodNode,
isSimulator, launchView, null, 0);
if (!bLoadTipResult)
{
return false;
}
}
}
}
#endregion
List dtsrcWells = ControlCom.GenerateWellCoordinate(labwares, slattice); //目标板位孔坐标数据集
ScrewTubeCapMParam screwTubeCapMParam = new ScrewTubeCapMParam();
#region 判断执行开盖子
string aspOpenLid = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.aspOpenLid].ToString();
if (aspOpenLid.Equals("1"))
{
// 获取当前台面的夹爪坐标
List gripperCoordinates = DataRWDAL.GripperCoordinateDB.GetAGripperCoordinateFromdb(Shared.SoftwareInformation.software_information_id, 19, srcLattice.lattice_num);
//转化成夹爪板位
Lattice glattice = new Lattice();
glattice.lattice_X = gripperCoordinates[0].lattice_X;
glattice.lattice_Y = gripperCoordinates[0].lattice_Y;
glattice.lattice_Z = gripperCoordinates[0].lattice_Z;
glattice.lattice_num = gripperCoordinates[0].lattice_num;
glattice.lattice_id = "";
// 获取板开盖位孔的坐标数据
List dtGripperWells = ControlCom.GenerateWellCoordinateForChemistry(labwares, glattice);
//离心管耗材对象
Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(labwares.piled_script);
//根据处理孔位
tipsTable = null;
tipsTable = dtGripperWells.SingleOrDefault(t => t.lattice_num.Equals(srcLattice.lattice_num)
&& t.labware_id.Equals(srcLabwareId)
&& t.wellname.Equals(sourceWell));
tipsTable.axis_b_Z = tipsTable.axis_b_Z + ControlCom.CurrentLengthOfTip;//被减的枪头要加回来
screwTubeCapMParam.tubeRackNo = Convert.ToInt32(srcLattice.lattice_num.Substring(1)); //板位号,数字部分
screwTubeCapMParam.tubeCol = Convert.ToInt32(sourceWell.Substring(1)); //孔所在列号,数字部分
screwTubeCapMParam.tubeScrewPitch = (float)centrifugalLabware.well_helical_distance;//螺纹螺距
screwTubeCapMParam.tubeDiameter = (float)centrifugalLabware.well_mouth_out_radius * 2; //离心管主管外径
screwTubeCapMParam.tubeRow = 0;
screwTubeCapMParam.capDiameter = (float)centrifugalLabware.lid_out_radius * 2;
screwTubeCapMParam.capExpandDistance = (float)centrifugalLabware.upgripper_spread;
screwTubeCapMParam.capPushDistance = (float)centrifugalLabware.upgripper_squeeze;
screwTubeCapMParam.capPushForce = (float)centrifugalLabware.upgripper_power;
screwTubeCapMParam.capScrewAngle = new float[] { (float)centrifugalLabware.well_helical_circle * 360 };
screwTubeCapMParam.capScrewSpeed = (float)30;
screwTubeCapMParam.capScrewDistance = new float[] { (float)centrifugalLabware.well_helical_distance * (float)Math.Ceiling(centrifugalLabware.well_helical_circle) };
screwTubeCapMParam.slotNo = 1;
screwTubeCapMParam.basezAxisVal = 0;
//下夹爪
screwTubeCapMParam.x2AxisVal = 0;
screwTubeCapMParam.y2AxisVal = 0;
screwTubeCapMParam.tubePushDistance = (float)centrifugalLabware.downgripper_squeeze;
screwTubeCapMParam.tubeExpandDistance = (float)centrifugalLabware.downgripper_spread;
screwTubeCapMParam.tubePushForce = (float)centrifugalLabware.downgripper_power;
screwTubeCapMParam.isKeepLowerGripperClamped = true;
//上夹爪
screwTubeCapMParam.xAxisVal = tipsTable.axis_b_X;
screwTubeCapMParam.yAxisVal = tipsTable.axis_b_Y;
screwTubeCapMParam.zAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).labware_height) + (float)centrifugalLabware.upgripper_zoffset;//孔口
launchView.SetWaitOne();//暂停
ret = switchLidBll.ExecuteSwitchLid(screwTubeCapMParam, 0, isSimulator);
tipsTable.axis_b_Z = tipsTable.axis_b_Z - ControlCom.CurrentLengthOfTip;//被加的枪头要减回来
if (ret.Result != ResultType.Success)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
}
}
}
else
{
//判断目标孔是否要开盖子,要开就先开目标孔的盖子
string ProtargetLattice = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.destinationLabware].ToString();
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, ProtargetLattice);
if (!string.IsNullOrEmpty(globalVariableValue))
{
ProtargetLattice = globalVariableValue;
}
XmlNode ProdesPlatformNode = ComUtility.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), ProtargetLattice);
if (ProdesPlatformNode == null)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunFileMoveLiquidResource.strWithoutLattice.ToString());
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodFileMoveLiquid.name + "】progress: the lattice of dispense liquid from pump is wrong! please check!");
}
result = false;
return result;
}
else
{
XmlNode desXml = ProdesPlatformNode.SelectSingleNode("labware[@id='" + ProdesPlatformNode.SelectNodes("labware").Count + "']");
string desLabwareId = desXml.SelectSingleNode("labware_id").InnerText;
string desLatticeId = ProdesPlatformNode.SelectSingleNode("lattice_id").InnerText;//被截掉"P"的板位编号名
Lattice desLattice = null;
TabletopTemplate ProtabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断
if (ProtabletopTemplate == null)
{
desLattice = LatticeDB.GetLatticeDataByIdFromdb("P" + desLatticeId, Convert.ToInt32(methodFileMoveLiquid.armValue), Shared.SoftwareInformation.software_device_number);
}
else
{
desLattice = LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb("P" + desLatticeId, Convert.ToInt32(methodFileMoveLiquid.armValue), Shared.SoftwareInformation.software_device_number, ProtabletopTemplate.tabletopid);
}
Labware Prolabwares = LabwareDB.GetLabware(desLabwareId); //目标耗材
// 获取当前台面的板子吸液列的坐标
Lattice Proslattice = DataRWDAL.LatticeDB.GetLatticeDataByIdFromdb(desLattice.lattice_id); //目标板位
//获取板位孔的坐标数据
List dtWells = ControlCom.GenerateWellCoordinate(Prolabwares, Proslattice); //目标板位孔坐标数据集
//根据循环处理孔位
string targetWell = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.destinationWell].ToString();
string targetVolume = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.dpsVolume].ToString();
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, targetWell);
if (!string.IsNullOrEmpty(globalVariableValue))
{
targetWell = globalVariableValue;
}
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, targetVolume);
if (!string.IsNullOrEmpty(globalVariableValue))
{
targetVolume = globalVariableValue;
}
ScrewTubeCapMParam ProscrewTubeCapMParam = new ScrewTubeCapMParam();
#region 判断执行开盖子
string dpsOpenLid = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.dpsOpenLid].ToString();
if (dpsOpenLid.Equals("1"))
{
// 获取当前台面的夹爪坐标
List gripperCoordinates = DataRWDAL.GripperCoordinateDB.GetAGripperCoordinateFromdb(Shared.SoftwareInformation.software_information_id, Shared.DeviceArmList.FirstOrDefault(x => x.arm_type.Equals(0)).device_arm_id, desLattice.lattice_num);
//转化成夹爪板位
Lattice glattice = new Lattice();
glattice.lattice_X = gripperCoordinates[0].lattice_X;
glattice.lattice_Y = gripperCoordinates[0].lattice_Y;
glattice.lattice_Z = gripperCoordinates[0].lattice_Z;
glattice.lattice_num = gripperCoordinates[0].lattice_num;
glattice.lattice_id = "";
// 获取板开盖位孔的坐标数据
List dtGripperWells = ControlCom.GenerateWellCoordinateForChemistry(Prolabwares, glattice);
//离心管耗材对象
Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(Prolabwares.piled_script);
//根据处理孔位
tipsTable = null;
tipsTable = dtGripperWells.SingleOrDefault(t => t.lattice_num.Equals(desLattice.lattice_num)
&& t.labware_id.Equals(desLabwareId)
&& t.wellname.Equals(targetWell));
tipsTable.axis_b_Z = tipsTable.axis_b_Z + ControlCom.CurrentLengthOfTip;//被减的枪头要加回来
ProscrewTubeCapMParam.tubeRackNo = Convert.ToInt32(desLattice.lattice_num.Substring(1)); //板位号,数字部分
ProscrewTubeCapMParam.tubeCol = Convert.ToInt32(targetWell.Substring(1)); //孔所在列号,数字部分
ProscrewTubeCapMParam.tubeScrewPitch = (float)centrifugalLabware.well_helical_distance;//螺纹螺距
ProscrewTubeCapMParam.tubeDiameter = (float)centrifugalLabware.well_mouth_out_radius * 2; //离心管主管外径
ProscrewTubeCapMParam.tubeRow = 0;
ProscrewTubeCapMParam.capDiameter = (float)centrifugalLabware.lid_out_radius * 2;
ProscrewTubeCapMParam.capExpandDistance = (float)centrifugalLabware.upgripper_spread;
ProscrewTubeCapMParam.capPushDistance = (float)centrifugalLabware.upgripper_squeeze;
ProscrewTubeCapMParam.capPushForce = (float)centrifugalLabware.upgripper_power;
ProscrewTubeCapMParam.capScrewAngle = new float[] { (float)centrifugalLabware.well_helical_circle * 360 };
ProscrewTubeCapMParam.capScrewSpeed = (float)30;
ProscrewTubeCapMParam.capScrewDistance = new float[] { (float)centrifugalLabware.well_helical_distance * (float)Math.Ceiling(centrifugalLabware.well_helical_circle) };
ProscrewTubeCapMParam.slotNo = 1;
ProscrewTubeCapMParam.basezAxisVal = 0;
//下夹爪
ProscrewTubeCapMParam.x2AxisVal = 0;
ProscrewTubeCapMParam.y2AxisVal = 0;
ProscrewTubeCapMParam.tubePushDistance = (float)centrifugalLabware.downgripper_squeeze;
ProscrewTubeCapMParam.tubeExpandDistance = (float)centrifugalLabware.downgripper_spread;
ProscrewTubeCapMParam.tubePushForce = (float)centrifugalLabware.downgripper_power;
ProscrewTubeCapMParam.isKeepLowerGripperClamped= true;
//上夹爪
ProscrewTubeCapMParam.xAxisVal = tipsTable.axis_b_X;
ProscrewTubeCapMParam.yAxisVal = tipsTable.axis_b_Y;
ProscrewTubeCapMParam.zAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(Prolabwares.piled_script).labware_height) + (float)centrifugalLabware.upgripper_zoffset;//孔口
launchView.SetWaitOne();//暂停
if (!currentExecuteTargetOpenLid)
{
ret = switchLidBll.ExecuteSwitchLid(ProscrewTubeCapMParam, 0, isSimulator);
tipsTable.axis_b_Z = tipsTable.axis_b_Z - ControlCom.CurrentLengthOfTip;//被加的枪头要减回来
if (ret.Result != ResultType.Success)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + Proslattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + Proslattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + Proslattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + Proslattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + Proslattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + Proslattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + Proslattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + Proslattice.lattice_num + " lattice!");
}
currentExecuteTargetOpenLid = true;
}
}
}
#endregion
}
currentExecuteTargetOpenLid = true;
}
#endregion
#region 构建参数执行枪吸液
tipsTable = null;
tipsTable = dtsrcWells.SingleOrDefault(t => t.lattice_id.Equals(srcLattice.lattice_id)
&& t.labware_id.Equals(srcLabwareId)
&& t.wellname.Equals(sourceWell));
AspirateMParam aspirateMParam = this.GenerateAspirateParam(methodNode, methodFileMoveLiquid, labwares, tipsTable, (float)Convert.ToDouble(souceVolume));
launchView.UpdateLabwareWells(tipsTable, new string[] { sourceWell }, 2); // 2:正在吸液红色
launchView.SetWaitOne();//暂停
ret = aspirateBll.ExecuteAspirate(aspirateMParam, isSimulator);
if (ret.Result != ResultType.Success)
{
//添加数据进入报表
launchView.addDataIntoReport(slattice.lattice_num, souceVolume, new string[1] { sourceWell }, "block");
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunAspirateResource.strAspirateFail.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunAspirateResource.strAspirateFail.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress: Aspirate was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress: Aspirate was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
//添加数据进入报表
launchView.addDataIntoReport(slattice.lattice_num, souceVolume, new string[1] { sourceWell }, "pass");
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunAspirateResource.strAspirateSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunAspirateResource.strAspirateSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress:Aspirate was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress:Aspirate was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
}
}
#endregion
#region 构建参数执行关盖
string aspCloseLid = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.aspCloseLid].ToString();
if (aspCloseLid.Equals("1"))
{
tipsTable.axis_b_Z = tipsTable.axis_b_Z + ControlCom.CurrentLengthOfTip;//被减的枪头要加回来
launchView.SetWaitOne();//暂停
screwTubeCapMParam.isKeepLowerGripperClamped = false;
ret = switchLidBll.ExecuteSwitchLid(screwTubeCapMParam, 1, isSimulator);
if (ret.Result != ResultType.Success)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to close lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to close lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to closed lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to closed lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
}
}
}
#endregion
}
#endregion
#region 目标过程处理
string targetLattice = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.destinationLabware].ToString();
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, targetLattice);
if (!string.IsNullOrEmpty(globalVariableValue))
{
targetLattice = globalVariableValue;
}
XmlNode desPlatformNode = ComUtility.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), targetLattice);
if (desPlatformNode == null)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunFileMoveLiquidResource.strWithoutLattice.ToString());
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodFileMoveLiquid.name + "】progress: the lattice of dispense liquid from pump is wrong! please check!");
}
result = false;
return result;
}
else
{
XmlNode desXml = desPlatformNode.SelectSingleNode("labware[@id='" + desPlatformNode.SelectNodes("labware").Count + "']");
string desLabwareId = desXml.SelectSingleNode("labware_id").InnerText;
string desLatticeId = desPlatformNode.SelectSingleNode("lattice_id").InnerText;//被截掉"P"的板位编号名
Lattice desLattice = null;
TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断
if (tabletopTemplate == null)
{
desLattice = LatticeDB.GetLatticeDataByIdFromdb("P" + desLatticeId, Convert.ToInt32(methodFileMoveLiquid.armValue), Shared.SoftwareInformation.software_device_number);
}
else
{
desLattice = LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb("P" + desLatticeId, Convert.ToInt32(methodFileMoveLiquid.armValue), Shared.SoftwareInformation.software_device_number, tabletopTemplate.tabletopid);
}
Labware labwares = LabwareDB.GetLabware(desLabwareId); //目标耗材
// 获取当前台面的板子吸液列的坐标
Lattice slattice = DataRWDAL.LatticeDB.GetLatticeDataByIdFromdb(desLattice.lattice_id); //目标板位
//获取板位孔的坐标数据
List dtWells = ControlCom.GenerateWellCoordinate(labwares, slattice); //目标板位孔坐标数据集
//根据循环处理孔位
string targetWell = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.destinationWell].ToString();
string targetVolume = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.dpsVolume].ToString();
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, targetWell);
if (!string.IsNullOrEmpty(globalVariableValue))
{
targetWell = globalVariableValue;
}
globalVariableValue = "";
globalVariableValue = ControlCom.SearchValueOfGlobalVariable(launchView, targetVolume);
if (!string.IsNullOrEmpty(globalVariableValue))
{
targetVolume = globalVariableValue;
}
ScrewTubeCapMParam screwTubeCapMParam = new ScrewTubeCapMParam();
#region 判断执行开盖子
string dpsOpenLid = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.dpsOpenLid].ToString();
if (dpsOpenLid.Equals("1"))
{
// 获取当前台面的夹爪坐标
List gripperCoordinates = DataRWDAL.GripperCoordinateDB.GetAGripperCoordinateFromdb(Shared.SoftwareInformation.software_information_id, Shared.DeviceArmList.FirstOrDefault(x => x.arm_type.Equals(0)).device_arm_id, desLattice.lattice_num);
//转化成夹爪板位
Lattice glattice = new Lattice();
glattice.lattice_X = gripperCoordinates[0].lattice_X;
glattice.lattice_Y = gripperCoordinates[0].lattice_Y;
glattice.lattice_Z = gripperCoordinates[0].lattice_Z;
glattice.lattice_num = gripperCoordinates[0].lattice_num;
glattice.lattice_id = "";
// 获取板开盖位孔的坐标数据
List dtGripperWells = ControlCom.GenerateWellCoordinateForChemistry(labwares, glattice);
//离心管耗材对象
Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(labwares.piled_script);
//根据处理孔位
tipsTable = null;
tipsTable = dtGripperWells.SingleOrDefault(t => t.lattice_num.Equals(desLattice.lattice_num)
&& t.labware_id.Equals(desLabwareId)
&& t.wellname.Equals(targetWell));
tipsTable.axis_b_Z = tipsTable.axis_b_Z + ControlCom.CurrentLengthOfTip;//被减的枪头要加回来
screwTubeCapMParam.tubeRackNo = Convert.ToInt32(desLattice.lattice_num.Substring(1)); //板位号,数字部分
screwTubeCapMParam.tubeCol = Convert.ToInt32(targetWell.Substring(1)); //孔所在列号,数字部分
screwTubeCapMParam.tubeScrewPitch = (float)centrifugalLabware.well_helical_distance;//螺纹螺距
screwTubeCapMParam.tubeDiameter = (float)centrifugalLabware.well_mouth_out_radius * 2; //离心管主管外径
screwTubeCapMParam.tubeRow = 0;
screwTubeCapMParam.capDiameter = (float)centrifugalLabware.lid_out_radius * 2;
screwTubeCapMParam.capExpandDistance = (float)centrifugalLabware.upgripper_spread;
screwTubeCapMParam.capPushDistance = (float)centrifugalLabware.upgripper_squeeze;
screwTubeCapMParam.capPushForce = (float)centrifugalLabware.upgripper_power;
screwTubeCapMParam.capScrewAngle = new float[] { (float)centrifugalLabware.well_helical_circle * 360 };
screwTubeCapMParam.capScrewSpeed = (float)30;
screwTubeCapMParam.capScrewDistance = new float[] { (float)centrifugalLabware.well_helical_distance * (float)Math.Ceiling(centrifugalLabware.well_helical_circle) };
screwTubeCapMParam.slotNo = 1;
screwTubeCapMParam.basezAxisVal = 0;
//下夹爪
screwTubeCapMParam.x2AxisVal = 0;
screwTubeCapMParam.y2AxisVal = 0;
screwTubeCapMParam.tubePushDistance = (float)centrifugalLabware.downgripper_squeeze;
screwTubeCapMParam.tubeExpandDistance = (float)centrifugalLabware.downgripper_spread;
screwTubeCapMParam.tubePushForce = (float)centrifugalLabware.downgripper_power;
screwTubeCapMParam.isKeepLowerGripperClamped = true;
//上夹爪
screwTubeCapMParam.xAxisVal = tipsTable.axis_b_X;
screwTubeCapMParam.yAxisVal = tipsTable.axis_b_Y;
screwTubeCapMParam.zAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).labware_height) + (float)centrifugalLabware.upgripper_zoffset;//孔口
launchView.SetWaitOne();//暂停
if (!currentExecuteTargetOpenLid)
{
ret = switchLidBll.ExecuteSwitchLid(screwTubeCapMParam, 0, isSimulator);
tipsTable.axis_b_Z = tipsTable.axis_b_Z - ControlCom.CurrentLengthOfTip;//被加的枪头要减回来
if (ret.Result != ResultType.Success)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
}
currentExecuteTargetOpenLid = true;
}
}
}
#endregion
#region 构建参数执行枪排液
tipsTable = null;
tipsTable = dtWells.SingleOrDefault(t => t.lattice_id.Equals(desLattice.lattice_id)
&& t.labware_id.Equals(desLabwareId)
&& t.wellname.Equals(targetWell));
DispenseMParam dispenseMParam = this.GenerateDispenseParam(methodNode, methodFileMoveLiquid, labwares, tipsTable, (float)Convert.ToDouble(targetVolume));
launchView.UpdateLabwareWells(tipsTable, new string[] { targetWell }, 3); // 正在放液水红色
DateTime startTime = DateTime.Now;
ret = dispenseBll.ExecuteDispense(dispenseMParam, isSimulator);
if (ret.Result != ResultType.Success)
{
launchView.addFinishDataIntoReport(tipsTable, slattice.lattice_num, targetVolume, new string[1] { tipsTable.wellname }, "block", new string[1] { "" });//目标孔
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseFail.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseFail.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress: Dispense was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress: Dispense was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
launchView.addFinishDataIntoReport(tipsTable, slattice.lattice_num, targetVolume, new string[1] { tipsTable.wellname }, "pass", new string[1] { "" });//目标孔
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress:Dispense was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】progress:Dispense was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
}
}
#endregion
#region 构建参数执行关盖
string dpsCloseLid = methodFileMoveLiquid.transferDataTable.Rows[recordIndex][methodFileMoveLiquid.dpsCloseLid].ToString();
if (dpsCloseLid.Equals("1"))
{
tipsTable.axis_b_Z = tipsTable.axis_b_Z + ControlCom.CurrentLengthOfTip;//被减的枪头要加回来
launchView.SetWaitOne();//暂停
screwTubeCapMParam.isKeepLowerGripperClamped = false;
if (currentExecuteTargetOpenLid)
{
ret = switchLidBll.ExecuteSwitchLid(screwTubeCapMParam, 1, isSimulator);
if (ret.Result != ResultType.Success)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to close lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: switch to close lid was failed on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
result = false;
return result;
}
else
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + slattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to closed lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:switch to closed lid was successful on " + tipsTable.wellname + " of " + slattice.lattice_num + " lattice!");
}
}
}
}
#endregion
#region 构建参数执行卸载枪头
if (changeTipsMode == 0)//不卸载
{
}
else if (changeTipsMode == 1)//根据文件内容卸载
{
if (tipSet.Equals("1"))
{
UnloadTipsControl unloadTipsControl = new UnloadTipsControl(Shared.SoftwareInformation.currentculture);
unloadTipsControl.launchView = launchView;
bool bUnloadResult = unloadTipsControl.ExecuteUnloadTipsInToTrash(platformNodeList, methodNode, isSimulator);
if (!bUnloadResult)
{
result = false;
return result;
}
launchView.currentIsLoadingTips = false;
bchannelTip = true;
}
else
{
}
}
else if (changeTipsMode == 2 || recordIndex == recordAllCount - 1)//最后一次都要下载枪头
{
UnloadTipsControl unloadTipsControl = new UnloadTipsControl(Shared.SoftwareInformation.currentculture);
unloadTipsControl.launchView = launchView;
bool bUnloadResult = unloadTipsControl.ExecuteUnloadTipsInToTrash(platformNodeList, methodNode, isSimulator);
if (!bUnloadResult)
{
result = false;
return result;
}
launchView.currentIsLoadingTips = false;
launchView.currentLengthOfTip = 0f;
bchannelTip = true;
bIsFirstDataWithZero = false;
}
if ((recordIndex == recordAllCount - 1) && changeTipsMode != 2)
{
UnloadTipsControl unloadTipsControl = new UnloadTipsControl(Shared.SoftwareInformation.currentculture);
unloadTipsControl.launchView = launchView;
bool bUnloadResult = unloadTipsControl.ExecuteUnloadTipsInToTrash(platformNodeList, methodNode, isSimulator);
if (!bUnloadResult)
{
result = false;
return result;
}
launchView.currentIsLoadingTips = false;
bchannelTip = true;
bIsFirstDataWithZero = false;
}
#endregion
}
#endregion
}
recordIndex = recordIndex + 1;
}
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.RunTransferFileResource.strAllStepsCompleted.ToString());
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】" + Properties.RunTransferFileResource.strAllStepsCompleted.ToString());
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】All steps of " + methodFileMoveLiquid.name + " have been completed;");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodFileMoveLiquid.name + "】All steps of " + methodFileMoveLiquid.name + " have been completed;");
}
}
#endregion
return result;
}
#endregion
#region 吸液参数对象构建
public AspirateMParam GenerateAspirateParam(XmlNode methodNode, MethodFileMoveLiquid methodFileMoveLiquid,
Labware labware, TipsTable tipsTable, float pVolume)
{
#region 数据准备
string liquididText = methodFileMoveLiquid.liquididText;
string liquididValue = methodFileMoveLiquid.liquididValue;
string liquidrangeidText = methodFileMoveLiquid.liquidrangeidText;
string liquidrangeidValue = methodFileMoveLiquid.liquidrangeidValue;
string liquidpidText = methodFileMoveLiquid.liquidpidText;
string liquidpidValue = methodFileMoveLiquid.liquidpidValue;
bool enableLiquidSensor = methodFileMoveLiquid.enableLiquidSensor;
int liquidSensorCount = Convert.ToInt32(methodFileMoveLiquid.liquidSensorCount);
double liquidSensorDistance = Convert.ToDouble(methodFileMoveLiquid.liquidSensorDistance);
double liquidSensorEndDistance = Convert.ToDouble(methodFileMoveLiquid.liquidSensorEndDistance);
double liquidSensorSpeed = Convert.ToDouble(methodFileMoveLiquid.liquidSensorSpeed);
double liquidSensorRadio = Convert.ToDouble(methodFileMoveLiquid.liquidSensorRadio);
string liquidSensorDisIdText = methodFileMoveLiquid.liquidSensorDisIdText;
double liquidSensorDisIdValue = methodFileMoveLiquid.liquidSensorDisIdValue;
bool enableLiquidFollow = methodFileMoveLiquid.enableLiquidFollow;
int liquidFollowType = Convert.ToInt32(methodFileMoveLiquid.liquidFollowType);
string liquidFollowTypeName = methodFileMoveLiquid.liquidFollowTypeName;
double liquidFollowSpeed = Convert.ToDouble(methodFileMoveLiquid.liquidFollowSpeed);
double liquidFollowDistance = Convert.ToDouble(methodFileMoveLiquid.liquidFollowDistance);
double liquidFollowArea = Convert.ToDouble(methodFileMoveLiquid.liquidFollowArea);
bool enableMixFollow = methodFileMoveLiquid.enableMixFollow;
string channelNums = string.Join(",", methodFileMoveLiquid.channels);
int[] chs = new int[methodFileMoveLiquid.channels.Length];
for (int m = 0; m < methodFileMoveLiquid.channels.Length; m++)
{
chs[m] = methodFileMoveLiquid.channels[m];
}
string[] wellnames = new string[methodFileMoveLiquid.channels.Length];
string[] indexLC = new string[methodFileMoveLiquid.channels.Length];
string[] tagCodeLC = new string[methodFileMoveLiquid.channels.Length];
float zAxisVals = 0f;
float pVolmunVals = 0f;
#endregion
// 液体参数
Liquid liquid = LiquidDB.GetALiquidFromdb(liquidpidValue);
AspirateMParam aspirateMParam = new AspirateMParam();
//aspirateMParam.channelCount = methodFileMoveLiquid.channels.Length;
//aspirateMParam.channelId = chs;
aspirateMParam.afterAirDelay = (int)liquid.after_aspirate_delay;
aspirateMParam.armId = Convert.ToInt32(methodFileMoveLiquid.armValue);
aspirateMParam.aspirateAcceleration = (float)liquid.aspirate_acceleration;
aspirateMParam.aspirateDeceleration = (float)liquid.aspirate_deceleration;
aspirateMParam.aspirateDelay = (int)liquid.aspirate_delay;
aspirateMParam.aspirateEnterSpeed = (float)liquid.aspirate_enter_speed;
aspirateMParam.aspirateOutSpeed = (float)liquid.aspirate_out_speed;
aspirateMParam.aspirateSpeed = (float)liquid.aspirate_speed;
aspirateMParam.basezAxisVal = (float)Convert.ToDouble(ConfigurationManager.AppSettings["zAxisSafeVal"]);
aspirateMParam.beforeAirDelay = (int)liquid.before_aspirate_delay;
#region 后吸空气
if ((float)liquid.after_aspirate_volume == 0f)
{
aspirateMParam.isAfterAir = false;
}
else
{
aspirateMParam.isAfterAir = true;
aspirateMParam.afterAirpAxisVal = (float)liquid.after_aspirate_volume;
}
#endregion
#region 前吸空气
if (liquid.before_aspirate_volume == 0d)
{
aspirateMParam.isBeforeAir = false;
}
else
{
aspirateMParam.isBeforeAir = true;
aspirateMParam.beforeAirpAxisVal = (float)liquid.before_aspirate_volume;
}
#endregion
aspirateMParam.liquidVolumeType = (int)Convert.ToInt32((liquid.liquid_volume_type != null ? "1" : liquid.liquid_volume_type));
//aspirateMParam.wellzAxisVal = (float)liquid.well_top_length; // 孔位平面的z轴
if (labware.labware_type_id.Equals("4"))
{
if (labware.labware_tubeshelf_type == 1)
{
ObservableCollection labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labware.labware_id);
LabwareWellInfo currentWellInfo = labwareWellInfoList.FirstOrDefault(x => x.labware_well_name.Equals(tipsTable.wellname));
aspirateMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id).labware_height);
}
else
{
aspirateMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height);
}
}
else
{
aspirateMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)labware.well_height);// - (float)liquid.well_top_length);
}
#region 碰壁
if (liquid.dispense_is_knock_wall == 0)
{
aspirateMParam.isKnockWall = false;
}
else
{
aspirateMParam.isKnockWall = true;
aspirateMParam.knockDirection = (int)liquid.knock_direction;
aspirateMParam.knockSpeed = Convert.ToInt32(liquid.knock_speed);
aspirateMParam.knockWallDelay = (int)liquid.knock_wall_delay;
aspirateMParam.knockWellxOryAxisVal = (float)liquid.knock_wall_length;
aspirateMParam.knockWellzAxisVal = (float)liquid.knock_well_height;
}
#endregion
aspirateMParam.isSurvey = false;// enableLiquidSensor;
if (aspirateMParam.isSurvey == true)
{
if (labware.labware_type_id.Equals("4"))
{
if (labware.labware_tubeshelf_type == 1)
{
ObservableCollection labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labware.labware_id);
LabwareWellInfo currentWellInfo = labwareWellInfoList.FirstOrDefault(x => x.labware_well_name.Equals(tipsTable.wellname));
aspirateMParam.surveyInitzVal = tipsTable.axis_b_Z - ((float)DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id).labware_height - (float)liquidSensorDistance);
aspirateMParam.surveyMaxzVal = tipsTable.axis_b_Z - ((float)DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id).labware_height - (float)liquidSensorEndDistance);
aspirateMParam.surveySpeed = (float)liquidSensorSpeed;
aspirateMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id).labware_height);
aspirateMParam.wellBottomzAxisVal = tipsTable.axis_b_Z;
}
else
{
Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(labware.piled_script);
aspirateMParam.surveyInitzVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height - (float)liquidSensorDistance);
aspirateMParam.surveyMaxzVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height - (float)liquidSensorEndDistance);
aspirateMParam.surveySpeed = (float)liquidSensorSpeed;
aspirateMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height);
aspirateMParam.wellBottomzAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height - (float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_height);
}
aspirateMParam.surveyFailHandleType = Convert.ToInt32(liquidSensorDisIdValue);
if (enableLiquidFollow)
{
aspirateMParam.followupType = liquidFollowType;
aspirateMParam.followupSpeed = (float)liquidFollowSpeed;
aspirateMParam.followupDistance = (float)liquidFollowDistance;
float area = 0.0f;
if (labware.well_shape == (int)WellSharpe.Round)
{
area = (float)(Math.PI * (float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_mouth_radius * (float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_mouth_radius);
}
else if (labware.well_shape == (int)WellSharpe.Rectangle)
{
area = (float)((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_top_x * (float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_top_y);
}
aspirateMParam.sectionalArea = area;
aspirateMParam.isMixFollowup = enableMixFollow;
}
else
{
}
}
else
{
//aspirateMParam.surveyRetryCount = liquidSensorCount;
aspirateMParam.surveyInitzVal = tipsTable.axis_b_Z - ((float)labware.well_height - (float)liquidSensorDistance);
aspirateMParam.surveyMaxzVal = tipsTable.axis_b_Z - ((float)labware.well_height - (float)liquidSensorEndDistance);
aspirateMParam.surveySpeed = (float)liquidSensorSpeed;
//aspirateMParam.surveyCoefficient =;
aspirateMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)labware.well_height);// - (float)liquid.well_top_length);
aspirateMParam.wellBottomzAxisVal = tipsTable.axis_b_Z;
aspirateMParam.surveyFailHandleType = Convert.ToInt32(liquidSensorDisIdValue);
if (enableLiquidFollow)
{
//aspirateMParam.followupType = liquidFollowType;
aspirateMParam.followupSpeed = (float)liquidFollowSpeed;
aspirateMParam.followupDistance = (float)liquidFollowDistance;
float area = 0.0f;
if (labware.well_shape == (int)WellSharpe.Round)
{
area = (float)(Math.PI * labware.well_mouth_radius * labware.well_mouth_radius);
}
else if (labware.well_shape == (int)WellSharpe.Rectangle)
{
area = (float)(labware.well_top_x * labware.well_top_y);
}
aspirateMParam.sectionalArea = area;
aspirateMParam.isMixFollowup = enableMixFollow;
}
else
{
}
}
}
else
{
}
aspirateMParam.isMix = methodFileMoveLiquid.baspMix;
if (aspirateMParam.isMix)
{
aspirateMParam.mixAspiratePositionValue = Convert.ToInt32(methodFileMoveLiquid.aspmixAspiratePositionValue);
aspirateMParam.mixAspiratePositionText = methodFileMoveLiquid.aspmixAspiratePositionText;
if (aspirateMParam.mixAspiratePositionValue == 0)//liquid
{
}
else if (aspirateMParam.mixAspiratePositionValue == 1)//top
{
aspirateMParam.mixAspirateDistance = ((float)labware.well_height - (float)methodFileMoveLiquid.aspmixAspirateDistance);
}
else if (aspirateMParam.mixAspiratePositionValue == 2)//bottom
{
aspirateMParam.mixAspirateDistance = (float)methodFileMoveLiquid.aspmixAspirateDistance;
}
aspirateMParam.mixAspirateSpeed = (float)Convert.ToDouble(methodFileMoveLiquid.aspmixAspirateSpeed);
aspirateMParam.mixDispensePositionValue = Convert.ToInt32(methodFileMoveLiquid.aspmixDispensePositionValue);
aspirateMParam.mixDispensePositionText = methodFileMoveLiquid.aspmixDispensePositionText;
if (aspirateMParam.mixDispensePositionValue == 0)//liquid
{
}
else if (aspirateMParam.mixDispensePositionValue == 1)//top
{
aspirateMParam.mixDispenseDistance = ((float)labware.well_height - (float)methodFileMoveLiquid.aspmixDispenseDistance);
}
else if (aspirateMParam.mixDispensePositionValue == 2)//bottom
{
aspirateMParam.mixDispenseDistance = (float)methodFileMoveLiquid.aspmixDispenseDistance;
}
aspirateMParam.mixDispenseSpeed = (float)Convert.ToDouble(methodFileMoveLiquid.aspmixDispenseSpeed);
aspirateMParam.mixvolume = (float)methodFileMoveLiquid.aspmixvolume;
aspirateMParam.mixCount = methodFileMoveLiquid.aspmixcount;
}
else
{
aspirateMParam.isMix = false;
aspirateMParam.mixAspirateDistance = 0;
aspirateMParam.mixAspirateSpeed = 100;
aspirateMParam.mixDispenseDistance = 0;
aspirateMParam.mixDispenseSpeed = 100;
aspirateMParam.mixvolume = 0;
aspirateMParam.mixCount = 0;
aspirateMParam.mixzAxisVal = 0f;
}
aspirateMParam.zAxisVal = zAxisVals;
aspirateMParam.pAxisVal = pVolmunVals;
float pVolumnVas = 0f;
for (int k = 0; k < methodFileMoveLiquid.channels.Length; k++)
{
pVolumnVas = pVolume; // 体积
if (k == 0)
{
aspirateMParam.xAxisVal = tipsTable.axis_b_X;
aspirateMParam.yAxisVal = tipsTable.axis_b_Y;
}
// 孔位平面的z轴
float zVal = aspirateMParam.wellzAxisVal;//tipsTableRemoteArrayList[n][k].axis_b_Z + ControlCom.CurrentLengthOfTipOffSetVal;
//aspirateMParam.wellzAxisVal = zVal - (float)labware.well_height;
#region 孔位的z轴
if (liquid.aspirate_position_type == 0)
{
}
else if (liquid.aspirate_position_type == 1)
{
zVal = zVal + (float)Convert.ToDouble(liquid.aspirate_well_bottom_length);
}
else if (liquid.aspirate_position_type == 2)
{
//zVal = aspirateMParam.wellzAxisVal + (float)liquid.aspirate_well_bottom_length;
if (labware.labware_type_id.Equals("4"))
{
if(labware.labware_tubeshelf_type==1)
{
ObservableCollection labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labware.labware_id);
LabwareWellInfo currentWellInfo = labwareWellInfoList.FirstOrDefault(x => x.labware_well_name.Equals(tipsTable.wellname));
Labware currentWellLabware = DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id);
zVal = tipsTable.axis_b_Z - (float)Convert.ToDouble(liquid.aspirate_well_bottom_length) - ((float)currentWellLabware.labware_height- (float)currentWellLabware.well_height);
}
else
{
zVal = tipsTable.axis_b_Z - (float)Convert.ToDouble(liquid.aspirate_well_bottom_length) - ControlCom.CalculateWellBottomThickness(labware.piled_script);
}
}
else
{
zVal = tipsTable.axis_b_Z - (float)Convert.ToDouble(liquid.aspirate_well_bottom_length);
}
}
zAxisVals = zVal < 0 ? 0 : zVal;
#endregion
aspirateMParam.mixzAxisVal = (float)Convert.ToDouble(aspirateMParam.zAxisVal);
wellnames[k] = tipsTable.wellname; // 孔位
// 精度校准后的体积
LiquidAccuracy liquidAccuracy = liquidAccuracyBll.GetLiquidAccuracyFromdb(Convert.ToInt32(liquidrangeidValue), Convert.ToInt32(aspirateMParam.armId), Convert.ToDouble(pVolume), liquididValue);
double targetVolume = liquidAccuracyBll.CalculateAspirateParamVolume(Convert.ToDouble(pVolumnVas), liquidAccuracy);
pVolmunVals = (float)targetVolume == 0f ? 20f : (float)targetVolume;
}
aspirateMParam.mixzAxisVal = zAxisVals;
aspirateMParam.zAxisVal = zAxisVals;
aspirateMParam.pAxisVal = pVolmunVals;
return aspirateMParam;
}
#endregion
#region 放液参数对象构建
public DispenseMParam GenerateDispenseParam(XmlNode methodNode, MethodFileMoveLiquid methodFileMoveLiquid,
Labware labware, TipsTable tipsTable, float pVolume)
{
#region 数据准备
string liquididText = methodFileMoveLiquid.liquididText;
string liquididValue = methodFileMoveLiquid.liquididValue;
string liquidrangeidText = methodFileMoveLiquid.liquidrangeidText;
string liquidrangeidValue = methodFileMoveLiquid.liquidrangeidValue;
string liquidpidText = methodFileMoveLiquid.liquidpidText;
string liquidpidValue = methodFileMoveLiquid.liquidpidValue;
bool enableLiquidSensor = methodFileMoveLiquid.enableLiquidSensor;
int liquidSensorCount = Convert.ToInt32(methodFileMoveLiquid.liquidSensorCount);
double liquidSensorDistance = Convert.ToDouble(methodFileMoveLiquid.liquidSensorDistance);
double liquidSensorEndDistance = Convert.ToDouble(methodFileMoveLiquid.liquidSensorEndDistance);
double liquidSensorSpeed = Convert.ToDouble(methodFileMoveLiquid.liquidSensorSpeed);
double liquidSensorRadio = Convert.ToDouble(methodFileMoveLiquid.liquidSensorRadio);
string liquidSensorDisIdText = methodFileMoveLiquid.liquidSensorDisIdText;
double liquidSensorDisIdValue = methodFileMoveLiquid.liquidSensorDisIdValue;
bool enableLiquidFollow = methodFileMoveLiquid.enableLiquidFollow;
int liquidFollowType = Convert.ToInt32(methodFileMoveLiquid.liquidFollowType);
string liquidFollowTypeName = methodFileMoveLiquid.liquidFollowTypeName;
double liquidFollowSpeed = Convert.ToDouble(methodFileMoveLiquid.liquidFollowSpeed);
double liquidFollowDistance = Convert.ToDouble(methodFileMoveLiquid.liquidFollowDistance);
double liquidFollowArea = Convert.ToDouble(methodFileMoveLiquid.liquidFollowArea);
bool enableMixFollow = methodFileMoveLiquid.enableMixFollow;
string channelNums = string.Join(",", methodFileMoveLiquid.channels);
int[] chs = new int[methodFileMoveLiquid.channels.Length];
for (int m = 0; m < methodFileMoveLiquid.channels.Length; m++)
{
chs[m] = methodFileMoveLiquid.channels[m];
}
string[] wellnames = new string[methodFileMoveLiquid.channels.Length];
string[] indexLC = new string[methodFileMoveLiquid.channels.Length];
string[] tagCodeLC = new string[methodFileMoveLiquid.channels.Length];
float zAxisVals = 0f;
float pVolmunVals = 0f;
#endregion
// 液体参数
Liquid liquid = LiquidDB.GetALiquidFromdb(liquidpidValue);
DispenseMParam dispenseMParam = new DispenseMParam();
//dispenseMParam.channelCount = methodFileMoveLiquid.channels.Length;
//dispenseMParam.channelId = chs;
dispenseMParam.afterAirDelay = (int)liquid.after_dispense_delay;
dispenseMParam.armId = Convert.ToInt32(methodFileMoveLiquid.armValue);
dispenseMParam.dispenseAcceleration = (float)liquid.dispense_acceleration;
dispenseMParam.dispenseDeceleration = (float)liquid.dispense_deceleration;
dispenseMParam.dispenseDelay = (int)liquid.dispense_delay;
dispenseMParam.dispenseEnterSpeed = (float)liquid.dispense_enter_speed;
dispenseMParam.dispenseOutSpeed = (float)liquid.dispense_out_speed;
dispenseMParam.dispenseSpeed = (float)liquid.dispense_speed;
dispenseMParam.basezAxisVal = (float)Convert.ToDouble(ConfigurationManager.AppSettings["zAxisSafeVal"]);
dispenseMParam.beforeAirDelay = (int)liquid.before_dispense_delay;
#region 后吸空气
if ((float)liquid.after_dispense_volume == 0f)
{
dispenseMParam.isAfterAir = false;
}
else
{
dispenseMParam.isAfterAir = true;
dispenseMParam.afterAirpAxisVal = (float)liquid.after_dispense_volume;
}
#endregion
#region 前吸空气
if (liquid.before_dispense_volume == 0d)
{
dispenseMParam.isBeforeAir = false;
}
else
{
dispenseMParam.isBeforeAir = true;
dispenseMParam.beforeAirpAxisVal = (float)liquid.before_dispense_volume;
}
#endregion
//dispenseMParam.liquidVolumeType = (int)Convert.ToInt32((liquid.liquid_volume_type != null ? "1" : liquid.liquid_volume_type));
//dispenseMParam.wellzAxisVal = (float)liquid.well_top_length; // 孔位平面的z轴
if (labware.labware_type_id.Equals("4"))
{
if (labware.labware_tubeshelf_type == 1)
{
ObservableCollection labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labware.labware_id);
LabwareWellInfo currentWellInfo = labwareWellInfoList.FirstOrDefault(x => x.labware_well_name.Equals(tipsTable.wellname));
dispenseMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id).labware_height);
}
else
{
dispenseMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height);
}
}
else
{
dispenseMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)labware.well_height);// - (float)liquid.well_top_length);
}
#region 碰壁
if (liquid.dispense_is_knock_wall == 0)
{
dispenseMParam.isKnockWall = false;
}
else
{
dispenseMParam.isKnockWall = true;
dispenseMParam.knockDirection = (int)liquid.knock_direction;
dispenseMParam.knockSpeed = (float)liquid.knock_speed;
dispenseMParam.knockWallDelay = (int)liquid.knock_wall_delay;
dispenseMParam.knockWellxOryAxisVal = (float)liquid.knock_wall_length;
dispenseMParam.knockWellzAxisVal = (float)liquid.knock_well_height;
}
#endregion
dispenseMParam.isSurvey = false;// enableLiquidSensor;
if (dispenseMParam.isSurvey == true)
{
if (labware.labware_type_id.Equals("4"))
{
if (labware.labware_tubeshelf_type == 1)
{
ObservableCollection labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labware.labware_id);
LabwareWellInfo currentWellInfo = labwareWellInfoList.FirstOrDefault(x => x.labware_well_name.Equals(tipsTable.wellname));
dispenseMParam.surveyInitzVal = tipsTable.axis_b_Z - ((float)DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id).labware_height - (float)liquidSensorDistance);
dispenseMParam.surveyMaxzVal = tipsTable.axis_b_Z - ((float)DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id).labware_height - (float)liquidSensorEndDistance);
dispenseMParam.surveySpeed = (float)liquidSensorSpeed;
dispenseMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id).labware_height);
dispenseMParam.wellBottomzAxisVal = tipsTable.axis_b_Z;
}
else
{
Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(labware.piled_script);
dispenseMParam.surveyInitzVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height - (float)liquidSensorDistance);
dispenseMParam.surveyMaxzVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height - (float)liquidSensorEndDistance);
dispenseMParam.surveySpeed = (float)liquidSensorSpeed;
dispenseMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height);
dispenseMParam.wellBottomzAxisVal = tipsTable.axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).labware_height - (float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_height);
}
dispenseMParam.surveyFailHandleType = Convert.ToInt32(liquidSensorDisIdValue);
if (enableLiquidFollow)
{
dispenseMParam.followupType = liquidFollowType;
dispenseMParam.followupSpeed = (float)liquidFollowSpeed;
dispenseMParam.followupDistance = (float)liquidFollowDistance;
float area = 0.0f;
if (labware.well_shape == (int)WellSharpe.Round)
{
area = (float)(Math.PI * (float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_mouth_radius * (float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_mouth_radius);
}
else if (labware.well_shape == (int)WellSharpe.Rectangle)
{
area = (float)((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_top_x * (float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_top_y);
}
dispenseMParam.sectionalArea = area;
dispenseMParam.isMixFollowup = enableMixFollow;
}
else
{
}
}
else
{
//dispenseMParam.surveyRetryCount = liquidSensorCount;
dispenseMParam.surveyInitzVal = tipsTable.axis_b_Z - ((float)labware.well_height - (float)liquidSensorDistance);
dispenseMParam.surveyMaxzVal = tipsTable.axis_b_Z - ((float)labware.well_height - (float)liquidSensorEndDistance);
dispenseMParam.surveySpeed = (float)liquidSensorSpeed;
//aspirateMParam.surveyCoefficient =;
dispenseMParam.wellzAxisVal = tipsTable.axis_b_Z - ((float)labware.well_height);// - (float)liquid.well_top_length);
dispenseMParam.wellBottomzAxisVal = tipsTable.axis_b_Z;
dispenseMParam.surveyFailHandleType = Convert.ToInt32(liquidSensorDisIdValue);
if (enableLiquidFollow)
{
//dispenseMParam.followupType = liquidFollowType;
dispenseMParam.followupSpeed = (float)liquidFollowSpeed;
dispenseMParam.followupDistance = (float)liquidFollowDistance;
float area = 0.0f;
if (labware.well_shape == (int)WellSharpe.Round)
{
area = (float)(Math.PI * labware.well_mouth_radius * labware.well_mouth_radius);
}
else if (labware.well_shape == (int)WellSharpe.Rectangle)
{
area = (float)(labware.well_top_x * labware.well_top_y);
}
dispenseMParam.sectionalArea = area;
dispenseMParam.isMixFollowup = enableMixFollow;
}
else
{
}
}
}
else
{
}
dispenseMParam.isMix = methodFileMoveLiquid.bdpsMix;
if (dispenseMParam.isMix)
{
dispenseMParam.mixAspiratePositionValue = Convert.ToInt32(methodFileMoveLiquid.dpsmixAspiratePositionValue);
dispenseMParam.mixAspiratePositionText = methodFileMoveLiquid.dpsmixAspiratePositionText;
if (labware.labware_type_id.Equals("4"))
{
if (methodFileMoveLiquid.dpsmixAspiratePositionValue == 0)//liquid
{
}
else if (methodFileMoveLiquid.dpsmixAspiratePositionValue == 1)//top
{
dispenseMParam.mixAspirateDistance = ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_height - (float)methodFileMoveLiquid.dpsmixAspirateDistance);
}
else if (methodFileMoveLiquid.dpsmixAspiratePositionValue == 2)//bottom
{
dispenseMParam.mixAspirateDistance = (float)methodFileMoveLiquid.dpsmixAspirateDistance;
}
}
else
{
if (methodFileMoveLiquid.dpsmixAspiratePositionValue == 0)//liquid
{
}
else if (methodFileMoveLiquid.dpsmixAspiratePositionValue == 1)//top
{
dispenseMParam.mixAspirateDistance = ((float)labware.well_height - (float)methodFileMoveLiquid.dpsmixAspirateDistance);
}
else if (methodFileMoveLiquid.dpsmixAspiratePositionValue == 2)//bottom
{
dispenseMParam.mixAspirateDistance = (float)methodFileMoveLiquid.dpsmixAspirateDistance;
}
}
dispenseMParam.mixAspirateSpeed = (float)Convert.ToDouble(methodFileMoveLiquid.dpsmixAspirateSpeed);
dispenseMParam.mixDispensePositionValue = Convert.ToInt32(methodFileMoveLiquid.dpsmixDispensePositionValue);
dispenseMParam.mixDispensePositionText = methodFileMoveLiquid.dpsmixDispensePositionText;
if (labware.labware_type_id.Equals("4"))
{
if (methodFileMoveLiquid.dpsmixDispensePositionValue == 0)//liquid
{
}
else if (methodFileMoveLiquid.dpsmixDispensePositionValue == 1)//top
{
dispenseMParam.mixDispenseDistance = ((float)ControlCom.GetCentrifugalLabwer(labware.piled_script).well_height - (float)methodFileMoveLiquid.dpsmixDispenseDistance);
}
else if (methodFileMoveLiquid.dpsmixDispensePositionValue == 2)//bottom
{
dispenseMParam.mixDispenseDistance = (float)methodFileMoveLiquid.dpsmixDispenseDistance;
}
}
else
{
if (methodFileMoveLiquid.dpsmixDispensePositionValue == 0)//liquid
{
}
else if (methodFileMoveLiquid.dpsmixDispensePositionValue == 1)//top
{
dispenseMParam.mixDispenseDistance = ((float)labware.well_height - (float)methodFileMoveLiquid.dpsmixDispenseDistance);
}
else if (methodFileMoveLiquid.dpsmixDispensePositionValue == 2)//bottom
{
dispenseMParam.mixDispenseDistance = (float)methodFileMoveLiquid.dpsmixDispenseDistance;
}
}
dispenseMParam.mixDispenseSpeed = (float)Convert.ToDouble(methodFileMoveLiquid.dpsmixDispenseSpeed);
dispenseMParam.mixvolume = (float)methodFileMoveLiquid.dpsmixvolume;
dispenseMParam.mixCount = methodFileMoveLiquid.dpsmixcount;
}
else
{
dispenseMParam.mixAspirateDistance = 0;
dispenseMParam.mixAspirateSpeed = 100;
dispenseMParam.mixDispenseDistance = 0;
dispenseMParam.mixDispenseSpeed = 100;
dispenseMParam.enableVolumeToNull = true;
dispenseMParam.zAxisVal = zAxisVals;
dispenseMParam.pAxisVal = pVolmunVals;
dispenseMParam.mixzAxisVal = 0f;
}
float pVolumnVas = 0f;
for (int k = 0; k < methodFileMoveLiquid.channels.Length; k++)
{
pVolumnVas = pVolume; // 体积
if (k == 0)
{
dispenseMParam.xAxisVal = tipsTable.axis_b_X;
dispenseMParam.yAxisVal = tipsTable.axis_b_Y;
}
// 孔位平面的z轴
float zVal = dispenseMParam.wellzAxisVal;//tipsTableRemoteArrayList[n][k].axis_b_Z + ControlCom.CurrentLengthOfTipOffSetVal;
//dispenseMParam.wellzAxisVal = zVal - (float)labware.well_height;
#region 孔位的z轴
if (liquid.dispense_position_type == 0)
{
}
else if (liquid.dispense_position_type == 1)
{
zVal = zVal + (float)liquid.dispense_well_bottom_length;
}
else if (liquid.dispense_position_type == 2)
{
//zVal = dispenseMParam.wellzAxisVal + (float)liquid.dispense_well_bottom_length;
if (labware.labware_type_id.Equals("4"))
{
if (labware.labware_tubeshelf_type == 1)
{
ObservableCollection labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labware.labware_id);
LabwareWellInfo currentWellInfo = labwareWellInfoList.FirstOrDefault(x => x.labware_well_name.Equals(tipsTable.wellname));
Labware currentWellLabware = DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id);
zVal = tipsTable.axis_b_Z - (float)Convert.ToDouble(liquid.dispense_well_bottom_length) - ((float)currentWellLabware.labware_height- (float)currentWellLabware.well_height);
}
else
{
zVal = tipsTable.axis_b_Z - (float)Convert.ToDouble(liquid.dispense_well_bottom_length) - ControlCom.CalculateWellBottomThickness(labware.piled_script);
}
}
else
{
zVal = tipsTable.axis_b_Z - (float)Convert.ToDouble(liquid.dispense_well_bottom_length);
}
}
zAxisVals = zVal < 0 ? 0 : zVal;
#endregion
wellnames[k] = tipsTable.wellname; // 孔位
dispenseMParam.mixzAxisVal = (float)Convert.ToDouble(dispenseMParam.zAxisVal);
// 精度校准后的体积
LiquidAccuracy liquidAccuracy = liquidAccuracyBll.GetLiquidAccuracyFromdb(Convert.ToInt32(liquidrangeidValue), Convert.ToInt32(dispenseMParam.armId), Convert.ToDouble(pVolume), liquididValue);
double targetVolume = liquidAccuracyBll.CalculateAspirateParamVolume(Convert.ToDouble(pVolumnVas), liquidAccuracy);
pVolmunVals = (float)targetVolume == 0f ? 20f : (float)targetVolume;
}
dispenseMParam.mixzAxisVal = zAxisVals;
dispenseMParam.zAxisVal = zAxisVals;
dispenseMParam.pAxisVal = pVolmunVals;
return dispenseMParam;
}
#endregion
}
}