using DriverLib.Engine; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml; using XCoreBLL.Resource; using XImagingXhandler.XDAL; namespace XCore { public class CommonBll { #region 获取xml共同部分数据 /// /// 获取xml共同部分数据 /// /// /// /// public static void GenerateMethodBaseDataByXmlNode(XmlNode xmlNode, MethodBase methodBase, bool isOpenFile) { methodBase.isrun = xmlNode.SelectSingleNode("isrun").InnerText; methodBase.status = xmlNode.SelectSingleNode("status").InnerText; methodBase.name = xmlNode.SelectSingleNode("name").InnerText; methodBase.label = xmlNode.SelectSingleNode("label").InnerText; methodBase.strIndex = xmlNode.SelectSingleNode("strIndex").InnerText; if (xmlNode.SelectSingleNode("id") != null) { methodBase.id = xmlNode.SelectSingleNode("id").InnerText; } if (!isOpenFile) { if (xmlNode.SelectSingleNode("keyId") != null) { methodBase.keyId = xmlNode.SelectSingleNode("keyId").InnerText; } } } #endregion /// /// 获取挑菌前环境设置参数 /// /// /// public static MethodChoiceAgoAspirateChild GenerateChoiceAgoAspirateChildDataByXmlNode(XmlNode xmlNode) { MethodChoiceAgoAspirateChild choiceAgoAspirateData = new MethodChoiceAgoAspirateChild(); choiceAgoAspirateData.bEnableBeforeAspirate = (xmlNode.SelectSingleNode("bEnableBeforeAspirate").InnerText.ToLower().ToString() == "true" ? true : false); if (choiceAgoAspirateData.bEnableBeforeAspirate) // 开启前吸液在挑菌前 { choiceAgoAspirateData.labwareText = xmlNode.SelectSingleNode("labwareAspirate/text").InnerText; choiceAgoAspirateData.labwareValue = xmlNode.SelectSingleNode("labwareAspirate/value").InnerText; choiceAgoAspirateData.positionText = xmlNode.SelectSingleNode("positionAspirate/text").InnerText; choiceAgoAspirateData.positionValue = xmlNode.SelectSingleNode("positionAspirate/value").InnerText; choiceAgoAspirateData.wellarray = xmlNode.SelectSingleNode("wellarray").InnerText; choiceAgoAspirateData.wellvolume = Convert.ToDouble(xmlNode.SelectSingleNode("wellvolume").InnerText); choiceAgoAspirateData.liquididText1 = xmlNode.SelectSingleNode("liquidid1/text").InnerText; choiceAgoAspirateData.liquididValue1 = xmlNode.SelectSingleNode("liquidid1/value").InnerText; choiceAgoAspirateData.liquidrangeidText1 = xmlNode.SelectSingleNode("liquidrangeid1/text").InnerText; choiceAgoAspirateData.liquidrangeidValue1 = xmlNode.SelectSingleNode("liquidrangeid1/value").InnerText; choiceAgoAspirateData.liquidpidText1 = xmlNode.SelectSingleNode("liquidpid1/text").InnerText; choiceAgoAspirateData.liquidpidValue1 = xmlNode.SelectSingleNode("liquidpid1/value").InnerText; } return choiceAgoAspirateData; } public static void DoSimulateDelay() { Thread.Sleep(Convert.ToInt32(ConfigurationManager.AppSettings["simulateDelay"])); } #region 状态灯 /// // 状态0 未链接 黄闪; // 状态1 链接成功 蓝亮; // 状态2 初始化 黄蓝绿交替闪; // 状态3 待机 蓝色; // 状态4 运行 绿色; // 状态5 暂停 黄色; // 状态6 报错/急停 红闪/蜂鸣5S; // 状态7 运行结束 蓝闪/蜂鸣5S; /// /// /// public static HxResult StatusLamp(int status, bool isSimulator) { HxResult ret = new HxResult(); if (isSimulator) { ret.Result = ResultType.Success; } else { ret = MethodAction.Instance.StatusLamp(status); } return ret; } #endregion } }