schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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共同部分数据
        /// <summary>
        /// 获取xml共同部分数据
        /// </summary>
        /// <param name="xmlNode"></param>
        /// <param name="methodBase"></param>
        /// <param name="isOpenFile"></param>
        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
 
        /// <summary>
        /// 获取挑菌前环境设置参数
        /// </summary>
        /// <param name="xmlNode"></param>
        /// <returns></returns>
        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 状态灯
        /// <summary>
        //  状态0 未链接 黄闪;
        //  状态1 链接成功 蓝亮;
        //  状态2 初始化 黄蓝绿交替闪;
        //  状态3 待机 蓝色;
        //  状态4 运行 绿色;
        //  状态5 暂停 黄色;
        //  状态6 报错/急停 红闪/蜂鸣5S;
        //  状态7 运行结束 蓝闪/蜂鸣5S;
        /// </summary>
        /// <param name="status"></param>
        /// <param name="isSimulator"></param>
        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
    }
}