using MaterialTraceability.Entity.DTO;
using MaterialTraceabilityUI.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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;
namespace MaterialTraceabilityUI
{
///
/// secondPage.xaml 的交互逻辑
///
public partial class secondPage : UserControl, INotifyPropertyChanged
{
private UpMaterialRecord upMaterialRecordControl = new UpMaterialRecord();
private LogRecordControl logControl = new LogRecordControl();
private ReadRecordControl readRecordControl = new ReadRecordControl();
private MesRequestControl RequestControl = new MesRequestControl();
private DownMaterialRecord downMaterialRecord = new DownMaterialRecord();
private ShaftInfoControl shaftInfoControl = new ShaftInfoControl();
private SplitSfc splitSfc = new SplitSfc();
public secondPage()
{
InitializeComponent();
DataContext = this;
AppConfigDto appConfig = AppConfigDto.Instance;
if (appConfig.processId != "TB")
{
splitButton.Visibility = Visibility.Visible;
}
}
private void RadioButton_Checked(object sender, RoutedEventArgs e)
{
MessageBox.Show("生产报表");
}
///
/// 上料记录
///
///
///
private void UpMaterialRecord_Click(object sender, RoutedEventArgs e)
{
UserControl = upMaterialRecordControl;
}
///
/// 异常记录
///
///
///
private void AlarmRecord_Click(object sender, RoutedEventArgs e)
{
UserControl = logControl;
}
public UserControl _content;
public UserControl UserControl
{
get { return _content; }
set
{
_content = value;
OnPropertyChanged("UserControl");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
UserControl = shaftInfoControl;
}
private void ReadRecord_Click(object sender, RoutedEventArgs e)
{
UserControl = readRecordControl;
}
private void MesRecord_Click(object sender, RoutedEventArgs e)
{
UserControl = RequestControl;
}
private void DownMaterialRecord_Click(object sender, RoutedEventArgs e)
{
UserControl = downMaterialRecord;
}
private void ShaftInfo_Click(object sender, RoutedEventArgs e)
{
UserControl = shaftInfoControl;
}
private void Split_Click(object sender, RoutedEventArgs e)
{
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作,当前用户角色ID:{roleId}");
}
else
{
UserControl = splitSfc;
}
}
}
}