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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
using DriverLib.Engine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using XCoreBLL.Resource;
using XImagingXhandler.XDAL;
 
namespace XCoreBLL
{
    public class WaitForBll
    {
        string strCurrentCulture = "";
        public WaitForBll()
        {
            strCurrentCulture = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
        }
        /// <summary>
        /// 生成计时器方法的xml节点属性对象
        /// </summary>
        /// <param name="xmlNode">计时器方法的xml节点</param>
        /// <returns>计时器方法的xml节点属性对象</returns>
        public MethodWaitFor GenerateMethodTimer(XmlNode xmlNode)
        {
            MethodWaitFor methodWaitFor = new MethodWaitFor();
            methodWaitFor.isrun = xmlNode.SelectSingleNode("isrun").InnerText;
            methodWaitFor.status = xmlNode.SelectSingleNode("status").InnerText;
            methodWaitFor.name = xmlNode.SelectSingleNode("name").InnerText;
            methodWaitFor.strIndex = xmlNode.SelectSingleNode("strIndex").InnerText;
            methodWaitFor.label = xmlNode.SelectSingleNode("label").InnerText;
            methodWaitFor.duringTimeText = xmlNode.SelectSingleNode("duringTimeText").InnerText;
            methodWaitFor.duringTimeTextStrIndex = xmlNode.SelectSingleNode("duringTimeTextStrIndex").InnerText;
            methodWaitFor.enableEndWaitfor = (xmlNode.SelectSingleNode("enableEndWaitfor").InnerText.ToLower()=="true")?true:false;
            return methodWaitFor;
        }
 
        #region 检查所有属性设置是否满足要求
        /// <summary>
        /// 检查所有属性设置是否满足要求
        /// </summary>
        /// <param name="methodAspirate">暂停属性对象</param>
        /// <returns>检查所有属性设置是否满足要求</returns>
        public MethodPropertyInfo CheckProperty(MethodWaitFor methodWaitFor)
        {
            MethodPropertyInfo methodPropertyInfo = new MethodPropertyInfo();
 
            if (strCurrentCulture == "zh-CN")
            {
                methodPropertyInfo.property_tips_info = PauseMoveResourceCHS.tipsInfo.ToString();
 
                //if (methodPauseMove.armText == null || methodPauseMove.armText == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceCHS.armText.ToString();
                //}
                //if (methodPauseMove.labwareText == null || methodPauseMove.labwareText == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceCHS.labwareText.ToString();
                //}
                //if (methodPauseMove.labwaretipText == null || methodPauseMove.labwaretipText == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceCHS.labwaretipText.ToString();
                //}
                //if (methodPauseMove.pauseTime == null || methodPauseMove.pauseTime == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceCHS.pauseTime.ToString();
                //}
                //if (methodPauseMove.positionText == null || methodPauseMove.positionText == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceCHS.positionText.ToString();
                //}
            }
            else if (strCurrentCulture == "en-US")
            {
                methodPropertyInfo.property_tips_info = PauseMoveResourceENU.tipsInfo.ToString();
 
                //if (methodPauseMove.armText == null || methodPauseMove.armText == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceENU.armText.ToString();
                //}
                //if (methodPauseMove.labwareText == null || methodPauseMove.labwareText == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceENU.labwareText.ToString();
                //}
                //if (methodPauseMove.labwaretipText == null || methodPauseMove.labwaretipText == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceENU.labwaretipText.ToString();
                //}
                //if (methodPauseMove.pauseTime == null || methodPauseMove.pauseTime == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceENU.pauseTime.ToString();
                //}
                //if (methodPauseMove.positionText == null || methodPauseMove.positionText == "")
                //{
                //    methodPropertyInfo.property_name_info = PauseMoveResourceENU.positionText.ToString();
                //}
            }
            return methodPropertyInfo;
        }
        #endregion
 
        #region 执行暂停,返回结果字符串
        /// <summary>
        /// 执行暂停,返回结果字符串
        /// </summary>
        /// <param name="flag">1:暂停;2:继续</param>
        /// <param name="isSimulator"></param>
        /// <returns>结果实体对象</returns>
        public HxResult ExecutePause(int flag, bool isSimulator = false)
        {
            HxResult ret = new HxResult();
            if (!isSimulator)
            {
                if (flag == 1)
                {
                    ret = MethodAction.Instance.Interrupt(flag, true);
                }
                else if (flag == 2)
                {
                    ret = MethodAction.Instance.Interrupt(flag, false);
                }
            }
            else
            {
                ret.Result = ResultType.Success;
            }
            return ret;
        }
        #endregion
    }
}