schangxiang@126.com
2025-11-04 ca398287db3f5ea01f03aac4a85edb13b28100a6
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
using DataEntity.Share;
using DriverLib.Engine;
using System;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Xml;
using System.Xml.Linq;
using XCommon.Log;
using XCore;
using XHandler.Controls.Run.Com;
using XHandler.View;
using XHandler.View.MethodProperty;
using XImagingXhandler.XDAL;
 
namespace XHandler.Controls
{
    /// <summary>
    /// 超声探测单命令
    /// </summary>
    public class UltrasonicControl
    {
        #region 变量
        private string strCurrentCulture = "";
        private WellCalc wellCalc = new WellCalc();
        private LatticeBll latticeBll = new LatticeBll();
        private AspirateBll aspirateBll = new AspirateBll();
        private UltrasonicBll ultrasonicBll = new UltrasonicBll();
        public RunWnd launchView = null;
        #endregion
 
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="strCurrentCulture"></param>
        public UltrasonicControl(string strCurrentCulture)
        {
            this.strCurrentCulture = strCurrentCulture;
        }
 
        #region 执行超声探测,返回结果字符串
        /// <summary>
        /// 执行超声探测
        /// </summary>
        /// <param name="xmlEnv"></param>
        /// <param name="methodNode"></param>
        /// <param name="isSimulator"></param>
        /// <returns></returns>
        public bool ExecuteUltrasonic(XmlNode xmlEnv, XmlNode methodNode, bool isSimulator)
        {
            bool result = true;
            if (launchView._cancelSource.IsCancellationRequested)
            {
                result = false;
                return result;
            }
 
            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:");
            }
 
            // 超声探测
            int nRtn = ControlCom.DoUltrasonic(launchView, xmlEnv, methodNode, isSimulator);
            if (nRtn == 2)      // 2:停止
            {
                result = false;
                return result;
            }
 
            if (strCurrentCulture.Equals("zh-CN"))
            {
                launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strEnd.ToString());
            }
            else
            {
                launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】complete;");
            }
 
            return result;
        }
        #endregion
    }
}