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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
using DriverLib.Engine;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Remoting.Channels;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using XCommon;
using XCoreBLL.Resource;
using XImagingXhandler.XDAL;
namespace XCore
{
    public class LoadTipsBll
    {
        string strCurrentCulture = "";
        WellCalc wellCalc = new WellCalc();
        LatticeBll latticeBll = new LatticeBll();
 
        public LoadTipsBll()
        {
            strCurrentCulture = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
        }
 
        public MethodLoadTips GenerateMethodLoadTipsDataByXmlNode(XmlNode xmlNode)
        {
            MethodLoadTips methodLoadTips= new MethodLoadTips();
 
            methodLoadTips.isrun = xmlNode.SelectSingleNode("isrun").InnerText;
            methodLoadTips.status = xmlNode.SelectSingleNode("status").InnerText;
            methodLoadTips.name = xmlNode.SelectSingleNode("name").InnerText;
            methodLoadTips.label = xmlNode.SelectSingleNode("label").InnerText;
            methodLoadTips.strIndex = xmlNode.SelectSingleNode("strIndex").InnerText;
            //methodLoadTips.labwareValue = xmlNode.SelectSingleNode("").InnerText;
            //methodLoadTips.positionText = xmlNode.SelectSingleNode("").InnerText;
            //methodLoadTips.positionValue = xmlNode.SelectSingleNode("").InnerText;
            methodLoadTips.armText = xmlNode.SelectSingleNode("arm/text").InnerText;
            methodLoadTips.armValue = xmlNode.SelectSingleNode("arm/value").InnerText;
            //methodLoadTips.headType = xmlNode.SelectSingleNode("").InnerText;
            methodLoadTips.labwaretipText = xmlNode.SelectSingleNode("labwaretip/text").InnerText;
            methodLoadTips.labwaretipValue = xmlNode.SelectSingleNode("labwaretip/value").InnerText;
            //methodLoadTips.wellarray = xmlNode.SelectSingleNode("").InnerText;
            string strchs= xmlNode.SelectSingleNode("channels").InnerText;
            methodLoadTips.channels = ComUtility.GetChannelsFromXml(strchs);
 
            return methodLoadTips;
        }
 
        #region 检查所有属性设置是否满足要求
        /// <summary>
        /// 检查所有属性设置是否满足要求
        /// </summary>
        /// <param name="methodAspirate">吸液属性对象</param>
        /// <returns>检查所有属性设置是否满足要求</returns>
        public MethodPropertyInfo CheckProperty(MethodLoadTips methodLoadTips)
        {
            MethodPropertyInfo methodPropertyInfo = new MethodPropertyInfo();
 
            if (strCurrentCulture == "zh-CN")
            {
                methodPropertyInfo.property_tips_info = LoadTipsResourceCHS.tipsInfo.ToString();
 
                if (methodLoadTips.labwaretipText == null || methodLoadTips.labwaretipText == "")
                {
                    methodPropertyInfo.property_name_info = LoadTipsResourceCHS.labwareText.ToString();
                }
                if (methodLoadTips.positionValue == null || methodLoadTips.positionValue == "")
                {
                    methodPropertyInfo.property_name_info = LoadTipsResourceCHS.positionText.ToString();
                }
                if (methodLoadTips.armValue == null || methodLoadTips.armValue == "")
                {
                    methodPropertyInfo.property_name_info = LoadTipsResourceCHS.armText.ToString();
                }
                else
                {
                    if(methodLoadTips.armValue== "arm1")
                    {
                        if(LoadTipsResourceCHS.wellarray.Contains(","))
                        {
                            methodPropertyInfo.property_name_info = LoadTipsResourceCHS.armWithSingleChannel.ToString();
                            methodPropertyInfo.property_tips_info = LoadTipsResourceCHS.errorInfo.ToString();
                        }
                    }
                    else if(methodLoadTips.armValue == "arm2")
                    {
                        if (!LoadTipsResourceCHS.wellarray.Contains(","))
                        {
                            methodPropertyInfo.property_name_info = LoadTipsResourceCHS.armWithSingleChannel.ToString();
                            methodPropertyInfo.property_tips_info = LoadTipsResourceCHS.errorInfo.ToString();
                        }
                    }
                }
                if (methodLoadTips.wellarray == null || methodLoadTips.wellarray == "")
                {
                    methodPropertyInfo.property_name_info = LoadTipsResourceCHS.wellarray.ToString();
                }
            }
            else if (strCurrentCulture == "en-US")
            {
                methodPropertyInfo.property_tips_info = LoadTipsResourceENU.tipsInfo.ToString();
 
                if (methodLoadTips.labwaretipText == null || methodLoadTips.labwaretipText == "")
                {
                    methodPropertyInfo.property_name_info = LoadTipsResourceENU.labwareText.ToString();
                }
                if (methodLoadTips.positionValue == null || methodLoadTips.positionValue == "")
                {
                    methodPropertyInfo.property_name_info = LoadTipsResourceENU.positionText.ToString();
                }
                if (methodLoadTips.armValue == null || methodLoadTips.armValue == "")
                {
                    methodPropertyInfo.property_name_info = LoadTipsResourceENU.armText.ToString();
                }
                else
                {
                    if (methodLoadTips.armValue == "arm1")
                    {
                        if (LoadTipsResourceENU.wellarray.Contains(","))
                        {
                            methodPropertyInfo.property_name_info = LoadTipsResourceENU.armWithSingleChannel.ToString();
                            methodPropertyInfo.property_tips_info = LoadTipsResourceENU.errorInfo.ToString();
                        }
                    }
                    else if (methodLoadTips.armValue == "arm2")
                    {
                        if (!LoadTipsResourceENU.wellarray.Contains(","))
                        {
                            methodPropertyInfo.property_name_info = LoadTipsResourceENU.armWithSingleChannel.ToString();
                            methodPropertyInfo.property_tips_info = LoadTipsResourceENU.errorInfo.ToString();
                        }
                    }
                }
                if (methodLoadTips.wellarray == null || methodLoadTips.wellarray == "")
                {
                    methodPropertyInfo.property_name_info = LoadTipsResourceENU.labwareText.ToString();
                }
            }
            return methodPropertyInfo;
        }
        #endregion
 
