using DataEntity.Rack;
|
using DataEntity.Share;
|
using DataRWDAL;
|
using DataRWDAL.Rack;
|
using HxEnum;
|
using System;
|
using System.Collections.Generic;
|
using System.Collections.ObjectModel;
|
using System.Linq;
|
using System.Windows;
|
using System.Windows.Controls;
|
using XCommon.Log;
|
using XCore;
|
using XHandler.Class;
|
using XHandler.Class.DataEx;
|
using XHandler.View.Dialog;
|
using XImagingXhandler.XDAL;
|
using XHandler.View.Consumables;
|
|
namespace XHandler.View.MethodProperty
|
{
|
/// <summary>
|
/// 夹爪保持结束 属性页面
|
/// </summary>
|
public partial class EndHoldingLabwareProperty : UserControl, IMethodProperty,IConsumableObserver
|
{
|
#region 变量
|
private MethodEx method = null;
|
public MethodHoldingLabware methodHoldingLabware { get; set; }
|
private int mark = 0;
|
#endregion
|
|
#region BLL
|
private AspirateBll aspirateBll = new AspirateBll();
|
private GripTransportBll gripTransportBll = new GripTransportBll();
|
#endregion
|
|
#region 构造函数
|
/// <summary>
|
/// 构造函数
|
/// </summary>
|
/// <param name="method"></param>
|
public EndHoldingLabwareProperty(MethodEx method)
|
{
|
InitializeComponent();
|
|
#region 臂
|
// 获取机械臂信息
|
List<DeviceArm> armList = DataModule.getInstance().GetDeviceArm();
|
cbArm.ItemsSource = armList;
|
#endregion
|
|
#region 转运点位
|
// 加载转运点位
|
LoadGripPosition(Shared.ChanelArmId);
|
#endregion
|
|
#region 放板方向
|
List<GripTransportModel> gripTransportModels = gripTransportBll.GenerateGripTransportModel(Shared.SoftwareInformation.software_device_number);
|
cbGripModelSet.ItemsSource = gripTransportModels;
|
#endregion
|
|
#region 放在耗材上
|
ObservableCollection<Labware> dropdownNames = LabwareDB.GetLabware(2);
|
ObservableCollection<Labware> pickDropdownNames = new ObservableCollection<Labware>(dropdownNames);
|
pickDropdownNames.Insert(0, new Labware() { labware_id = "-1", labware_name = "空板位" });
|
cbGripPlaceObject.ItemsSource = pickDropdownNames;
|
#endregion
|
|
methodHoldingLabware = new MethodHoldingLabware();
|
methodHoldingLabware.name = method.method_name;
|
methodHoldingLabware.label = method.method_name;
|
//methodHoldingLabware.transportMode = 0;
|
methodHoldingLabware.status = (method.isEnabled == true ? "enable" : "disable");
|
methodHoldingLabware.strIndex = method.strIndex;
|
|
this.method = method;
|
if (method.tag != null)
|
{
|
methodHoldingLabware = (MethodHoldingLabware)method.tag;
|
}
|
this.DataContext = methodHoldingLabware;
|
}
|
#endregion
|
|
bool isConsumableUpdate = false;
|
/// <summary>
|
/// 耗材变更后,更新节点
|
/// </summary>
|
/// <param name="consumableManagement">耗材管理对象</param>
|
public void ReceiveAndUpdate(ConsumableManagement consumableManagement)
|
{
|
// 放在耗材上
|
isConsumableUpdate = true;
|
ObservableCollection<Labware> dropdownNames = LabwareDB.GetLabware(2);
|
ObservableCollection<Labware> pickDropdownNames = new ObservableCollection<Labware>(dropdownNames);
|
pickDropdownNames.Insert(0, new Labware() { labware_id = "-1", labware_name = "空板位" });
|
cbGripPlaceObject.ItemsSource = pickDropdownNames;
|
cbGripPlaceObject.SelectedValue = methodHoldingLabware.gripPlaceLabwareValue;
|
}
|
|
#region 加载转运点位
|
/// <summary>
|
/// 加载转运点位
|
/// </summary>
|
/// <param name="armId"></param>
|
private void LoadGripPosition(int armId)
|
{
|
List<GripTransportPosition> gripPositionList = new List<GripTransportPosition>();
|
|
// 获取台面点位
|
List<Lattice> lattices = aspirateBll.ProviderLatticeList(Shared.SoftwareInformation.software_device_number, armId);
|
// 获取台面以外点位
|
List<PositionModel> positons = PositionDB.GetList(Shared.SoftwareInformation.software_information_id);
|
|
foreach (var lattice in lattices)
|
{
|
if (!lattice.lattice_num.Equals("请选择"))
|
{
|
GripTransportPosition gripPosition = new GripTransportPosition();
|
gripPosition.position_id = lattice.lattice_id;
|
gripPosition.position_name = lattice.lattice_num;
|
gripPosition.position_type = EnumManagement.GetEnumValue(PositonTypeEnum.Desktop);
|
gripPositionList.Add(gripPosition);
|
}
|
}
|
|
foreach (var positon in positons)
|
{
|
GripTransportPosition gripPosition = new GripTransportPosition();
|
gripPosition.position_id = positon.id;
|
gripPosition.position_name = positon.name;
|
gripPosition.position_type = positon.type;
|
gripPositionList.Add(gripPosition);
|
}
|
|
cbDestinationLattice.ItemsSource = gripPositionList;
|
cbDestinationLattice.SelectedIndex = 0;
|
}
|
#endregion
|
|
#region 初始化
|
/// <summary>
|
/// 初始化
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
{
|
mark += 1;
|
try
|
{
|
if (mark > 1)
|
{
|
return;
|
}
|
|
List<DeviceArm> armList = (List<DeviceArm>)cbArm.ItemsSource;
|
DeviceArm gripper = armList.FirstOrDefault(it => it.arm_type == EnumManagement.GetEnumValue(ArmTypeEnum.Gripper));
|
cbArm.SelectedItem = gripper;
|
|
if (!string.IsNullOrEmpty(methodHoldingLabware.armValue))
|
{
|
// 机械臂
|
cbArm.SelectedValue = methodHoldingLabware.armValue;
|
// 放板位
|
cbDestinationLattice.SelectedValue = methodHoldingLabware.desPositionValue;
|
// 放板方向
|
cbGripModelSet.SelectedValue = methodHoldingLabware.gripModelSetValue;
|
// 放在耗材上
|
cbGripPlaceObject.SelectedValue = methodHoldingLabware.gripPlaceLabwareValue;
|
|
if (this.method != null)
|
{
|
this.method.method_Tipcontent = string.Format("放板到{0}", methodHoldingLabware.desPositionText);
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region 臂
|
/// <summary>
|
/// 臂
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void cbArm_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (cbArm.SelectedIndex < 0)
|
{
|
return;
|
}
|
|
DeviceArm arm = (DeviceArm)cbArm.SelectedItem;
|
methodHoldingLabware.armText = arm.device_arm_name;
|
methodHoldingLabware.armValue = arm.device_arm_id.ToString();
|
}
|
#endregion
|
|
#region 转运板位
|
/// <summary>
|
/// 转运板位
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void cbDestinationLattice_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (cbDestinationLattice.SelectedIndex < 0 || mark == 0)
|
{
|
return;
|
}
|
|
if (cbDestinationLattice.SelectedIndex >= 0)
|
{
|
GripTransportPosition gripPosition = cbDestinationLattice.SelectedItem as GripTransportPosition;
|
if (methodHoldingLabware != null)
|
{
|
methodHoldingLabware.desPositionText = gripPosition.position_name;
|
methodHoldingLabware.desPositionValue = gripPosition.position_id;
|
methodHoldingLabware.desPositionType = gripPosition.position_type;
|
}
|
|
if (this.method != null)
|
{
|
this.method.method_Tipcontent = string.Format("放板到{0}", methodHoldingLabware.desPositionText);
|
}
|
}
|
}
|
#endregion
|
|
#region 放板方向
|
/// <summary>
|
/// 放板方向
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
|
private void cbGripModelSet_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
try
|
{
|
GripTransportModel gripTransportModel = cbGripModelSet.SelectedItem as GripTransportModel;
|
if (methodHoldingLabware != null)
|
{
|
methodHoldingLabware.gripModelSetText = gripTransportModel.model_name;
|
methodHoldingLabware.gripModelSetValue = Convert.ToInt32(gripTransportModel.model_id);
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region 放在耗材上
|
private void cbGripPlaceObject_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
try
|
{
|
if (isConsumableUpdate)
|
{
|
isConsumableUpdate = false;
|
return;
|
}
|
Labware gripTransportModel = cbGripPlaceObject.SelectedItem as Labware;
|
if (methodHoldingLabware != null)
|
{
|
methodHoldingLabware.gripPlaceLabwareText = gripTransportModel.labware_name;
|
methodHoldingLabware.gripPlaceLabwareValue = gripTransportModel.labware_id;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
public void SetTableName(string name, Labware labware)
|
{
|
}
|
}
|
}
|