using DriverLib.Engine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XCoreBLL.Resource;
using XImagingXhandler.XDAL;
using DriverLib;
using System.Xml;
using XCommon;
namespace XCore
{
public class UnloadTipsBll
{
string strCurrentCulture = "";
public UnloadTipsBll()
{
strCurrentCulture = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
}
public MethodUnloadTips GenerateMethodUnloadTipsDataByXmlNode(XmlNode xmlNode)
{
MethodUnloadTips methodUnloadTips = new MethodUnloadTips();
methodUnloadTips.isrun = xmlNode.SelectSingleNode("isrun").InnerText;
methodUnloadTips.status = xmlNode.SelectSingleNode("status").InnerText;
methodUnloadTips.name = xmlNode.SelectSingleNode("name").InnerText;
methodUnloadTips.label = xmlNode.SelectSingleNode("label").InnerText;
methodUnloadTips.strIndex = xmlNode.SelectSingleNode("strIndex").InnerText;
methodUnloadTips.positionText = xmlNode.SelectSingleNode("position/text").InnerText;
methodUnloadTips.positionValue = xmlNode.SelectSingleNode("position/value").InnerText;
methodUnloadTips.armText = xmlNode.SelectSingleNode("arm/text").InnerText;
methodUnloadTips.armValue = xmlNode.SelectSingleNode("arm/value").InnerText;
string strchs = xmlNode.SelectSingleNode("channels").InnerText;
methodUnloadTips.channels = ComUtility.GetChannelsFromXml(strchs);
methodUnloadTips.isputToSource= xmlNode.SelectSingleNode("isputToSource").InnerText.ToLower()=="true"?true:false;
return methodUnloadTips;
}
#region 检查所有属性设置是否满足要求
///
/// 检查所有属性设置是否满足要求
///
/// 吸液属性对象
/// 检查所有属性设置是否满足要求
public MethodPropertyInfo CheckProperty(MethodUnloadTips methodUnloadTips)
{
MethodPropertyInfo methodPropertyInfo = new MethodPropertyInfo();
if (strCurrentCulture == "zh-CN")
{
methodPropertyInfo.property_tips_info = AspirateResourceCHS.tipsInfo.ToString();
//if (methodUnloadTips.labwareValue == null || methodUnloadTips.labwaretipValue == "")
//{
// methodPropertyInfo.property_name_info = AspirateResourceCHS.labwareText.ToString();
//}
if (methodUnloadTips.positionValue == null || methodUnloadTips.positionValue == "" || methodUnloadTips.positionValue == "0")
{
methodPropertyInfo.property_name_info = AspirateResourceCHS.positionText.ToString();
}
if (methodUnloadTips.armValue == null || methodUnloadTips.armValue == "" || methodUnloadTips.armValue == "0")
{
methodPropertyInfo.property_name_info = AspirateResourceCHS.armText.ToString();
}
//if (methodUnloadTips.wellarray == null || methodUnloadTips.wellarray == "")
//{
// methodPropertyInfo.property_name_info = AspirateResourceCHS.labwareText.ToString();
//}
}
else if (strCurrentCulture == "en-US")
{
methodPropertyInfo.property_tips_info = AspirateResourceENU.tipsInfo.ToString();
//if (methodUnloadTips.labwareValue == null || methodUnloadTips.labwaretipValue == "")
//{
// methodPropertyInfo.property_name_info = AspirateResourceENU.labwareText.ToString();
//}
if (methodUnloadTips.positionValue == null || methodUnloadTips.positionValue == "" || methodUnloadTips.positionValue == "0")
{
methodPropertyInfo.property_name_info = AspirateResourceENU.positionText.ToString();
}
if (methodUnloadTips.armValue == null || methodUnloadTips.armValue == "" || methodUnloadTips.armValue == "0")
{
methodPropertyInfo.property_name_info = AspirateResourceENU.armText.ToString();
}
//if (methodUnloadTips.wellarray == null || methodUnloadTips.wellarray == "")
//{
// methodPropertyInfo.property_name_info = AspirateResourceENU.labwareText.ToString();
//}
}
return methodPropertyInfo;
}
#endregion
#region 执行卸载吸头,返回结果字符串
///
/// 执行卸载吸头,返回结果字符串
///
/// 卸载吸头的板位节点对象
/// true:仿真;false:实际运行
/// 结果实体对象
public HxResult ExecuteUnLoadTips(UnloadTipsMParam unloadTipsMParam, bool isSimulator = false)
{
HxResult ret = new HxResult();
if (!isSimulator)
{
ret = MethodAction.Instance.UnloadTip(unloadTipsMParam);
}
else
{
ret.Result = ResultType.Success;
}
return ret;
}
public HxResult ExecuteUnLoadTips(UnloadTipsMParamSH unloadTipsMParam, bool isSimulator = false)
{
HxResult ret = new HxResult();
if (!isSimulator)
{
ret = MethodAction.Instance.UnloadTip(unloadTipsMParam);
}
else
{
ret.Result = ResultType.Success;
}
return ret;
}
#endregion
}
}