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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
using DataEntity.Rack;
using DataEntity.Share;
using DataRWDAL;
using DriverLib.Engine;
using HxEnum;
using HxSocket;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Windows.Media;
using System.Xml;
using XCommon;
using XCommon.Log;
using XCore;
using XHandler.Class;
using XHandler.Controls.Run.Com;
using XHandler.View;
using XHandler.View.MethodProperty;
using XImagingXhandler.XDAL;
using static HxEnum.OtherEnum;
using XCoreBLL;
using XHandler.View.Liquids;
using System.Collections.ObjectModel;
using DataRWDAL.Rack;
using static HxEnum.OperationTypeEnum;
using System.Reflection;
 
namespace XHandler.Controls
{
    /// <summary>
    /// 文件切胶控制类
    /// </summary>
    public class CutGumFileControl
    {
        #region 变量
        private string strCurrentCulture = "";
        private WellCalc wellCalc = new WellCalc();
 
        #region BLL
        private LatticeBll latticeBll = new LatticeBll();
        private AspirateBll aspirateBll = new AspirateBll();
        private DispenseBll dispenseBll = new DispenseBll();
        private UltrasonicBll ultrasonicBll = new UltrasonicBll();
        TransferFileBll transferFileBll = new TransferFileBll();
        #endregion
 
        private MethodFrame methodFrame = new MethodFrame();
        private CutGumFileBll cutGumFileBll = new CutGumFileBll();
        private CoatingBll coatingBll = new CoatingBll();
        private LoadTipsBll loadTipsBll = new LoadTipsBll();
        private string circularBarcode = string.Empty;                          // 记录下当前圆皿
        private string plate1Barcode = string.Empty;                            // 记录下当前切胶的皿号
        private string plate2Barcode = string.Empty;
        private string choiceCenterPointVal = string.Empty;                     // 切胶中心点位
        private List<string> listCoatingCoverLatticeId = new List<string>();    // 切胶的板放盖位号:P2,P3
 
        public RunWnd launchView = null;
        public HxSocketClient socketTcpClientToRemote = null;
        #endregion
 
        /// <summary>
        /// 构造函数
        /// </summary>
        public CutGumFileControl(string strCurrentCulture)
        {
            this.strCurrentCulture = strCurrentCulture;
            // 切胶中心点位
            choiceCenterPointVal = ConfigurationManager.AppSettings["choiceCenterPointVal"].ToString();
 
            // 切胶的板放盖位号:P2,P3
            listCoatingCoverLatticeId = ComUtility.GetPlateCoverLatticeName();
        }
 
