using DataEntity;
using DataEntity.Share;
using DataRWDAL;
using DriverLib.Engine;
using MySqlX.XDevAPI.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Xml;
using XCommon;
using XCommon.Log;
using XCore;
using XCoreBLL;
using XHandler.Controls.Run.Com;
using XHandler.View;
using XHandler.View.MethodProperty;
using XImaging.Automation.Service.Interface;
using XImagingXhandler.XDAL;
using static HxEnum.OperationTypeEnum;
namespace XHandler.Controls
{
///
/// 开关盖
///
public class SwitchLidControl
{
string strCurrentCulture = "";
WellCalc wellCalc = new WellCalc();
LatticeBll latticeBll = new LatticeBll();
SwitchLidBll switchLidBll = new SwitchLidBll();
public RunWnd launchView = null;
public SwitchLidControl(string strCurrentCulture)
{
this.strCurrentCulture = strCurrentCulture;
}
#region 执行开关盖,返回结果字符串
///
/// 执行开关盖,返回结果字符串
///
/// 板位节点信息
/// 装载方法属性节点对象
/// z轴安全距离
/// 0:连接谁;1:仿真
///
public bool ExecuteSwitchLid(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 数据准备
MethodSwitchLid methodSwitchLid = switchLidBll.GenerateMethodSwitchLidDataByXmlNode(methodNode);
#endregion
#region 数据验证
Labware labwares = LabwareDB.GetLabware(methodSwitchLid.labwareValue);
string strWells = methodSwitchLid.wellarray;
string[] wells = new string[] { };
string wellVariable = string.Empty;
if (!string.IsNullOrEmpty(strWells))
{
//判断是否包含等号,如果是包含等号的,则是变量控制孔位
if (strWells.Contains(","))
{
wells = strWells.Split(',');
}
else if (strWells.Contains("="))
{
}
}
else if (strWells.Contains("="))
{
wellVariable = strWells.Substring(strWells.LastIndexOf('=') + 1, (strWells.Length - strWells.LastIndexOf('=') - 1));
Variable variable = new Variable();
Stack stackTem = new Stack();//临时存储变量过得对象
int totalLoop = launchView.gloadVariable.Count;
// 从当前变量字典中取出变量的值
for (int i = 0; i < totalLoop; i++)
{
Variable v = launchView.gloadVariable.Pop(); //取出最近的一个匹配变量
stackTem.Push(v);
if (v.variablename == wellVariable)
{
variable = v;
break;
}
}
int totalLoopTem = stackTem.Count;
for (int i = 0; i < totalLoopTem; i++)
{
Variable v = stackTem.Pop();
launchView.gloadVariable.Push(v);
}
}
// 给孔位排序
if (strWells.Contains(','))
{
string suffix = wells[0].Substring(1, wells[0].Length - 1);
List sortWellName = new List();
if (Shared.ChannelCount == 1)
{
for (int i = 0; i < labwares.number_row; i++)
{
string rowName = ComUtility.GetRowChar(i);
string rowWellName = rowName + suffix;
if (wells.Contains(rowWellName))
{
sortWellName.Add(rowWellName);
}
}
wells = sortWellName.ToArray();
}
else if (Shared.ChannelCount > 1)
{
}
}
else if (!string.IsNullOrEmpty(strWells) &&
!strWells.Contains(',') &&
!strWells.Contains("=")) // 只有一个孔位
{
wells = new string[] { strWells };
}
else if (strWells.Contains("=")) // 利用循环
{
string strvariable = strWells.Substring(strWells.LastIndexOf('=') + 1, (strWells.Length - strWells.LastIndexOf('=') - 1));
Variable variable = new Variable();
Stack stackTem = new Stack();//临时存储变量过得对象
int totalLoop = launchView.gloadVariable.Count;
// 从当前变量字典中取出变量的值
for (int i = 0; i < totalLoop; i++)
{
Variable v = launchView.gloadVariable.Pop(); //取出最近的一个匹配变量
stackTem.Push(v);
if (v.variablename == strvariable)
{
variable = v;
break;
}
}
int totalLoopTem = stackTem.Count;
for (int i = 0; i < totalLoopTem; i++)
{
Variable v = stackTem.Pop();
launchView.gloadVariable.Push(v);
}
if (variable.variablename.Equals(string.Empty) && strvariable.Length >= 1)//没有查找到变量名,看看是不是表达式,并求出表达式值
{
totalLoop = launchView.gloadVariable.Count;
List variablelist = new List();
stackTem = new Stack();//临时存储变量过得对象
for (int i = 0; i < totalLoop; i++) //看看表达式中包不包含变量,如果包含就把变量全部替换成值
{
Variable v = launchView.gloadVariable.Pop();
variablelist.Add(v);
stackTem.Push(v);
}
for(int i=0;i< variablelist.Count;i++)
{
if (strvariable.Contains(variablelist[i].variablename))
{
strvariable = strvariable.Replace(variable.variablename, variable.variablecurval);
break;
}
}
//恢复全局变量
for (int i = 0; i < variablelist.Count; i++)
{
Variable v = stackTem.Pop();
launchView.gloadVariable.Push(v);
}
Microsoft.JScript.Vsa.VsaEngine ve = Microsoft.JScript.Vsa.VsaEngine.CreateEngine();
variable.variablecurval = Microsoft.JScript.Eval.JScriptEvaluate(strvariable, ve).ToString();
}
List sortWellName = new List();
for (int j = 1; j <= labwares.number_column; j++)
{
for (int i = 0; i < labwares.number_row; i++)
{
string rowName = ComUtility.GetRowChar(i);
string rowWellName = rowName + j;
sortWellName.Add(rowWellName);
}
}
wells = new string[1];
wells[0] = sortWellName[Convert.ToInt32(variable.variablecurval) - 1];
}
// 判断方法中的板位和板子是否能对应上设置的台面
Lattice lattice = new Lattice();
string armId = Shared.DeviceArmList.FirstOrDefault(x => x.arm_type.Equals(1)).device_arm_id.ToString();
string latticenum = methodSwitchLid.positionText.ToString();
TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断
if (tabletopTemplate == null)
{
lattice = LatticeDB.GetLatticeDataByIdFromdb(latticenum, Convert.ToInt32(armId), Shared.SoftwareInformation.software_device_number);
}
else
{
lattice = LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb(latticenum, Convert.ToInt32(armId), Shared.SoftwareInformation.software_device_number, tabletopTemplate.tabletopid);
}
int xmlLatticeId = Convert.ToInt32(latticenum.Substring(1));
var latticeXn = xmlEnv.SelectSingleNode("platform[lattice_id='" + xmlLatticeId.ToString() + "']");
if (latticeXn != null)
{
labwares.labware_sname = latticeXn.SelectNodes("labware")[0].SelectSingleNode("labware_sname").InnerText;
}
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.RunAspirateResource.strWithoutLattice.ToString());
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: the lattice of aspirate liquid is wrong! please check!");
}
result = false;
return result;
}
//}
#endregion
#region 执行构建
try
{
// 获取当前台面的夹爪坐标
List gripperCoordinates = DataRWDAL.GripperCoordinateDB.GetAGripperCoordinateFromdb(Shared.SoftwareInformation.software_information_id, Convert.ToInt32(methodSwitchLid.armValue),lattice.lattice_num);
//转化成板位
Lattice slattice = new Lattice();
slattice.lattice_X = gripperCoordinates[0].lattice_X;
slattice.lattice_Y = gripperCoordinates[0].lattice_Y;
slattice.lattice_Z = gripperCoordinates[0].lattice_Z;
slattice.lattice_num = gripperCoordinates[0].lattice_num;
slattice.lattice_id = "";
// 获取板位孔的坐标数据
List dtWells = ControlCom.GenerateWellCoordinateForChemistry(labwares, slattice);
//离心管耗材对象
Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(labwares.piled_script);
//根据循环处理孔位
TipsTable tipsTable = null;
tipsTable = dtWells.SingleOrDefault(t => t.lattice_num.Equals(lattice.lattice_num)
&& t.labware_id.Equals(labwares.labware_id)
&& t.wellname.Equals(wells[0]));
tipsTable.axis_b_Z = tipsTable.axis_b_Z + ControlCom.CurrentLengthOfTip;//被减的枪头要加回来
if (methodSwitchLid.armText == "夹爪臂")
{
ScrewTubeCapMParam screwTubeCapMParam = new ScrewTubeCapMParam();
screwTubeCapMParam.tubeRackNo = Convert.ToInt32(lattice.lattice_num.Substring(1)); //板位号,数字部分
screwTubeCapMParam.tubeCol = Convert.ToInt32(wells[0].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)methodSwitchLid.numOfCircle * 360 };
screwTubeCapMParam.capScrewSpeed = (float)methodSwitchLid.switchSpeed;
screwTubeCapMParam.capScrewDistance =new float[] { (float)centrifugalLabware.well_helical_distance * (float)Math.Ceiling(methodSwitchLid.numOfCircle) };
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.xAxisVal = tipsTable.axis_b_X;
screwTubeCapMParam.yAxisVal = tipsTable.axis_b_Y;
//Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(labwares.piled_script);
screwTubeCapMParam.zAxisVal = tipsTable.axis_b_Z-((float)centrifugalLabware.labware_height+3f)+(float)centrifugalLabware.upgripper_zoffset;//孔口
launchView.SetWaitOne();//暂停
ret = switchLidBll.ExecuteSwitchLid(screwTubeCapMParam, methodSwitchLid.switchState, isSimulator);
if (ret.Result != ResultType.Success)
{
if (strCurrentCulture.Equals("zh-CN"))
{
if (methodSwitchLid.switchState == 0)
{
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 if (methodSwitchLid.switchState == 1)
{
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
{
if (methodSwitchLid.switchState == 0)
{
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);
}
else if (methodSwitchLid.switchState == 1)
{
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;
OperateDialog plsConfirmOper = null;
if (!launchView.isRemotingOper)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.GripTransportResource.strPickFailWhatToDo : "The action of pick was fail! What do you want to do?");
plsConfirmOper.ShowDialog();
}));
}
else
{
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1027", 5, Properties.GripTransportResource.strPickFailWhatToDo, 2);
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.GripTransportResource.strPickFailWhatToDo : "The action of pick was fail! What do you want to do?");
plsConfirmOper.ShowDialog();
}
if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Retry) // 重试
{
return ExecuteSwitchLidReTry(lattice, wells, centrifugalLabware, methodSwitchLid, isSimulator, tipsTable);
}
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Cancel) // 终止
{
if (launchView.isRemotingOper)
{
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1045", 5, Properties.GripTransportResource.strPickWasStopped, 2);
}
result = false;
return result;
}
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Continue) // 跳过
{
result = true;
return result;
}
return result;
}
else
{
if (methodSwitchLid.switchState == 0)
{
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 if (methodSwitchLid.switchState == 1)
{
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!");
}
}
}
}
}
catch (Exception ex)
{
LoggerHelper.ErrorLog("ERROR:", ex);
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strError.ToString() + " 源 " + ex.Source + " 错误信息 " + ex.Message + ";");
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】error:source:" + ex.Source + ";error:" + ex.Message + ";");
}
result = false;
}
#endregion
return result;
}
#endregion
#region 开关盖重试函数
public bool ExecuteSwitchLidReTry(Lattice lattice,string[] wells, Labware centrifugalLabware,MethodSwitchLid methodSwitchLid,bool isSimulator,TipsTable tipsTable)
{
bool result = true;
ScrewTubeCapMParam screwTubeCapMParam = new ScrewTubeCapMParam();
screwTubeCapMParam.tubeRackNo = Convert.ToInt32(lattice.lattice_num.Substring(1)); //板位号,数字部分
screwTubeCapMParam.tubeCol = Convert.ToInt32(wells[0].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)methodSwitchLid.numOfCircle * 360 };
screwTubeCapMParam.capScrewSpeed = (float)methodSwitchLid.switchSpeed;
screwTubeCapMParam.capScrewDistance = new float[] { (float)centrifugalLabware.well_helical_distance * (float)Math.Ceiling(methodSwitchLid.numOfCircle) };
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.xAxisVal = tipsTable.axis_b_X;
screwTubeCapMParam.yAxisVal = tipsTable.axis_b_Y;
//Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(labwares.piled_script);
screwTubeCapMParam.zAxisVal = tipsTable.axis_b_Z - ((float)centrifugalLabware.labware_height + 3f) + (float)centrifugalLabware.upgripper_zoffset;//孔口
launchView.SetWaitOne();//暂停
HxResult ret = switchLidBll.ExecuteSwitchLid(screwTubeCapMParam, methodSwitchLid.switchState, isSimulator);
if (ret.Result != ResultType.Success)
{
if (strCurrentCulture.Equals("zh-CN"))
{
if (methodSwitchLid.switchState == 0)
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + lattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + lattice.lattice_num);
}
else if (methodSwitchLid.switchState == 1)
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + lattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseFailed.ToString() + ret.AlarmInfo + " 孔 " + tipsTable.wellname + " 板位 " + lattice.lattice_num);
}
}
else
{
if (methodSwitchLid.switchState == 0)
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + lattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】progress: switch to open lid was failed on " + tipsTable.wellname + " of " + lattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
else if (methodSwitchLid.switchState == 1)
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】progress: switch to close lid was failed on " + tipsTable.wellname + " of " + lattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】progress: switch to close lid was failed on " + tipsTable.wellname + " of " + lattice.lattice_num + " lattice! Error info:" + ret.AlarmInfo);
}
}
result = false;
OperateDialog plsConfirmOper = null;
if (!launchView.isRemotingOper)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
if (methodSwitchLid.switchState == 0)
{
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.SwitchLidResource.strSwitchOpenFailWhatToDo : "The action of switch open was fail! What do you want to do?");
}
else
{
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.SwitchLidResource.strSwitchCloseFailWhatToDo : "The action of switch close was fail! What do you want to do?");
}
plsConfirmOper.ShowDialog();
}));
}
else
{
if (methodSwitchLid.switchState == 0)
{
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1027", 5, Properties.SwitchLidResource.strSwitchOpenFailWhatToDo, 2);
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.SwitchLidResource.strSwitchOpenFailWhatToDo : "The action of switch open was fail! What do you want to do?");
}
else
{
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1027", 5, Properties.SwitchLidResource.strSwitchCloseFailWhatToDo, 2);
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.SwitchLidResource.strSwitchCloseFailWhatToDo : "The action of switch close was fail! What do you want to do?");
}
plsConfirmOper.ShowDialog();
}
if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Retry) // 重试
{
return ExecuteSwitchLidReTry(lattice, wells, centrifugalLabware, methodSwitchLid, isSimulator, tipsTable);
}
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Cancel) // 终止
{
if (launchView.isRemotingOper)
{
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1045", 5, Properties.SwitchLidResource.strSwitchWasStopped, 2);
}
result = false;
return result;
}
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Continue) // 跳过
{
result = true;
return result;
}
return result;
}
else
{
if (methodSwitchLid.switchState == 0)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + lattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidOpenSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + lattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + lattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】progress:switch to open lid was successful on " + tipsTable.wellname + " of " + lattice.lattice_num + " lattice!");
}
}
else if (methodSwitchLid.switchState == 1)
{
if (strCurrentCulture.Equals("zh-CN"))
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + lattice.lattice_num);
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.SwitchLidResource.strSwitchLidCloseSuccess.ToString() + " 孔 " + tipsTable.wellname + " 板位 " + lattice.lattice_num);
}
else
{
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】progress:switch to closed lid was successful on " + tipsTable.wellname + " of " + lattice.lattice_num + " lattice!");
LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodSwitchLid.name + "】progress:switch to closed lid was successful on " + tipsTable.wellname + " of " + lattice.lattice_num + " lattice!");
}
}
}
return result;
}
#endregion
}
}