using DataEntity; using DataEntity.Share; using DataRWDAL; using DriverLib.Engine; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Data; using System.Linq; using System.Windows; using System.Windows.Media; using System.Xml; using XCommon; using XCommon.Log; using XCore; using XHandler.Controls.Run.Com; using XHandler.View; using XHandler.View.Liquids; using XHandler.View.MethodProperty; using XImagingXhandler.XDAL; using static HxEnum.OperationTypeEnum; namespace XHandler.Controls { public class DispenseControl { string strCurrentCulture = ""; WellCalc wellCalc = new WellCalc(); LatticeBll latticeBll = new LatticeBll(); DispenseBll dispenseBll = new DispenseBll(); public RunWnd launchView = null; MethodFrame methodFrame = new MethodFrame(); LiquidAccuracyBll liquidAccuracyBll = new LiquidAccuracyBll(); public DispenseControl(string strCurrentCulture) { this.strCurrentCulture = strCurrentCulture; } #region 执行放液,返回结果字符串 /// /// 执行放液,返回结果字符串 /// /// 板位节点信息 /// 装载方法属性节点对象 /// 本次吸液的孔位 /// 当前使用通道号,逗号分割 /// 加载枪头后多出出来的长度 /// z轴安全距离 /// 设备号 /// 0:连接谁;1:仿真 /// public bool ExecuteDispense(XmlNode xmlEnv, XmlNode methodNode, float currentLengthOfTip, float zAxisVal, bool isSimulator) { bool result = true; HxResult ret = new HxResult(); if (launchView._cancelSource.IsCancellationRequested) { result = false; return result; } try { #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 if (currentLengthOfTip == 0f)//枪上没有Tip不允许排液 { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.MachineRunResource.strWithTipInfo.ToString()); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: it seems without loaded tip! please check!"); } result = false; return result; } #region 数据准备 string labwareText = methodNode.SelectSingleNode("labware/text").InnerText; string strLabwareid = methodNode.SelectSingleNode("labware/value").InnerText; string channelNums = methodNode.SelectSingleNode("channels").InnerText; string armName = methodNode.SelectSingleNode("arm/text").InnerText; string armId = methodNode.SelectSingleNode("arm/value").InnerText; string latticenum = methodNode.SelectSingleNode("position/text").InnerText; string latticeId = methodNode.SelectSingleNode("position/value").InnerText; string strWells = methodNode.SelectSingleNode("wellarray").InnerText; bool enableSingleWellvolume = methodNode.SelectSingleNode("enableSingleWellvolume").InnerText.ToLower() == "true" ? true : false; //每孔体积 List dropdownNames = new List(); var drops = methodNode.SelectNodes("SingleWellvolume"); if (drops != null) { foreach (XmlNode x in drops) { DropdownName d = new DropdownName(); d.dropdown_id = x.SelectSingleNode("channel").InnerText; d.dropdown_name = x.SelectSingleNode("name").InnerText; dropdownNames.Add(d); } } double wellvolume = Convert.ToDouble(methodNode.SelectSingleNode("wellvolume").InnerText); bool isNull = methodNode.SelectSingleNode("isNull").InnerText.ToLower() == "true" ? true : false; string liquididText = methodNode.SelectSingleNode("liquidid/text").InnerText; string liquididValue = methodNode.SelectSingleNode("liquidid/value").InnerText; string liquidrangeidText = methodNode.SelectSingleNode("liquidrangeid/text").InnerText; string liquidrangeidValue = methodNode.SelectSingleNode("liquidrangeid/value").InnerText; string liquidpidText = methodNode.SelectSingleNode("liquidpid/text").InnerText; string liquidpidValue = methodNode.SelectSingleNode("liquidpid/value").InnerText; bool enableMix = methodNode.SelectSingleNode("enableMix").InnerText.ToLower() == "true" ? true : false; bool enableMultiMix = methodNode.SelectSingleNode("enableMultiMix").InnerText.ToLower() == "true" ? true : false; double mixvolume = Convert.ToDouble(methodNode.SelectSingleNode("mixvolume").InnerText); int mixcount = Convert.ToInt32(methodNode.SelectSingleNode("mixcount").InnerText); string mixAspiratePositionText = methodNode.SelectSingleNode("mixAspiratePosition/text").InnerText; string mixAspiratePositionValue = methodNode.SelectSingleNode("mixAspiratePosition/value").InnerText; double mixAspirateDistance = Convert.ToDouble(methodNode.SelectSingleNode("mixAspirateDistance").InnerText); double mixAspirateSpeed = Convert.ToDouble(methodNode.SelectSingleNode("mixAspirateSpeed").InnerText); string mixDispensePositionText = methodNode.SelectSingleNode("mixDispensePosition/text").InnerText; string mixDispensePositionValue = methodNode.SelectSingleNode("mixDispensePosition/value").InnerText; double mixDispenseDistance = Convert.ToDouble(methodNode.SelectSingleNode("mixDispenseDistance").InnerText); double mixDispenseSpeed = Convert.ToDouble(methodNode.SelectSingleNode("mixDispenseSpeed").InnerText); bool enableLiquidSensor = methodNode.SelectSingleNode("enableLiquidSensor").InnerText.ToLower() == "true" ? true : false; int liquidSensorCount = Convert.ToInt32(methodNode.SelectSingleNode("liquidSensorCount").InnerText); double liquidSensorDistance = Convert.ToDouble(methodNode.SelectSingleNode("liquidSensorDistance").InnerText); double liquidSensorEndDistance = Convert.ToDouble(methodNode.SelectSingleNode("liquidSensorEndDistance").InnerText); double liquidSensorSpeed = Convert.ToDouble(methodNode.SelectSingleNode("liquidSensorSpeed").InnerText); double liquidSensorRadio = Convert.ToDouble(methodNode.SelectSingleNode("liquidSensorRadio").InnerText); string liquidSensorDisIdText = methodNode.SelectSingleNode("liquidSensorDisId/text").InnerText; string liquidSensorDisIdValue = methodNode.SelectSingleNode("liquidSensorDisId/value").InnerText; bool enableLiquidFollow = methodNode.SelectSingleNode("enableLiquidFollow").InnerText.ToLower() == "true" ? true : false; int liquidFollowType = Convert.ToInt32(methodNode.SelectSingleNode("liquidFollowType/value").InnerText); string liquidFollowTypeName = methodNode.SelectSingleNode("liquidFollowType/text").InnerText; double liquidFollowSpeed = Convert.ToDouble(methodNode.SelectSingleNode("liquidFollowSpeed").InnerText); double liquidFollowDistance = Convert.ToDouble(methodNode.SelectSingleNode("liquidFollowDistance").InnerText); double liquidFollowArea = Convert.ToDouble(methodNode.SelectSingleNode("liquidFollowArea").InnerText); bool enableMixFollow = methodNode.SelectSingleNode("enableMixFollow").InnerText.ToLower() == "true" ? true : false; bool enableSensorBlock = methodNode.SelectSingleNode("enableSensorBlock").InnerText.ToLower() == "true" ? true : false; //double liquidSensorBlockDistance = Convert.ToDouble(methodNode.SelectSingleNode("liquidSensorBlockDistance").InnerText); string dispenseBlockDisIdText = methodNode.SelectSingleNode("dispenseBlockDisId/text").InnerText; string dispenseBlockDisIdValue = methodNode.SelectSingleNode("dispenseBlockDisId/value").InnerText; #endregion #region 数据验证 if (channelNums == "") { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:" + Properties.MachineRunResource.strWithoutChannel.ToString()); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:Channel wasn't set, please check!"); } result = false; return result; } string[] wells = new string[] { }; string wellVariable = string.Empty; if (!string.IsNullOrEmpty(strWells)) { //判断是否包含等号,如果是包含等号的,则是变量控制孔位 if (strWells.Contains(",")) { wells = strWells.Split(','); } else if (strWells.Contains("=")) { } } Labware labwares = LabwareDB.GetLabware(strLabwareid); string[] chs = channelNums.Split(','); if (strWells.Contains(",")) { if (labwares.labware_type_id.Equals("3")) { } else { if (chs.Length != wells.Length) { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:" + Properties.MachineRunResource.strOverWell.ToString()); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:Total of channel isn't same with total of wells, please check!"); } result = false; return result; } } } else if (strWells.Contains("=")) { wellVariable = strWells.Substring(strWells.LastIndexOf('=') + 1, (strWells.Length - strWells.LastIndexOf('=') - 1)); Variable variable = new Variable(); //从当前变量字典中取出变量的值 for (int i = 0; i < launchView.gloadVariable.Count; i++) { Variable v = launchView.gloadVariable.Peek(); if (v.variablename == wellVariable) { variable = v; break; } } } // 给孔位排序 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) { List sortWellNameSH = new List();//用来按列的孔位名称 #region Del ////上海的移液枪正常排列,A1,B1,C1,D1,E1,F1,G1,H1 //for (int j = 1; j < labwares.number_column; j++) //{ // int countWell = 0;//当前选择的孔位数量 // sortWellNameSH.Clear(); // for (int i = 0; i <= labwares.number_row; i++) // { // string rowName = ComUtility.GetRowChar(i);//创建行号 // string rowWellName = rowName + j; // if (wells.Contains(rowWellName)) // { // sortWellNameSH.Add(rowWellName); // countWell++; // } // } // if (wells.Length == countWell && countWell == chs.Length) // { // wells = sortWellNameSH.ToArray(); // break; // } // else // { // if (strCurrentCulture.Equals("zh-CN")) // { // launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:" + Properties.MachineRunResource.strError.ToString() + Properties.RunAspirateResource.strChannelMatch.ToString()); // LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:" + Properties.MachineRunResource.strError.ToString() + Properties.RunAspirateResource.strChannelMatch.ToString()); // } // else // { // launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:Channels aren't match with these wells, please check!"); // LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:Channel aren't match with these wells, please check!"); // } // result = false; // return result; // } //} #endregion } } else if (!string.IsNullOrEmpty(strWells) && !strWells.Contains(',') && !strWells.Contains("=")) { wells = new string[] { strWells }; } else if (strWells.Contains("=")) { Variable variable = new Variable(); string strvariable = strWells.Substring(strWells.LastIndexOf('=') + 1, (strWells.Length - strWells.LastIndexOf('=') - 1)); for (int i = 0; i < launchView.gloadVariable.Count; i++) { Variable v = launchView.gloadVariable.Peek(); if (strvariable == v.variablename) { variable = v; break; } } if (variable.variablename.Equals(string.Empty) && strvariable.Length >= 1)//没有查找到变量名,看看是不是表达式,并求出表达式值 { for (int i = 0; i < launchView.gloadVariable.Count; i++) { Variable v = launchView.gloadVariable.Peek(); if (strvariable.Contains(v.variablename)) { variable = v; break; } } Microsoft.JScript.Vsa.VsaEngine ve = Microsoft.JScript.Vsa.VsaEngine.CreateEngine(); //return Microsoft.JScript.Eval.JScriptEvaluate(s, ve); string strExpress = strvariable.Replace(variable.variablename, variable.variablecurval); variable.variablecurval = Microsoft.JScript.Eval.JScriptEvaluate(strExpress, ve).ToString(); //ScriptControlClass sc = new ScriptControlClass(); //sc.Language = "JavasSript"; //string strExpress = strvariable.Replace(variable.variablename, variable.variablecurval); //variable.variablecurval = sc.Eval(strExpress).ToString(); } List sortWellName = new List(); if (chs.Length == 8) { for (int i = 0; i < labwares.number_row; i++) { string rowName = ComUtility.GetRowChar(i); string rowWellName = rowName + variable.variablecurval; //if (wells.Contains(rowWellName)) //{ sortWellName.Add(rowWellName); //} } wells = sortWellName.ToArray(); } else if(chs.Length>1&&chs.Length<8) { //根据枪头通道计算在第几个孔位 int startNum = chs.Length * (Convert.ToInt32(variable.variablecurval) - 1); int columnCount = (int)(Math.Ceiling((double)startNum / (double)labwares.number_row)); if (columnCount == 0) { columnCount++; } int totalCount = (int)labwares.number_row * columnCount; //选中列剩余多少个孔 int leftCount = totalCount - startNum; int startRowNum = (int)labwares.number_row - leftCount; if (leftCount == chs.Length) { for (int i = startRowNum; i < labwares.number_row; i++) { string rowName = ComUtility.GetRowChar(i); string rowWellName = rowName + columnCount.ToString(); sortWellName.Add(rowWellName); } } else { if (chs.Length >= labwares.number_row) { for (int i = startRowNum; i < labwares.number_row; i++) { string rowName = ComUtility.GetRowChar(i); string rowWellName = rowName + columnCount.ToString(); sortWellName.Add(rowWellName); } for (int i = 0; i < chs.Length - leftCount; i++) { string rowName = ComUtility.GetRowChar(i); string rowWellName = rowName + (columnCount + 1).ToString(); sortWellName.Add(rowWellName); } } else { int countNum = 0; for (int i = startRowNum; i < labwares.number_row; i++) { if (countNum >= chs.Length) { break; } countNum++; string rowName = ComUtility.GetRowChar(i); string rowWellName = rowName + columnCount.ToString(); sortWellName.Add(rowWellName); } for (int i = 0; i < chs.Length - leftCount; i++) { string rowName = ComUtility.GetRowChar(i); string rowWellName = rowName + (columnCount + 1).ToString(); sortWellName.Add(rowWellName); } } } wells = sortWellName.ToArray(); } else if (chs.Length == 1) { 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); } } if (Convert.ToInt32(variable.variablecurval) - 1 >= 0) { wells = new string[1]; wells[0] = sortWellName[Convert.ToInt32(variable.variablecurval) - 1]; } 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.RunDispenseResource.strLoopOutOfRange.ToString()); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: the value of variable is wrong! please check!"); } result = false; return result; } } } // 判断方法中的板位和板子是否能对应上设置的台面 Lattice lattice = new Lattice(); if (Shared.ChannelCount >= 1) { TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断 if (tabletopTemplate == null) { lattice = LatticeDB.GetLatticeDataByIdFromdb(latticenum, Convert.ToInt32(armId), Shared.SoftwareInformation.software_device_number);//arm1 } else { lattice = LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb(latticenum, Convert.ToInt32(armId), Shared.SoftwareInformation.software_device_number, tabletopTemplate.tabletopid); } int xmlLatticeId = Convert.ToInt32(latticenum.Substring(1));//ControlCom.GetLatticeId(Convert.ToInt32(lattice.lattice_id), false); 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.RunDispenseResource.strWithoutLattice.ToString()); LoggerRunHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.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!"); LoggerRunHelper.InfoLog("【" + 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 string[] charray = chs; // 获取板位信息 Lattice slattice = LatticeDB.GetLatticeDataByIdFromdb(lattice.lattice_id); // 获取板位孔的坐标数据 List dtWells = ControlCom.GenerateWellCoordinate(labwares, slattice); //液体参数 Liquid liquid = LiquidDB.GetALiquidFromdb(liquidpidValue); // 根据循环处理孔位 TipsTable aData = dtWells.SingleOrDefault(t => t.lattice_id.Equals(slattice.lattice_id) && t.labware_id.Equals(strLabwareid) && t.wellname.Equals(wells[0])); if (aData == null) { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strWithoutWellInfo.ToString()); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: the well on lattice of dispense liquid is wrong! please check!"); } result = false; return result; } if (Shared.ChannelCount.Equals(96)) { if (labwares.labware_type_id.Equals("3")) { if (!wells.Contains("A1")) { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strWithoutWellInfo.ToString()); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: the wells on lattice of dispense liquid is wrong! please check!"); } result = false; return result; } } else { if (!wells.Contains("A1") || !wells.Length.Equals(96)) { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strWithoutWellInfo.ToString()); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: the wells on lattice of dispense liquid is wrong! please check!"); } result = false; return result; } } } aData.lattice_num = slattice.lattice_num; string strWell = string.Join(",", wells); if (Shared.ChannelCount == 1) { #region DispenseMParam DispenseMParam dispenseMParam = new DispenseMParam(); dispenseMParam.afterAirDelay = (int)liquid.after_dispense_delay; dispenseMParam.armId = Convert.ToInt32(armId); dispenseMParam.basezAxisVal = zAxisVal; dispenseMParam.beforeAirDelay = (int)liquid.before_dispense_delay; dispenseMParam.afterAirDelay = (int)liquid.after_dispense_delay; if ((float)liquid.after_dispense_volume == 0.0f) { dispenseMParam.isAfterAir = false; } else { dispenseMParam.isAfterAir = true; dispenseMParam.afterAirpAxisVal = (float)liquid.after_dispense_volume; } if (liquid.before_dispense_volume == 0.0d) { dispenseMParam.isBeforeAir = false; } else { dispenseMParam.isBeforeAir = true; dispenseMParam.beforeAirpAxisVal = (float)liquid.before_dispense_volume; } if (liquid.dispense_is_knock_wall == 0) { dispenseMParam.isKnockWall = false; } else { dispenseMParam.isKnockWall = true; dispenseMParam.knockDirection = (int)liquid.dispense_knock_direction; dispenseMParam.knockSpeed = (float)liquid.dispense_knock_speed; dispenseMParam.knockWallDelay = (int)liquid.dispense_knock_wall_delay; dispenseMParam.knockWellxOryAxisVal = (float)liquid.dispense_knock_wall_length; dispenseMParam.knockWellzAxisVal = (float)liquid.dispense_knock_well_height; } if (isNull) { dispenseMParam.pAxisVal = ((float)Convert.ToDouble(wellvolume) + dispenseMParam.afterAirpAxisVal + dispenseMParam.beforeAirpAxisVal); } else { dispenseMParam.pAxisVal = (float)Convert.ToDouble(wellvolume); } dispenseMParam.dispenseSpeed = (float)liquid.dispense_speed; 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.wellzAxisVal = (float)liquid.well_top_length; dispenseMParam.xAxisVal = aData.axis_b_X; dispenseMParam.yAxisVal = aData.axis_b_Y; float zVal = 0f; if (liquid.dispense_well_bottom_length != 0) { string[] zOffsiteArray = liquid.dispense_well_bottom_length.ToString().Split(','); if (liquid.dispense_position_type == 0)//液体液面 { zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]);//底层用探测到的液面一下用aspirateMParam.zAxisAspirateOffsetVal } else if (liquid.dispense_position_type == 1)//孔口 { zVal = dispenseMParam.wellzAxisVal + (float)Convert.ToDouble(zOffsiteArray[0]); } else if (liquid.dispense_position_type == 2)//孔底 { if (labwares.labware_type_id.Equals("4")) { if (labwares.labware_tubeshelf_type == 1) { ObservableCollection labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labwares.labware_id); LabwareWellInfo currentWellInfo = labwareWellInfoList.FirstOrDefault(x => x.labware_well_name.Equals(aData.wellname)); Labware currentWellLabware = DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id); zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]) - ((float)currentWellLabware.labware_height-(float)currentWellLabware.well_height); } else { zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]) - ControlCom.CalculateWellBottomThickness(labwares.piled_script); } } else { zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]); } } } dispenseMParam.zAxisVal = zVal < 0 ? 0 : zVal; //dispenseMParam.zAxisVal = aData.axis_b_Z - (float)liquid.dispense_well_bottom_length; dispenseMParam.isMix = enableMix; if (dispenseMParam.isMix == true) { dispenseMParam.mixAspiratePositionValue = Convert.ToInt32(mixAspiratePositionValue); dispenseMParam.mixAspiratePositionText = mixAspiratePositionText; if (mixAspiratePositionValue == "0")//liquid { } else if (mixAspiratePositionValue == "1")//top { dispenseMParam.mixAspirateDistance = ((float)labwares.well_height - (float)mixAspirateDistance); } else if (mixAspiratePositionValue == "2")//bottom { dispenseMParam.mixAspirateDistance = (float)mixAspirateDistance; } dispenseMParam.mixAspirateSpeed = (float)Convert.ToDouble(mixAspirateSpeed); dispenseMParam.mixDispensePositionValue = Convert.ToInt32(mixDispensePositionValue); dispenseMParam.mixDispensePositionText = mixDispensePositionText; if (mixDispensePositionValue == "0")//liquid { } else if (mixDispensePositionValue == "1")//top { dispenseMParam.mixDispenseDistance = ((float)labwares.well_height - (float)mixDispenseDistance); } else if (mixDispensePositionValue == "2")//bottom { dispenseMParam.mixDispenseDistance = (float)mixDispenseDistance; } dispenseMParam.mixDispenseSpeed = (float)Convert.ToDouble(mixDispenseSpeed); dispenseMParam.mixvolume = (float)mixvolume; dispenseMParam.mixCount = mixcount; } else { dispenseMParam.mixAspirateDistance = 0; dispenseMParam.mixAspirateSpeed = 100; dispenseMParam.mixDispenseDistance = 0; dispenseMParam.mixDispenseSpeed = 100; } dispenseMParam.mixzAxisVal = (float)Convert.ToDouble(dispenseMParam.zAxisVal); //dispenseMParam.wellzAxisVal= aData. #endregion launchView.UpdateLabwareWells(aData, wells, 3); launchView.SetWaitOne();//暂停 ret = dispenseBll.ExecuteDispense(dispenseMParam, isSimulator); #region 错误处理 result = DoError(ret, methodNode, strWell, xmlEnv, currentLengthOfTip, zAxisVal, isSimulator, dispenseMParam.pAxisVal); #endregion } else if (Shared.ChannelCount > 1&&!Shared.ChannelCount.Equals(96)) { //// 判断是否是12孔板,12孔板就转变为4个枪头放液4次 //if (labwares.number_row.Equals(3) && labwares.number_column.Equals(4)) //{ // charray = new string[] { "1", "2", "3", "4" }; //} #region 拆分目标孔位 List tipsTableList = new List(); for (int i = 0; i < charray.Length; i++) { aData = dtWells.SingleOrDefault(t => t.lattice_id.Equals(lattice.lattice_id) && t.labware_id.Equals(strLabwareid) && t.wellname.Equals(wells[i])); if (aData != null) { tipsTableList.Add(aData); } } List> tipsTablesArr = ControlCom.GetGroupTipsByColumn(tipsTableList); if((float)labwares.a1_b1_distance<20f&& tipsTablesArr.Count>1)//枪限制增加判断 { tipsTablesArr.Clear(); tipsTableList.Clear(); for (int i = 0; i < charray.Length; i++) { tipsTableList = new List(); aData = dtWells.SingleOrDefault(t => t.lattice_id.Equals(lattice.lattice_id) && t.labware_id.Equals(strLabwareid) && t.wellname.Equals(wells[i])); if (aData != null) { tipsTableList.Add(aData); tipsTablesArr.Add(tipsTableList); } } } #endregion #region DispenseMParamSH for (int iTipChanelIndex = 0; iTipChanelIndex < tipsTablesArr.Count; iTipChanelIndex++) { DispenseMParamSH dispenseMParam = new DispenseMParamSH(); dispenseMParam.afterAirDelay = (int)liquid.after_dispense_delay; dispenseMParam.armId = Convert.ToInt32(armId); dispenseMParam.basezAxisVal = zAxisVal; dispenseMParam.beforeAirDelay = (int)liquid.before_dispense_delay; dispenseMParam.afterAirDelay = (int)liquid.after_dispense_delay; if ((float)liquid.after_dispense_volume == 0.0f) { dispenseMParam.isAfterAir = false; } else { dispenseMParam.isAfterAir = true; dispenseMParam.afterAirpAxisVal = (float)liquid.after_dispense_volume; } if (liquid.before_dispense_volume == 0.0d) { dispenseMParam.isBeforeAir = false; } else { dispenseMParam.isBeforeAir = true; dispenseMParam.beforeAirpAxisVal = (float)liquid.before_dispense_volume; } if (liquid.dispense_is_knock_wall == 0) { dispenseMParam.isKnockWall = false; } else { dispenseMParam.isKnockWall = true; dispenseMParam.knockDirection = (int)liquid.dispense_knock_direction; dispenseMParam.knockSpeed = (float)liquid.dispense_knock_speed; dispenseMParam.knockWallDelay = (int)liquid.dispense_knock_wall_delay; dispenseMParam.knockWellxOryAxisVal = (float)liquid.dispense_knock_wall_length; dispenseMParam.knockWellzAxisVal = (float)liquid.dispense_knock_well_height; dispenseMParam.knockWellzAxisVal = (float)liquid.knock_well_height; //dispenseMParam.xAxisKnockOffsetVal = (float)liquid.knock_wall_x; //dispenseMParam.yAxisKnockOffsetVal = (float)liquid.knock_wall_y; dispenseMParam.wellDiameter = (float)liquid.knock_wall_y; if (labwares.well_shape == 2) { dispenseMParam.wellDiameter = (float)labwares.well_top_x; } else if (labwares.well_shape == 1) { dispenseMParam.wellDiameter = (float)(labwares.well_mouth_radius * 2); } } //string strIsEmpty = methodNode.SelectSingleNode("isNull").InnerText; if (isNull) { dispenseMParam.enableVolumeToNull = true; float[] pAxisVal = new float[tipsTablesArr[iTipChanelIndex].Count]; for (int i = 0; i < tipsTablesArr[iTipChanelIndex].Count; i++) { pAxisVal[i] = (float)Convert.ToDouble(wellvolume); } dispenseMParam.pAxisVal = pAxisVal; //DataRow dataRow = launchView.dataTableTotal.Rows[launchView.dataTableTotal.Rows.Count - 1]; wellvolume = launchView.fVolumeToNull; } else { dispenseMParam.enableVolumeToNull = false; LiquidAccuracy liquidAccuracy = liquidAccuracyBll.GetLiquidAccuracyFromdb(Convert.ToInt32(liquidrangeidValue), Convert.ToInt32(armId), Convert.ToDouble(wellvolume), liquididValue); double targetVolume = liquidAccuracyBll.CalculateAspirateParamVolume(Convert.ToDouble(wellvolume), liquidAccuracy); float[] pAxisVal = new float[tipsTablesArr[iTipChanelIndex].Count]; for (int i = 0; i < tipsTablesArr[iTipChanelIndex].Count; i++) { pAxisVal[i] = (float)targetVolume; } dispenseMParam.pAxisVal = pAxisVal; launchView.fVolumeToNull = launchView.fVolumeToNull - (float)Convert.ToDouble(wellvolume); } launchView.fVolumeToNull = (float)Convert.ToDouble(wellvolume); dispenseMParam.dispenseSpeed = (float)liquid.dispense_speed; 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.wellzAxisVal = (float)liquid.well_top_length; if (labwares.labware_type_id.Equals("4")) { dispenseMParam.wellzAxisVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).labware_height); } else { dispenseMParam.wellzAxisVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Z - ((float)labwares.well_height);// - (float)liquid.well_top_length) ; } dispenseMParam.xAxisVal = tipsTablesArr[iTipChanelIndex][0].axis_b_X; dispenseMParam.yAxisVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Y; dispenseMParam.isMix = enableMix; if (dispenseMParam.isMix == true) { dispenseMParam.mixAspiratePositionValue = Convert.ToInt32(mixAspiratePositionValue); dispenseMParam.mixAspiratePositionText = mixAspiratePositionText; if (labwares.labware_type_id.Equals("4")) { if (mixAspiratePositionValue == "0")//liquid { } else if (mixAspiratePositionValue == "1")//top { dispenseMParam.mixAspirateDistance = ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).well_height - (float)mixAspirateDistance); } else if (mixAspiratePositionValue == "2")//bottom { dispenseMParam.mixAspirateDistance = (float)mixAspirateDistance; } } else { if (mixAspiratePositionValue == "0")//liquid { } else if (mixAspiratePositionValue == "1")//top { dispenseMParam.mixAspirateDistance = ((float)labwares.well_height - (float)mixAspirateDistance); } else if (mixAspiratePositionValue == "2")//bottom { dispenseMParam.mixAspirateDistance = (float)mixAspirateDistance; } } dispenseMParam.mixAspirateSpeed = (float)Convert.ToDouble(mixAspirateSpeed); dispenseMParam.mixDispensePositionValue = Convert.ToInt32(mixDispensePositionValue); dispenseMParam.mixDispensePositionText = mixDispensePositionText; if (labwares.labware_type_id.Equals("4")) { if (mixDispensePositionValue == "0")//liquid { } else if (mixDispensePositionValue == "1")//top { dispenseMParam.mixDispenseDistance = ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).well_height - (float)mixDispenseDistance); } else if (mixDispensePositionValue == "2")//bottom { dispenseMParam.mixDispenseDistance = (float)mixDispenseDistance; } } else { if (mixDispensePositionValue == "0")//liquid { } else if (mixDispensePositionValue == "1")//top { dispenseMParam.mixDispenseDistance = ((float)labwares.well_height - (float)mixDispenseDistance); } else if (mixDispensePositionValue == "2")//bottom { dispenseMParam.mixDispenseDistance = (float)mixDispenseDistance; } } dispenseMParam.mixDispenseSpeed = (float)Convert.ToDouble(mixDispenseSpeed); dispenseMParam.mixvolume = (float)mixvolume; dispenseMParam.mixCount = mixcount; } else { dispenseMParam.mixAspirateDistance = 0; dispenseMParam.mixAspirateSpeed = 100; dispenseMParam.mixDispenseDistance = 0; dispenseMParam.mixDispenseSpeed = 100; } dispenseMParam.isSurvey = enableLiquidSensor; if (dispenseMParam.isSurvey == true) { if (labwares.labware_type_id.Equals("4")) { Labware centrifugalLabware = ControlCom.GetCentrifugalLabwer(labwares.piled_script); dispenseMParam.surveyInitzVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).labware_height - (float)liquidSensorDistance); dispenseMParam.surveyMaxzVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).labware_height - (float)liquidSensorEndDistance); dispenseMParam.surveySpeed = (float)liquidSensorSpeed; dispenseMParam.wellzAxisVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).labware_height); dispenseMParam.wellBottomzAxisVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Z - ((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).labware_height - (float)ControlCom.GetCentrifugalLabwer(labwares.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 (labwares.well_shape == (int)WellSharpe.Round) { area = (float)(Math.PI * (float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).well_mouth_radius * (float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).well_mouth_radius); } else if (labwares.well_shape == (int)WellSharpe.Rectangle) { area = (float)((float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).well_top_x * (float)ControlCom.GetCentrifugalLabwer(labwares.piled_script).well_top_y); } dispenseMParam.sectionalArea = area; dispenseMParam.isMixFollowup = enableMixFollow; } else { } } else { //dispenseMParam.surveyRetryCount = liquidSensorCount; dispenseMParam.surveyInitzVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Z - ((float)labwares.well_height - (float)liquidSensorDistance); dispenseMParam.surveyMaxzVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Z - ((float)labwares.well_height - (float)liquidSensorEndDistance); dispenseMParam.surveySpeed = (float)liquidSensorSpeed; //aspirateMParam.surveyCoefficient =; dispenseMParam.wellzAxisVal = tipsTablesArr[iTipChanelIndex][0].axis_b_Z - ((float)labwares.well_height);// - (float)liquid.well_top_length); dispenseMParam.wellBottomzAxisVal = tipsTablesArr[iTipChanelIndex][0].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 (labwares.well_shape == (int)WellSharpe.Round) { area = (float)(Math.PI * labwares.well_mouth_radius * labwares.well_mouth_radius); } else if (labwares.well_shape == (int)WellSharpe.Rectangle) { area = (float)(labwares.well_top_x * labwares.well_top_y); } dispenseMParam.sectionalArea = area; dispenseMParam.isMixFollowup = enableMixFollow; } else { } } } else { } float[] fzAxisVal = new float[tipsTablesArr[iTipChanelIndex].Count]; int[] channelIds = new int[tipsTablesArr[iTipChanelIndex].Count]; //计算已用的通道号 int startChannelNum = 0; for (int k = 0; k < iTipChanelIndex; k++) { startChannelNum += tipsTablesArr[k].Count; } for (int i = 0; i < tipsTablesArr[iTipChanelIndex].Count; i++) { float zVal = tipsTablesArr[iTipChanelIndex][i].axis_b_Z; //dispenseMParam.wellzAxisVal = zVal - (float)labwares.well_height; if (liquid.dispense_position_type == 0)//液面开始探测时用, { zVal = tipsTablesArr[iTipChanelIndex][i].axis_b_Z - (float)labwares.labware_height; } else if (liquid.dispense_position_type == 1)//孔口 { zVal = dispenseMParam.wellzAxisVal + (float)liquid.dispense_well_bottom_length; } else if (liquid.dispense_position_type == 2)//孔底 { if (labwares.labware_type_id.Equals("4")) { zVal = tipsTablesArr[iTipChanelIndex][i].axis_b_Z - (float)Convert.ToDouble(liquid.dispense_well_bottom_length) - ControlCom.CalculateWellBottomThickness(labwares.piled_script); } else { zVal = tipsTablesArr[iTipChanelIndex][i].axis_b_Z - (float)Convert.ToDouble(liquid.dispense_well_bottom_length); } } //float zVal = tipsTable.axis_b_Z - (float)liquid.aspirate_well_bottom_length; //aspirateMParam.zAxisVal = fzAxisVal[i] = zVal < 0 ? 0 : zVal;//aData.axis_b_Z - (float)liquid.dispense_well_bottom_length; channelIds[i] = Convert.ToInt32(charray[i + startChannelNum]); } dispenseMParam.zAxisVal = fzAxisVal; dispenseMParam.channelId = channelIds; dispenseMParam.channelCount = channelIds.Length; dispenseMParam.mixzAxisVal = (float)Convert.ToDouble(dispenseMParam.zAxisVal[0]); //dispenseMParam.wellzAxisVal= aData. if (tipsTablesArr.Count > 1 && (float)labwares.a1_b1_distance < 20f) { dispenseMParam.yChannelGapVal = 25f; } else { dispenseMParam.yChannelGapVal = ((float)labwares.a1_b1_distance).Equals(0f) ? 9f : (float)labwares.a1_b1_distance; } #endregion wells = new string[tipsTablesArr[iTipChanelIndex].Count]; for (int k = 0; k < tipsTablesArr[iTipChanelIndex].Count; k++) { wells[k] = tipsTablesArr[iTipChanelIndex][k].wellname; } launchView.UpdateLabwareWells(aData, wells, 3); launchView.SetWaitOne();//暂停 ret = dispenseBll.ExecuteDispense(dispenseMParam, isSimulator); #region 错误处理 result = DoError(ret, methodNode, strWell, xmlEnv, currentLengthOfTip, zAxisVal, isSimulator, dispenseMParam.pAxisVal[0]); #endregion } } else if (Shared.ChannelCount.Equals(96)) { #region DispenseMParam DispenseMParam dispenseMParam = new DispenseMParam(); dispenseMParam.afterAirDelay = (int)liquid.after_dispense_delay; dispenseMParam.armId = Convert.ToInt32(armId); dispenseMParam.basezAxisVal = zAxisVal; dispenseMParam.beforeAirDelay = (int)liquid.before_dispense_delay; dispenseMParam.afterAirDelay = (int)liquid.after_dispense_delay; if ((float)liquid.after_dispense_volume == 0.0f) { dispenseMParam.isAfterAir = false; } else { dispenseMParam.isAfterAir = true; dispenseMParam.afterAirpAxisVal = (float)liquid.after_dispense_volume; } if (liquid.before_dispense_volume == 0.0d) { dispenseMParam.isBeforeAir = false; } else { dispenseMParam.isBeforeAir = true; dispenseMParam.beforeAirpAxisVal = (float)liquid.before_dispense_volume; } if (liquid.dispense_is_knock_wall == 0) { dispenseMParam.isKnockWall = false; } else { dispenseMParam.isKnockWall = true; dispenseMParam.knockDirection = (int)liquid.dispense_knock_direction; dispenseMParam.knockSpeed = (float)liquid.dispense_knock_speed; dispenseMParam.knockWallDelay = (int)liquid.dispense_knock_wall_delay; dispenseMParam.knockWellxOryAxisVal = (float)liquid.dispense_knock_wall_length; dispenseMParam.knockWellzAxisVal = (float)liquid.dispense_knock_well_height; } if (isNull) { dispenseMParam.enableVolumeToNull = true; DataRow dataRow = launchView.dataTableTotal.Rows[launchView.dataTableTotal.Rows.Count - 1]; wellvolume = launchView.fVolumeToNull; dispenseMParam.pAxisVal = ((float)Convert.ToDouble(wellvolume) + dispenseMParam.afterAirpAxisVal + dispenseMParam.beforeAirpAxisVal); } else { dispenseMParam.enableVolumeToNull = false; LiquidAccuracy liquidAccuracy = liquidAccuracyBll.GetLiquidAccuracyFromdb(Convert.ToInt32(liquidrangeidValue), Convert.ToInt32(armId), Convert.ToDouble(wellvolume), liquididValue); double targetVolume = liquidAccuracyBll.CalculateAspirateParamVolume(Convert.ToDouble(wellvolume), liquidAccuracy); launchView.fVolumeToNull = launchView.fVolumeToNull - (float)Convert.ToDouble(wellvolume); dispenseMParam.pAxisVal = (float)Convert.ToDouble(targetVolume); } dispenseMParam.dispenseSpeed = (float)liquid.dispense_speed; 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.wellzAxisVal = (float)liquid.well_top_length; dispenseMParam.xAxisVal = aData.axis_b_X; dispenseMParam.yAxisVal = aData.axis_b_Y; dispenseMParam.zAxisVal = aData.axis_b_Z- currentLengthOfTip - (float)liquid.dispense_well_bottom_length; dispenseMParam.isMix = enableMix; if (dispenseMParam.isMix == true) { dispenseMParam.mixAspiratePositionValue = Convert.ToInt32(mixAspiratePositionValue); dispenseMParam.mixAspiratePositionText = mixAspiratePositionText; if (mixAspiratePositionValue == "0")//liquid { } else if (mixAspiratePositionValue == "1")//top { dispenseMParam.mixAspirateDistance = ((float)labwares.well_height - (float)mixAspirateDistance); } else if (mixAspiratePositionValue == "2")//bottom { dispenseMParam.mixAspirateDistance = (float)mixAspirateDistance; } dispenseMParam.mixAspirateSpeed = (float)Convert.ToDouble(mixAspirateSpeed); dispenseMParam.mixDispensePositionValue = Convert.ToInt32(mixDispensePositionValue); dispenseMParam.mixDispensePositionText = mixDispensePositionText; if (mixDispensePositionValue == "0")//liquid { } else if (mixDispensePositionValue == "1")//top { dispenseMParam.mixDispenseDistance = ((float)labwares.well_height - (float)mixDispenseDistance); } else if (mixDispensePositionValue == "2")//bottom { dispenseMParam.mixDispenseDistance = (float)mixDispenseDistance; } dispenseMParam.mixDispenseSpeed = (float)Convert.ToDouble(mixDispenseSpeed); dispenseMParam.mixvolume = (float)mixvolume; dispenseMParam.mixCount = mixcount; } else { dispenseMParam.mixAspirateDistance = 0; dispenseMParam.mixAspirateSpeed = 100; dispenseMParam.mixDispenseDistance = 0; dispenseMParam.mixDispenseSpeed = 100; } dispenseMParam.mixzAxisVal = (float)Convert.ToDouble(dispenseMParam.zAxisVal); //dispenseMParam.wellzAxisVal= aData. #endregion launchView.UpdateLabwareWells(aData, wells, 3); launchView.SetWaitOne();//暂停 ret = dispenseBll.ExecuteDispense(dispenseMParam, isSimulator); #region 错误处理 result = DoError(ret, methodNode, strWell, xmlEnv, currentLengthOfTip, zAxisVal, isSimulator, dispenseMParam.pAxisVal); #endregion } } 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 + ";"); } if (launchView.isRemotingOper) { launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1001", 5, "error:source:" + ex.Source + ";error:" + ex.Message + ";", 2); } result = false; } return result; } #endregion #region 错误处理 private bool DoError(HxResult ret, XmlNode methodNode, string strWell, XmlNode xmlEnv, float currentLengthOfTip, float zAxisVal, bool isSimulator, float pAxisVal) { bool result = true; string methodName = methodNode.SelectSingleNode("name").InnerText; string position = methodNode.SelectSingleNode("position/text").InnerText; #region 错误处理 if (ret.Result != ResultType.Success) { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodName + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseFail.ToString() + ret.AlarmInfo + "孔 " + strWell + " 板位 " + position); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodName + "】progress: dispense liquid progress is fail from" + strWell + " well on " + position + "lattice! error information:" + ret.AlarmInfo); } OperateDialog plsConfirmOper = null; if (!launchView.isRemotingOper) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.RunDispenseResource.strFailWhatToDo : "dispense liquid is fail! What do you want to do?"); plsConfirmOper.ShowDialog(); })); } else { launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1052", 5, Properties.RunDispenseResource.strFailWhatToDo, 2); plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.RunDispenseResource.strFailWhatToDo : "dispense liquid is fail! What do you want to do?"); plsConfirmOper.ShowDialog(); } if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Retry) // 重试 { return ExecuteDispense(xmlEnv, methodNode, currentLengthOfTip, zAxisVal, isSimulator); } else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Cancel) // 终止 { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodName + "】" + Properties.MachineRunResource.strProgress + Properties.RunDispenseResource.strLoadTipWasStopped); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodName + "】progress:dispense liquid was stopped!"); } if (launchView.isRemotingOper) { launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1053", 5, Properties.RunDispenseResource.strLoadTipWasStopped, 2); } result = false; return result; } else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Continue) // 跳过 { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodName + "】" + Properties.MachineRunResource.strProgress + Properties.RunDispenseResource.strLoadTipWasSkipped); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodName + "】progress:dispense liquid was skipped!"); } } } else { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodName + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunDispenseResource.strDispenseSuccess.ToString() + " 体积 " + pAxisVal.ToString() + "ul 孔 " + strWell + " 板位 " + position); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodName + "】progress:aspirate " + pAxisVal.ToString() + "ul liquid is success from " + strWell + " well on " + position + " lattice!"); } } #endregion return result; } #endregion } }