        #region 执行切胶文件,返回结果字符串
        /// <summary>
        /// 执行切胶文件,返回结果字符串
        /// </summary>
        /// <param name="xmlEnv"></param>
        /// <param name="methodNode"></param>
        /// <param name="zAxisVal"></param>
        /// <param name="isSimulator"></param>
        /// <returns></returns>
        public bool ExecuteCoatingFile(XmlNode xmlEnv, XmlNode methodNode, float zAxisVal, bool isSimulator)
        {
            bool result = true;
            var platformNodeList = xmlEnv.SelectNodes("platform");
            string strMethodName = methodNode.SelectSingleNode("name").InnerText;
 
            if (launchView._cancelSource.IsCancellationRequested)
            {
                result = false;
                return result;
            }
            if (strCurrentCulture.Equals("zh-CN"))
            {
                launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】" + Properties.MachineRunResource.strStart.ToString());
            }
            else
            {
                launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】start:");
            }
 
            try
            {
                #region 数据准备
                if (strCurrentCulture.Equals("zh-CN"))
                {
                    launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.MachineRunResource.strPrepareData);
                }
                else
                {
                    launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】progress: prepare data;");
                }
                MethodElectroFile methodElectroFile = cutGumFileBll.GenerateMethodCoatingFileDataByXmlNode(methodNode);//获取切胶表
                methodElectroFile.transferDataTable = SelectFile(methodNode.SelectSingleNode("filePath").InnerText);
 
                LoggerHelper.InfoLog($"[CoatingFileControl]:Args:  {JsonConvert.SerializeObject(methodElectroFile)}");
 
                //从Excel文件读取当前挑选参数数据
                string filePath = ConfigurationManager.AppSettings["choiceFilePath"];
                DataTable dtParam = null;
 
                if (!launchView.isRemotingOper)
                {
                    // 单机运行时,作成 切胶下发参数.xls
                    //dtParam = DoUpdateCoatingMode(methodNode, filePath);
                }
                else
                {
                    dtParam = ExcelAndCsvHelper.GetDataTableFromExcelFile(filePath, true);
                }
 
                int[] charray = Shared.ChannelsId;
                string channelNums = Shared.ChannelsId.Count().ToString();
 
                methodNode.SelectSingleNode("channels").InnerText = channelNums;    // 更新一下枪通道数据
                int iChioceTotal = methodElectroFile.transferDataTable.Rows.Count;  // 待切胶的数据总条目数
                int realChioceTotal = iChioceTotal / launchView.choiceTimes;        // 实际菌落的个数
                #endregion
 
                #region 数据验证
                if (strCurrentCulture.Equals("zh-CN"))
                {
                    launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.MachineRunResource.strCheckData);
                }
                else
                {
                    launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】progress: check data;");
                }
                #endregion
 
                //判断是否是双切胶的文件,如果是双切胶的文件数据则分通道的处理方式不同;如果是单切胶的文件数据则正常分通道切胶即可
                #region 切胶+切胶
 
                #region Lite_Choice、T200
                if (Shared.ChannelCount == 1)
                {
                    if (methodElectroFile.transferDataTable.Rows.Count == 0)
                    {
                        // 文件切胶不执行,继续执行后面的动作方法
                        result = true;
                        return result;
                    }
 
                    #region 准备参数
                    //// 转移目标板到切胶位方法
                    //string strTransferDesPlateMethodFileName = AppDomain.CurrentDomain.BaseDirectory +
                    //    "\\" + ConfigurationManager.AppSettings["transferDesPlateMethod"].ToString();
                    //// 转移目标板盖到切胶放盖位方法
                    //string strTransferDesPlateCoverMethodFileName = AppDomain.CurrentDomain.BaseDirectory +
                    //    "\\" + ConfigurationManager.AppSettings["transferDesPlateCoverMethod"].ToString();
 
                    // 待切胶的数据总条目数
                    iChioceTotal = methodElectroFile.transferDataTable.Rows.Count;
 
                    DataTable dtCoatingFile = methodElectroFile.transferDataTable;
                    string targetWellName = dtCoatingFile.Rows[0][methodElectroFile.destinationWell].ToString();    // 目标板孔位: A1
                    List<CoatingLabware> lstDesPlateInfo = new List<CoatingLabware>();                              // 目标板已开盖的点位名称
 
                    // 所有目标板
                    DataView dvCoatingFile = new DataView(dtCoatingFile);
                    DataTable dtDistinct = dvCoatingFile.ToTable(true, methodElectroFile.destinationLabware);
 
                    // 前回切胶板位
                    List<string> lstCoatingLastLabwareName = new List<string>();
                    string strLog = string.Empty;
 
                    // 拍照点位名称
                    string strSrcPlateName = ConfigurationManager.AppSettings["choiceLatticeId"].ToString();
                    #endregion
 
                    launchView.SetWaitOne();//暂停
 
                    #region 循环切胶数量
                    for (int iChoiceIndex = 0; iChoiceIndex < iChioceTotal; iChoiceIndex++)  // 循环控制待挑选的所有菌落
                    {
                        DataRow rowItem = dtCoatingFile.Rows[iChoiceIndex];
                        string strSrcRealPlateName = rowItem[methodElectroFile.sourceLabware].ToString();           // 来源板真实点位名称
                        string strSrcPlateBarcode = rowItem["SourceBarcode"].ToString();                            // 来源板Barcode
                        string strChoiceWellXYZ = rowItem[methodElectroFile.sourceWell].ToString();                 // 切胶板孔位坐标
                        string strDesPlateName = rowItem[methodElectroFile.destinationLabware].ToString();          // 目标板名称:P4
                        string strDesWell = rowItem[methodElectroFile.destinationWell].ToString();                  // 目标板孔位
                        bool isNewPlateBatch = bool.Parse(rowItem["IsNewPlateBatch"].ToString());                   // 是否是新一批次的目标板(目标板不够用时,需要弹窗,人工补充耗材后点击继续)
                        bool isPlateLastWell = bool.Parse(rowItem["IsPlateLastWell"].ToString());                   // 是否是一个板子最后的一个有效孔
                        bool isOpenCover = !lstDesPlateInfo.Exists(it => it.LabwarePositon.Equals(strDesPlateName));// 是否开盖
                        int diff = ((iChoiceIndex + 1) % launchView.choiceTimes);
 
                        launchView.SetWaitOne();//暂停
 
                        #region 是否为当前切胶点的第一次切胶动作; 是否为当前切胶点的最后一次切胶动作
                        bool isPointFirstTime = false;
                        bool isPointLastTime = false;
 
                        if (launchView.choiceTimes == 1)
                        {
                            isPointFirstTime = true;
                            isPointLastTime = true;
                        }
                        else
                        {
                            isPointFirstTime = ((iChoiceIndex + 1) % launchView.choiceTimes) != 0 ? true : false;
                            isPointLastTime = ((iChoiceIndex + 1) % launchView.choiceTimes) == 0 ? true : false;
                        }
                        #endregion
 
                        #region 安装切胶头
                        // 当前切胶点的第一次切胶动作
                        // 多块目标板切胶前要换枪头
                        if (isPointFirstTime)
                        {
                            // 先去安装枪头
                            bool bLoadTipResult = ControlCom.LoadTipAutomation(xmlEnv.SelectNodes("platform"), methodNode,
                                isSimulator, launchView, socketTcpClientToRemote);
                            if (!bLoadTipResult)
                            {
                                return false;
                            }
                        }
                        #endregion
 
                        #region 切胶
                        // 当前切胶点的第一次切胶动作
                        // 每次切胶前都切胶
                        if (isPointFirstTime)
                        {
                            //string srcLabwareName = dtCoatingFile.Rows[0][cnSourceLabware].ToString(); // 来源板名称
                            //string scrLabwareId = "";                                       // 来源板id;
                            //string scrLatticeId = "";                                       // 来源板位置Id
 
                            //// 用目标板名字查找目标板的类型
                            //string desLabwareName = dtCoatingFile.Rows[0][cnDestinationLabware].ToString();    // 目标板名称
                            //string desLabwareId = "";                                               // 目标板id;
                            //string desLatticeId = "";
                            // 液体参数
                            Liquid liquid = LiquidDB.GetALiquidFromdb(methodElectroFile.liquidpidValue);
 
                            string strScrlabwareid = "";                                                                                // 来源板耗材ID;
                            string strScrLatticeid = "";                                                                                // 来源板位置ID
                            //XmlNode desPlatformNode = transferFileBll.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), strDesPlateName);
                            //XmlNode desXml = desPlatformNode.SelectSingleNode("labware[@id='" + desPlatformNode.SelectNodes("labware").Count + "']");
 
                            XmlNode srcPlatformNode = transferFileBll.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), strSrcRealPlateName);
                            XmlNode srcXml = srcPlatformNode.SelectSingleNode("labware[@id='" + srcPlatformNode.SelectNodes("labware").Count + "']");
 
                            // 用来源板名字取查找来源板的类型
                            var latticeXn = srcXml;// xmlEnv.SelectSingleNode("platform[labware_sname='" + strSrcPlateName + "']");
                            if (latticeXn != null)
                            {
                                strScrlabwareid = latticeXn.SelectSingleNode("labware_id").InnerText;
                                strScrLatticeid = srcPlatformNode.SelectSingleNode("lattice_id").InnerText;
 
                                // 获取拍照位的坐标
                                Labware labwareSrc = LabwareDB.GetLabware(strScrlabwareid);
                                int latticeIdSrc = ControlCom.GetLatticeId(Convert.ToInt32(strScrLatticeid));
                                Lattice latticeSrc = LatticeDB.GetLatticeDataByIdFromdb(latticeIdSrc.ToString());
 
                                if (labwareSrc != null)
                                {
                                    string[] vChoiceWellXYZSplit = strChoiceWellXYZ.Split(',');             // 分割后的切胶板孔位坐标
                                    CutGumMParam cutGumMParam = new CutGumMParam();
                                    cutGumMParam.armId = Convert.ToInt32(methodElectroFile.armValue);       // 挑选所用机械臂Id
                                    cutGumMParam.xAxisVal = (float)Convert.ToDouble(vChoiceWellXYZSplit[0]);
                                    cutGumMParam.yAxisVal = (float)Convert.ToDouble(vChoiceWellXYZSplit[1]);
                                    cutGumMParam.basezAxisVal = zAxisVal;
                                    cutGumMParam.pAxisVal = 0f;
                                    cutGumMParam.aspirateSpeed = (float)liquid.aspirate_speed;
                                    cutGumMParam.aspirateAcceleration = (float)liquid.aspirate_acceleration;
                                    cutGumMParam.aspirateDeceleration = (float)liquid.aspirate_deceleration;
                                    cutGumMParam.cutGumDelay = (int)liquid.aspirate_delay;
                                    cutGumMParam.cutGumEnterSpeed = (float)liquid.aspirate_enter_speed;
                                    cutGumMParam.cutGumOutSpeed = (float)liquid.aspirate_out_speed;
                                    cutGumMParam.cutGumSpeed = (float)liquid.cutgumspeed;
                                    cutGumMParam.divorcedGumEnable = liquid.divorcedgum_enable==1?true:false;
                                    cutGumMParam.divorcedGumDistanceXAxis = (float)liquid.divorcedgum_xaxis;
                                    cutGumMParam.divorcedGumDistanceYAxis = (float)liquid.divorcedgum_yaxis;
 
                                    //固定高度切胶
                                    cutGumMParam.zAxisVal = (float)latticeSrc.lattice_Z - (float)Convert.ToDouble(labwareSrc.well_bottom_height) -
                                            ControlCom.CurrentLengthOfTip;
 
                                    // 执行切胶动作
                                    bool bIsOk = ControlCom.RunCutGum(launchView, strMethodName, cutGumMParam, strChoiceWellXYZ,
                                        strSrcRealPlateName, strSrcPlateBarcode, isSimulator);
                                    if (!bIsOk)
                                    {
                                        return false;
                                    }
                                }
                            }
                            else
                            {
                                if (strCurrentCulture.Equals("zh-CN"))
                                {
                                    launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodElectroFile.name + "】" + Properties.MachineRunResource.strProgress + Properties.CutGumFileResource.strCutGumLatticeWithout);
                                }
                                else
                                {
                                    launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodElectroFile.name + "】progress:Can't find lattice!");
                                }
                                result = false;
                                return result;
                            }
                        }
                        else
                        {
                            DateTime startTime = DateTime.Now;
                            DateTime endTime = DateTime.Now;
                            launchView.addChoiceDataIntoReport(null, strSrcRealPlateName, "0", new string[] { strChoiceWellXYZ }, "pass", "",
                                startTime, endTime, "Choice", strSrcPlateBarcode);
                        }
                        #endregion
 
                        #region 排胶
                        string strDesLabwareName = strDesPlateName;         // 目标板名称:P10
                        string strDeslabwareid = "";                        // 目标板耗材id;
                        string strDesLatticeid = "";                        // 目标板位置Id
                        string strDesLabwareBarcode = "";                   // 目标板条码
                        XmlNode desPlatformNode = transferFileBll.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), strDesPlateName);
                        XmlNode desXml = desPlatformNode.SelectSingleNode("labware[@id='" + desPlatformNode.SelectNodes("labware").Count + "']");
                        var latticeDesXn = desXml;// xmlEnv.SelectSingleNode("platform[labware_sname='" + strDesLabwareName + "']");
                        if (latticeDesXn != null)
                        {
                            strDeslabwareid = latticeDesXn.SelectSingleNode("labware_id").InnerText;
                            strDesLatticeid = desPlatformNode.SelectSingleNode("lattice_id").InnerText;
                            //strDesLabwareBarcode = latticeDesXn.SelectSingleNode("labware_barcode").InnerText;
                            strDesLabwareBarcode = rowItem["TargetBarcode"].ToString();                                 // 目标板条码
 
                            // 获取待切胶板位的坐标
                            Labware labwareDes = LabwareDB.GetLabware(strDeslabwareid);
                            int latticeIdDes = ControlCom.GetLatticeId(Convert.ToInt32(strDesLatticeid));
 
                            Lattice latticeDes = LatticeDB.GetLatticeDataByIdFromdb(latticeIdDes.ToString());
 
                            if (labwareDes != null)
                            {
                                // 获取板位孔的坐标数据
                                List<TipsTable> dtWells = ControlCom.GenerateWellCoordinate(labwareDes, latticeDes);
                                //液体参数
                                Liquid liquid = LiquidDB.GetALiquidFromdb(methodElectroFile.liquidpidValue);
                                // 根据循环处理孔位
                                TipsTable aData = dtWells.SingleOrDefault(t => t.lattice_id.Equals(latticeDes.lattice_id)
                                                                            && t.labware_id.Equals(strDeslabwareid)
                                                                            && t.wellname.Equals(strDesWell));
                                // 获取孔位信息
                                TipsTable targetWellInfo = ControlCom.GetWellInfo(labwareDes, latticeDes, latticeIdDes, strDeslabwareid, strDesWell);
 
                                if (targetWellInfo != null)
                                {
                                    #region 放胶
                                    SpitGumMParam spitGumMParam = new SpitGumMParam();
                                    spitGumMParam.armId = Convert.ToInt32(methodElectroFile.armValue);
                                    spitGumMParam.xAxisVal = aData.axis_b_X;
                                    spitGumMParam.yAxisVal = aData.axis_b_Y;
                                    spitGumMParam.pAxisVal = 0f;
 
                                    float zVal = 0f;
                                    if (liquid.dispense_well_bottom_length != 0)
                                    {
                                        string[] zOffsiteArray = liquid.dispense_well_bottom_length.ToString().Split(',');
 
                                        if (liquid.dispense_position_type == 0)//液体液面
                                        {
                                            zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]);//底层用探测到的液面一下用aspirateMParam.zAxisAspirateOffsetVal
                                        }
                                        else if (liquid.dispense_position_type == 1)//孔口
                                        {
                                            zVal = (float)liquid.well_top_length + (float)Convert.ToDouble(zOffsiteArray[0]);
                                        }
                                        else if (liquid.dispense_position_type == 2)//孔底
                                        {
                                            if (labwareDes.labware_type_id.Equals("4"))
                                            {
                                                if (labwareDes.labware_tubeshelf_type == 1)
                                                {
                                                    ObservableCollection<LabwareWellInfo> labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labwareDes.labware_id);
                                                    LabwareWellInfo currentWellInfo = labwareWellInfoList.FirstOrDefault(x => x.labware_well_name.Equals(aData.wellname));
                                                    Labware currentWellLabware = DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id);
 
                                                    zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]) - ((float)currentWellLabware.labware_height - (float)currentWellLabware.well_height);
                                                }
                                                else
                                                {
                                                    zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]) - ControlCom.CalculateWellBottomThickness(labwareDes.piled_script);
                                                }
                                            }
                                            else
                                            {
                                                zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]);
                                            }
                                        }
                                    }
                                    spitGumMParam.zAxisVal = zVal < 0 ? 0 : zVal;
                                    spitGumMParam.dispenseSpeed = (float)liquid.dispense_speed;
                                    spitGumMParam.dispenseAcceleration = (float)liquid.dispense_acceleration;
                                    spitGumMParam.dispenseDeceleration = (float)liquid.dispense_deceleration;
                                    spitGumMParam.spitGumDelay = (int)liquid.dispense_delay;
                                    spitGumMParam.spitGumEnterSpeed = (float)liquid.dispense_enter_speed;
                                    spitGumMParam.basezAxisVal = (float)Convert.ToDouble(ConfigurationManager.AppSettings["zAxisSafeVal"]);
                                    launchView.UpdateLabwareWells(aData, new string[] { strDesWell }, 3);
                                    launchView.SetWaitOne();//暂停
                                    HxResult ret = cutGumFileBll.ExecuteSpitGum(spitGumMParam, isSimulator);
 
                                    #region 错误处理
                                    if (ret.Result != ResultType.Success)
                                    {
                                        if (strCurrentCulture.Equals("zh-CN"))
                                        {
                                            launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodElectroFile.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.CutGumFileResource.strSpitGumFail.ToString() + ret.AlarmInfo + "孔 " + strDesWell + " 板位 " + strDesPlateName);
                                        }
                                        else
                                        {
                                            launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodElectroFile.name + "】progress: spit gum progress is fail from" + strDesWell + " well on " + strDesPlateName + "lattice! error information:" + ret.AlarmInfo);
                                        }
 
                                        
                                    }
                                    else
                                    {
                                        if (strCurrentCulture.Equals("zh-CN"))
                                        {
                                            launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodElectroFile.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.CutGumFileResource.strSpitGumSuccess.ToString() + " 孔 " + strDesWell + " 板位 " + strDesPlateName);
                                        }
                                        else
                                        {
                                            launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodElectroFile.name + "】progress:spit gum is success from " + strDesWell + " well on " + strDesPlateName + " lattice!");
                                        }
                                    }
                                    #endregion
                                    #endregion
                                }
                            }
                            else
                            {
                                if (strCurrentCulture.Equals("zh-CN"))
                                {
                                    launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodElectroFile.name + "】" + Properties.MachineRunResource.strProgress + Properties.CutGumFileResource.strSpitGumLatticeWithout);
                                }
                                else
                                {
                                    launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodElectroFile.name + "】progress:Can't find lattice!");
                                }
                                result = false;
                                return result;
                            }
                        }
                        else
                        {
                            if (strCurrentCulture.Equals("zh-CN"))
                            {
                                launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】" + Properties.MachineRunResource.strProgress + Properties.CutGumFileResource.strCutGumLatticeWithout);
                            }
                            else
                            {
                                launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】progress: lattice was wrong!");
                            }
                            result = false;
                            return result;
                        }
                        #endregion
 
                        #region 卸载Tip,丢在垃圾桶
                        if (isPointLastTime)
                        {
                            UnloadTipsControl unloadTipsControl = new UnloadTipsControl(Shared.SoftwareInformation.currentculture);
                            unloadTipsControl.launchView = launchView;
                            unloadTipsControl.socketTcpClientToRemote = socketTcpClientToRemote;
                            bool bUnloadResult = unloadTipsControl.ExecuteUnloadTipsInToTrash(platformNodeList, methodNode, isSimulator);
                            launchView.currentIsLoadingTips = false;
                        }
                        #endregion
 
                        if (isPointLastTime)
                        {
                            #region 计算当前切胶的个数
                            decimal dTemp = ((decimal)(iChoiceIndex + 1)) / (decimal)launchView.choiceTimes;
                            decimal realCurrentChioceCnt = Math.Ceiling(dTemp);
 
                            if (strCurrentCulture.Equals("zh-CN"))
                            {
                                strLog = string.Format("【{0}】>Xhandler: 【{1}】{2} {3}:{4}/{5}",
                                    DateTime.Now.ToString("HH:mm:ss:fff"), methodElectroFile.name,
                                    Properties.MachineRunResource.strProgress, Properties.CutGumFileResource.strCutAndSpit, realCurrentChioceCnt, realChioceTotal);
                            }
                            else
                            {
                                strLog = string.Format("【{0}】>Xhandler: 【{1}】progress: picking bacteria:{2}/{3}",
                                    DateTime.Now.ToString("HH:mm:ss:fff"), methodElectroFile.name, realCurrentChioceCnt, realChioceTotal);
                            }
 
                            launchView.AddLogs(strLog);
                            #endregion
                        }
                    }
                    #endregion
                }
                #endregion
 
                #endregion
            }
            catch (Exception ex)
            {
                LoggerHelper.ErrorLog("ERROR:", ex);
 
                #region Exception
                launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + strMethodName + "】error:source:" + ex.Source + ";error:" + ex.Message + ";");
 
                result = false;
                MethodMsg methodMsg = new MethodMsg(
                    Guid.NewGuid().ToString(),
                    "ID202_Choice_machine",
                    5,
                    "",
                    "ExecuteCoatingFile",
                    "1001",
                    "error source:" + ex.Source + ";error:" + ex.Message,
                    6,
                    0
                );
                if (socketTcpClientToRemote != null)
                {
                    socketTcpClientToRemote.sendmessageError(socketTcpClientToRemote.CreateSendMsgContent(methodMsg, false), launchView.isRemotingOper);
                }
                #endregion
            }
 
            return result;
        }
 
        /// <summary>
        /// 单机运行时,作成 切胶下发参数.xls
        /// </summary>
        /// <param name="xmlNode"></param>
        /// <param name="filePath"></param>
        private DataTable DoUpdateCoatingMode(XmlNode xmlNode, string filePath)
        {
            DataTable dtCoatingParams = ExcelAndCsvHelper.GetDataTableFromExcelFile(filePath, true);
            string strValName = "属性值";
 
            #region 数据准备
            if (dtCoatingParams.Rows.Count > 29)
            {
                // 切胶方式:0:单选; 1:穿刺; 2:吸放液; 3:放液
                dtCoatingParams.Rows[29][strValName] = xmlNode.SelectSingleNode("choiceCategory").InnerText;
            }
            // 切胶方式
            dtCoatingParams.Rows[17][strValName] = xmlNode.SelectSingleNode("coatingmodeValue").InnerText;        // 画面上切胶方式 0:回字型  1:Z字型;2:上下移动
            #endregion
 
            ExcelAndCsvHelper.WriteDataTableToExcelFile(dtCoatingParams, filePath);
 
            return dtCoatingParams;
        }
        #endregion
 
        #region 重新加载文件数据
        private DataTable SelectFile(string file)
        {
            string ext = System.IO.Path.GetExtension(file);
            DataTable transferData = null;
            if (string.Compare(ext, ".csv", true) == 0)
                transferData = ExcelAndCsvHelper.GetDataTableFromCsvFile(file, false);
            else
                transferData = ExcelAndCsvHelper.GetDataTableFromExcelFile(file, true);
 
 
            if (transferData == null)
            {
                transferData = new DataTable();
            }
            return transferData;
        }
        #endregion
    }
}