using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using XImagingXhandler.XDAL; using DataEntity.Share; using DataEntity; using System.Collections.ObjectModel; using XHandler.Class.DataEx; using System.Runtime.Remoting.Channels; using XCommon.Log; using XHandler.Controls; using DataRWDAL; using HandyControl.Data; using XCommon.Tip; namespace XHandler.View.MethodProperty { /// /// PumpAspirateProperty.xaml 的交互逻辑 /// public partial class PumpDispenseProperty : UserControl, IMethodProperty { public MethodPumpDispese methodPumpDispese { get; set; } public MethodEx method = null; public MethodPumpDispese currmethodPumpDispese = null; #region 变量 string isrun = ""; string status = ""; string name = ""; string label = ""; string labwareText = ""; string labwareValue = ""; string positionText = ""; string positionValue = ""; string armText = ""; string armValue = ""; string wellarray = ""; List pumpList = null; int curArmSelectedIndex = -1; private Labware selectedLabware = null; int mark = 0; #endregion public PumpDispenseProperty() { InitializeComponent(); } public PumpDispenseProperty(MethodEx method) { mark = 0; InitializeComponent(); List armList = DataModule.getInstance().GetDeviceArm(); cbArm.ItemsSource = armList; if (armList.Count == 2) //只有一个臂的情况下默认选中该臂 { curArmSelectedIndex = 1; } else if (armList.Count == 5) { curArmSelectedIndex = 3; } else { curArmSelectedIndex = 0; } //加载泵 DeviceArm deviceArm = Shared.DeviceArmList.FirstOrDefault(x => x.arm_type.Equals(2)); if (deviceArm != null) { string[] strPumpList = deviceArm.device_arm_property.Split(','); cbxPumpNumber1.Content = strPumpList[0]; cbxPumpNumber2.Content = strPumpList[1]; cbxPumpNumber3.Content = strPumpList[2]; cbxPumpNumber4.Content = strPumpList[3]; } //加载台面 List list = new List(); List lattices = DataModule.getInstance().GetLattices(); TabletopTemplate tabletopTemplate = TabletopTemplateDB.GetCurrentAppTabletopTemplateCollectionFromdb(); //增加台面模板判断 if (tabletopTemplate == null) { for (int i = 0; i < Shared.SoftwareInformation.columns; i++) { for (int j = 0; j < Shared.SoftwareInformation.rows; j++) { int tmp = i * Shared.SoftwareInformation.rows + j; Lattice latt = lattices[tmp]; //if (latt.is_trash == 1) // continue; list.Add(latt.lattice_num); } } } else { foreach (Lattice lattice in lattices) { //if (lattice.is_trash == 1) // continue; list.Add(lattice.lattice_num); } } comboboxTablePos.ItemsSource = list; comboboxTablePos.SelectedIndex = 0; //加载泵液体参数 ObservableCollection liquidTypeList = DataModule.getInstance().GetLiquidTypes(); cbLiquidType1.ItemsSource = liquidTypeList; cbLiquidType2.ItemsSource = liquidTypeList; cbLiquidType3.ItemsSource = liquidTypeList; cbLiquidType4.ItemsSource = liquidTypeList; ObservableCollection liquidRangeList = DataModule.getInstance().GetLiquidRanges(); cbLiquidRange1.ItemsSource = liquidRangeList.OrderBy(m => Convert.ToInt32(m.liquid_range_id)); cbLiquidRange2.ItemsSource = liquidRangeList.OrderBy(m => Convert.ToInt32(m.liquid_range_id)); cbLiquidRange3.ItemsSource = liquidRangeList.OrderBy(m => Convert.ToInt32(m.liquid_range_id)); cbLiquidRange4.ItemsSource = liquidRangeList.OrderBy(m => Convert.ToInt32(m.liquid_range_id)); cbxPumpNumber1.IsChecked= true; cbxPumpNumber2.IsChecked= false; cbxPumpNumber3.IsChecked= false; cbxPumpNumber4.IsChecked= false; ObservableCollection liquidList = new ObservableCollection(); Liquid liquid = new Liquid(); liquid.liquid_name = Properties.Resources.strPleaseSelect; liquidList.Add(liquid); cbLiquid1.ItemsSource = liquidList; cbLiquid2.ItemsSource = liquidList; cbLiquid3.ItemsSource = liquidList; cbLiquid4.ItemsSource = liquidList; tbxCommandLabel.Text = method.method_name; methodPumpDispese = new MethodPumpDispese(); methodPumpDispese.name = method.method_name; methodPumpDispese.label = method.method_name; methodPumpDispese.status = (method.isEnabled == true ? "enable" : "disable"); methodPumpDispese.wellarray = ""; methodPumpDispese.strIndex = method.strIndex; this.method = method; if (method.tag != null) { methodPumpDispese = (MethodPumpDispese)method.tag; currmethodPumpDispese = methodPumpDispese; isrun = methodPumpDispese.isrun; status = methodPumpDispese.status; name = methodPumpDispese.name; label = methodPumpDispese.label; labwareText = methodPumpDispese.labwareText; labwareValue = methodPumpDispese.labwareValue; positionText = methodPumpDispese.positionText; positionValue = methodPumpDispese.positionValue; armText = methodPumpDispese.armText; armValue = methodPumpDispese.armValue; wellarray = methodPumpDispese.wellarray; pumpList = methodPumpDispese.pumpParams; if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } this.DataContext= methodPumpDispese; } private void UserControl_Loaded(object sender, RoutedEventArgs e) { mark += 1; try { if (mark > 1) { return; } if (!string.IsNullOrEmpty(armText)) { tbxCommandName.Text = name; cbArm.SelectedValue = armValue; DeviceArm arm = cbArm.SelectedItem as DeviceArm; comboboxTablePos.SelectedItem = positionText; tbxWellPositionTips.Text = wellarray; //根据板位上的耗材类型,显示耗材孔位示意图 Labware labwareA = DataRWDAL.LabwareDB.GetLabware(methodPumpDispese.labwareValue); wellPlate.Rows = labwareA.number_row; wellPlate.Columns = labwareA.number_column; if (labwareA.labware_type_id.Equals("4")) { labwareA.labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labwareA.labware_id); wellPlate.labwareWellInfoList = labwareA.labwareWellInfoList; wellPlate.LabwareRealWidth = labwareA.labware_length; wellPlate.LabwareRealLength = labwareA.labware_width; } wellPlate.Selection = wellarray; Pump pump = pumpList.FirstOrDefault(x => x.name.Equals("泵1")); if (pump != null) { cbxPumpNumber1.IsChecked = true; cbLiquidType1.SelectedValue = pump.liquidTypeValue; cbLiquidRange1.SelectedValue = pump.liquidRSValue; cbLiquid1.SelectedValue = pump.liquidValue; txtVolume1.Text = pump.volume.ToString(); cbxPumpNumber1_Click(sender, e); } else { cbxPumpNumber1.IsChecked = false; cbxPumpNumber1_Click(sender, e); } pump = pumpList.FirstOrDefault(x => x.name.Equals("泵2")); if (pump != null) { cbxPumpNumber2.IsChecked = true; cbLiquidType2.SelectedValue = pump.liquidTypeValue; cbLiquidRange2.SelectedValue = pump.liquidRSValue; cbLiquid2.SelectedValue = pump.liquidValue; txtVolume2.Text = pump.volume.ToString(); cbxPumpNumber2_Click(sender, e); } else { cbxPumpNumber2.IsChecked = false; cbxPumpNumber2_Click(sender, e); } pump = pumpList.FirstOrDefault(x => x.name.Equals("泵3")); if (pump != null) { cbxPumpNumber3.IsChecked = true; cbLiquidType3.SelectedValue = pump.liquidTypeValue; cbLiquidRange3.SelectedValue = pump.liquidRSValue; cbLiquid3.SelectedValue = pump.liquidValue; txtVolume3.Text = pump.volume.ToString(); cbxPumpNumber3_Click(sender, e); } else { cbxPumpNumber3.IsChecked = false; cbxPumpNumber3_Click(sender, e); } pump = pumpList.FirstOrDefault(x => x.name.Equals("泵4")); if (pump != null) { cbxPumpNumber4.IsChecked = true; cbLiquidType4.SelectedValue = pump.liquidTypeValue; cbLiquidRange4.SelectedValue = pump.liquidRSValue; cbLiquid4.SelectedValue = pump.liquidValue; txtVolume4.Text = pump.volume.ToString(); cbxPumpNumber4_Click(sender, e); } else { cbxPumpNumber4.IsChecked = false; cbxPumpNumber4_Click(sender, e); } } else { cbxPumpNumber1.IsChecked = true; cbxPumpNumber2.IsChecked = false; cbxPumpNumber3.IsChecked = false; cbxPumpNumber4.IsChecked = false; txtVolume1.Text = "1"; txtVolume2.Text = "1"; txtVolume3.Text = "1"; txtVolume4.Text = "1"; cbxPumpNumber1_Click(sender, e); cbxPumpNumber2_Click(sender, e); cbxPumpNumber3_Click(sender, e); cbxPumpNumber4_Click(sender, e); cbArm.SelectedIndex = curArmSelectedIndex; cbLiquidType1.SelectedIndex = 0; cbLiquidRange1.SelectedIndex = 0; cbLiquid1.SelectedIndex = 0; cbLiquidType2.SelectedIndex = 0; cbLiquidRange2.SelectedIndex = 0; cbLiquid2.SelectedIndex = 0; cbLiquidType3.SelectedIndex = 0; cbLiquidRange3.SelectedIndex = 0; cbLiquid3.SelectedIndex = 0; cbLiquidType4.SelectedIndex = 0; cbLiquidRange4.SelectedIndex = 0; cbLiquid4.SelectedIndex = 0; } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } #region 设置某些属性信息值 public void SetTableName(string tableName, Labware lb) { try { if (lb == null) return; if (string.IsNullOrEmpty(lb.labware_id)) { if (lb.labware_name.Equals("垃圾桶")) { } else { return; } } selectedLabware = lb; wellPlate.Rows = lb.number_row; wellPlate.Columns = lb.number_column; wellPlate.labwareWellInfoList = lb.labwareWellInfoList; wellPlate.LabwareRealWidth = lb.labware_length; wellPlate.LabwareRealLength = lb.labware_width; wellPlate.DataContext = lb; List latticeList = DataRWDAL.LatticeDB.GetLatticeDataFromdb(Shared.SoftwareInformation.software_device_number, Convert.ToInt32(methodPumpDispese.armValue),0); Lattice lattice = latticeList.Find(s => s.lattice_num == tableName); if (lattice == null) { LoggerHelper.InfoLog("Error: Can't find lattice with lattice_num=" + tableName); return; } comboboxTablePos.SelectedItem = tableName; if (lb.labware_tubeshelf_type.Equals(1))//异形管架耗材 { tbxWellPositionTips.Text = ""; wellPlate.Selection = ""; } if (methodPumpDispese != null) { methodPumpDispese.positionText = tableName; methodPumpDispese.positionValue = lattice.lattice_id; methodPumpDispese.labwareText = lb.labware_name; methodPumpDispese.labwareValue = lb.labware_id; } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } #endregion private void tbxCommandLabel_TextChanged(object sender, TextChangedEventArgs e) { try { if (methodPumpDispese != null) { methodPumpDispese.label = tbxCommandLabel.Text; methodPumpDispese.name = tbxCommandName.Text.ToString(); } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } private void tbxCommandName_TextChanged(object sender, TextChangedEventArgs e) { try { if (methodPumpDispese != null) { methodPumpDispese.label = tbxCommandLabel.Text; methodPumpDispese.name = tbxCommandName.Text.ToString(); } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } private void cbArm_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { // 臂未选择 if (cbArm.SelectedIndex < 0 || cbArm.SelectedIndex == 0) { return; } string armName = ((DeviceArm)cbArm.SelectedItem).device_arm_name.ToString(); DeviceArm arm = cbArm.SelectedItem as DeviceArm; methodPumpDispese.armText = arm.device_arm_name; methodPumpDispese.armValue = arm.device_arm_id.ToString(); } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } private void comboboxTablePos_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (comboboxTablePos.SelectedItem == null) return; string name = comboboxTablePos.SelectedItem as string; SetTableName(name, selectedLabware); #region 验证台面耗材类型 if (TestDesign.SelectLabwares.Count() <= 0 || TestDesign.SelectLabwares.FirstOrDefault(m => m.Label.Equals(comboboxTablePos.SelectedValue.ToString())) == null) return; ControlLabware labware = TestDesign.SelectLabwares.FirstOrDefault(m => m.Label.Equals(comboboxTablePos.SelectedValue.ToString())); if ("1,3,5,4".Contains(labware.LabwareType.ToString())) { tbkErrorWellPosition.Text = ""; } else { tbkErrorWellPosition.Text = $"不能在耗材 [{labware.LabwareName}] 执行吸液"; } #endregion if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } private void cbxPumpNumber1_Click(object sender, RoutedEventArgs e) { if ((bool)cbxPumpNumber1.IsChecked) { tbxPumpNumber1.Text = "泵1"; gdPumpSettingsList.RowDefinitions[0].Height = new GridLength(95); gdPumpSettings1.Visibility = Visibility.Visible; if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } else { gdPumpSettingsList.RowDefinitions[0].Height = new GridLength(0); gdPumpSettings1.Visibility = Visibility.Collapsed; } } private void cbxPumpNumber2_Click(object sender, RoutedEventArgs e) { if ((bool)cbxPumpNumber2.IsChecked) { tbxPumpNumber2.Text = "泵2"; gdPumpSettingsList.RowDefinitions[1].Height = new GridLength(95); gdPumpSettings2.Visibility = Visibility.Visible; if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } else { gdPumpSettingsList.RowDefinitions[1].Height = new GridLength(0); gdPumpSettings2.Visibility = Visibility.Collapsed; } } private void cbxPumpNumber3_Click(object sender, RoutedEventArgs e) { if ((bool)cbxPumpNumber3.IsChecked) { tbxPumpNumber3.Text = "泵3"; gdPumpSettingsList.RowDefinitions[2].Height = new GridLength(95); gdPumpSettings3.Visibility = Visibility.Visible; if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } else { gdPumpSettingsList.RowDefinitions[2].Height = new GridLength(0); gdPumpSettings3.Visibility = Visibility.Collapsed; } } private void cbxPumpNumber4_Click(object sender, RoutedEventArgs e) { if ((bool)cbxPumpNumber4.IsChecked) { tbxPumpNumber4.Text = "泵4"; gdPumpSettingsList.RowDefinitions[3].Height = new GridLength(95); gdPumpSettings4.Visibility = Visibility.Visible; if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } else { gdPumpSettingsList.RowDefinitions[3].Height = new GridLength(0); gdPumpSettings4.Visibility = Visibility.Collapsed; } } private void txtVolume1_TextChanged(object sender, TextChangedEventArgs e) { try { if (!Consumables.ConsumablesValidationRule.IsRange(txtVolume1.Text, 1.0, 1000000.0, false, out string message)) { txtVolume1.BorderBrush = Brushes.Red; tbkErrorWellVolume1.Text = message; tbkErrorWellVolume1.Foreground = Brushes.Red; tbkErrorWellVolume1.Visibility = Visibility.Visible; } else { txtVolume1.BorderBrush = Brushes.Black; tbkErrorWellVolume1.Text = ""; } if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵1")); if (pump != null) { pump.volume = Convert.ToDouble(txtVolume1.Text); } else { if ((bool)cbxPumpNumber1.IsChecked == true) { Pump pump1 = new Pump(); pump1.volume = Convert.ToDouble(txtVolume1.Text); pump1.name = "泵1"; methodPumpDispese.pumpParams.Add(pump1); } } //validationWellVolume(); if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); txtVolume1.BorderBrush = Brushes.Red; tbkErrorWellVolume1.Text = "体积值:[1,1000000]之间"; tbkErrorWellVolume1.Foreground = Brushes.Red; tbkErrorWellVolume1.Visibility = Visibility.Visible; return; } } private void txtVolume2_TextChanged(object sender, TextChangedEventArgs e) { try { if (!Consumables.ConsumablesValidationRule.IsRange(txtVolume2.Text, 1.0, 1000000.0, false, out string message)) { txtVolume2.BorderBrush = Brushes.Red; tbkErrorWellVolume2.Text = message; tbkErrorWellVolume2.Foreground = Brushes.Red; tbkErrorWellVolume2.Visibility = Visibility.Visible; } else { txtVolume2.BorderBrush = Brushes.Black; tbkErrorWellVolume2.Text = ""; } if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵2")); if (pump != null) { pump.volume = Convert.ToDouble(txtVolume2.Text); } else { if ((bool)cbxPumpNumber2.IsChecked == true) { Pump pump1 = new Pump(); pump1.volume = Convert.ToDouble(txtVolume2.Text); pump1.name = "泵2"; methodPumpDispese.pumpParams.Add(pump1); } } //validationWellVolume(); if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); txtVolume2.BorderBrush = Brushes.Red; tbkErrorWellVolume2.Text = "体积值:[1,1000000]之间"; tbkErrorWellVolume2.Foreground = Brushes.Red; tbkErrorWellVolume2.Visibility = Visibility.Visible; return; } } private void txtVolume3_TextChanged(object sender, TextChangedEventArgs e) { try { if (!Consumables.ConsumablesValidationRule.IsRange(txtVolume3.Text, 1.0, 1000000.0, false, out string message)) { txtVolume3.BorderBrush = Brushes.Red; tbkErrorWellVolume3.Text = message; tbkErrorWellVolume3.Foreground = Brushes.Red; tbkErrorWellVolume3.Visibility = Visibility.Visible; } else { txtVolume3.BorderBrush = Brushes.Black; tbkErrorWellVolume3.Text = ""; } if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵3")); if (pump != null) { pump.volume = Convert.ToDouble(txtVolume3.Text); } else { if ((bool)cbxPumpNumber3.IsChecked == true) { Pump pump1 = new Pump(); pump1.volume = Convert.ToDouble(txtVolume3.Text); pump1.name = "泵3"; methodPumpDispese.pumpParams.Add(pump1); } } //validationWellVolume(); if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); txtVolume3.BorderBrush = Brushes.Red; tbkErrorWellVolume3.Text = "体积值:[1,1000000]之间"; tbkErrorWellVolume3.Foreground = Brushes.Red; tbkErrorWellVolume3.Visibility = Visibility.Visible; return; } } private void txtVolume4_TextChanged(object sender, TextChangedEventArgs e) { try { if (!Consumables.ConsumablesValidationRule.IsRange(txtVolume4.Text, 1.0, 1000000.0, false, out string message)) { txtVolume4.BorderBrush = Brushes.Red; tbkErrorWellVolume4.Text = message; tbkErrorWellVolume4.Foreground = Brushes.Red; tbkErrorWellVolume4.Visibility = Visibility.Visible; } else { txtVolume4.BorderBrush = Brushes.Black; tbkErrorWellVolume4.Text = ""; } if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵4")); if (pump != null) { pump.volume = Convert.ToDouble(txtVolume4.Text); } else { if ((bool)cbxPumpNumber4.IsChecked == true) { Pump pump1 = new Pump(); pump1.volume = Convert.ToDouble(txtVolume4.Text); pump1.name = "泵4"; methodPumpDispese.pumpParams.Add(pump1); } } //validationWellVolume(); if (this.method != null) { this.method.method_Tipcontent = string.Format("{0};{1};{2}:{3};{4}:{5};{6}:{7};{8}:{9}", methodPumpDispese.positionText, methodPumpDispese.wellarray, (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.FirstOrDefault() != null) ? methodPumpDispese.pumpParams[0].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 2) ? methodPumpDispese.pumpParams[1].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 3) ? methodPumpDispese.pumpParams[2].volume.ToString() : "0", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].name : "", (methodPumpDispese.pumpParams != null && methodPumpDispese.pumpParams.Count >= 4) ? methodPumpDispese.pumpParams[3].volume.ToString() : "0"); } } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); txtVolume4.BorderBrush = Brushes.Red; tbkErrorWellVolume4.Text = "体积值:[1,1000000]之间"; tbkErrorWellVolume4.Foreground = Brushes.Red; tbkErrorWellVolume4.Visibility = Visibility.Visible; return; } } #region 泵1液体参数 private void cbLiquidType1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquidType1.SelectedIndex < 0) return; if (cbLiquidType1.SelectedIndex == 0) { cbLiquidRange1.SelectedIndex = 0; cbLiquid1.SelectedIndex = 0; } if (cbLiquidType1.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵1")); if (pump != null) { pump.liquidTypeText = ((LiquidType)cbLiquidType1.SelectedItem).liquid_type_name.ToString(); pump.liquidTypeValue = ((LiquidType)cbLiquidType1.SelectedItem).liquid_type_id.ToString(); } else { if ((bool)cbxPumpNumber1.IsChecked == true) { Pump pump1 = new Pump(); pump1.liquidTypeText = ((LiquidType)cbLiquidType1.SelectedItem).liquid_type_name.ToString(); pump1.liquidTypeValue = ((LiquidType)cbLiquidType1.SelectedItem).liquid_type_id.ToString(); pump1.name = "泵1"; methodPumpDispese.pumpParams.Add(pump1); } } } } } private void cbLiquidRange1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquidRange1.SelectedIndex < 0) return; string typeID = cbLiquidType1.SelectedValue as string; string rangeID = cbLiquidRange1.SelectedValue as string; string armID = cbArm.SelectedValue.ToString(); ObservableCollection liquidList = LiquidTypeRSRangeDB.GetLiquidFromdbByTypeAndRange(typeID, rangeID, armID); Liquid liquid = new Liquid(); liquid.liquid_name = Properties.Resources.strPleaseSelect; liquidList.Insert(0, liquid); if (cbLiquidRange1.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵1")); if (pump != null) { pump.liquidRSText = ((LiquidRange)cbLiquidRange1.SelectedItem).liquid_range_name.ToString(); pump.liquidRSValue = ((LiquidRange)cbLiquidRange1.SelectedItem).liquid_range_id.ToString(); } else { if ((bool)cbxPumpNumber1.IsChecked == true) { Pump pump1 = new Pump(); pump1.liquidRSText = ((LiquidRange)cbLiquidRange1.SelectedItem).liquid_range_name.ToString(); pump1.liquidRSValue = ((LiquidRange)cbLiquidRange1.SelectedItem).liquid_range_id.ToString(); pump1.name = "泵1"; methodPumpDispese.pumpParams.Add(pump1); } } } } cbLiquid1.ItemsSource = liquidList; cbLiquid1.SelectedIndex = 0; } private void cbLiquid1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquid1.SelectedIndex < 1) return; Liquid liquid = cbLiquid1.SelectedItem as Liquid; if (cbLiquid1.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵1")); if (pump != null) { pump.liquidText = liquid.liquid_name.ToString(); pump.liquidValue = liquid.liquid_id.ToString(); } else { if ((bool)cbxPumpNumber1.IsChecked == true) { Pump pump1 = new Pump(); pump.liquidText = liquid.liquid_name.ToString(); pump.liquidValue = liquid.liquid_id.ToString(); pump1.name = "泵1"; methodPumpDispese.pumpParams.Add(pump1); } } } } } #endregion #region 泵2液体参数 private void cbLiquidType2_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquidType2.SelectedIndex < 0) return; if (cbLiquidType2.SelectedIndex == 0) { cbLiquidRange2.SelectedIndex = 0; cbLiquid2.SelectedIndex = 0; } if (cbLiquidType2.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵2")); if (pump != null) { pump.liquidTypeText = ((LiquidType)cbLiquidType2.SelectedItem).liquid_type_name.ToString(); pump.liquidTypeValue = ((LiquidType)cbLiquidType2.SelectedItem).liquid_type_id.ToString(); } else { if ((bool)cbxPumpNumber2.IsChecked == true) { Pump pump1 = new Pump(); pump1.liquidTypeText = ((LiquidType)cbLiquidType2.SelectedItem).liquid_type_name.ToString(); pump1.liquidTypeValue = ((LiquidType)cbLiquidType2.SelectedItem).liquid_type_id.ToString(); pump1.name = "泵2"; methodPumpDispese.pumpParams.Add(pump1); } } } } } #endregion private void cbLiquidRange2_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquidRange2.SelectedIndex < 0) return; string typeID = cbLiquidType2.SelectedValue as string; string rangeID = cbLiquidRange2.SelectedValue as string; string armID = cbArm.SelectedValue.ToString(); ObservableCollection liquidList = LiquidTypeRSRangeDB.GetLiquidFromdbByTypeAndRange(typeID, rangeID, armID); Liquid liquid = new Liquid(); liquid.liquid_name = Properties.Resources.strPleaseSelect; liquidList.Insert(0, liquid); if (cbLiquidRange2.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵2")); if (pump != null) { pump.liquidRSText = ((LiquidRange)cbLiquidRange2.SelectedItem).liquid_range_name.ToString(); pump.liquidRSValue = ((LiquidRange)cbLiquidRange2.SelectedItem).liquid_range_id.ToString(); } else { if ((bool)cbxPumpNumber2.IsChecked == true) { Pump pump1 = new Pump(); pump1.liquidRSText = ((LiquidRange)cbLiquidRange2.SelectedItem).liquid_range_name.ToString(); pump1.liquidRSValue = ((LiquidRange)cbLiquidRange2.SelectedItem).liquid_range_id.ToString(); pump1.name = "泵2"; methodPumpDispese.pumpParams.Add(pump1); } } } } cbLiquid2.ItemsSource = liquidList; cbLiquid2.SelectedIndex = 0; } private void cbLiquid2_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquid2.SelectedIndex < 1) return; Liquid liquid = cbLiquid2.SelectedItem as Liquid; if (cbLiquid2.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵2")); if (pump != null) { pump.liquidText = liquid.liquid_name.ToString(); pump.liquidValue = liquid.liquid_id.ToString(); } else { if ((bool)cbxPumpNumber2.IsChecked == true) { Pump pump1 = new Pump(); pump.liquidText = liquid.liquid_name.ToString(); pump.liquidValue = liquid.liquid_id.ToString(); pump1.name = "泵2"; methodPumpDispese.pumpParams.Add(pump1); } } } } } #region 泵3液体参数 private void cbLiquidType3_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquidType3.SelectedIndex < 0) return; if (cbLiquidType3.SelectedIndex == 0) { cbLiquidRange3.SelectedIndex = 0; cbLiquid3.SelectedIndex = 0; } if (cbLiquidType3.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵3")); if (pump != null) { pump.liquidTypeText = ((LiquidType)cbLiquidType3.SelectedItem).liquid_type_name.ToString(); pump.liquidTypeValue = ((LiquidType)cbLiquidType3.SelectedItem).liquid_type_id.ToString(); } else { if ((bool)cbxPumpNumber3.IsChecked == true) { Pump pump1 = new Pump(); pump1.liquidTypeText = ((LiquidType)cbLiquidType3.SelectedItem).liquid_type_name.ToString(); pump1.liquidTypeValue = ((LiquidType)cbLiquidType3.SelectedItem).liquid_type_id.ToString(); pump1.name = "泵3"; methodPumpDispese.pumpParams.Add(pump1); } } } } } private void cbLiquidRange3_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquidRange3.SelectedIndex < 0) return; string typeID = cbLiquidType3.SelectedValue as string; string rangeID = cbLiquidRange3.SelectedValue as string; string armID = cbArm.SelectedValue.ToString(); ObservableCollection liquidList = LiquidTypeRSRangeDB.GetLiquidFromdbByTypeAndRange(typeID, rangeID, armID); Liquid liquid = new Liquid(); liquid.liquid_name = Properties.Resources.strPleaseSelect; liquidList.Insert(0, liquid); if (cbLiquidRange3.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵3")); if (pump != null) { pump.liquidRSText = ((LiquidRange)cbLiquidRange3.SelectedItem).liquid_range_name.ToString(); pump.liquidRSValue = ((LiquidRange)cbLiquidRange3.SelectedItem).liquid_range_id.ToString(); } else { if ((bool)cbxPumpNumber3.IsChecked == true) { Pump pump1 = new Pump(); pump1.liquidRSText = ((LiquidRange)cbLiquidRange3.SelectedItem).liquid_range_name.ToString(); pump1.liquidRSValue = ((LiquidRange)cbLiquidRange3.SelectedItem).liquid_range_id.ToString(); pump1.name = "泵3"; methodPumpDispese.pumpParams.Add(pump1); } } } } cbLiquid3.ItemsSource = liquidList; cbLiquid3.SelectedIndex = 0; } private void cbLiquid3_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquid3.SelectedIndex < 1) return; Liquid liquid = cbLiquid3.SelectedItem as Liquid; if (cbLiquid3.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵3")); if (pump != null) { pump.liquidText = liquid.liquid_name.ToString(); pump.liquidValue = liquid.liquid_id.ToString(); } else { if ((bool)cbxPumpNumber3.IsChecked == true) { Pump pump1 = new Pump(); pump.liquidText = liquid.liquid_name.ToString(); pump.liquidValue = liquid.liquid_id.ToString(); pump1.name = "泵3"; methodPumpDispese.pumpParams.Add(pump1); } } } } } #endregion #region 泵4液体参数 private void cbLiquidType4_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquidType4.SelectedIndex < 0) return; if (cbLiquidType4.SelectedIndex == 0) { cbLiquidRange4.SelectedIndex = 0; cbLiquid4.SelectedIndex = 0; } if (cbLiquidType4.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵4")); if (pump != null) { pump.liquidTypeText = ((LiquidType)cbLiquidType4.SelectedItem).liquid_type_name.ToString(); pump.liquidTypeValue = ((LiquidType)cbLiquidType4.SelectedItem).liquid_type_id.ToString(); } else { if ((bool)cbxPumpNumber4.IsChecked == true) { Pump pump1 = new Pump(); pump1.liquidTypeText = ((LiquidType)cbLiquidType4.SelectedItem).liquid_type_name.ToString(); pump1.liquidTypeValue = ((LiquidType)cbLiquidType4.SelectedItem).liquid_type_id.ToString(); pump1.name = "泵4"; methodPumpDispese.pumpParams.Add(pump1); } } } } } private void cbLiquidRange4_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquidRange4.SelectedIndex < 0) return; string typeID = cbLiquidType4.SelectedValue as string; string rangeID = cbLiquidRange4.SelectedValue as string; string armID = cbArm.SelectedValue.ToString(); ObservableCollection liquidList = LiquidTypeRSRangeDB.GetLiquidFromdbByTypeAndRange(typeID, rangeID, armID); Liquid liquid = new Liquid(); liquid.liquid_name = Properties.Resources.strPleaseSelect; liquidList.Insert(0, liquid); if (cbLiquidRange4.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵4")); if (pump != null) { pump.liquidRSText = ((LiquidRange)cbLiquidRange4.SelectedItem).liquid_range_name.ToString(); pump.liquidRSValue = ((LiquidRange)cbLiquidRange4.SelectedItem).liquid_range_id.ToString(); } else { if ((bool)cbxPumpNumber4.IsChecked == true) { Pump pump1 = new Pump(); pump1.liquidRSText = ((LiquidRange)cbLiquidRange4.SelectedItem).liquid_range_name.ToString(); pump1.liquidRSValue = ((LiquidRange)cbLiquidRange4.SelectedItem).liquid_range_id.ToString(); pump1.name = "泵4"; methodPumpDispese.pumpParams.Add(pump1); } } } } cbLiquid4.ItemsSource = liquidList; cbLiquid4.SelectedIndex = 0; } private void cbLiquid4_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbLiquid4.SelectedIndex < 1) return; Liquid liquid = cbLiquid4.SelectedItem as Liquid; if (cbLiquid4.SelectedIndex != 0) { if (methodPumpDispese != null) { Pump pump = methodPumpDispese.pumpParams.FirstOrDefault(x => x.name.Equals("泵4")); if (pump != null) { pump.liquidText = liquid.liquid_name.ToString(); pump.liquidValue = liquid.liquid_id.ToString(); } else { if ((bool)cbxPumpNumber4.IsChecked == true) { Pump pump1 = new Pump(); pump.liquidText = liquid.liquid_name.ToString(); pump.liquidValue = liquid.liquid_id.ToString(); pump1.name = "泵4"; methodPumpDispese.pumpParams.Add(pump1); } } } } } #endregion private void tbxWellPositionTips_TextChanged(object sender, TextChangedEventArgs e) { } private void wellPlate_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { tbxWellPositionTips.Text = wellPlate.Selection; } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } } }