diff --git a/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs b/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs
index 6b05787..04fd088 100644
--- a/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs
+++ b/Sln.Wcs.Model/Domain/BaseDeviceInfo.cs
@@ -1,4 +1,4 @@
-using SqlSugar;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -122,5 +122,11 @@ namespace Sln.Wcs.Model.Domain
///
[SugarColumn(ColumnName = "updated_time")]
public DateTime? updatedTime { get; set; }
+
+ ///
+ /// 序号(用于列表显示,不参与数据库操作)
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public int RowIndex { get; set; }
}
}
diff --git a/Sln.Wcs.Model/Domain/BaseMaterialInfo.cs b/Sln.Wcs.Model/Domain/BaseMaterialInfo.cs
index 286dcf2..8ebb37a 100644
--- a/Sln.Wcs.Model/Domain/BaseMaterialInfo.cs
+++ b/Sln.Wcs.Model/Domain/BaseMaterialInfo.cs
@@ -1,4 +1,4 @@
-using SqlSugar;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -138,5 +138,11 @@ namespace Sln.Wcs.Model.Domain
///
[SugarColumn(ColumnName = "updated_time")]
public DateTime? updatedTime { get; set; }
+
+ ///
+ /// 序号(用于列表显示,不参与数据库操作)
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public int RowIndex { get; set; }
}
}
diff --git a/Sln.Wcs.Model/Domain/BaseStoreInfo.cs b/Sln.Wcs.Model/Domain/BaseStoreInfo.cs
index 58e16e0..c7e49e5 100644
--- a/Sln.Wcs.Model/Domain/BaseStoreInfo.cs
+++ b/Sln.Wcs.Model/Domain/BaseStoreInfo.cs
@@ -1,4 +1,4 @@
-using SqlSugar;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -106,5 +106,11 @@ namespace Sln.Wcs.Model.Domain
///
[SugarColumn(ColumnName = "updated_time")]
public DateTime? updatedTime { get; set; }
+
+ ///
+ /// 序号(用于列表显示,不参与数据库操作)
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public int RowIndex { get; set; }
}
}
diff --git a/Sln.Wcs.UI/MainWindow.xaml.cs b/Sln.Wcs.UI/MainWindow.xaml.cs
index efc3f50..b828713 100644
--- a/Sln.Wcs.UI/MainWindow.xaml.cs
+++ b/Sln.Wcs.UI/MainWindow.xaml.cs
@@ -2,6 +2,7 @@ using Sln.Wcs.UI.Attribute;
using Sln.Wcs.UI.Page.BasicInfo;
using Sln.Wcs.UI.Page.BasicInfo.DeviceInfo;
using Sln.Wcs.UI.Page.BasicInfo.MaterialInfo;
+using Sln.Wcs.UI.Page.BasicInfo.StoreInfo;
using Sln.Wcs.UI.Page.Home;
using System.Windows;
using System.Windows.Controls.Primitives;
@@ -20,6 +21,7 @@ namespace Sln.Wcs.UI
private BasicInfoPage _basicInfoPage;
private DeviceInfoPage _deviceInfoPage;
private MaterialInfoPage _materialInfoPage;
+ private StoreInfoPage _storeInfoPage;
public MainWindow()
{
@@ -28,6 +30,7 @@ namespace Sln.Wcs.UI
_basicInfoPage = new BasicInfoPage();
_deviceInfoPage = new DeviceInfoPage();
_materialInfoPage = new MaterialInfoPage();
+ _storeInfoPage = new StoreInfoPage();
MainContent.Content = _homePage;
BtnBasicInfo.Checked += BtnBasicInfo_Checked;
@@ -97,7 +100,7 @@ namespace Sln.Wcs.UI
private void BtnWarehouseInfo_Click(object sender, RoutedEventArgs e)
{
BtnBasicInfo.IsChecked = false;
- MainContent.Content = _basicInfoPage;
+ MainContent.Content = _storeInfoPage;
}
private void BtnLocationInfo_Click(object sender, RoutedEventArgs e)
diff --git a/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml
index 1ad1c3d..43a34a8 100644
--- a/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml
+++ b/Sln.Wcs.UI/Page/BasicInfo/DeviceInfo/DeviceInfoPage.xaml
@@ -301,18 +301,27 @@
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/StoreInfoPage.xaml.cs b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/StoreInfoPage.xaml.cs
new file mode 100644
index 0000000..b84c861
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/StoreInfoPage.xaml.cs
@@ -0,0 +1,99 @@
+using Microsoft.Extensions.DependencyInjection;
+using Sln.Wcs.Model.Domain;
+using Sln.Wcs.Repository.service;
+using Sln.Wcs.UI.Controls;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+
+namespace Sln.Wcs.UI.Page.BasicInfo.StoreInfo
+{
+ public partial class StoreInfoPage : UserControl
+ {
+ private readonly IBaseStoreInfoService? _storeInfoService;
+
+ public StoreInfoPage()
+ {
+ InitializeComponent();
+ _storeInfoService = App.ServiceProvider.GetService();
+ LoadData();
+ }
+
+ public void LoadData()
+ {
+ if (_storeInfoService != null)
+ {
+ var list = _storeInfoService.Query();
+ for (int i = 0; i < list.Count; i++)
+ {
+ list[i].RowIndex = i + 1;
+ }
+ StoreDataGrid.ItemsSource = list;
+ }
+ }
+
+ private void StoreDataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
+ {
+ e.Row.Header = e.Row.GetIndex() + 1;
+ }
+
+ private void BtnQuery_Click(object sender, RoutedEventArgs e)
+ {
+ if (_storeInfoService == null) return;
+
+ var code = TxtQueryCode.Text?.Trim();
+ var name = TxtQueryName.Text?.Trim();
+ var list = _storeInfoService.Query()
+ .Where(m => string.IsNullOrEmpty(code) || (m.storeCode != null && m.storeCode.Contains(code)))
+ .Where(m => string.IsNullOrEmpty(name) || (m.storeName != null && m.storeName.Contains(name)))
+ .ToList();
+ for (int i = 0; i < list.Count; i++)
+ {
+ list[i].RowIndex = i + 1;
+ }
+ StoreDataGrid.ItemsSource = list;
+ }
+
+ private void BtnAdd_Click(object sender, RoutedEventArgs e)
+ {
+ var window = new Windows.StoreAddWindow(this);
+ window.Owner = Window.GetWindow(this);
+ window.ShowDialog();
+ }
+
+ private void BtnEdit_Click(object sender, RoutedEventArgs e)
+ {
+ if (StoreDataGrid.SelectedItem is BaseStoreInfo store)
+ {
+ var window = new Windows.StoreEditWindow(this, store);
+ window.Owner = Window.GetWindow(this);
+ window.ShowDialog();
+ }
+ }
+
+ private void BtnDelete_Click(object sender, RoutedEventArgs e)
+ {
+ if (_storeInfoService == null) return;
+
+ if (StoreDataGrid.SelectedItem is BaseStoreInfo store)
+ {
+ var result = CustomMessageBox.Show($"确认删除仓库: {store.storeName}?", "删除确认", MessageBoxButton.YesNo);
+ if (result == MessageBoxResult.Yes)
+ {
+ var success = _storeInfoService.Delete(store);
+ if (success)
+ {
+ CustomMessageBox.Show("删除成功", "提示", MessageBoxButton.OK);
+ LoadData();
+ }
+ else
+ {
+ CustomMessageBox.Show("删除失败", "错误", MessageBoxButton.OK);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreAddWindow.xaml b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreAddWindow.xaml
new file mode 100644
index 0000000..28acdc7
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreAddWindow.xaml
@@ -0,0 +1,311 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreAddWindow.xaml.cs b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreAddWindow.xaml.cs
new file mode 100644
index 0000000..6004594
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreAddWindow.xaml.cs
@@ -0,0 +1,93 @@
+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.StoreInfo.Windows
+{
+ public partial class StoreAddWindow : Window
+ {
+ private readonly IBaseStoreInfoService? _storeInfoService;
+ private readonly StoreInfoPage _parentPage;
+
+ public StoreAddWindow(StoreInfoPage parentPage)
+ {
+ InitializeComponent();
+ _storeInfoService = App.ServiceProvider.GetService();
+ _parentPage = parentPage;
+ }
+
+ private void BtnConfirm_Click(object sender, RoutedEventArgs e)
+ {
+ if (_storeInfoService == null) return;
+
+ if (string.IsNullOrWhiteSpace(TxtStoreCode.Text))
+ {
+ CustomMessageBox.Show("请输入仓库编号", "提示", MessageBoxButton.OK);
+ return;
+ }
+
+ if (string.IsNullOrWhiteSpace(TxtStoreName.Text))
+ {
+ CustomMessageBox.Show("请输入仓库名称", "提示", MessageBoxButton.OK);
+ return;
+ }
+
+ var isFlagItem = CmbIsFlag.SelectedItem as ComboBoxItem;
+ int? isFlag = null;
+ if (isFlagItem?.Tag != null && int.TryParse(isFlagItem.Tag.ToString(), out int flag))
+ {
+ isFlag = flag;
+ }
+
+ var store = new BaseStoreInfo
+ {
+ storeCode = TxtStoreCode.Text.Trim(),
+ storeName = TxtStoreName.Text.Trim(),
+ isFlag = isFlag,
+ remark = TxtRemark.Text?.Trim(),
+ createdTime = DateTime.Now,
+ createdBy = "Admin"
+ };
+
+ var success = _storeInfoService.Insert(store);
+ 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()
+ {
+ TxtStoreCode.Text = "";
+ TxtStoreName.Text = "";
+ TxtRemark.Text = "";
+ CmbIsFlag.SelectedIndex = 0;
+ }
+ }
+}
diff --git a/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreEditWindow.xaml b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreEditWindow.xaml
new file mode 100644
index 0000000..4bd864c
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreEditWindow.xaml
@@ -0,0 +1,311 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreEditWindow.xaml.cs b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreEditWindow.xaml.cs
new file mode 100644
index 0000000..6ca074d
--- /dev/null
+++ b/Sln.Wcs.UI/Page/BasicInfo/StoreInfo/Windows/StoreEditWindow.xaml.cs
@@ -0,0 +1,102 @@
+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.StoreInfo.Windows
+{
+ public partial class StoreEditWindow : Window
+ {
+ private readonly IBaseStoreInfoService? _storeInfoService;
+ private readonly StoreInfoPage _parentPage;
+ private readonly BaseStoreInfo _store;
+
+ public StoreEditWindow(StoreInfoPage parentPage, BaseStoreInfo store)
+ {
+ InitializeComponent();
+ _storeInfoService = App.ServiceProvider.GetService();
+ _parentPage = parentPage;
+ _store = store;
+
+ // 初始化表单数据
+ TxtStoreCode.Text = store.storeCode;
+ TxtStoreName.Text = store.storeName;
+ TxtRemark.Text = store.remark;
+
+ // 设置是否标识下拉框
+ if (store.isFlag.HasValue)
+ {
+ foreach (ComboBoxItem item in CmbIsFlag.Items)
+ {
+ if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == store.isFlag.Value)
+ {
+ item.IsSelected = true;
+ break;
+ }
+ }
+ }
+ }
+
+ private void BtnConfirm_Click(object sender, RoutedEventArgs e)
+ {
+ if (_storeInfoService == null) return;
+
+ if (string.IsNullOrWhiteSpace(TxtStoreCode.Text))
+ {
+ CustomMessageBox.Show("请输入仓库编号", "提示", MessageBoxButton.OK);
+ return;
+ }
+
+ if (string.IsNullOrWhiteSpace(TxtStoreName.Text))
+ {
+ CustomMessageBox.Show("请输入仓库名称", "提示", MessageBoxButton.OK);
+ return;
+ }
+
+ var isFlagItem = CmbIsFlag.SelectedItem as ComboBoxItem;
+ int? isFlag = null;
+ if (isFlagItem?.Tag != null && int.TryParse(isFlagItem.Tag.ToString(), out int flag))
+ {
+ isFlag = flag;
+ }
+
+ // 更新仓库信息
+ _store.storeCode = TxtStoreCode.Text.Trim();
+ _store.storeName = TxtStoreName.Text.Trim();
+ _store.isFlag = isFlag;
+ _store.remark = TxtRemark.Text?.Trim();
+ _store.updatedTime = DateTime.Now;
+ _store.updatedBy = "Admin";
+
+ var success = _storeInfoService.Update(_store);
+ 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();
+ }
+ }
+}