        #region 执行装载吸头,返回结果字符串
        /// <summary>
        /// 执行装载吸头,返回结果字符串
        /// </summary>
        /// <param name="labwareNode">装载吸头的板位节点对象</param>
        /// <param name="isSimulator"></param>
        /// <returns>结果实体对象</returns>
        public HxResult ExecuteLoadTips(LoadTipsMParam loadTipsMParam,bool isSimulator=false)
        {
            HxResult ret = new HxResult();
            if (!isSimulator)
            {
                ret = MethodAction.Instance.LoadTip(loadTipsMParam);
            }
            else
            {
                ret.Result = ResultType.Success;
            }
 
            return ret;
        }
        #endregion
 
        #region 执行装载吸头,返回结果字符串
        /// <summary>
        /// 执行装载吸头,返回结果字符串
        /// </summary>
        /// <param name="labwareNode">装载吸头的板位节点对象</param>
        /// <param name="isSimulator"></param>
        /// <returns>结果实体对象</returns>
        public HxResult ExecuteLoadTips(LoadTipsMParamSH loadTipsMParam, bool isSimulator = false)
        {
            HxResult ret = new HxResult();
            if (!isSimulator)
            {
                ret = MethodAction.Instance.LoadTip(loadTipsMParam);
            }
            else
            {
                ret.Result = ResultType.Success;
            }
 
            return ret;
        }
        #endregion
 
        #region 检查所有属性设置是否满足要求
        /// <summary>
        /// 检查所有属性设置是否满足要求
        /// </summary>
        /// <param name="methodAspirate">吸液属性对象</param>
        /// <returns>检查所有属性设置是否满足要求</returns>
        public DataCheckResult CheckProperty(XmlNode xmlNode)
        {
            DataCheckResult dataCheckResult = new DataCheckResult();
            dataCheckResult.result = 0;
            dataCheckResult.errorlist = new List<string>();
            dataCheckResult.errorlist.Add("LoadTips method:");
 
            if (strCurrentCulture == "zh-CN")
            {
                string armValue = xmlNode.SelectSingleNode("arm/value").InnerText;
                if(string.IsNullOrEmpty(armValue)||armValue=="0")
                {
                    dataCheckResult.result = 1;
                    
                    dataCheckResult.errorlist.Add(LoadTipsResourceCHS.armText.ToString()+"未设置;");
                }
 
                string channels = xmlNode.SelectSingleNode("channels").InnerText;
                if(string.IsNullOrEmpty(channels))
                {
                    dataCheckResult.result = 1;
 
                    dataCheckResult.errorlist.Add(LoadTipsResourceCHS.armWithSingleChannel.ToString() + "未设置;");
                }
 
                string labwaretiptype = xmlNode.SelectSingleNode("labwaretip/value").InnerText;
                if (string.IsNullOrEmpty(labwaretiptype))
                {
                    dataCheckResult.result = 1;
 
                    dataCheckResult.errorlist.Add(LoadTipsResourceCHS.labwaretipText.ToString() + "未设置;");
                }
            }
            else if (strCurrentCulture == "en-US")
            {
                string armValue = xmlNode.SelectSingleNode("arm/value").InnerText;
                if (string.IsNullOrEmpty(armValue)||armValue=="0")
                {
                    dataCheckResult.result = 1;
 
                    dataCheckResult.errorlist.Add(LoadTipsResourceENU.armText.ToString() + "isn't set;");
                }
 
                string channels = xmlNode.SelectSingleNode("channels").InnerText;
                if (string.IsNullOrEmpty(channels))
                {
                    dataCheckResult.result = 1;
 
                    dataCheckResult.errorlist.Add(LoadTipsResourceENU.armWithSingleChannel.ToString() + "isn't set;");
                }
 
                string labwaretiptype = xmlNode.SelectSingleNode("labwaretip/value").InnerText;
                if (string.IsNullOrEmpty(labwaretiptype))
                {
                    dataCheckResult.result = 1;
 
                    dataCheckResult.errorlist.Add(LoadTipsResourceENU.labwaretipText.ToString() + "isn't set;");
                }
            }
            return dataCheckResult;
        }
        #endregion
    }
}