using DataEntity.Share;
|
using DataRWDAL;
|
using HandyControl.Data;
|
using Microsoft.Win32;
|
using System;
|
using System.Collections.Generic;
|
using System.Collections.ObjectModel;
|
using System.Data;
|
using System.IO;
|
using System.Linq;
|
using System.Runtime.Remoting.Channels;
|
using System.Text;
|
using System.Text.RegularExpressions;
|
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 XCommon.Log;
|
using XCommon.Tip;
|
using XCore;
|
using XHandler.Class;
|
using XHandler.Class.DataEx;
|
using XImagingXhandler.XDAL;
|
|
namespace XHandler.View.MethodProperty.ElectroPart
|
{
|
/// <summary>
|
/// FileElectroProperty.xaml 的交互逻辑
|
/// </summary>
|
public partial class FileElectroProperty : UserControl,IMethodProperty
|
{
|
TransferFileBll transferFileBll = new TransferFileBll();
|
|
public MethodElectroFile methodElectroFile { get; set; }
|
public MethodElectroFile currmethodElectroFile = null;
|
public MethodEx method = null;
|
private Labware selectedLabware = null;
|
private int curArmSelectedIndex = -1;
|
|
#region 全局变量
|
string isrun = "";
|
string status = "";
|
string name = "";
|
string label = "";
|
string armText = "";
|
string armValue = "";
|
string labwaretipText = "";
|
string labwaretipValue = "";
|
int[] channels = new int[0] { };
|
string filePath = "";
|
int beginLine = 0;
|
DataTable transferDataTable = new DataTable();
|
string sourceLabware = "";
|
string sourceWell = "";
|
string destinationLabware = "";
|
string destinationWell = "";
|
string destVolume = "";
|
string tipSet = "";
|
int changeTipsMode = 0;
|
string changeToTipText = "";
|
int changeToTipValue = 0;
|
string liquididText = "";
|
string liquididValue = "";
|
string liquidrangeidText = "";
|
string liquidrangeidValue = "";
|
string liquidpidText = "";
|
string liquidpidValue = "";
|
int mark = 0;
|
#endregion
|
|
public FileElectroProperty()
|
{
|
InitializeComponent();
|
}
|
|
public FileElectroProperty(MethodEx method)
|
{
|
InitializeComponent();
|
mark = 0;
|
methodElectroFile = new MethodElectroFile();
|
methodElectroFile.label = method.method_name;
|
methodElectroFile.name = method.method_name;
|
methodElectroFile.status = (method.isEnabled == true ? "enable" : "disable");
|
|
|
ObservableCollection<LiquidType> liquidTypeList = DataModule.getInstance().GetLiquidTypes();
|
cbLiquidType.ItemsSource = liquidTypeList;
|
cbLiquidType.SelectedIndex = 0;
|
|
ObservableCollection<Labware> tipsList = DataRWDAL.LabwareDB.GetTipLabwareFromdb();
|
cbTipsType.ItemsSource = tipsList;
|
cbTipsType.SelectedIndex = 0;
|
|
ObservableCollection<LiquidRange> liquidRangeList = DataModule.getInstance().GetLiquidRanges();
|
cbLiquidRange.ItemsSource = liquidRangeList;
|
//cbTipsType.ItemsSource = liquidRangeList;
|
cbLiquidRange.SelectedIndex = 0;
|
|
|
List<DeviceArm> armList = DataModule.getInstance().GetDeviceArm();
|
cbArm.ItemsSource = armList;
|
if (armList.Count == 2) //只有一个臂的情况下默认选中该臂
|
curArmSelectedIndex = 1;
|
else
|
curArmSelectedIndex = 0;
|
|
tbxCommandLabel.Text = method.method_name;
|
|
|
radioBtnNotChange.IsChecked = true;
|
methodElectroFile.strIndex = method.strIndex;
|
this.method = method;
|
if (method.tag != null)
|
{
|
methodElectroFile = (MethodElectroFile)method.tag;
|
|
currmethodElectroFile = methodElectroFile;
|
|
isrun = methodElectroFile.isrun;
|
status = methodElectroFile.status;
|
name = methodElectroFile.name;
|
label = methodElectroFile.label;
|
armText = methodElectroFile.armText;
|
armValue = methodElectroFile.armValue;
|
labwaretipText = methodElectroFile.labwaretipText;
|
labwaretipValue = methodElectroFile.labwaretipValue;
|
channels = methodElectroFile.channels;
|
|
filePath = methodElectroFile.filePath;
|
beginLine = methodElectroFile.beginLine;
|
transferDataTable = methodElectroFile.transferDataTable;
|
sourceLabware = methodElectroFile.sourceLabware;
|
sourceWell = methodElectroFile.sourceWell;
|
destinationLabware = methodElectroFile.destinationLabware;
|
destinationWell = methodElectroFile.destinationWell;
|
destVolume = methodElectroFile.destVolume;
|
tipSet = methodElectroFile.tipSet;
|
changeTipsMode = methodElectroFile.changeTipsMode;
|
changeToTipText = methodElectroFile.changeToTipText;
|
changeToTipValue = methodElectroFile.changeToTipValue;
|
|
liquididText = methodElectroFile.liquididText;
|
liquididValue = methodElectroFile.liquididValue;
|
liquidrangeidText = methodElectroFile.liquidrangeidText;
|
liquidrangeidValue = methodElectroFile.liquidrangeidValue;
|
liquidpidText = methodElectroFile.liquidpidText;
|
liquidpidValue = methodElectroFile.liquidpidValue;
|
|
}
|
this.DataContext = methodElectroFile;
|
}
|
|
/// <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;
|
}
|
int[] ichs = channels;
|
if (!string.IsNullOrEmpty(armText))
|
{
|
tbxCommandName.Text = name;
|
cbArm.SelectedValue = armValue;
|
DeviceArm arm = cbArm.SelectedItem as DeviceArm;
|
tbxHeadType.Text = arm.head_type;
|
//tbSelectTable.Tag = labwaretipValue;
|
//tbSelectTable.Text = labwaretipText;
|
|
tbxbeginLine.Text = beginLine.ToString();
|
cbTipsType.SelectedValue = labwaretipValue;
|
|
cbLiquidType.SelectedValue = liquididValue;
|
cbLiquidRange.SelectedValue = liquidrangeidValue;
|
cbLiquid.SelectedValue = liquidpidValue;
|
|
dgTransferFileData.ItemsSource = transferDataTable.DefaultView;
|
tbExcelFile.Text = filePath;
|
|
//更新所有下拉列表
|
List<TransferFileHeader> transferFileHeaders = transferFileBll.GetTransferFileHeaders(transferDataTable);
|
|
cbSourceBoard.ItemsSource = transferFileHeaders;
|
|
cbSourceWell.ItemsSource = transferFileHeaders;
|
|
cbTargetBoard.ItemsSource = transferFileHeaders;
|
|
cbTargetWell.ItemsSource = transferFileHeaders;
|
|
cbVolumn.ItemsSource = transferFileHeaders;
|
cbChangeTip.ItemsSource = transferFileHeaders;
|
|
//cbVolumn.ItemsSource = transferFileHeaders;
|
|
//if (methodTransferFile.transferDataTable.Columns.Count >= 5)
|
//{
|
cbSourceBoard.Text = sourceLabware;
|
cbSourceWell.Text = sourceWell;
|
cbTargetBoard.SelectedValue = destinationLabware;
|
cbTargetWell.Text = destinationWell;
|
cbVolumn.Text = destVolume.ToString();
|
//cbTipsType.Text = tipSet;
|
cbChangeTip.Text = tipSet;
|
|
if (changeTipsMode == 0)
|
{
|
radioBtnNotChange.IsChecked = true;
|
}
|
else if (changeTipsMode == 1)
|
{
|
radioBtnChangeByFile.IsChecked = true;
|
}
|
else if (changeTipsMode == 2)
|
{
|
radioBtnOperation.IsChecked = true;
|
}
|
|
if (currmethodElectroFile != null)
|
{
|
methodElectroFile = currmethodElectroFile;
|
}
|
}
|
else
|
{
|
cbArm.SelectedIndex = curArmSelectedIndex;
|
if (cbArm.Items.Count > 1)
|
{
|
cbArm.SelectedIndex = 1;
|
}
|
|
DeviceArm arm = cbArm.SelectedItem as DeviceArm;
|
tbxHeadType.Text = arm.head_type;
|
cbLiquidType.SelectedIndex = 0;
|
if (currmethodElectroFile != null)
|
{
|
methodElectroFile = currmethodElectroFile;
|
}
|
|
}
|
|
//ReceiveAndUpdate();
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
/// <summary>
|
/// 实现设置台面选中的耗材
|
/// </summary>
|
/// <param name="tableName"></param>
|
/// <param name="lb"></param>
|
public void SetTableName(string tableName, Labware lb)
|
{
|
if (lb == null)
|
return;
|
if (string.IsNullOrEmpty(lb.labware_id))
|
return;
|
if (string.IsNullOrEmpty(methodElectroFile.armValue))
|
{
|
MessageBox.Show(Properties.Resources.msgPlsSelectArm, "Tips");
|
return;
|
}
|
selectedLabware = lb;
|
|
List<Lattice> latticeList = DataRWDAL.LatticeDB.GetLatticeDataFromdb(Shared.SoftwareInformation.software_device_number, Convert.ToInt32(methodElectroFile.armValue));
|
Lattice lattice = latticeList.Find(s => s.lattice_num == tableName);
|
if (lattice == null)
|
{
|
LoggerHelper.InfoLog("Error: Can't find lattice with lattice_num=" + tableName);
|
return;
|
}
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.labwaretipText = lb.labware_name;
|
methodElectroFile.labwaretipValue = lb.labware_id;
|
}
|
//tbSelectTable.Tag = lb.labware_id;
|
//tbSelectTable.Text = lb.labware_name;
|
}
|
|
private void tbxCommandName_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
if (string.IsNullOrEmpty(tbxCommandName.Text))
|
{
|
cnError.Text = "命令名称不能为空";
|
return;
|
}
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.name = tbxCommandName.Text;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void tbExcelFile_PreviewKeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.Key == Key.Enter)
|
{
|
if (!string.IsNullOrEmpty(tbExcelFile.Text.Trim()))
|
{
|
if (System.IO.Path.HasExtension(tbExcelFile.Text.Trim()))
|
{
|
if (System.IO.File.Exists(tbExcelFile.Text.Trim()))
|
{
|
SelectFile(tbExcelFile.Text.Trim());
|
}
|
}
|
}
|
}
|
}
|
|
private void SelectFile(string file)
|
{
|
string ext = System.IO.Path.GetExtension(file);
|
DataTable transferData = null;
|
if (string.Compare(ext, ".csv", true) == 0)
|
transferData = ExcelAndCsvHelper.GetDataTableFromCsvFile(file);
|
else
|
transferData = ExcelAndCsvHelper.GetDataTableFromExcelFile(file, true);
|
|
if (transferData != null)
|
{
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.transferDataTable = transferData;
|
}
|
dgTransferFileData.ItemsSource = transferData.DefaultView;
|
|
List<TransferFileHeader> transferFileHeaders = transferFileBll.GetTransferFileHeaders(transferData);
|
|
cbSourceBoard.ItemsSource = transferFileHeaders;
|
cbSourceWell.ItemsSource = transferFileHeaders;
|
cbTargetBoard.ItemsSource = transferFileHeaders;
|
cbTargetWell.ItemsSource = transferFileHeaders;
|
cbVolumn.ItemsSource = transferFileHeaders;
|
cbChangeTip.ItemsSource = transferFileHeaders;
|
|
cbSourceBoard.SelectedIndex = 1;
|
cbSourceWell.SelectedIndex = 2;
|
cbTargetBoard.SelectedIndex = 3;
|
cbTargetWell.SelectedIndex = 4;
|
cbVolumn.SelectedIndex = 5;
|
cbChangeTip.SelectedIndex = 6;
|
}
|
}
|
|
private void btnSelectFile_Click(object sender, RoutedEventArgs e)
|
{
|
OpenFileDialog dlg = new OpenFileDialog();
|
dlg.Title = "请选择Excel文件";
|
dlg.FileName = string.Empty;
|
dlg.FilterIndex = 1;
|
dlg.Filter = "excel files(*.xls)|*.xls|csv files(*.csv)|*.csv|All files(*.*)|*.*";
|
dlg.Multiselect = false;
|
if (!string.IsNullOrEmpty(tbExcelFile.Text.Trim()))
|
{
|
try
|
{
|
if (System.IO.Path.HasExtension(tbExcelFile.Text.Trim()))
|
dlg.InitialDirectory = System.IO.Path.GetDirectoryName(tbExcelFile.Text.Trim());
|
else
|
dlg.InitialDirectory = tbExcelFile.Text.Trim();
|
}
|
catch (Exception ex)
|
{
|
|
}
|
}
|
if (dlg.ShowDialog() == true)
|
{
|
string fullPath = dlg.FileName;
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.filePath = fullPath;
|
}
|
tbExcelFile.Text = fullPath;
|
|
SelectFile(fullPath);
|
}
|
|
((MainWindow)Application.Current.MainWindow).testDesign.IsIgnore = true; //防止影响到主界面流程中已拖放的单命令顺序
|
}
|
|
private void tbxbeginLine_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.beginLine = Convert.ToInt32(tbxbeginLine.Text);
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void cbSourceBoard_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
try
|
{
|
if (cbSourceBoard.SelectedItem == null)
|
return;
|
TransferFileHeader transferFileHeader = cbSourceBoard.SelectedItem as TransferFileHeader;
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.sourceLabware = transferFileHeader.header_name.ToString();
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void cbSourceWell_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
try
|
{
|
if (cbSourceWell.SelectedItem == null)
|
return;
|
TransferFileHeader transferFileHeader = cbSourceWell.SelectedItem as TransferFileHeader;
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.sourceWell = transferFileHeader.header_name;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void cbTargetBoard_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
try
|
{
|
if (cbTargetBoard.SelectedItem == null)
|
return;
|
TransferFileHeader transferFileHeader = cbTargetBoard.SelectedItem as TransferFileHeader;
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.destinationLabware = transferFileHeader.header_name;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void cbTargetWell_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
try
|
{
|
if (cbTargetWell.SelectedItem == null)
|
return;
|
TransferFileHeader transferFileHeader = cbTargetWell.SelectedItem as TransferFileHeader;
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.destinationWell = transferFileHeader.header_name;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void cbVolumn_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
try
|
{
|
if (cbVolumn.SelectedItem == null)
|
return;
|
TransferFileHeader transferFileHeader = cbVolumn.SelectedItem as TransferFileHeader;
|
if (methodElectroFile != null)
|
{
|
|
methodElectroFile.destVolume = transferFileHeader.header_name;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void btnNext_Click(object sender, RoutedEventArgs e)
|
{
|
stepBar.Next();
|
gridSelectFile.Visibility = Visibility.Collapsed;
|
gridTipSetting.Visibility = Visibility.Visible;
|
gridLiquidParam.Visibility = Visibility.Collapsed;
|
scrollViewer.ScrollToTop();
|
}
|
|
private void cbArm_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
try
|
{
|
if (cbArm.SelectedIndex < 0)
|
{
|
return;
|
}
|
curArmSelectedIndex = cbArm.SelectedIndex;
|
string armName = ((DeviceArm)cbArm.SelectedItem).device_arm_name.ToString();
|
methodElectroFile.channels = Shared.ChannelsId;
|
DeviceArm arm = cbArm.SelectedItem as DeviceArm;
|
methodElectroFile.armText = arm.device_arm_name;
|
methodElectroFile.armValue = arm.device_arm_id.ToString();
|
methodElectroFile.headType = arm.head_type;
|
tbxHeadType.Text = arm.head_type.ToString();
|
if (arm.arm_type.Equals(0))
|
{
|
gridTipSetting.RowDefinitions[1].Height = new GridLength(0);
|
gridTipSetting.RowDefinitions[2].Height = new GridLength(0);
|
return;
|
}
|
else
|
{
|
gridTipSetting.RowDefinitions[1].Height = new GridLength(40);
|
gridTipSetting.RowDefinitions[2].Height = new GridLength(80);
|
}
|
|
if (cbArm.SelectedIndex != 1)
|
{
|
tipsChannel.Visibility = Visibility.Collapsed;
|
}
|
else
|
{
|
tipsChannel.SelectedChannels = Shared.ChannelsId.ToList();
|
tipsChannel.SetTotalChannelCount(Shared.ChannelCount);
|
tipsChannel.SetSelectedChannels();
|
tipsChannel_SelectedChangedEvent(null, null);
|
tipsChannel.Visibility = Visibility.Visible;
|
}
|
//ReceiveAndUpdate();
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
|
private void tipsChannel_SelectedChangedEvent(object sender, EventArgs e)
|
{
|
methodElectroFile.channels = tipsChannel.SelectedChannels.ToArray();
|
}
|
|
private void cbTipsType_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (methodElectroFile == null) return;
|
if (cbTipsType.SelectedIndex < 0) return;
|
//if (isConsumableUpdate)
|
//{
|
// isConsumableUpdate = false;
|
// return;
|
//}
|
|
Labware labware = cbTipsType.SelectedItem as Labware;
|
methodElectroFile.labwaretipText = labware.labware_name;
|
methodElectroFile.labwaretipValue = labware.labware_id.ToString();
|
}
|
|
private void radioBtnNotChange_Checked(object sender, RoutedEventArgs e)
|
{
|
if (radioBtnNotChange.IsChecked == true)
|
{
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.changeTipsMode = 0;
|
}
|
}
|
}
|
|
private void radioBtnChangeByFile_Checked(object sender, RoutedEventArgs e)
|
{
|
if (radioBtnChangeByFile.IsChecked == true)
|
{
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.changeTipsMode = 1;
|
}
|
}
|
}
|
|
private void radioBtnOperation_Checked(object sender, RoutedEventArgs e)
|
{
|
if (radioBtnOperation.IsChecked == true)
|
{
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.changeTipsMode = 2;
|
}
|
}
|
}
|
private void btnPrev_Click(object sender, RoutedEventArgs e)
|
{
|
stepBar.Prev();
|
gridSelectFile.Visibility = Visibility.Visible;
|
gridTipSetting.Visibility = Visibility.Collapsed;
|
gridLiquidParam.Visibility = Visibility.Collapsed;
|
scrollViewer.ScrollToTop();
|
}
|
|
private void btnNext1_Click(object sender, RoutedEventArgs e)
|
{
|
stepBar.Next();
|
gridSelectFile.Visibility = Visibility.Collapsed;
|
gridTipSetting.Visibility = Visibility.Collapsed;
|
gridLiquidParam.Visibility = Visibility.Visible;
|
scrollViewer.ScrollToTop();
|
}
|
|
private void cbLiquidType_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (cbLiquidType.SelectedIndex < 0)
|
return;
|
if (cbLiquidType.SelectedIndex == 0)
|
{
|
ObservableCollection<Liquid> liquids = new ObservableCollection<Liquid>();
|
Liquid liquid = new Liquid();
|
liquid.liquid_name = Properties.Resources.strPleaseSelect;
|
liquids.Insert(0, liquid);
|
cbLiquid.ItemsSource = liquids;
|
cbLiquid.SelectedIndex = 0;
|
return;
|
}
|
|
if (cbLiquidType.SelectedIndex != 0)
|
{
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.liquididText = ((LiquidType)cbLiquidType.SelectedItem).liquid_type_name.ToString();
|
methodElectroFile.liquididValue = ((LiquidType)cbLiquidType.SelectedItem).liquid_type_id.ToString();
|
}
|
}
|
}
|
|
private void cbLiquidRange_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (cbLiquidRange.SelectedIndex < 0)
|
return;
|
if (cbLiquidRange.SelectedIndex == 0)
|
{
|
ObservableCollection<Liquid> liquids = new ObservableCollection<Liquid>();
|
Liquid liquid = new Liquid();
|
liquid.liquid_name = Properties.Resources.strPleaseSelect;
|
liquids.Insert(0, liquid);
|
cbLiquid.ItemsSource = liquids;
|
cbLiquid.SelectedIndex = 0;
|
return;
|
}
|
if (cbLiquidType.SelectedIndex <= 0)
|
return;
|
string typeID = cbLiquidType.SelectedValue as string;
|
string rangeID = cbLiquidRange.SelectedValue as string;
|
string armID = cbArm.SelectedValue.ToString();
|
ObservableCollection<Liquid> liquidList = LiquidTypeRSRangeDB.GetLiquidFromdbByTypeAndRange(typeID, rangeID, armID);
|
Liquid l = new Liquid();
|
l.liquid_name = Properties.Resources.strPleaseSelect;
|
liquidList.Insert(0, l);
|
if (cbLiquidRange.SelectedIndex != 0)
|
{
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.liquidrangeidText = ((LiquidRange)cbLiquidRange.SelectedItem).liquid_range_name.ToString();
|
methodElectroFile.liquidrangeidValue = ((LiquidRange)cbLiquidRange.SelectedItem).liquid_range_id.ToString();
|
}
|
}
|
cbLiquid.ItemsSource = liquidList;
|
cbLiquid.SelectedIndex = 0;
|
}
|
|
private void cbLiquid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (cbLiquid.SelectedIndex <= 0)
|
return;
|
Liquid l = cbLiquid.SelectedItem as Liquid;
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.liquidpidText = l.liquid_name;
|
methodElectroFile.liquidpidValue = l.liquid_id;
|
}
|
}
|
|
private void btnPrev1_Click(object sender, RoutedEventArgs e)
|
{
|
if (stepBar.StepIndex > stepBar.Items.Count)
|
{
|
stepBar.Prev();
|
stepBar.Prev();
|
}
|
else
|
stepBar.Prev();
|
gridSelectFile.Visibility = Visibility.Collapsed;
|
gridTipSetting.Visibility = Visibility.Visible;
|
gridLiquidParam.Visibility = Visibility.Collapsed;
|
scrollViewer.ScrollToTop();
|
}
|
|
private void btnFinish_Click(object sender, RoutedEventArgs e)
|
{
|
stepBar.Next();
|
scrollViewer.ScrollToTop();
|
}
|
|
private void btnDownloadTemplate_Click(object sender, RoutedEventArgs e)
|
{
|
//弹出保存对话框
|
try
|
{
|
string fileDir = string.Empty;
|
SaveFileDialog dlg = new SaveFileDialog();
|
dlg.Title = "另存为";
|
dlg.FileName = $"{DateTime.Now.ToString("yyyyMMddHHmmss")}.csv"; // Default file name
|
dlg.DefaultExt = ".xls"; // Default file extension
|
dlg.Filter = "excel files(*.xls)|*.xls|csv files(*.csv)|*.csv";// Filter files by extension
|
dlg.InitialDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
|
|
if (dlg.ShowDialog() == true)
|
{
|
string directoryBase = System.AppDomain.CurrentDomain.BaseDirectory;
|
string sourceFilePath = directoryBase + "TempData\\movecutgumHX.csv";
|
File.Copy(sourceFilePath, dlg.FileName, true);
|
ShowTip.ShowNotice(string.Format("{0}成功{1}{2}", "下载保存", Environment.NewLine, dlg.FileName), InfoType.Warning);
|
}
|
}
|
catch (Exception ex)
|
{
|
ShowTip.ShowNotice(string.Format("{0}失败{1}{2}", "下载保存", Environment.NewLine, ""), InfoType.Warning);
|
LoggerHelper.ErrorLog("btnDownloadTemplate_Click ERROR:", ex);
|
}
|
}
|
|
private void cbChangeTip_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
try
|
{
|
if (cbChangeTip.SelectedIndex == -1)
|
return;
|
TransferFileHeader transferFileHeader = cbChangeTip.SelectedItem as TransferFileHeader;
|
if (methodElectroFile != null)
|
{
|
methodElectroFile.tipSet = transferFileHeader.header_name.ToString();
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("cbChangeTip_SelectionChanged ERROR:", ex);
|
}
|
}
|
|
private void tbxCommandComment_TextChanged(object sender, TextChangedEventArgs e)
|
{
|
try
|
{
|
if (methodElectroFile != null)
|
{
|
if (this.method != null)
|
{
|
this.method.method_Tipcontent = tbxCommandComment.Text;
|
}
|
methodElectroFile.comment = tbxCommandComment.Text;
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("tbxCommandComment_TextChanged ERROR:", ex);
|
}
|
}
|
}
|
}
|