using DataEntity.Share;
|
using DriverLib.Engine;
|
using HxSocket;
|
using System;
|
using System.Collections.Generic;
|
using System.Configuration;
|
using System.Data;
|
using System.Linq;
|
using System.Windows;
|
using System.Windows.Forms;
|
using System.Windows.Media;
|
using System.Xml;
|
using XCommon;
|
using XCore;
|
using XHandler.Controls.Run.Com;
|
using XHandler.View;
|
using XHandler.View.MethodProperty;
|
using XImagingXhandler.XDAL;
|
using static HxEnum.OperationTypeEnum;
|
using DataRWDAL;
|
using DataEntity;
|
using Newtonsoft.Json;
|
using XCommon.Log;
|
using XHandler.View.Liquids;
|
|
namespace XHandler.Controls
|
{
|
public class LoadTipsControl
|
{
|
private static LabwareBll getOrSetLabware = new LabwareBll();
|
string strCurrentCulture = "";
|
WellCalc wellCalc = new WellCalc();
|
LatticeBll latticeBll = new LatticeBll();
|
LoadTipsBll loadTipsBll = new LoadTipsBll();
|
public static RunWnd launchView = null;
|
public List<TipsTable> dteTips = new List<TipsTable>();//保存结束时吸头集合数据
|
UIElement uIElement = new UIElement();
|
WellCheck wellCheck = new WellCheck();
|
public HxSocketClient socketTcpClientToRemote = null;
|
|
public LoadTipsControl(string strCurrentCulture)
|
{
|
this.strCurrentCulture = strCurrentCulture;
|
}
|
|
#region 执行装载吸头,返回结果字符串
|
/// <summary>
|
/// 执行装载吸头,返回结果字符串
|
/// </summary>
|
/// <param name="platformNodeList">env下所有platform节点集合</param>
|
/// <param name="methodNode">装载方法属性节点对象</param>
|
/// <param name="isSimulator">false:连接;true:仿真</param>
|
/// <returns></returns>
|
public bool ExecuteLoadTips(XmlNodeList platformNodeList, XmlNode methodNode, bool isSimulator)
|
{
|
bool result = true;
|
PlsToolTipWin plsToolTipWin = null;
|
bool dialogResult = false;
|
HxResult ret = new HxResult();
|
if (launchView._cancelSource.IsCancellationRequested)
|
{
|
result = false;
|
return result;
|
}
|
|
#region Start Log
|
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:");
|
}
|
#endregion
|
|
try
|
{
|
#region 数据准备
|
string channelNums = methodNode.SelectSingleNode("channels").InnerText;
|
string armName = methodNode.SelectSingleNode("arm/text").InnerText;
|
string labwaretipId = methodNode.SelectSingleNode("labwaretip/value").InnerText;
|
#endregion
|
|
#region 数据验证
|
if (channelNums == "")
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strWithoutChannel.ToString());
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:Channel wasn't set, please check!");
|
}
|
result = false;
|
//MethodMsg methodMsg = new MethodMsg(Guid.NewGuid().ToString(), "ID202_Choice_machine", 5, "", "ExecuteLoadTips", "1003",
|
//"安装枪头方法没有设置通道,安装方法终止运行。", 6, 0);
|
//if (socketTcpClientToRemote != null)
|
//{
|
// socketTcpClientToRemote.sendmessageError(socketTcpClientToRemote.CreateSendMsgContent(methodMsg, false), launchView.isRemotingOper);
|
//}
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1003", 5, Properties.MachineRunResource.strWithoutChannel, 2);
|
}
|
return result;
|
}
|
#endregion
|
|
#region 获取板位上孔板的所有孔位坐标集合对象
|
Labware labwares = getOrSetLabware.GetLabware(methodNode.SelectSingleNode("labwaretip/value").InnerText); // 特定枪头的信息
|
List<Lattice> lstLatticeTipPlate = new List<Lattice>(); // 匹配枪头类型的所有枪头盒点位信息
|
for (int i = 0; i < platformNodeList.Count; i++) // 查找枪头位置PN
|
{
|
if(platformNodeList[i].SelectNodes("labware")==null)
|
{
|
continue;
|
}
|
if (platformNodeList[i].SelectSingleNode("labware[@id="+ platformNodeList[i].SelectNodes("labware").Count+ "]/labware_id").InnerText == labwares.labware_id) // 找同类型的枪头点位
|
{
|
string latticeIdTemp = platformNodeList[i].SelectSingleNode("lattice_id").InnerText;
|
TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断
|
int latticeId = 0;
|
if (tabletopTemplate == null)
|
{
|
latticeId = ControlCom.GetLatticeId(Convert.ToInt32(latticeIdTemp));
|
}
|
else
|
{
|
string latticeNumber = "P" + latticeIdTemp;
|
string armid = methodNode.SelectSingleNode("arm/value").InnerText;//Shared.DeviceArmList.FirstOrDefault(x => x.arm_type.Equals(1)).device_arm_id;
|
latticeId = Convert.ToInt32(LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb(latticeNumber,Convert.ToInt32(armid),Shared.SoftwareInformation.software_device_number, tabletopTemplate.tabletopid).lattice_id);
|
}
|
|
// 获取枪头台面点位信息
|
Lattice latticeInfo = LatticeDB.GetLatticeDataByIdFromdb(latticeId.ToString());
|
//latticeInfo = LatticeDB.GetLatticeDataByIdFromdb(latticeInfo.lattice_num, Convert.ToInt32(methodNode.SelectSingleNode("arm/value").InnerText), Shared.SoftwareInformation.software_device_number);
|
lstLatticeTipPlate.Add(latticeInfo);
|
}
|
}
|
#endregion
|
|
List<TipsTable> lstTipWellsNoUsedTemp = new List<TipsTable>(); // 未使用的枪头集合
|
if (lstLatticeTipPlate.Count == 0) // 台面上没设置枪头盒
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.RunLoadTipsResource.strLoadTipsWithOutLabware.ToString());
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:labware wasn't set, please check!");
|
}
|
result = false;
|
//MethodMsg methodMsg = new MethodMsg(Guid.NewGuid().ToString(), "ID202_Choice_machine", 5, "", "ExecuteLoadTips", "1004",
|
//"安装枪头方法设置的板位上未放枪头,安装方法终止运行。", 6, 0);
|
//if (socketTcpClientToRemote != null)
|
//{
|
// socketTcpClientToRemote.sendmessageError(socketTcpClientToRemote.CreateSendMsgContent(methodMsg, false), launchView.isRemotingOper);
|
//}
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1004", 5, Properties.RunLoadTipsResource.strLoadTipsWithOutLabware, 2);
|
}
|
return result;
|
}
|
else
|
{
|
//读取所有指定枪头类型和板位设定的可用枪头
|
int lapid = 1;
|
|
foreach (XmlNode platformNodeItem in platformNodeList)
|
{
|
if (!platformNodeItem.SelectSingleNode("labware[@id=" + platformNodeItem.SelectNodes("labware").Count + "]/labware_id").InnerText.Equals(labwares.labware_id))
|
{
|
continue;
|
}
|
|
#region 查找可用枪头孔位
|
string strWellStip = platformNodeItem.SelectSingleNode("labware[@id=" + platformNodeItem.SelectNodes("labware").Count + "]/residueValidWells").InnerText; // 可用枪头孔位
|
string p = platformNodeItem.SelectSingleNode("lattice_id").InnerText;
|
|
string[] tipWells = strWellStip.Split(',');
|
for (int i = 0; i < tipWells.Length; i++)
|
{
|
TipsTable tipTable = new TipsTable();
|
tipTable.labware_id = labwares.labware_id;
|
tipTable.wellname = tipWells[i];
|
tipTable.axis_b_X = 0.0f;
|
tipTable.axis_b_Y = 0.0f;
|
tipTable.axis_b_Z = 0.0f;
|
tipTable.well_top_shape = 0;
|
tipTable.axis_b_r = 0.0f;
|
|
// 获取LatticeId
|
TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断
|
if (tabletopTemplate == null)
|
{
|
lapid = ControlCom.GetLatticeId(Convert.ToInt32(p), true);
|
}
|
else
|
{
|
string latticeNumber = "P" + p;
|
string armid = methodNode.SelectSingleNode("arm/value").InnerText;//Shared.DeviceArmList.FirstOrDefault(x => x.arm_type.Equals(1)).device_arm_id;
|
lapid = Convert.ToInt32(LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb(latticeNumber, Convert.ToInt32(armid), Shared.SoftwareInformation.software_device_number, tabletopTemplate.tabletopid).lattice_id);
|
}
|
tipTable.lattice_num = lstLatticeTipPlate.FirstOrDefault(n => n.lattice_id.Equals(lapid.ToString())).lattice_num;
|
tipTable.lattice_id = lapid.ToString();
|
|
if (RunWnd.currentIsUsedWellLattice.Count > 0)
|
{
|
var v = RunWnd.currentIsUsedWellLattice.FirstOrDefault(q => q.dropdown_id.Equals(lstLatticeTipPlate.FirstOrDefault(n => n.lattice_id.Equals(lapid.ToString())).lattice_id) && q.dropdown_name.Equals(tipWells[i]));
|
if (v != null)
|
{
|
tipTable.isUsed = 1;
|
}
|
else
|
{
|
tipTable.isUsed = 0;
|
}
|
}
|
else
|
{
|
tipTable.isUsed = 0;
|
}
|
|
lstTipWellsNoUsedTemp.Add(tipTable);
|
}
|
#endregion
|
}
|
}
|
|
#region 获取孔位机械坐标
|
DataTable dtWellCoordinate = null;
|
if (!String.IsNullOrEmpty(labwares.labware_id))
|
{
|
dtWellCoordinate = ControlCom.GenerateCurrentTablayoutWellCoordinate(labwares, lstLatticeTipPlate);
|
}
|
|
if (dtWellCoordinate == null)
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.RunLoadTipsResource.strWithoutLattice.ToString());
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler:Position of tip isn't set, please check!");
|
}
|
|
result = false;
|
//MethodMsg methodMsg = new MethodMsg(Guid.NewGuid().ToString(), "ID202_Choice_machine", 5, "", "ExecuteLoadTips", "1005",
|
//"安装枪头方法未设置板位,安装方法终止运行。", 6, 0);
|
//if (socketTcpClientToRemote != null)
|
//{
|
// socketTcpClientToRemote.sendmessageError(socketTcpClientToRemote.CreateSendMsgContent(methodMsg, false), launchView.isRemotingOper);
|
//}
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1005", 5, Properties.RunLoadTipsResource.strWithoutLattice, 2);
|
}
|
return result;
|
}
|
#endregion
|
|
#region 所有未使用枪头集合
|
List<TipsTable> lstTipWellsNoUsed = new List<TipsTable>(); // 所有未使用枪头集合
|
for (int i = 0; i < dtWellCoordinate.Rows.Count; i++)
|
{
|
// 有效枪头孔位
|
var tipWellsNoUsed = lstTipWellsNoUsedTemp.FirstOrDefault(x => x.labware_id.Equals(dtWellCoordinate.Rows[i]["labware_id"].ToString()) &&
|
x.lattice_id.Equals(dtWellCoordinate.Rows[i]["lattice_id"].ToString()) &&
|
x.lattice_num.Equals(dtWellCoordinate.Rows[i]["lattice_num"].ToString()) &&
|
x.wellname.Equals(dtWellCoordinate.Rows[i]["wellname"].ToString()) &&
|
x.isUsed.Equals(0));
|
if (tipWellsNoUsed != null)
|
{
|
TipsTable tipsTable = new TipsTable();
|
tipsTable.labware_id = dtWellCoordinate.Rows[i]["labware_id"].ToString();
|
tipsTable.lattice_id = dtWellCoordinate.Rows[i]["lattice_id"].ToString();
|
tipsTable.wellname = dtWellCoordinate.Rows[i]["wellname"].ToString();
|
tipsTable.axis_b_X = (float)Convert.ToDouble(dtWellCoordinate.Rows[i]["axis_b_X"].ToString());
|
tipsTable.axis_b_Y = (float)Convert.ToDouble(dtWellCoordinate.Rows[i]["axis_b_Y"].ToString());
|
tipsTable.axis_b_Z = (float)Convert.ToDouble(dtWellCoordinate.Rows[i]["axis_b_Z"].ToString());
|
tipsTable.well_top_shape = Convert.ToInt32(dtWellCoordinate.Rows[i]["well_top_shape"].ToString());
|
tipsTable.axis_b_r = (float)Convert.ToDouble(dtWellCoordinate.Rows[i]["axis_b_r"].ToString());
|
tipsTable.isUsed = Convert.ToInt32(dtWellCoordinate.Rows[i]["isUsed"].ToString());
|
tipsTable.lattice_num = dtWellCoordinate.Rows[i]["lattice_num"].ToString();
|
|
//(远程时,从已使用的Tip头文件中查找出数据比较,删除已经用的
|
if ((launchView.isRemotingOper == true) && (RunWnd.currentIsUsedWellLattice.Count != 0))
|
{
|
var selectATip = RunWnd.currentIsUsedWellLattice.SingleOrDefault(x => x.dropdown_name.Equals(tipsTable.wellname) && x.dropdown_id.Equals(tipsTable.lattice_id));
|
if (selectATip != null && selectATip.dropdown_id != "")
|
{
|
}
|
else
|
{
|
lstTipWellsNoUsed.Add(tipsTable);
|
}
|
}
|
else
|
{
|
lstTipWellsNoUsed.Add(tipsTable);
|
}
|
}
|
}
|
#endregion
|
|
#region 校验孔位是否和所用的通道匹配
|
int[] chArry = Array.ConvertAll(channelNums.Split(','), int.Parse);
|
|
#endregion
|
|
#region 硬件上是单通道
|
if (Shared.ChannelCount == 1) //单通道的:微牧
|
{
|
LoadTipsMParam loadTipsMParam = new LoadTipsMParam();
|
loadTipsMParam.armId = Convert.ToInt32(methodNode.SelectSingleNode("arm/value").InnerText);
|
loadTipsMParam.basezAxisVal = (float)Convert.ToDouble(ConfigurationManager.AppSettings["zAxisSafeVal"]);
|
string labwareid = methodNode.SelectSingleNode("labwaretip/value").InnerText;
|
|
TipsTable tipsTable = lstTipWellsNoUsed.FirstOrDefault(t => t.isUsed.Equals(0)); // 取第一个未使用的枪头
|
if (tipsTable != null)
|
{
|
loadTipsMParam.xAxisVal = (float)Convert.ToDouble(tipsTable.axis_b_X.ToString());
|
loadTipsMParam.yAxisVal = (float)Convert.ToDouble(tipsTable.axis_b_Y.ToString());
|
loadTipsMParam.zAxisVal = (float)Convert.ToDouble(tipsTable.axis_b_Z.ToString());
|
}
|
else
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strWithoutCountOfTips);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: Load tips were failed! error information: Tips are running out!");
|
}
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1007", 5, Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset, 2);
|
}
|
result = false;
|
|
// 状态6 报错/急停 红闪/蜂鸣5S
|
CommonBll.StatusLamp(6, isSimulator);
|
if (!launchView.isRemotingOper)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
plsToolTipWin.Height = launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Hidden;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}));
|
}
|
else
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
plsToolTipWin.Height = launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Hidden;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}
|
|
if (dialogResult)
|
{
|
return ExecuteLoadTips(platformNodeList, methodNode, isSimulator);
|
}
|
|
return result;
|
}
|
|
string strWell = tipsTable.wellname;
|
|
launchView.SetWaitOne();//暂停
|
ret = loadTipsBll.ExecuteLoadTips(loadTipsMParam, isSimulator);
|
|
if (ret.Result == ResultType.Success)
|
{
|
launchView.currentIsLoadingTips = true;
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strLoadTipsSuccess + "孔位:" + tipsTable.wellname + " 板位:" + tipsTable.lattice_num);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:loadtip is success from " + tipsTable.wellname + " well on " + tipsTable.lattice_num + " lattice!");
|
}
|
// 更新台面被装的枪头和当前运行时的xml文档
|
launchView.UpdateLabwaretips(tipsTable);
|
launchView.currentInValidWell = tipsTable.wellname;
|
}
|
else if (ret.Result != ResultType.Success)
|
{
|
OperateDialog plsConfirmOper = null;
|
if (!launchView.isRemotingOper)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.RunLoadTipsResource.strFailWhatToDo : "loadtips are fail! What do you want to do?");
|
plsConfirmOper.ShowDialog();
|
}));
|
}
|
else
|
{
|
|
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.RunLoadTipsResource.strFailWhatToDo : "loadtips are fail! What do you want to do?");
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1008", 5, Properties.RunLoadTipsResource.strLoadTipsError, 2);
|
plsConfirmOper.ShowDialog();
|
}
|
|
if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Retry) // 重试
|
{
|
result = ExecuteLoadTips(platformNodeList, methodNode, isSimulator);
|
return result;
|
}
|
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Cancel) // 终止
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strLoadTipWasStopped);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:load tip was stopped!");
|
}
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1010", 5, Properties.RunLoadTipsResource.strLoadTipWasStopped, 2);
|
}
|
result = false;
|
return result;
|
}
|
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Continue) // 跳过
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strLoadTipWasSkipped);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:load tip was skipped!");
|
}
|
}
|
}
|
}
|
#endregion
|
|
#region 硬件上是多通道
|
else if (Shared.ChannelCount > 1&&Shared.ChannelCount!=96)
|
{
|
LoadTipsMParamSH loadTipsMParam = new LoadTipsMParamSH();
|
loadTipsMParam.armId = Convert.ToInt32(methodNode.SelectSingleNode("arm/value").InnerText);
|
loadTipsMParam.basezAxisVal = (float)Convert.ToDouble(ConfigurationManager.AppSettings["zAxisSafeVal"]);
|
|
string labwareid = methodNode.SelectSingleNode("labwaretip/value").InnerText;
|
Labware currentLabware = getOrSetLabware.GetLabware(labwareid);
|
loadTipsMParam.presstippower = (float)currentLabware.press_tip_power;
|
//loadTipsMParam.yChannelGapVal = (float)currentLabware.a1_b1_distance;
|
TipsTable tipsTable = lstTipWellsNoUsed.FirstOrDefault(t => t.isUsed.Equals(0));
|
if (tipsTable != null)
|
{
|
List<TipsTable> tipsTableList = this.GetTipsByTopTips(chArry, lstTipWellsNoUsed);
|
if (chArry.Count() != tipsTableList.Count)
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strWithoutCountOfTips);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: Load tips were failed! error information: Tips are running out!");
|
}
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1007", 5, Properties.RunLoadTipsResource.strWithoutCountOfTips, 2);
|
}
|
|
// 状态6 报错/急停 红闪/蜂鸣5S
|
CommonBll.StatusLamp(6, isSimulator);
|
if (!launchView.isRemotingOper)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
plsToolTipWin.Height = launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Hidden;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}));
|
}
|
else
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
plsToolTipWin.Height = launchView.ActualHeight==0d?950d: launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth == 0d ? 1850d : launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Hidden;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}
|
|
if (dialogResult)
|
{
|
return ExecuteLoadTips(platformNodeList, methodNode, isSimulator);
|
}
|
return result;
|
}
|
|
List<List<TipsTable>> tipsTablesArr = this.GetGroupTipsByColumn(tipsTableList);
|
|
int counNumber = 0; //拆分次数
|
for (int iTipChanelIndex = 0; iTipChanelIndex < tipsTablesArr.Count; iTipChanelIndex++)
|
{
|
counNumber++;
|
var tipsTableOneEach = tipsTablesArr[iTipChanelIndex];
|
if (tipsTableOneEach.Count == Shared.ChannelsId.Length)
|
{
|
if (counNumber > 1)
|
{
|
loadTipsMParam.yChannelGapVal = 20f;
|
}
|
else
|
{
|
loadTipsMParam.yChannelGapVal = (float)currentLabware.a1_b1_distance;
|
}
|
}
|
else
|
{
|
if (counNumber == 1)
|
{
|
loadTipsMParam.yChannelGapVal = (float)currentLabware.a1_b1_distance;
|
}
|
else
|
{
|
loadTipsMParam.yChannelGapVal = 20f;
|
}
|
}
|
|
loadTipsMParam.xAxisVal = tipsTableOneEach.First().axis_b_X;
|
loadTipsMParam.yAxisVal = tipsTableOneEach.First().axis_b_Y;
|
|
float[] f = new float[tipsTableOneEach.Count];
|
int[] ch = new int[tipsTableOneEach.Count];
|
if (iTipChanelIndex == 0)
|
{
|
ch = chArry.Skip(iTipChanelIndex).Take(tipsTableOneEach.Count).ToArray();
|
}
|
else if(iTipChanelIndex == 1)
|
{
|
ch = chArry.Skip(tipsTablesArr[iTipChanelIndex-1].Count).Take(tipsTableOneEach.Count).ToArray();
|
}
|
else if (iTipChanelIndex == 2)
|
{
|
int jumpNum = tipsTablesArr[iTipChanelIndex - 1].Count + tipsTablesArr[iTipChanelIndex - 2].Count;
|
ch = chArry.Skip(jumpNum).Take(tipsTableOneEach.Count).ToArray();
|
}
|
else if (iTipChanelIndex == 3)
|
{
|
int jumpNum = tipsTablesArr[iTipChanelIndex - 1].Count + tipsTablesArr[iTipChanelIndex - 2].Count + tipsTablesArr[iTipChanelIndex - 3].Count;
|
ch = chArry.Skip(jumpNum).Take(tipsTableOneEach.Count).ToArray();
|
}
|
|
for (int i = 0; i < tipsTableOneEach.Count; i++)
|
{
|
f[i] = tipsTableOneEach[i].axis_b_Z;
|
}
|
loadTipsMParam.zAxisVal = f;
|
loadTipsMParam.channelCount = tipsTableOneEach.Count;
|
loadTipsMParam.channelId = ch;
|
loadTipsMParam.loadModel = 3;
|
string strJson = JsonConvert.SerializeObject(loadTipsMParam);
|
LoggerHelper.InfoLog("安装枪头参数:"+strJson);
|
result = ExecuteFunction(platformNodeList, methodNode, loadTipsMParam, tipsTableOneEach, methodNode.SelectSingleNode("name").InnerText, isSimulator);
|
if (!result)
|
{
|
return result;
|
}
|
}
|
|
#region Del
|
//if (tipsTablesArr[0].Count > 0)
|
//{
|
// TipsTable tipsTableFirst = tipsTablesArr[0][0];
|
|
// loadTipsMParam.xAxisVal = (float)Convert.ToDouble(tipsTableFirst.axis_b_X.ToString());
|
// loadTipsMParam.yAxisVal = (float)Convert.ToDouble(tipsTableFirst.axis_b_Y.ToString());
|
// float[] f = new float[tipsTablesArr[0].Count];
|
// int[] ch = new int[tipsTablesArr[0].Count];
|
// for (int i = 0; i < tipsTablesArr[0].Count; i++)
|
// {
|
// f[i] = tipsTablesArr[0][i].axis_b_Z;
|
// ch[i] = chArry[i];
|
// }
|
// loadTipsMParam.zAxisVal = f;
|
// loadTipsMParam.channelCount = tipsTablesArr[0].Count;
|
// loadTipsMParam.channelId = ch;
|
// loadTipsMParam.loadModel = 3;
|
|
// result = ExecuteFunction(platformNodeList, methodNode, loadTipsMParam, tipsTablesArr[0], methodNode.SelectSingleNode("name").InnerText, isSimulator);
|
//}
|
|
//if (result && tipsTablesArr[1].Count > 0)
|
//{
|
// loadTipsMParam.xAxisVal = (float)Convert.ToDouble(tipsTablesArr[1][0].axis_b_X.ToString());
|
// loadTipsMParam.yAxisVal = (float)Convert.ToDouble(tipsTablesArr[1][0].axis_b_Y.ToString());
|
// float[] f = new float[tipsTablesArr[1].Count];
|
// int[] ch = new int[tipsTablesArr[1].Count];
|
// for (int i = 0; i < tipsTablesArr[1].Count; i++)
|
// {
|
// f[i] = tipsTablesArr[1][i].axis_b_Z;
|
// ch[i] = chArry[i + tipsTablesArr[0].Count];
|
//}
|
// loadTipsMParam.zAxisVal = f;
|
// loadTipsMParam.channelCount = tipsTablesArr[1].Count;
|
// loadTipsMParam.channelId = ch;
|
// loadTipsMParam.loadModel = 3;
|
// result = ExecuteFunction(platformNodeList, methodNode, loadTipsMParam, tipsTablesArr[1], methodNode.SelectSingleNode("name").InnerText, isSimulator);
|
//}
|
#endregion
|
}
|
else
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strWithoutCountOfTips);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: Load tips were failed! error information: Tips are running out!");
|
}
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1007", 5, Properties.RunLoadTipsResource.strWithoutCountOfTips, 2);
|
}
|
result = false;
|
|
// 状态6 报错/急停 红闪/蜂鸣5S
|
CommonBll.StatusLamp(6, isSimulator);
|
if (!launchView.isRemotingOper)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
plsToolTipWin.Height = launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Hidden;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}));
|
}
|
else
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1007", 5, Properties.RunLoadTipsResource.strWithoutCountOfTips, 2);
|
plsToolTipWin.Height = launchView.ActualHeight==0?950: launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth==0?1880: launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Visible;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}
|
|
if (dialogResult)
|
{
|
return ExecuteLoadTips(platformNodeList, methodNode, isSimulator);
|
}
|
|
return result;
|
}
|
}
|
#endregion
|
|
#region 硬件上是96通道
|
else if (Shared.ChannelCount == 96)
|
{
|
LoadTipsMParam loadTipsMParam = new LoadTipsMParam();
|
loadTipsMParam.armId = Convert.ToInt32(methodNode.SelectSingleNode("arm/value").InnerText);
|
loadTipsMParam.basezAxisVal = (float)Convert.ToDouble(ConfigurationManager.AppSettings["zAxisSafeVal"]);
|
string labwareid = methodNode.SelectSingleNode("labwaretip/value").InnerText;
|
|
TipsTable tipsTable = lstTipWellsNoUsed.FirstOrDefault(t => t.isUsed.Equals(0)); // 取第一个未使用的枪头
|
if (tipsTable != null)
|
{
|
if (!tipsTable.wellname.Equals("A1"))
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strWithoutCountOfTips);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: Load tips were failed! error information: Tips are running out!");
|
}
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1007", 5, Properties.RunLoadTipsResource.strWithoutCountOfTips, 2);
|
}
|
result = false;
|
|
// 状态6 报错/急停 红闪/蜂鸣5S
|
CommonBll.StatusLamp(6, isSimulator);
|
|
if (!launchView.isRemotingOper)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
plsToolTipWin.Height = launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Hidden;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}));
|
}
|
else
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
plsToolTipWin.Height = launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Hidden;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}
|
|
if (dialogResult)
|
{
|
return ExecuteLoadTips(platformNodeList, methodNode, isSimulator);
|
}
|
|
return result;
|
}
|
else
|
{
|
loadTipsMParam.xAxisVal = (float)Convert.ToDouble(tipsTable.axis_b_X.ToString());
|
loadTipsMParam.yAxisVal = (float)Convert.ToDouble(tipsTable.axis_b_Y.ToString());
|
loadTipsMParam.zAxisVal = (float)Convert.ToDouble(tipsTable.axis_b_Z.ToString());
|
}
|
}
|
else
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strWithoutCountOfTips);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: Load tips were failed! error information: Tips are running out!");
|
}
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1007", 5, Properties.RunLoadTipsResource.strWithoutCountOfTips, 2);
|
}
|
result = false;
|
|
// 状态6 报错/急停 红闪/蜂鸣5S
|
CommonBll.StatusLamp(6, isSimulator);
|
|
if (!launchView.isRemotingOper)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
plsToolTipWin.Height = launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Hidden;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}));
|
}
|
else
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
plsToolTipWin = new PlsToolTipWin(Properties.RunLoadTipsResource.strWithoutCountOfTipsAndReset.ToString());
|
}
|
else
|
{
|
plsToolTipWin = new PlsToolTipWin(string.Format("Tips are running out, {0}Please load the tips first, then click OK!", Environment.NewLine));
|
}
|
plsToolTipWin.Height = launchView.ActualHeight;
|
plsToolTipWin.Width = launchView.ActualWidth;
|
plsToolTipWin.btnClearData.Visibility = Visibility.Hidden;
|
plsToolTipWin.lauchView = launchView;
|
|
SolidColorBrush mybtn1_Brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(70, 0, 0, 0));
|
plsToolTipWin.Background = (System.Windows.Media.Brush)mybtn1_Brush;
|
plsToolTipWin.btnCancel.Visibility = Visibility.Hidden;
|
plsToolTipWin.ShowDialog();
|
|
if (plsToolTipWin.DialogResult == true)
|
{
|
// 状态4 运行 绿色
|
CommonBll.StatusLamp(4, isSimulator);
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(launchView);
|
}
|
|
dialogResult = (bool)plsToolTipWin.DialogResult;
|
}
|
|
if (dialogResult)
|
{
|
return ExecuteLoadTips(platformNodeList, methodNode, isSimulator);
|
}
|
|
return result;
|
}
|
|
string strWell = tipsTable.wellname;
|
|
launchView.SetWaitOne();//暂停
|
ret = loadTipsBll.ExecuteLoadTips(loadTipsMParam, isSimulator);
|
|
if (ret.Result == ResultType.Success)
|
{
|
launchView.currentIsLoadingTips = true;
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strLoadTipsSuccess + "所有孔位 板位:" + tipsTable.lattice_num);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:loadtip is success from all wells on " + tipsTable.lattice_num + " lattice!");
|
}
|
// 更新台面被装的枪头和当前运行时的xml文档
|
Labware labware = LabwareDB.GetLabware(tipsTable.labware_id);
|
strWell = ComUtility.GetValidWells(labware.number_row, labware.number_column);
|
|
//strWell = "A1,B1,C1,D1,E1,F1,G1,H1,A2,B2,C2,D2,E2,F2,G2,H2,A3,B3,C3,D3,E3,F3,G3,H3,A4,B4,C4,D4,E4,F4,G4,H4,A5,B5,C5,D5,E5,F5,G5,H5,A6,B6,C6,D6,E6,F6,G6,H6,A7,B7,C7,D7,E7,F7,G7,H7,A8,B8,C8,D8,E8,F8,G8,H8,A9,B9,C9,D9,E9,F9,G9,H9,A10,B10,C10,D10,E10,F10,G10,H10,A11,B11,C11,D11,E11,F11,G11,H11,A12,B12,C12,D12,E12,F12,G12,H12";
|
launchView.UpdateLabwaretips(tipsTable, strWell);
|
launchView.currentInValidWell = strWell;
|
launchView.currentWellLatticeId = tipsTable.lattice_id;
|
}
|
else if (ret.Result != ResultType.Success)
|
{
|
OperateDialog plsConfirmOper = null;
|
|
if (!launchView.isRemotingOper)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.RunLoadTipsResource.strFailWhatToDo : "loadtips are fail! What do you want to do?");
|
plsConfirmOper.ShowDialog();
|
}));
|
}
|
else
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1008", 5, Properties.RunLoadTipsResource.strFailWhatToDo, 2);
|
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.RunLoadTipsResource.strFailWhatToDo : "loadtips are fail! What do you want to do?");
|
plsConfirmOper.ShowDialog();
|
}
|
|
if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Retry) // 重试
|
{
|
result = ExecuteLoadTips(platformNodeList, methodNode, isSimulator);
|
return result;
|
}
|
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Cancel) // 终止
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strLoadTipWasStopped);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:load tip was stopped!");
|
}
|
result = false;
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1011", 5, Properties.RunLoadTipsResource.strLoadTipWasStopped, 2);
|
}
|
return result;
|
}
|
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Continue) // 跳过
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strLoadTipWasSkipped);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:load tip was skipped!");
|
}
|
}
|
}
|
}
|
#endregion
|
|
#region End Log
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strEnd);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】complete;");
|
}
|
#endregion
|
}
|
catch (Exception ex)
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strError.ToString() + " 源 " + ex.Source + " 错误信息 " + ex.Message + ";");
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】error:source:" + ex.Source + ";error:" + ex.Message + ";");
|
}
|
result = false;
|
|
if (launchView.isRemotingOper)
|
{
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1001", 5, "error:source:" + ex.Source + ";error:" + ex.Message + ";", 2);
|
}
|
//if (socketTcpClientToRemote != null)
|
//{
|
// MethodMsg methodMsg = new MethodMsg(Guid.NewGuid().ToString(), "ID202_Choice_machine", 5, "", "ExecuteLoadTips", "1001",
|
// "error source:" + ex.Source + ";error:" + ex.Message, 6, 0);
|
// socketTcpClientToRemote.sendmessageError(socketTcpClientToRemote.CreateSendMsgContent(methodMsg, false), launchView.isRemotingOper);
|
//}
|
return result;
|
}
|
return result;
|
}
|
#endregion
|
|
|
#region 根据剩余的可用Tip头,获取本次要装载的Tip对象集合
|
private List<TipsTable> GetTipsByleftTips(string[] ch, List<TipsTable> tipsTables)
|
{
|
List<TipsTable> tipsTableList = new List<TipsTable>();
|
|
List<TipsTable> tList = (List<TipsTable>)tipsTables.FindAll(x => x.isUsed.Equals(0));
|
|
TipsTable a = tList.FirstOrDefault(t => t.isUsed.Equals(0));
|
if (a != null)
|
{
|
|
string well = string.Empty;//保存前一个枪头的孔名称
|
bool markNeighbour = false;//
|
int currIndex = 0;//记录当前的孔位索引
|
for (int i = 0; i < ch.Length; i++)
|
{
|
//取出第一个
|
if (i != 0)
|
{
|
string wellnameFirst = well;
|
string prefix = wellnameFirst.Substring(0, 1);
|
string suffix = wellnameFirst.Substring(1, wellnameFirst.Length - 1);
|
int nextid = Convert.ToInt32(suffix) + 2;
|
string nextFix = prefix;
|
if (nextid > 12)
|
{
|
if ((nextid - 12) == 1)
|
{
|
nextid = 1;
|
}
|
else if ((nextid - 12) == 2)
|
{
|
nextid = 2;
|
}
|
|
nextFix = Convert.ToChar(Convert.ToInt32(Convert.ToChar(nextFix)) + 1).ToString();
|
int fixValue = Convert.ToInt32(Convert.ToChar(nextFix));
|
if (fixValue > 72)
|
{
|
nextFix = "A";
|
}
|
}
|
|
string nextName = nextFix + nextid.ToString();
|
|
if (tList[i].wellname == nextName)
|
{
|
if (i < tList.Count)
|
{
|
TipsTable t = new TipsTable();
|
t.labware_id = tList[i].labware_id;
|
t.lattice_id = tList[i].lattice_id;
|
t.lattice_num = tList[i].lattice_num;
|
t.axis_b_X = tList[i].axis_b_X;
|
t.axis_b_Y = tList[i].axis_b_Y;
|
t.axis_b_Z = tList[i].axis_b_Z;
|
t.axis_b_r = tList[i].axis_b_r;
|
t.isUsed = tList[i].isUsed;
|
t.isUsedCount = tList[i].isUsedCount;
|
t.wellname = tList[i].wellname.ToString();
|
well = t.wellname;
|
t.well_top_shape = tList[i].well_top_shape;
|
tipsTableList.Add(t);
|
markNeighbour = true;
|
currIndex = currIndex + 1;
|
}
|
}
|
else
|
{
|
while (tList[currIndex].wellname != nextName)
|
{
|
currIndex = currIndex + 1;
|
}
|
|
TipsTable t = new TipsTable();
|
t.labware_id = tList[currIndex].labware_id;
|
t.lattice_id = tList[currIndex].lattice_id;
|
t.lattice_num = tList[currIndex].lattice_num;
|
t.axis_b_X = tList[currIndex].axis_b_X;
|
t.axis_b_Y = tList[currIndex].axis_b_Y;
|
t.axis_b_Z = tList[currIndex].axis_b_Z;
|
t.axis_b_r = tList[currIndex].axis_b_r;
|
t.isUsed = tList[currIndex].isUsed;
|
t.isUsedCount = tList[currIndex].isUsedCount;
|
t.wellname = tList[currIndex].wellname.ToString();
|
well = t.wellname;
|
t.well_top_shape = tList[currIndex].well_top_shape;
|
tipsTableList.Add(t);
|
|
//if (markNeighbour)
|
//{
|
// if ((i * 2-1) < tList.Count)
|
// {
|
// TipsTable t = new TipsTable();
|
// t.labware_id = tList[i * 2-1].labware_id;
|
// t.lattice_id = tList[i * 2-1].lattice_id;
|
// t.lattice_num = tList[i * 2-1].lattice_num;
|
// t.axis_b_X = tList[i * 2-1].axis_b_X;
|
// t.axis_b_Y = tList[i * 2-1].axis_b_Y;
|
// t.axis_b_Z = tList[i * 2-1].axis_b_Z;
|
// t.axis_b_r = tList[i * 2-1].axis_b_r;
|
// t.isUsed = tList[i * 2-1].isUsed;
|
// t.isUsedCount = tList[i * 2-1].isUsedCount;
|
// t.wellname = tList[i * 2-1].wellname.ToString();
|
// well = t.wellname;
|
// t.well_top_shape = tList[i * 2-1].well_top_shape;
|
// tipsTableList.Add(t);
|
// }
|
//}
|
//else
|
//{
|
// if ((i * 2 ) < tList.Count)
|
// {
|
// TipsTable t = new TipsTable();
|
// t.labware_id = tList[i * 2 ].labware_id;
|
// t.lattice_id = tList[i * 2 ].lattice_id;
|
// t.lattice_num = tList[i * 2].lattice_num;
|
// t.axis_b_X = tList[i * 2 ].axis_b_X;
|
// t.axis_b_Y = tList[i * 2 ].axis_b_Y;
|
// t.axis_b_Z = tList[i * 2 ].axis_b_Z;
|
// t.axis_b_r = tList[i * 2 ].axis_b_r;
|
// t.isUsed = tList[i * 2 ].isUsed;
|
// t.isUsedCount = tList[i * 2 ].isUsedCount;
|
// t.wellname = tList[i * 2 ].wellname.ToString();
|
// well = t.wellname;
|
// t.well_top_shape = tList[i * 2 ].well_top_shape;
|
// tipsTableList.Add(t);
|
// }
|
//}
|
}
|
}
|
else
|
{
|
TipsTable t = new TipsTable();
|
t.labware_id = tList[i].labware_id;
|
t.lattice_id = tList[i].lattice_id;
|
t.lattice_num = tList[i].lattice_num;
|
t.axis_b_X = tList[i].axis_b_X;
|
t.axis_b_Y = tList[i].axis_b_Y;
|
t.axis_b_Z = tList[i].axis_b_Z;
|
t.axis_b_r = tList[i].axis_b_r;
|
t.isUsed = tList[i].isUsed;
|
t.isUsedCount = tList[i].isUsedCount;
|
t.wellname = tList[i].wellname.ToString();
|
well = t.wellname;
|
t.well_top_shape = tList[i].well_top_shape;
|
tipsTableList.Add(t);
|
}
|
}
|
markNeighbour = false;
|
}
|
return tipsTableList;
|
}
|
#endregion
|
|
#region 把本次要装载的枪头孔位集合按行分开
|
private List<TipsTable>[] GetGroupTipsByRow(List<TipsTable> tipsTables)
|
{
|
List<TipsTable>[] tipsTablesArr = new List<TipsTable>[2];
|
List<TipsTable> tipsTables1 = new List<TipsTable>();
|
List<TipsTable> tipsTables2 = new List<TipsTable>();
|
if (tipsTables.Count > 0)
|
{
|
string prefix = tipsTables[0].wellname.Substring(0, 1);
|
foreach (TipsTable t in tipsTables)
|
{
|
string a = t.wellname.Substring(0, 1);
|
if (prefix == a)
|
{
|
tipsTables1.Add(t);
|
}
|
else
|
{
|
tipsTables2.Add(t);
|
}
|
}
|
}
|
|
tipsTablesArr[0] = tipsTables1;
|
tipsTablesArr[1] = tipsTables2;
|
return tipsTablesArr;
|
}
|
#endregion
|
|
|
#region 正常设备Tip头序列特殊处理
|
#region 根据剩余的可用Tip头,获取本次要装载的Tip对象集合
|
private List<TipsTable> GetTipsByTopTips(int[] chList, List<TipsTable> tipsTables)
|
{
|
return tipsTables.Take(chList.Length).ToList();
|
|
|
//List<TipsTable> tipsTableList = new List<TipsTable>();
|
|
//List<TipsTable> tList = (List<TipsTable>)tipsTables.FindAll(x => x.isUsed.Equals(0));
|
|
//TipsTable a = tList.FirstOrDefault(t => t.isUsed.Equals(0));
|
//if (a != null)
|
//{
|
|
// string well = string.Empty; // 保存前一个枪头的孔名称
|
// bool markNeighbour = false;
|
// int currIndex = 0; // 记录当前的孔位索引
|
// for (int i = 0; i < chList.Length; i++)
|
// {
|
// // 取出第一个
|
// if (i != 0)
|
// {
|
// string wellnameFirst = well;
|
// string prefix = wellnameFirst.Substring(0, 1);//行字母
|
// // 根据输入的行名称,取得对应的行index
|
// int rowNum = ComUtility.GetRowIndex(prefix);
|
// string suffix = wellnameFirst.Substring(1, wellnameFirst.Length - 1);//列号
|
// int nextid = rowNum + 1;//行数字号
|
|
// string nextFix = suffix;//列号
|
// if (nextid > 7)
|
// {
|
// if ((nextid - 7) == 1)
|
// {
|
// nextid = 0;
|
// }
|
|
// nextFix = (Convert.ToInt32(nextFix) + 1).ToString();
|
// if ((Convert.ToInt32(nextFix) + 1) > 12)
|
// {
|
// nextFix = "1";
|
// }
|
// }
|
|
// string nextName = ComUtility.GetRowChar(nextid) + nextFix.ToString();
|
|
// if (tList[i].wellname == nextName)
|
// {
|
// if (i < tList.Count)
|
// {
|
// TipsTable t = new TipsTable();
|
// t.labware_id = tList[i].labware_id;
|
// t.lattice_id = tList[i].lattice_id;
|
// t.lattice_num = tList[i].lattice_num;
|
// t.axis_b_X = tList[i].axis_b_X;
|
// t.axis_b_Y = tList[i].axis_b_Y;
|
// t.axis_b_Z = tList[i].axis_b_Z;
|
// t.axis_b_r = tList[i].axis_b_r;
|
// t.isUsed = tList[i].isUsed;
|
// t.isUsedCount = tList[i].isUsedCount;
|
// t.wellname = tList[i].wellname.ToString();
|
// well = t.wellname;
|
// t.well_top_shape = tList[i].well_top_shape;
|
// tipsTableList.Add(t);
|
// markNeighbour = true;
|
// currIndex = currIndex + 1;
|
// }
|
// }
|
// else
|
// {
|
// while (tList[currIndex].wellname != nextName)
|
// {
|
// currIndex = currIndex + 1;
|
// }
|
|
// TipsTable t = new TipsTable();
|
// t.labware_id = tList[currIndex].labware_id;
|
// t.lattice_id = tList[currIndex].lattice_id;
|
// t.lattice_num = tList[currIndex].lattice_num;
|
// t.axis_b_X = tList[currIndex].axis_b_X;
|
// t.axis_b_Y = tList[currIndex].axis_b_Y;
|
// t.axis_b_Z = tList[currIndex].axis_b_Z;
|
// t.axis_b_r = tList[currIndex].axis_b_r;
|
// t.isUsed = tList[currIndex].isUsed;
|
// t.isUsedCount = tList[currIndex].isUsedCount;
|
// t.wellname = tList[currIndex].wellname.ToString();
|
// well = t.wellname;
|
// t.well_top_shape = tList[currIndex].well_top_shape;
|
// tipsTableList.Add(t);
|
// }
|
// }
|
// else
|
// {
|
// TipsTable t = new TipsTable();
|
// t.labware_id = tList[i].labware_id;
|
// t.lattice_id = tList[i].lattice_id;
|
// t.lattice_num = tList[i].lattice_num;
|
// t.axis_b_X = tList[i].axis_b_X;
|
// t.axis_b_Y = tList[i].axis_b_Y;
|
// t.axis_b_Z = tList[i].axis_b_Z;
|
// t.axis_b_r = tList[i].axis_b_r;
|
// t.isUsed = tList[i].isUsed;
|
// t.isUsedCount = tList[i].isUsedCount;
|
// t.wellname = tList[i].wellname.ToString();
|
// well = t.wellname;
|
// t.well_top_shape = tList[i].well_top_shape;
|
// tipsTableList.Add(t);
|
// }
|
// }
|
// markNeighbour = false;
|
//}
|
//return tipsTableList;
|
}
|
#endregion
|
|
#region 把本次要装载的枪头孔位集合按列分开
|
private List<List<TipsTable>> GetGroupTipsByColumn(List<TipsTable> tipsTables)
|
{
|
List<List<TipsTable>> tipsTablesList = new List<List<TipsTable>>();
|
//List<TipsTable> tipsTables1 = new List<TipsTable>();
|
//List<TipsTable> tipsTables2 = new List<TipsTable>();
|
//if (tipsTables.Count > 0)
|
//{
|
// string suffix = tipsTables[0].wellname.Substring(1, tipsTables[0].wellname.Length - 1);
|
// foreach (TipsTable t in tipsTables)
|
// {
|
// string a = t.wellname.Substring(1, t.wellname.Length - 1);
|
// if (suffix == a)
|
// {
|
// tipsTables1.Add(t);
|
// }
|
// else
|
// {
|
// tipsTables2.Add(t);
|
// }
|
// }
|
//}
|
|
//tipsTablesArr[0] = tipsTables1;
|
//tipsTablesArr[1] = tipsTables2;
|
|
|
List<int> colNumList = new List<int>();
|
foreach (var tipItem in tipsTables)
|
{
|
colNumList.Add(ComUtility.GetColNum(tipItem.wellname));
|
}
|
colNumList = colNumList.Distinct().ToList();
|
|
int countNumber = 0;//计算拆分次数
|
foreach (var colNumItem in colNumList)
|
{
|
countNumber++;
|
var selColTips = tipsTables.Where(it => ComUtility.GetColNum(it.wellname) == colNumItem);
|
if (selColTips.Any())
|
{
|
List<TipsTable> colTipList = selColTips.ToList();
|
if (colTipList.Count != Shared.ChannelsId.Length)
|
{
|
if (countNumber == 1)
|
{
|
tipsTablesList.Add(colTipList);
|
}
|
else
|
{
|
foreach (var tipItem in colTipList)
|
{
|
List<TipsTable> newTipList = new List<TipsTable>();
|
newTipList.Add(tipItem);
|
tipsTablesList.Add(newTipList);
|
}
|
}
|
}
|
else
|
{
|
tipsTablesList.Add(colTipList);
|
}
|
}
|
}
|
|
return tipsTablesList;
|
}
|
#endregion
|
#endregion
|
|
#region 执行方法装枪头的动作
|
private bool ExecuteFunction(XmlNodeList platformNodeList, XmlNode methodNode, LoadTipsMParamSH loadTipsMParam, List<TipsTable> tipsTables, string methodName, bool isSimulator)
|
{
|
bool result = true;
|
launchView.SetWaitOne();//暂停
|
|
HxResult ret = loadTipsBll.ExecuteLoadTips(loadTipsMParam, isSimulator);
|
|
List<string> wellNameList = tipsTables.Select(it => it.wellname).ToList();
|
string strWell = string.Join(",", wellNameList);
|
|
if (ret.Result == ResultType.Success)
|
{
|
launchView.currentIsLoadingTips = true;
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strLoadTipsSuccess + "孔位:" + strWell + " 板位:" + tipsTables[0].lattice_num);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodName + "】progress: load tips are success from " + strWell + " well on " + tipsTables[0].lattice_num + " lattice!");
|
}
|
launchView.UpdateLabwaretips(tipsTables[0], strWell);
|
launchView.currentInValidWell = strWell;
|
launchView.currentWellLatticeId = tipsTables[0].lattice_id;
|
}
|
else if (ret.Result != ResultType.Success)
|
{
|
OperateDialog plsConfirmOper = null;
|
if (!launchView.isRemotingOper)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.RunLoadTipsResource.strFailWhatToDo : "loadtips are fail! What do you want to do?");
|
plsConfirmOper.ShowDialog();
|
}));
|
}
|
else
|
{
|
plsConfirmOper = new OperateDialog(strCurrentCulture.Equals("zh-CN") ? Properties.RunLoadTipsResource.strFailWhatToDo : "loadtips are fail! What do you want to do?");
|
launchView.OnError?.Invoke(launchView.remoteObjectCmd, "EC-1008", 5, Properties.RunLoadTipsResource.strLoadTipsError, 2);
|
plsConfirmOper.ShowDialog();
|
}
|
|
|
if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Retry) // 重试
|
{
|
result = ExecuteFunction(platformNodeList, methodNode, loadTipsMParam, tipsTables, methodName, isSimulator);
|
return result;
|
}
|
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Cancel) // 终止
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strLoadTipWasStopped);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:load tip was stopped!");
|
}
|
result = false;
|
return result;
|
}
|
else if (plsConfirmOper != null && plsConfirmOper.OperMark == NodeOperationTypeEnum.Continue) // 跳过
|
{
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress + Properties.RunLoadTipsResource.strLoadTipWasSkipped);
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress:load tip was skipped!");
|
}
|
}
|
}
|
|
return result;
|
}
|
#endregion
|
|
|
#region 获取列的剩余的吸头集合,返回结果字符串
|
/// <summary>
|
/// 执行装载吸头,返回结果字符串
|
/// </summary>
|
/// <param name="platformNodeList">env下所有platform节点集合</param>
|
/// <param name="methodNode">装载方法属性节点对象</param>
|
/// <param name="isSimulator">false:连接;true:仿真</param>
|
/// <returns></returns>
|
public static List<TipsTable> GetLeftTipsByLoadTips(XmlNodeList platformNodeList, XmlNode methodNode)
|
{
|
List<TipsTable> result = new List<TipsTable>();
|
|
try
|
{
|
#region 数据准备
|
string channelNums = methodNode.SelectSingleNode("channels").InnerText;
|
string armName = methodNode.SelectSingleNode("arm/text").InnerText;
|
string labwaretipId = methodNode.SelectSingleNode("labwaretip/value").InnerText;
|
#endregion
|
|
#region 获取板位上孔板的所有孔位坐标集合对象
|
Labware labwares = getOrSetLabware.GetLabware(methodNode.SelectSingleNode("labwaretip/value").InnerText); // 特定枪头的信息
|
List<Lattice> lstLatticeTipPlate = new List<Lattice>(); // 匹配枪头类型的所有枪头盒点位信息
|
for (int i = 0; i < platformNodeList.Count; i++) // 查找枪头位置PN
|
{
|
if (platformNodeList[i].SelectSingleNode("labware_id").InnerText == labwares.labware_id) // 找同类型的枪头点位
|
{
|
string latticeIdTemp = platformNodeList[i].SelectSingleNode("lattice_id").InnerText;
|
TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断
|
int latticeId = 0;
|
if (tabletopTemplate == null)
|
{
|
latticeId = ControlCom.GetLatticeId(Convert.ToInt32(latticeIdTemp));
|
}
|
else
|
{
|
string latticeNumber = "P" + latticeIdTemp;
|
latticeId = Convert.ToInt32(LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb(latticeNumber, Convert.ToInt32(Shared.DeviceArmList.SingleOrDefault(x => x.arm_type.Equals(1)).device_arm_id), Shared.SoftwareInformation.software_device_number, tabletopTemplate.tabletopid).lattice_id);
|
}
|
|
// 获取枪头点位信息
|
Lattice latticeInfo = LatticeDB.GetLatticeDataByIdFromdb(latticeId.ToString());
|
latticeInfo = LatticeDB.GetLatticeDataByIdFromdb(latticeInfo.lattice_num, Convert.ToInt32(methodNode.SelectSingleNode("arm/value").InnerText), Shared.SoftwareInformation.software_device_number);
|
lstLatticeTipPlate.Add(latticeInfo);
|
}
|
}
|
#endregion
|
|
List<TipsTable> lstTipWellsNoUsedTemp = new List<TipsTable>(); // 未使用的枪头集合
|
//读取所有指定枪头类型和板位设定的可用枪头
|
int lapid = 1;
|
foreach (XmlNode platformNodeItem in platformNodeList)
|
{
|
if (platformNodeItem.SelectSingleNode("labware_id").InnerText == labwares.labware_id)
|
{
|
string strWellStip = platformNodeItem.SelectSingleNode("residueValidWells").InnerText; // 可用枪头
|
string p = platformNodeItem.SelectSingleNode("lattice_id").InnerText;
|
|
string[] tipWells = strWellStip.Split(',');
|
for (int i = 0; i < tipWells.Length; i++)
|
{
|
TipsTable tipTable = new TipsTable();
|
tipTable.labware_id = labwares.labware_id;
|
|
tipTable.wellname = tipWells[i];
|
tipTable.axis_b_X = 0.0f;
|
tipTable.axis_b_Y = 0.0f;
|
tipTable.axis_b_Z = 0.0f;
|
tipTable.well_top_shape = 0;
|
tipTable.axis_b_r = 0.0f;
|
|
TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断
|
if (tabletopTemplate == null)
|
{
|
lapid = ControlCom.GetLatticeId(Convert.ToInt32(p));
|
}
|
else
|
{
|
string latticeNumber = "P" + p;
|
lapid = Convert.ToInt32(LatticeDB.GetLatticeDataByLatticeNumAndTempIdFromdb(latticeNumber, Convert.ToInt32(Shared.DeviceArmList.SingleOrDefault(x => x.arm_type.Equals(1)).device_arm_id), Shared.SoftwareInformation.software_device_number, tabletopTemplate.tabletopid).lattice_id);
|
}
|
|
tipTable.lattice_num = lstLatticeTipPlate.FirstOrDefault(n => n.lattice_id.Equals(lapid.ToString())).lattice_num;
|
tipTable.lattice_id = lapid.ToString();
|
|
if (RunWnd.currentIsUsedWellLattice.Count > 0)
|
{
|
var v = RunWnd.currentIsUsedWellLattice.FirstOrDefault(q => q.dropdown_id.Equals(lstLatticeTipPlate.FirstOrDefault(n => n.lattice_id.Equals(lapid.ToString())).lattice_id) && q.dropdown_name.Equals(tipWells[i]));
|
if (v != null)
|
{
|
tipTable.isUsed = 1;
|
}
|
else
|
{
|
tipTable.isUsed = 0;
|
}
|
}
|
else
|
{
|
tipTable.isUsed = 0;
|
}
|
|
lstTipWellsNoUsedTemp.Add(tipTable);
|
}
|
}
|
}
|
|
DataTable dt = null;
|
if (!String.IsNullOrEmpty(labwares.labware_id))
|
{
|
dt = ControlCom.GenerateCurrentTablayoutWellCoordinate(labwares, lstLatticeTipPlate);
|
}
|
|
List<TipsTable> lstTipWellsNoUsed = new List<TipsTable>(); // 所有未使用枪头集合
|
//dt 转化为实体类对象集合
|
for (int i = 0; i < dt.Rows.Count; i++)
|
{
|
// 有效枪头孔位
|
var tipWellsNoUsed = lstTipWellsNoUsedTemp.FirstOrDefault(x => x.labware_id.Equals(dt.Rows[i]["labware_id"].ToString()) &&
|
x.lattice_id.Equals(dt.Rows[i]["lattice_id"].ToString()) &&
|
x.lattice_num.Equals(dt.Rows[i]["lattice_num"].ToString()) &&
|
x.wellname.Equals(dt.Rows[i]["wellname"].ToString()) &&
|
x.isUsed.Equals(0));
|
if (tipWellsNoUsed != null)
|
{
|
TipsTable tipsTable = new TipsTable();
|
tipsTable.labware_id = dt.Rows[i]["labware_id"].ToString();
|
tipsTable.lattice_id = dt.Rows[i]["lattice_id"].ToString();
|
tipsTable.wellname = dt.Rows[i]["wellname"].ToString();
|
tipsTable.axis_b_X = (float)Convert.ToDouble(dt.Rows[i]["axis_b_X"].ToString());
|
tipsTable.axis_b_Y = (float)Convert.ToDouble(dt.Rows[i]["axis_b_Y"].ToString());
|
tipsTable.axis_b_Z = (float)Convert.ToDouble(dt.Rows[i]["axis_b_Z"].ToString());
|
tipsTable.well_top_shape = Convert.ToInt32(dt.Rows[i]["well_top_shape"].ToString());
|
tipsTable.axis_b_r = (float)Convert.ToDouble(dt.Rows[i]["axis_b_r"].ToString());
|
tipsTable.isUsed = Convert.ToInt32(dt.Rows[i]["isUsed"].ToString());
|
tipsTable.lattice_num = dt.Rows[i]["lattice_num"].ToString();
|
|
//(远程时,从已使用的Tip头文件中查找出数据比较,删除已经用的
|
if ((launchView.isRemotingOper == true) &&
|
(RunWnd.currentIsUsedWellLattice.Count != 0))
|
{
|
var selectATip = RunWnd.currentIsUsedWellLattice.SingleOrDefault(x => x.dropdown_name.Equals(tipsTable.wellname) && x.dropdown_id.Equals(tipsTable.lattice_id));
|
if (selectATip != null && selectATip.dropdown_id != "")
|
{
|
|
}
|
else
|
{
|
lstTipWellsNoUsed.Add(tipsTable);
|
}
|
}
|
else
|
{
|
lstTipWellsNoUsed.Add(tipsTable);
|
}
|
}
|
}
|
|
result = lstTipWellsNoUsed;
|
}
|
catch (Exception ex)
|
{
|
return result;
|
}
|
return result;
|
}
|
#endregion
|
}
|
}
|