diff --git a/Sln.Wcs.UI/Controls/CustomMessageBox.xaml b/Sln.Wcs.UI/Controls/CustomMessageBox.xaml
new file mode 100644
index 0000000..536a371
--- /dev/null
+++ b/Sln.Wcs.UI/Controls/CustomMessageBox.xaml
@@ -0,0 +1,166 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sln.Wcs.UI/Controls/CustomMessageBox.xaml.cs b/Sln.Wcs.UI/Controls/CustomMessageBox.xaml.cs
new file mode 100644
index 0000000..7c706b4
--- /dev/null
+++ b/Sln.Wcs.UI/Controls/CustomMessageBox.xaml.cs
@@ -0,0 +1,109 @@
+using System.Windows;
+
+namespace Sln.Wcs.UI.Controls
+{
+ public partial class CustomMessageBox : Window
+ {
+ public MessageBoxResult Result { get; private set; } = MessageBoxResult.None;
+
+ public CustomMessageBox()
+ {
+ InitializeComponent();
+ }
+
+ public static MessageBoxResult Show(string message, string title = "提示", MessageBoxButton button = MessageBoxButton.OK)
+ {
+ var window = new CustomMessageBox
+ {
+ TxtMessage = { Text = message },
+ Title = title,
+ TxtTitle = { Text = title }
+ };
+
+ if (button == MessageBoxButton.OK)
+ {
+ window.PanelOneButton.Visibility = Visibility.Visible;
+ window.PanelTwoButtons.Visibility = Visibility.Collapsed;
+ window.TxtIcon.Text = "✓";
+ window.TxtIcon.Foreground = new System.Windows.Media.SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#4CAF50"));
+ }
+ else if (button == MessageBoxButton.YesNo)
+ {
+ window.PanelOneButton.Visibility = Visibility.Collapsed;
+ window.PanelTwoButtons.Visibility = Visibility.Visible;
+ window.TxtIcon.Text = "?";
+ window.TxtIcon.Foreground = new System.Windows.Media.SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#FFC107"));
+ }
+
+ window.ShowDialog();
+ return window.Result;
+ }
+
+ public static void ShowSuccess(string message, Window owner = null)
+ {
+ var window = new CustomMessageBox
+ {
+ TxtMessage = { Text = message },
+ Title = "提示",
+ TxtTitle = { Text = "提示" },
+ PanelOneButton = { Visibility = Visibility.Visible },
+ PanelTwoButtons = { Visibility = Visibility.Collapsed }
+ };
+ window.TxtIcon.Text = "✓";
+ window.TxtIcon.Foreground = new System.Windows.Media.SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#4CAF50"));
+
+ if (owner != null)
+ {
+ window.Owner = owner;
+ }
+
+ window.ShowDialog();
+ }
+
+ public static MessageBoxResult ShowConfirm(string message, Window owner = null)
+ {
+ var window = new CustomMessageBox
+ {
+ TxtMessage = { Text = message },
+ Title = "确认",
+ TxtTitle = { Text = "确认" },
+ PanelOneButton = { Visibility = Visibility.Collapsed },
+ PanelTwoButtons = { Visibility = Visibility.Visible }
+ };
+ window.TxtIcon.Text = "?";
+ window.TxtIcon.Foreground = new System.Windows.Media.SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#FFC107"));
+
+ if (owner != null)
+ {
+ window.Owner = owner;
+ }
+
+ window.ShowDialog();
+ return window.Result;
+ }
+
+ private void BtnOk_Click(object sender, RoutedEventArgs e)
+ {
+ Result = MessageBoxResult.OK;
+ Close();
+ }
+
+ private void BtnYes_Click(object sender, RoutedEventArgs e)
+ {
+ Result = MessageBoxResult.Yes;
+ Close();
+ }
+
+ private void BtnNo_Click(object sender, RoutedEventArgs e)
+ {
+ Result = MessageBoxResult.No;
+ Close();
+ }
+
+ private void BtnClose_Click(object sender, RoutedEventArgs e)
+ {
+ Result = MessageBoxResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/Sln.Wcs.UI/MainWindow.xaml b/Sln.Wcs.UI/MainWindow.xaml
index 9e7ab56..99016c1 100644
--- a/Sln.Wcs.UI/MainWindow.xaml
+++ b/Sln.Wcs.UI/MainWindow.xaml
@@ -1,12 +1,196 @@
-
-
-
+ Title="WCS调度平台"
+ Height="868" Width="1424"
+ ResizeMode="NoResize"
+ WindowStartupLocation="CenterScreen">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sln.Wcs.UI/MainWindow.xaml.cs b/Sln.Wcs.UI/MainWindow.xaml.cs
index 3a37b71..96bebae 100644
--- a/Sln.Wcs.UI/MainWindow.xaml.cs
+++ b/Sln.Wcs.UI/MainWindow.xaml.cs
@@ -1,14 +1,10 @@
-using Sln.Wcs.UI.Attribute;
-using System.Text;
+using Sln.Wcs.UI.Attribute;
+using Sln.Wcs.UI.Page.BasicInfo;
+using Sln.Wcs.UI.Page.BasicInfo.DeviceInfo;
+using Sln.Wcs.UI.Page.Home;
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 System.Windows.Controls.Primitives;
+using System.Windows.Media.Animation;
namespace Sln.Wcs.UI
{
@@ -19,9 +15,97 @@ namespace Sln.Wcs.UI
[RegisterAsSingletonAttribute]
public partial class MainWindow : Window
{
+ private HomePage _homePage;
+ private BasicInfoPage _basicInfoPage;
+ private DeviceInfoPage _deviceInfoPage;
+
public MainWindow()
{
InitializeComponent();
+ _homePage = new HomePage();
+ _basicInfoPage = new BasicInfoPage();
+ _deviceInfoPage = new DeviceInfoPage();
+ MainContent.Content = _homePage;
+
+ BtnBasicInfo.Checked += BtnBasicInfo_Checked;
+ BtnBasicInfo.Unchecked += BtnBasicInfo_Unchecked;
+ }
+
+ private void BtnHome_Click(object sender, RoutedEventArgs e)
+ {
+ MainContent.Content = _homePage;
+ }
+
+ private void BtnBasicInfo_Click(object sender, RoutedEventArgs e)
+ {
+ MainContent.Content = _basicInfoPage;
+ }
+
+ private void BtnBasicInfo_Checked(object sender, RoutedEventArgs e)
+ {
+ DropPanelPopup.IsOpen = true;
+ ShowDropPanel();
+ }
+
+ private void BtnBasicInfo_Unchecked(object sender, RoutedEventArgs e)
+ {
+ HideDropPanel(() => DropPanelPopup.IsOpen = false);
+ }
+
+ private void DropPanel_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
+ {
+ BtnBasicInfo.IsChecked = false;
+ }
+
+ private void ShowDropPanel()
+ {
+ var fadeIn = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(200)) { EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut } };
+ var slideIn = new DoubleAnimation(-15, 0, TimeSpan.FromMilliseconds(250)) { EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut } };
+
+ DropPanel.BeginAnimation(OpacityProperty, fadeIn);
+ DropPanel.RenderTransform = new System.Windows.Media.TranslateTransform(0, -15);
+ DropPanel.RenderTransform.BeginAnimation(System.Windows.Media.TranslateTransform.YProperty, slideIn);
+ }
+
+ private void HideDropPanel(Action onComplete)
+ {
+ var fadeOut = new DoubleAnimation(1, 0, TimeSpan.FromMilliseconds(150)) { EasingFunction = new CubicEase { EasingMode = EasingMode.EaseIn } };
+ var slideOut = new DoubleAnimation(0, -15, TimeSpan.FromMilliseconds(150)) { EasingFunction = new CubicEase { EasingMode = EasingMode.EaseIn } };
+
+ fadeOut.Completed += (s, e) => onComplete?.Invoke();
+
+ DropPanel.BeginAnimation(OpacityProperty, fadeOut);
+ DropPanel.RenderTransform = new System.Windows.Media.TranslateTransform(0, 0);
+ DropPanel.RenderTransform.BeginAnimation(System.Windows.Media.TranslateTransform.YProperty, slideOut);
+ }
+
+ private void BtnDeviceInfo_Click(object sender, RoutedEventArgs e)
+ {
+ BtnBasicInfo.IsChecked = false;
+ MainContent.Content = _deviceInfoPage;
+ }
+
+ private void BtnMaterialInfo_Click(object sender, RoutedEventArgs e)
+ {
+ BtnBasicInfo.IsChecked = false;
+ MainContent.Content = _basicInfoPage;
+ }
+
+ private void BtnWarehouseInfo_Click(object sender, RoutedEventArgs e)
+ {
+ BtnBasicInfo.IsChecked = false;
+ MainContent.Content = _basicInfoPage;
+ }
+
+ private void BtnLocationInfo_Click(object sender, RoutedEventArgs e)
+ {
+ BtnBasicInfo.IsChecked = false;
+ MainContent.Content = _basicInfoPage;
+ }
+
+ private void BtnExit_Click(object sender, RoutedEventArgs e)
+ {
+ Application.Current.Shutdown();
}
}
}
\ No newline at end of file
diff --git a/Sln.Wcs.UI/Page/BasicInfo/BasicInfoPage.xaml b/Sln.Wcs.UI/Page/BasicInfo/BasicInfoPage.xaml
new file mode 100644
index 0000000..8d18cdc
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/BasicInfoPage.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/Sln.Wcs.UI/Page/BasicInfo/BasicInfoPage.xaml.cs b/Sln.Wcs.UI/Page/BasicInfo/BasicInfoPage.xaml.cs
new file mode 100644
index 0000000..ad8ac93
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/BasicInfoPage.xaml.cs
@@ -0,0 +1,12 @@
+using System.Windows.Controls;
+
+namespace Sln.Wcs.UI.Page.BasicInfo
+{
+ public partial class BasicInfoPage : UserControl
+ {
+ public BasicInfoPage()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceAddWindow.xaml b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceAddWindow.xaml
new file mode 100644
index 0000000..48637ab
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceAddWindow.xaml
@@ -0,0 +1,349 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceAddWindow.xaml.cs b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceAddWindow.xaml.cs
new file mode 100644
index 0000000..e54405f
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceAddWindow.xaml.cs
@@ -0,0 +1,91 @@
+using Microsoft.Extensions.DependencyInjection;
+using Sln.Wcs.Model.Domain;
+using Sln.Wcs.Repository.service;
+using Sln.Wcs.UI.Controls;
+using System;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Sln.Wcs.UI.Page.BasicInfo.DeviceInfo
+{
+ public partial class DeviceAddWindow : Window
+ {
+ private readonly IBaseDeviceInfoService _deviceInfoService;
+ private readonly DeviceInfoPage _parentPage;
+
+ public DeviceAddWindow(DeviceInfoPage parentPage)
+ {
+ InitializeComponent();
+ _deviceInfoService = App.ServiceProvider.GetService();
+ _parentPage = parentPage;
+ }
+
+ private void BtnConfirm_Click(object sender, RoutedEventArgs e)
+ {
+ if (string.IsNullOrWhiteSpace(TxtDeviceCode.Text))
+ {
+ CustomMessageBox.Show("请输入设备编号", "提示", MessageBoxButton.OK);
+ return;
+ }
+
+ if (string.IsNullOrWhiteSpace(TxtDeviceName.Text))
+ {
+ CustomMessageBox.Show("请输入设备名称", "提示", MessageBoxButton.OK);
+ return;
+ }
+
+ var deviceTypeItem = CmbDeviceType.SelectedItem as ComboBoxItem;
+ var deviceStatusItem = CmbDeviceStatus.SelectedItem as ComboBoxItem;
+ var isFlagItem = CmbIsFlag.SelectedItem as ComboBoxItem;
+
+ var device = new BaseDeviceInfo
+ {
+ deviceCode = TxtDeviceCode.Text.Trim(),
+ deviceName = TxtDeviceName.Text.Trim(),
+ deviceType = deviceTypeItem?.Tag != null ? int.Parse(deviceTypeItem.Tag.ToString()) : null,
+ deviceStatus = deviceStatusItem?.Tag != null ? int.Parse(deviceStatusItem.Tag.ToString()) : null,
+ isFlag = isFlagItem?.Tag != null ? int.Parse(isFlagItem.Tag.ToString()) : null,
+ remark = TxtRemark.Text?.Trim(),
+ createdTime = DateTime.Now
+ };
+
+ var success = _deviceInfoService.Insert(device);
+ if (success)
+ {
+ CustomMessageBox.Show("添加成功", "提示", MessageBoxButton.OK);
+ CloseAndRefresh();
+ }
+ else
+ {
+ CustomMessageBox.Show("添加失败", "错误", MessageBoxButton.OK);
+ }
+ }
+
+ private void BtnCancel_Click(object sender, RoutedEventArgs e)
+ {
+ CloseAndRefresh();
+ }
+
+ private void BtnClose_Click(object sender, RoutedEventArgs e)
+ {
+ CloseAndRefresh();
+ }
+
+ private void CloseAndRefresh()
+ {
+ ClearForm();
+ _parentPage.LoadData();
+ Close();
+ }
+
+ private void ClearForm()
+ {
+ TxtDeviceCode.Text = "";
+ TxtDeviceName.Text = "";
+ TxtRemark.Text = "";
+ CmbDeviceType.SelectedIndex = 0;
+ CmbDeviceStatus.SelectedIndex = 0;
+ CmbIsFlag.SelectedIndex = 0;
+ }
+ }
+}
diff --git a/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceEditWindow.xaml b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceEditWindow.xaml
new file mode 100644
index 0000000..da0d0b3
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceEditWindow.xaml
@@ -0,0 +1,349 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceEditWindow.xaml.cs b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceEditWindow.xaml.cs
new file mode 100644
index 0000000..6a6fef8
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceEditWindow.xaml.cs
@@ -0,0 +1,107 @@
+using Microsoft.Extensions.DependencyInjection;
+using Sln.Wcs.Model.Domain;
+using Sln.Wcs.Repository.service;
+using Sln.Wcs.UI.Controls;
+using System;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Sln.Wcs.UI.Page.BasicInfo.DeviceInfo
+{
+ public partial class DeviceEditWindow : Window
+ {
+ private readonly IBaseDeviceInfoService _deviceInfoService;
+ private readonly DeviceInfoPage _parentPage;
+ private readonly BaseDeviceInfo _device;
+
+ public DeviceEditWindow(DeviceInfoPage parentPage, BaseDeviceInfo device)
+ {
+ InitializeComponent();
+ _deviceInfoService = App.ServiceProvider.GetService();
+ _parentPage = parentPage;
+ _device = device;
+ LoadDeviceData();
+ }
+
+ private void LoadDeviceData()
+ {
+ TxtDeviceCode.Text = _device.deviceCode;
+ TxtDeviceName.Text = _device.deviceName;
+ TxtRemark.Text = _device.remark;
+
+ if (_device.deviceType.HasValue)
+ {
+ SelectComboBoxItem(CmbDeviceType, _device.deviceType.Value);
+ }
+
+ if (_device.deviceStatus.HasValue)
+ {
+ SelectComboBoxItem(CmbDeviceStatus, _device.deviceStatus.Value);
+ }
+
+ if (_device.isFlag.HasValue)
+ {
+ SelectComboBoxItem(CmbIsFlag, _device.isFlag.Value);
+ }
+ }
+
+ private void SelectComboBoxItem(ComboBox comboBox, int value)
+ {
+ foreach (ComboBoxItem item in comboBox.Items)
+ {
+ if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == value)
+ {
+ comboBox.SelectedItem = item;
+ break;
+ }
+ }
+ }
+
+ private void BtnConfirm_Click(object sender, RoutedEventArgs e)
+ {
+ if (string.IsNullOrWhiteSpace(TxtDeviceName.Text))
+ {
+ CustomMessageBox.Show("请输入设备名称", "提示", MessageBoxButton.OK);
+ return;
+ }
+
+ var deviceTypeItem = CmbDeviceType.SelectedItem as ComboBoxItem;
+ var deviceStatusItem = CmbDeviceStatus.SelectedItem as ComboBoxItem;
+ var isFlagItem = CmbIsFlag.SelectedItem as ComboBoxItem;
+
+ _device.deviceName = TxtDeviceName.Text.Trim();
+ _device.deviceType = deviceTypeItem?.Tag != null ? int.Parse(deviceTypeItem.Tag.ToString()) : null;
+ _device.deviceStatus = deviceStatusItem?.Tag != null ? int.Parse(deviceStatusItem.Tag.ToString()) : null;
+ _device.isFlag = isFlagItem?.Tag != null ? int.Parse(isFlagItem.Tag.ToString()) : null;
+ _device.remark = TxtRemark.Text?.Trim();
+ _device.updatedTime = DateTime.Now;
+
+ var success = _deviceInfoService.Update(_device);
+ if (success)
+ {
+ CustomMessageBox.Show("修改成功", "提示", MessageBoxButton.OK);
+ CloseAndRefresh();
+ }
+ else
+ {
+ CustomMessageBox.Show("修改失败", "错误", MessageBoxButton.OK);
+ }
+ }
+
+ private void BtnCancel_Click(object sender, RoutedEventArgs e)
+ {
+ CloseAndRefresh();
+ }
+
+ private void BtnClose_Click(object sender, RoutedEventArgs e)
+ {
+ CloseAndRefresh();
+ }
+
+ private void CloseAndRefresh()
+ {
+ _parentPage.LoadData();
+ Close();
+ }
+ }
+}
diff --git a/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml
new file mode 100644
index 0000000..1ad1c3d
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml
@@ -0,0 +1,384 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml.cs b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml.cs
new file mode 100644
index 0000000..a57c227
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml.cs
@@ -0,0 +1,117 @@
+using System.Globalization;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using Microsoft.Extensions.DependencyInjection;
+using Sln.Wcs.Model.Domain;
+using Sln.Wcs.Repository.service;
+using Sln.Wcs.UI.Controls;
+
+namespace Sln.Wcs.UI.Page.BasicInfo.DeviceInfo
+{
+ public partial class DeviceInfoPage : UserControl
+ {
+ private readonly IBaseDeviceInfoService _deviceInfoService;
+
+ public DeviceInfoPage()
+ {
+ InitializeComponent();
+ _deviceInfoService = App.ServiceProvider.GetService();
+ LoadData();
+ }
+
+ public void LoadData()
+ {
+ var list = _deviceInfoService.Query();
+ DeviceGrid.ItemsSource = list;
+ }
+
+ private void BtnQuery_Click(object sender, RoutedEventArgs e)
+ {
+ var code = TxtQueryCode.Text?.Trim();
+ var name = TxtQueryName.Text?.Trim();
+ var list = _deviceInfoService.Query()
+ .Where(d => string.IsNullOrEmpty(code) || d.deviceCode.Contains(code))
+ .Where(d => string.IsNullOrEmpty(name) || (d.deviceName != null && d.deviceName.Contains(name)))
+ .ToList();
+ DeviceGrid.ItemsSource = list;
+ }
+
+ private void BtnAdd_Click(object sender, RoutedEventArgs e)
+ {
+ var window = new DeviceAddWindow(this);
+ window.Owner = Window.GetWindow(this);
+ window.ShowDialog();
+ }
+
+ private void BtnEdit_Click(object sender, RoutedEventArgs e)
+ {
+ if (DeviceGrid.SelectedItem is BaseDeviceInfo device)
+ {
+ var window = new DeviceEditWindow(this, device);
+ window.Owner = Window.GetWindow(this);
+ window.ShowDialog();
+ }
+ }
+
+ private void BtnDelete_Click(object sender, RoutedEventArgs e)
+ {
+ if (DeviceGrid.SelectedItem is BaseDeviceInfo device)
+ {
+ var result = CustomMessageBox.Show($"确认删除设备: {device.deviceName}?", "删除确认", MessageBoxButton.YesNo);
+ if (result == MessageBoxResult.Yes)
+ {
+ var success = _deviceInfoService.Delete(device);
+ if (success)
+ {
+ CustomMessageBox.Show("删除成功", "提示", MessageBoxButton.OK);
+ LoadData();
+ }
+ else
+ {
+ CustomMessageBox.Show("删除失败", "错误", MessageBoxButton.OK);
+ }
+ }
+ }
+ }
+ }
+
+ public class DeviceTypeConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value switch
+ {
+ 0 => "输送线",
+ 1 => "AGV",
+ 2 => "提升机",
+ _ => "未知"
+ };
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class DeviceStatusConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value switch
+ {
+ 0 => "正常",
+ 1 => "在忙",
+ 2 => "异常",
+ _ => "未知"
+ };
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Sln.Wcs.UI/Page/Home/HomePage.xaml b/Sln.Wcs.UI/Page/Home/HomePage.xaml
new file mode 100644
index 0000000..128de12
--- /dev/null
+++ b/Sln.Wcs.UI/Page/Home/HomePage.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/Sln.Wcs.UI/Page/Home/HomePage.xaml.cs b/Sln.Wcs.UI/Page/Home/HomePage.xaml.cs
new file mode 100644
index 0000000..df9b29b
--- /dev/null
+++ b/Sln.Wcs.UI/Page/Home/HomePage.xaml.cs
@@ -0,0 +1,12 @@
+using System.Windows.Controls;
+
+namespace Sln.Wcs.UI.Page.Home
+{
+ public partial class HomePage : UserControl
+ {
+ public HomePage()
+ {
+ InitializeComponent();
+ }
+ }
+}