using DataEntity.Share;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Web.UI.WebControls;
|
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 XHandler.Class;
|
using XHandler.Class.DataEx;
|
using XImagingXhandler.XDAL;
|
|
namespace XHandler.View.Liquids
|
{
|
/// <summary>
|
/// DispenseParam.xaml 的交互逻辑
|
/// </summary>
|
public partial class DispenseParam : UserControl
|
{
|
public Liquid liquid { get; set; }
|
|
int nLiquidDetectLevelSelectedIndex = 0;
|
int nBlockDetectLevelSelectedIndex = 0;
|
int nDispensePositionSelectedIndex = 0;
|
int nKnockPositionSelectedIndex = 0;
|
public DispenseParam()
|
{
|
InitializeComponent();
|
List<string> sensitiveList = new List<string>();
|
sensitiveList.Add(SensitiveMode.None.ToString());
|
sensitiveList.Add(SensitiveMode.Low.ToString());
|
sensitiveList.Add(SensitiveMode.Middle.ToString());
|
sensitiveList.Add(SensitiveMode.High.ToString());
|
cbLiquidDetectLevel.ItemsSource = sensitiveList;
|
cbBlockDetectLevel.ItemsSource = sensitiveList;
|
|
List<string> aspiratePositionList = new List<string>();
|
aspiratePositionList.Add(MixPositionEnum.Liquid.ToString());
|
aspiratePositionList.Add(MixPositionEnum.Top.ToString());
|
aspiratePositionList.Add(MixPositionEnum.Bottom.ToString());
|
cbDispensePosition.ItemsSource = aspiratePositionList;
|
cbKnockPosition.ItemsSource = aspiratePositionList;
|
}
|
|
public DispenseParam(Liquid l)
|
{
|
InitializeComponent();
|
liquid = l;
|
|
List<string> sensitiveList = new List<string>();
|
sensitiveList.Add(SensitiveMode.None.ToString());
|
sensitiveList.Add(SensitiveMode.Low.ToString());
|
sensitiveList.Add(SensitiveMode.Middle.ToString());
|
sensitiveList.Add(SensitiveMode.High.ToString());
|
cbLiquidDetectLevel.ItemsSource = sensitiveList;
|
cbBlockDetectLevel.ItemsSource = sensitiveList;
|
|
List<string> aspiratePositionList = new List<string>();
|
aspiratePositionList.Add(MixPositionEnum.Liquid.ToString());
|
aspiratePositionList.Add(MixPositionEnum.Top.ToString());
|
aspiratePositionList.Add(MixPositionEnum.Bottom.ToString());
|
cbDispensePosition.ItemsSource = aspiratePositionList;
|
cbKnockPosition.ItemsSource = aspiratePositionList;
|
|
if (liquid == null)
|
return;
|
this.DataContext = liquid;
|
if (string.IsNullOrEmpty(liquid.dispense_sensibility))
|
nLiquidDetectLevelSelectedIndex = 0;
|
else
|
nLiquidDetectLevelSelectedIndex = Convert.ToInt16(liquid.dispense_sensibility);
|
if (string.IsNullOrEmpty(liquid.dispense_blocking_sensibility))
|
nBlockDetectLevelSelectedIndex = 0;
|
else
|
nBlockDetectLevelSelectedIndex = Convert.ToInt16(liquid.dispense_blocking_sensibility);
|
nDispensePositionSelectedIndex = liquid.dispense_position_type;
|
nKnockPositionSelectedIndex = liquid.dispense_knock_position_type;
|
}
|
|
public void SetLiquid(Liquid l)
|
{
|
liquid = l;
|
this.DataContext = liquid;
|
|
if (string.IsNullOrEmpty(liquid.dispense_sensibility))
|
nLiquidDetectLevelSelectedIndex = 0;
|
else
|
nLiquidDetectLevelSelectedIndex = Convert.ToInt16(liquid.dispense_sensibility);
|
if (string.IsNullOrEmpty(liquid.dispense_blocking_sensibility))
|
nBlockDetectLevelSelectedIndex = 0;
|
else
|
nBlockDetectLevelSelectedIndex = Convert.ToInt16(liquid.dispense_blocking_sensibility);
|
nDispensePositionSelectedIndex = liquid.dispense_position_type;
|
nKnockPositionSelectedIndex = liquid.dispense_knock_position_type;
|
|
cbDispensePosition.SelectedIndex = liquid.aspirate_position_type;
|
if (!string.IsNullOrEmpty(liquid.dispense_sensibility))
|
{
|
cbLiquidDetectLevel.SelectedIndex = Convert.ToInt32(liquid.dispense_sensibility);
|
cbBlockDetectLevel.SelectedIndex = Convert.ToInt32(liquid.dispense_blocking_sensibility);
|
}
|
|
if(liquid.dispense_is_knock_wall==1)
|
{
|
checkBoxIsKnock.IsChecked= true;
|
}
|
else
|
{
|
checkBoxIsKnock.IsChecked= false;
|
}
|
|
if (liquid.dispense_knock_direction == 4)
|
{
|
radiobuttonN.IsChecked = true;
|
}
|
else
|
{
|
radiobuttonN.IsChecked = false;
|
}
|
|
if (liquid.dispense_knock_direction == 3)
|
{
|
radiobuttonS.IsChecked = true;
|
}
|
else
|
{
|
radiobuttonS.IsChecked = false;
|
}
|
|
if (liquid.dispense_knock_direction == 2)
|
{
|
radiobuttonW.IsChecked = true;
|
}
|
else
|
{
|
radiobuttonW.IsChecked = false;
|
}
|
|
if (liquid.dispense_knock_direction == 1)
|
{
|
radiobuttonE.IsChecked = true;
|
}
|
else
|
{
|
radiobuttonE.IsChecked = false;
|
}
|
|
cbKnockPosition.SelectedIndex=liquid.dispense_knock_position_type;
|
}
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
{
|
if (Shared.SoftwareInformation.software_device_number.Equals(DeviceCategory.DeviceHXELEC))
|
{
|
HiddenOnElectroSys();
|
}
|
else
|
{
|
DisplayToOthersSys();
|
}
|
cbLiquidDetectLevel.SelectedIndex = nLiquidDetectLevelSelectedIndex;
|
cbBlockDetectLevel.SelectedIndex = nBlockDetectLevelSelectedIndex;
|
cbDispensePosition.SelectedIndex = nDispensePositionSelectedIndex;
|
cbKnockPosition.SelectedIndex = nKnockPositionSelectedIndex;
|
|
if (liquid == null)
|
return;
|
|
if (liquid.dispense_is_knock_wall == 1)
|
checkBoxIsKnock.IsChecked = true;
|
else
|
checkBoxIsKnock.IsChecked = false;
|
if (liquid.dispense_knock_direction == (int)KnockDirection.North)
|
radiobuttonN.IsChecked = true;
|
else if (liquid.dispense_knock_direction == (int)KnockDirection.South)
|
radiobuttonS.IsChecked = true;
|
else if (liquid.dispense_knock_direction == (int)KnockDirection.West)
|
radiobuttonW.IsChecked = true;
|
else if (liquid.dispense_knock_direction == (int)KnockDirection.East)
|
radiobuttonE.IsChecked = true;
|
|
string userid = UserDB.GetUserInfByUserName(Shared.User.username).id;
|
//所有菜单
|
List<RoleMenu> roleMenuAllList = UserDB.GetWholeRoleMenuByUserId(userid);
|
//权限控制
|
var MenuLiquidManage = roleMenuAllList.FirstOrDefault(x => x.rolemenuname.Equals(MenuName.MenuLiquidManage));
|
if (MenuLiquidManage != null)
|
{
|
var MenuLiquidEdit = MenuLiquidManage.rolemenuchildren.FirstOrDefault(x => x.rolemenuname.Equals(MenuName.SubMenuEdit));
|
if (MenuLiquidEdit != null)
|
{
|
gdContent.IsEnabled = true;
|
}
|
else
|
{
|
gdContent.IsEnabled = false;
|
}
|
}
|
}
|
|
/// <summary>
|
/// 为切胶系统隐藏控件
|
/// </summary>
|
private void HiddenOnElectroSys()
|
{
|
imgGumLiquidMark.Visibility = Visibility.Hidden;
|
gdContent.RowDefinitions[4].Height = new GridLength(0);
|
gdContent.RowDefinitions[5].Height = new GridLength(0);
|
gdContent.RowDefinitions[6].Height = new GridLength(0);
|
gdContent.RowDefinitions[7].Height = new GridLength(0);
|
//gdContent.RowDefinitions[8].Height = new GridLength(0);
|
//gdContent.RowDefinitions[9].Height = new GridLength(0);
|
//gdContent.RowDefinitions[10].Height = new GridLength(0);
|
gdContent.RowDefinitions[11].Height = new GridLength(0);
|
gdContent.RowDefinitions[12].Height = new GridLength(0);
|
gdContent.RowDefinitions[13].Height = new GridLength(0);
|
gdContent.RowDefinitions[14].Height = new GridLength(0);
|
gdContent.RowDefinitions[15].Height = new GridLength(0);
|
gdContent.RowDefinitions[16].Height = new GridLength(0);
|
gdContent.RowDefinitions[17].Height = new GridLength(0);
|
gdContent.RowDefinitions[18].Height = new GridLength(0);
|
gdContent.RowDefinitions[19].Height = new GridLength(0);
|
gdContent.RowDefinitions[20].Height = new GridLength(0);
|
gdContent.RowDefinitions[21].Height = new GridLength(0);
|
gdContent.RowDefinitions[22].Height = new GridLength(0);
|
gdContent.RowDefinitions[23].Height = new GridLength(0);
|
gdContent.RowDefinitions[24].Height = new GridLength(0);
|
gdContent.RowDefinitions[25].Height = new GridLength(0);
|
gdContent.RowDefinitions[26].Height = new GridLength(0);
|
|
}
|
|
/// <summary>
|
/// 反显--切胶系统隐藏控件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void DisplayToOthersSys()
|
{
|
imgGumLiquidMark.Visibility = Visibility.Visible;
|
gdContent.RowDefinitions[4].Height = new GridLength(40);
|
gdContent.RowDefinitions[5].Height = new GridLength(40);
|
gdContent.RowDefinitions[6].Height = new GridLength(40);
|
gdContent.RowDefinitions[7].Height = new GridLength(40);
|
gdContent.RowDefinitions[8].Height = new GridLength(40);
|
gdContent.RowDefinitions[9].Height = new GridLength(40);
|
gdContent.RowDefinitions[10].Height = new GridLength(40);
|
gdContent.RowDefinitions[11].Height = new GridLength(40);
|
gdContent.RowDefinitions[12].Height = new GridLength(40);
|
gdContent.RowDefinitions[13].Height = new GridLength(300);
|
gdContent.RowDefinitions[14].Height = new GridLength(40);
|
gdContent.RowDefinitions[15].Height = new GridLength(40);
|
gdContent.RowDefinitions[16].Height = new GridLength(40);
|
gdContent.RowDefinitions[17].Height = new GridLength(40);
|
gdContent.RowDefinitions[18].Height = new GridLength(40);
|
gdContent.RowDefinitions[19].Height = new GridLength(40);
|
gdContent.RowDefinitions[20].Height = new GridLength(40);
|
gdContent.RowDefinitions[21].Height = new GridLength(40);
|
gdContent.RowDefinitions[22].Height = new GridLength(40);
|
gdContent.RowDefinitions[23].Height = new GridLength(40);
|
gdContent.RowDefinitions[24].Height = new GridLength(40);
|
gdContent.RowDefinitions[25].Height = new GridLength(40);
|
gdContent.RowDefinitions[26].Height = new GridLength(40);
|
}
|
|
private void cbDispensePosition_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_position_type = cbDispensePosition.SelectedIndex;
|
}
|
|
private void cbLiquidDetectLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_sensibility = cbLiquidDetectLevel.SelectedIndex.ToString();
|
}
|
|
private void cbBlockDetectLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_blocking_sensibility = cbBlockDetectLevel.SelectedIndex.ToString();
|
}
|
|
private void checkBoxIsKnock_Click(object sender, RoutedEventArgs e)
|
{
|
if((bool)checkBoxIsKnock.IsChecked)
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_is_knock_wall = 1;
|
}
|
else
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_is_knock_wall = 0;
|
}
|
}
|
|
private void radiobuttonN_Click(object sender, RoutedEventArgs e)
|
{
|
if((bool)radiobuttonN.IsChecked)
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_knock_direction = 4;
|
}
|
}
|
|
private void radiobuttonS_Click(object sender, RoutedEventArgs e)
|
{
|
if ((bool)radiobuttonS.IsChecked)
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_knock_direction = 3;
|
}
|
}
|
|
private void radiobuttonW_Click(object sender, RoutedEventArgs e)
|
{
|
if ((bool)radiobuttonW.IsChecked)
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_knock_direction = 2;
|
}
|
}
|
|
private void radiobuttonE_Click(object sender, RoutedEventArgs e)
|
{
|
if ((bool)radiobuttonE.IsChecked)
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_knock_direction = 1;
|
}
|
}
|
|
private void cbKnockPosition_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
{
|
if (liquid == null)
|
return;
|
liquid.dispense_knock_position_type = cbKnockPosition.SelectedIndex;
|
}
|
|
private void awblError_SizeChanged(object sender, SizeChangedEventArgs e)
|
{
|
awblError.Visibility = Visibility.Visible;
|
awxlError.Visibility = Visibility.Hidden;
|
awylError.Visibility = Visibility.Hidden;
|
}
|
|
private void awxlError_SizeChanged(object sender, SizeChangedEventArgs e)
|
{
|
awblError.Visibility = Visibility.Hidden;
|
awxlError.Visibility = Visibility.Visible;
|
awylError.Visibility = Visibility.Hidden;
|
}
|
|
private void awylError_SizeChanged(object sender, SizeChangedEventArgs e)
|
{
|
awblError.Visibility = Visibility.Hidden;
|
awxlError.Visibility = Visibility.Hidden;
|
awylError.Visibility = Visibility.Visible;
|
}
|
private void checkBoxIsKnock_Checked(object sender, RoutedEventArgs e)
|
{
|
if ((bool)checkBoxIsKnock.IsChecked)
|
{
|
radiobuttonN.IsEnabled = true;
|
radiobuttonS.IsEnabled = true;
|
radiobuttonW.IsEnabled = true;
|
radiobuttonE.IsEnabled = true;
|
tbdispense_knock_speed.IsEnabled = true;
|
tbdispense_knock_wall_delay.IsEnabled = true;
|
cbKnockPosition.IsEnabled = true;
|
tbknock_well_height.IsEnabled = true;
|
}
|
else
|
{
|
radiobuttonN.IsEnabled = false;
|
radiobuttonS.IsEnabled = false;
|
radiobuttonW.IsEnabled = false;
|
radiobuttonE.IsEnabled = false;
|
tbdispense_knock_speed.IsEnabled = false;
|
tbdispense_knock_wall_delay.IsEnabled = false;
|
cbKnockPosition.IsEnabled = false;
|
tbknock_well_height.IsEnabled = false;
|
}
|
}
|
}
|
}
|