diff --git a/Aucma.Core.SheetMetal/App.xaml b/Aucma.Core.SheetMetal/App.xaml index 2b9c4bb5..38a88188 100644 --- a/Aucma.Core.SheetMetal/App.xaml +++ b/Aucma.Core.SheetMetal/App.xaml @@ -24,6 +24,11 @@ + + diff --git a/Aucma.Core.SheetMetal/Aucma.Core.SheetMetal.csproj.user b/Aucma.Core.SheetMetal/Aucma.Core.SheetMetal.csproj.user index 162e6793..f6ef3125 100644 --- a/Aucma.Core.SheetMetal/Aucma.Core.SheetMetal.csproj.user +++ b/Aucma.Core.SheetMetal/Aucma.Core.SheetMetal.csproj.user @@ -7,9 +7,21 @@ + + Code + Code + + Code + + + Code + + + Code + Code @@ -24,12 +36,24 @@ Designer + + Designer + Designer Designer + + Designer + + + Designer + + + Designer + Designer diff --git a/Aucma.Core.SheetMetal/Common/AppConfigHelper.cs b/Aucma.Core.SheetMetal/Common/AppConfigHelper.cs new file mode 100644 index 00000000..e2fa0b22 --- /dev/null +++ b/Aucma.Core.SheetMetal/Common/AppConfigHelper.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Aucma.Core.SheetMetal.Common +{ + public class AppConfigHelper + { + + private static IniHelper iniHelper = new IniHelper(System.Environment.CurrentDirectory + "/config/App.InI"); + + + //private static readonly AppConfigHelper lazy = new AppConfigHelper(); + //public static AppConfigHelper Instance + //{ + // get + // { + // return lazy; + // } + //} + + public AppConfigHelper() + { + } + + public string searchItems + { + get { return iniHelper.IniReadValue("system", "searchItems"); } + set { iniHelper.IniWriteValue("system", "searchItems", value); } + } + } +} diff --git a/Aucma.Core.SheetMetal/Common/IniHelper.cs b/Aucma.Core.SheetMetal/Common/IniHelper.cs new file mode 100644 index 00000000..43c71bdb --- /dev/null +++ b/Aucma.Core.SheetMetal/Common/IniHelper.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Aucma.Core.SheetMetal.Common +{ + public class IniHelper + { + public string path; + + public IniHelper(string INIPath) + { + path = INIPath; + } + + [DllImport("kernel32")] + private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); + + [DllImport("kernel32")] + private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); + + + [DllImport("kernel32")] + private static extern int GetPrivateProfileString(string section, string key, string defVal, Byte[] retVal, int size, string filePath); + + [DllImport("kernel32", EntryPoint = "GetPrivateProfileString")] + private static extern uint GetPrivateProfileStringA(string section, string key, string def, Byte[] retVal, int size, string filePath); + + /// + /// 写INI文件 + /// + /// + /// + /// + public void IniWriteValue(string Section, string Key, string Value) + { + + WritePrivateProfileString(Section, Key, Value, this.path); + } + + /// + /// 读取INI文件 + /// + /// + /// + /// + public string IniReadValue(string Section, string Key) + { + StringBuilder temp = new StringBuilder(255); + int i = GetPrivateProfileString(Section, Key, "", temp, 255, this.path); + //return temp.ToString(); + + string str = temp.ToString(); + + return str; + } + public byte[] IniReadValues(string section, string key) + { + byte[] temp = new byte[255]; + int i = GetPrivateProfileString(section, key, "", temp, 255, this.path); + return temp; + + } + + + /// + /// 删除ini文件下所有段落 + /// + public void ClearAllSection() + { + IniWriteValue(null, null, null); + } + /// + /// 删除ini文件下personal段落下的所有键 + /// + /// + public void ClearSection(string Section) + { + IniWriteValue(Section, null, null); + } + + public List ReadKeys(String SectionName) + { + return ReadKeys(SectionName, this.path); + } + + public List ReadKeys(string SectionName, string iniFilename) + { + List result = new List(); + Byte[] buf = new Byte[65536]; + uint len = GetPrivateProfileStringA(SectionName, null, null, buf, buf.Length, iniFilename); + int j = 0; + for (int i = 0; i < len; i++) + if (buf[i] == 0) + { + result.Add(Encoding.Default.GetString(buf, j, i - j)); + j = i + 1; + } + return result; + } + } +} diff --git a/Aucma.Core.SheetMetal/Common/WindowManager.cs b/Aucma.Core.SheetMetal/Common/WindowManager.cs deleted file mode 100644 index f89895d4..00000000 --- a/Aucma.Core.SheetMetal/Common/WindowManager.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Aucma.Core.SheetMetal.Common -{ - /// - /// 窗口管理器 - /// - public class WindowManager - { - static Dictionary _regWindowContainer = new Dictionary(); - - /// - /// 注册类型 - /// - /// - /// - /// - public static void Register(string name, System.Windows.Window owner = null) - { - if (!_regWindowContainer.ContainsKey(name)) - { - _regWindowContainer.Add(name, new WindowStruct { WindowType = typeof(T), Owner = owner }); - } - } - - /// - /// 获取对象 - /// - /// - /// - /// - /// - public static bool ShowDialog(string name, T dataContext) - { - if (_regWindowContainer.ContainsKey(name)) - { - Type type = _regWindowContainer[name].WindowType; - //反射创建窗体对象 - var window = (System.Windows.Window)Activator.CreateInstance(type); - window.Owner = _regWindowContainer[name].Owner; - window.DataContext = dataContext; - return window.ShowDialog() == true; - } - - return false; - } - } - public class WindowStruct - { - public Type WindowType { get; set; } - public System.Windows.Window Owner { get; set; } - } -} diff --git a/Aucma.Core.SheetMetal/Models/PlanMaintenanceModel.cs b/Aucma.Core.SheetMetal/Models/ProductPlanInfoModel.cs similarity index 98% rename from Aucma.Core.SheetMetal/Models/PlanMaintenanceModel.cs rename to Aucma.Core.SheetMetal/Models/ProductPlanInfoModel.cs index d3feda23..3ded20dc 100644 --- a/Aucma.Core.SheetMetal/Models/PlanMaintenanceModel.cs +++ b/Aucma.Core.SheetMetal/Models/ProductPlanInfoModel.cs @@ -9,7 +9,7 @@ namespace Aucma.Core.SheetMetal.Models /// /// 计划维护表 /// - public class PlanMaintenanceModel + public class ProductPlanInfoModel { /// /// 序号 diff --git a/Aucma.Core.SheetMetal/Models/TaskExecModel.cs b/Aucma.Core.SheetMetal/Models/TaskExecModel.cs index c372b27f..616dd2b1 100644 --- a/Aucma.Core.SheetMetal/Models/TaskExecModel.cs +++ b/Aucma.Core.SheetMetal/Models/TaskExecModel.cs @@ -6,8 +6,12 @@ using System.Threading.Tasks; namespace Aucma.Core.SheetMetal.Models { - public class TaskExecModel + public class TaskExecModel { + /// + /// 主键 + /// + public int No { get; set; } /// /// 主键 /// diff --git a/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs index 50c8ffb9..0be4a7ba 100644 --- a/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs +++ b/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs @@ -20,6 +20,7 @@ using Admin.Core.Model; using System.Windows.Media; using log4net; using Admin.Core.Common; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; /* * 首页信息 * @@ -126,9 +127,11 @@ namespace Aucma.Core.SheetMetal.ViewModels { var list= await _taskExecutionServices.QueryAsync(d=>d.ProductLineCode.Contains("1001")); var execList= list.OrderBy(d=>d.ExecuteOrder); + int i = 1; foreach (var item in execList) { TaskExecModel task=new TaskExecModel(); + task.No = i; task.ID = item.ObjId.ToString(); task.OrderCode = item.OrderCode; task.MaterialCode = item.MaterialCode; @@ -138,6 +141,7 @@ namespace Aucma.Core.SheetMetal.ViewModels task.BeginTime = item.BeginTime; task.IsExec = item.ExecuteStatus; PlanInfoDataGrid.Add(task); + i++; } } @@ -259,6 +263,18 @@ namespace Aucma.Core.SheetMetal.ViewModels } #endregion + #region 物料库存 + /// + /// 物料库存 + /// + [RelayCommand] + private void InventoryStatistics() + { + MaterialStatisticsView model = new MaterialStatisticsView(); + model.ShowDialog(); + } + #endregion + #endregion #region 执行计划 @@ -282,15 +298,15 @@ namespace Aucma.Core.SheetMetal.ViewModels #endregion #region 计划编号 - private string _planCode; - public string PlanCode + private string _mesMOrderCode; + public string MesMOrderCode { - get => _planCode; - set => SetProperty(ref _planCode, value); + get => _mesMOrderCode; + set => SetProperty(ref _mesMOrderCode, value); } #endregion - #region 产品型号 + #region 成品型号 private string _productModel; public string ProductModel { @@ -439,7 +455,7 @@ namespace Aucma.Core.SheetMetal.ViewModels { PlanMaxNum = info.PlanAmount; OrderCode = info.OrderCode; - PlanCode = info.ProductPlanCode; + MesMOrderCode = info.ProductPlanCode; ProductModel = info.MaterialName; BeginTime = info.BeginTime.ToString(); diff --git a/Aucma.Core.SheetMetal/ViewModels/InventoryStatisticsPageViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/InventoryStatisticsPageViewModel.cs new file mode 100644 index 00000000..7712c944 --- /dev/null +++ b/Aucma.Core.SheetMetal/ViewModels/InventoryStatisticsPageViewModel.cs @@ -0,0 +1,14 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Aucma.Core.SheetMetal.ViewModels +{ + public class InventoryStatisticsPageViewModel : ObservableObject + { + + } +} diff --git a/Aucma.Core.SheetMetal/ViewModels/MaterialStatisticsViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/MaterialStatisticsViewModel.cs new file mode 100644 index 00000000..a05e290b --- /dev/null +++ b/Aucma.Core.SheetMetal/ViewModels/MaterialStatisticsViewModel.cs @@ -0,0 +1,135 @@ +using Admin.Core.Common; +using Admin.Core.IService; +using Admin.Core.Model; +using Admin.Core.Service; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows; + +namespace Aucma.Core.SheetMetal.ViewModels +{ + public partial class MaterialStatisticsViewModel : ObservableObject + { + private readonly IBaseSpaceInfoServices _baseSpaceInfoServices; + + public MaterialStatisticsViewModel() + { + _baseSpaceInfoServices = App.ServiceProvider.GetService(); + Refresh(); + } + + #region 刷新 + [RelayCommand] + private async void Refresh() + { + string shellStoreCode = Appsettings.app("StoreInfo", "shellStoreCode"); + string linerStoreCode = Appsettings.app("StoreInfo", "linerStoreCode"); + string foamBeforeStoreCode = Appsettings.app("StoreInfo", "foamBeforeStoreCode"); + //箱壳物料库存 + ShellMaterialStockDataGrid = new ObservableCollection(); + List shellList =await _baseSpaceInfoServices.GetSpaceInfosByStoreCode(shellStoreCode); + shellList.OrderBy(x => x.ObjId); + var shellResult = from m in shellList + group m by m.MaterialType into g + select new BaseSpaceInfo() + { + MaterialType = g.Key, + SpaceStock = g.Sum(m => m.SpaceStock) + }; + foreach (var item in shellResult) + { + if (string.IsNullOrEmpty(item.MaterialType)) continue; + ShellMaterialStockDataGrid.Add(new BaseSpaceInfo() { MaterialType = item.MaterialType, SpaceStock = item.SpaceStock }); + } + + //内胆物料库存 + LinerMaterialStockDataGrid = new ObservableCollection(); + List linerList =await _baseSpaceInfoServices.GetSpaceInfosByStoreCode(linerStoreCode); + var linerResult = from m in linerList + group m by m.MaterialType into g + select new BaseSpaceInfo() + { + MaterialType = g.Key, + SpaceStock = g.Sum(m => m.SpaceStock) + }; + foreach (var item in linerResult) + { + if (string.IsNullOrEmpty(item.MaterialType)) continue; + LinerMaterialStockDataGrid.Add(new BaseSpaceInfo() { MaterialType = item.MaterialType, SpaceStock = item.SpaceStock }); + } + + //泡前库物料库存 + FoamBeforeMaterialStockDataGrid = new ObservableCollection(); + List foamBeforeList =await _baseSpaceInfoServices.GetSpaceInfosByStoreCode(foamBeforeStoreCode); + var foamBeforeResult = from m in foamBeforeList + group m by m.MaterialType into g + select new BaseSpaceInfo() + { + MaterialType = g.Key, + SpaceStock = g.Sum(m => m.SpaceStock) + }; + foreach (var item in foamBeforeResult) + { + if (string.IsNullOrEmpty(item.MaterialType)) continue; + FoamBeforeMaterialStockDataGrid.Add(new BaseSpaceInfo() { MaterialType = item.MaterialType, SpaceStock = item.SpaceStock }); + } + } + + #endregion + + #region 关闭窗口 + [RelayCommand] + private void CloseWindow(object parameter) + { + var window = parameter as Window; + if (window != null) + { + window.Close(); + } + + } + + + #endregion + + #region 参数定义 + /// + /// 箱壳物料库存DataGrid + /// + private ObservableCollection shellMaterialStockDataGrid; + + public ObservableCollection ShellMaterialStockDataGrid + { + get => shellMaterialStockDataGrid; + set => SetProperty(ref shellMaterialStockDataGrid, value); + + } + + /// + /// 内胆物料库存DataGrid + /// + private ObservableCollection linerMaterialStockDataGrid; + + public ObservableCollection LinerMaterialStockDataGrid + { + get => linerMaterialStockDataGrid; + set => SetProperty(ref linerMaterialStockDataGrid, value); + } + + /// + /// 泡前库物料库存DataGrid + /// + private ObservableCollection foamBeforeMaterialStockDataGrid; + + public ObservableCollection FoamBeforeMaterialStockDataGrid + { + get => foamBeforeMaterialStockDataGrid; + set => SetProperty(ref foamBeforeMaterialStockDataGrid, value); + } + #endregion + } +} diff --git a/Aucma.Core.SheetMetal/ViewModels/QuantityIssuedViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/QuantityIssuedViewModel.cs new file mode 100644 index 00000000..b4d08a81 --- /dev/null +++ b/Aucma.Core.SheetMetal/ViewModels/QuantityIssuedViewModel.cs @@ -0,0 +1,115 @@ +using Admin.Core.Model; +using Aucma.Core.SheetMetal.Models; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace Aucma.Core.SheetMetal.ViewModels +{ + public partial class QuantityIssuedViewModel : ObservableObject + { + public QuantityIssuedViewModel(ProductPlanInfoModel productPlanInfo) { + PlanInfo = productPlanInfo; + } + + private ProductPlanInfoModel _PlanInfo = new ProductPlanInfoModel(); + public ProductPlanInfoModel PlanInfo + { + get => _PlanInfo; + set => SetProperty(ref _PlanInfo, value); + } + private string _TransmitAmount = string.Empty; + public string TransmitAmount + { + get => _TransmitAmount; + set => SetProperty(ref _TransmitAmount, value); + } + + [RelayCommand] + private void PlanInfoTransmit() + { + var productPlanInfo = _PlanInfo; + + //if (productPlanInfo != null) + //{ + // var materialType = productPlanInfo.MaterialCode; + + // bool shellResult = assemblyPlanBusiness.JudgmentStock(productPlanInfo, Convert.ToInt32(_TransmitAmount), appConfig.shellMaterialType, appConfig.shellStoreCode); + // if (!shellResult) + // { + // MessageBox.Show("计划下达失败,箱壳物料库存不足", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); + // return; + // } + // bool linerResult = assemblyPlanBusiness.JudgmentStock(productPlanInfo, Convert.ToInt32(_TransmitAmount), appConfig.linerMaterialType, appConfig.linerStoreCode); + // if (!linerResult) + // { + // MessageBox.Show("计划下达失败,内胆物料库存不足", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); + // return; + // } + + //if (!shellResult && !linerResult) + //{ + // MessageBox.Show("计划下达失败,箱壳、内胆物料库存不足"); + // return; + //}else if(!shellResult || !linerResult) + //{ + // if (!shellResult) + // { + // MessageBox.Show("计划下达失败,箱壳物料库存不足"); + // return; + // } + // else if (!linerResult) + // { + // MessageBox.Show("计划下达失败,内胆物料库存不足"); + // return; + // } + //} + //} + //else + //{ + // MessageBox.Show("生产计划获取失败,加载为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); + // return; + //} + + //bool result = assemblyPlanBusiness.PlanTransmitByProductPlan(_PlanInfo.planCode, Convert.ToInt32(_TransmitAmount)); + //if (result) + //{ + // MessageBox.Show("执行计划维护成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); + //} + } + + [RelayCommand] + private void ClearTransmitAmount() + { + string amount = _TransmitAmount.ToString(); + if (amount.Length > 0) + { + TransmitAmount = amount.Substring(0, amount.Length - 1); + } + } + + [RelayCommand] + private void KeypadButton(object obj) + { + var info = obj as string; + + TransmitAmount += info; + } + + [RelayCommand] + private void CloseWindow(object parameter) + { + var window = parameter as Window; + if (window != null) + { + window.Close(); + } + } + + } +} diff --git a/Aucma.Core.SheetMetal/ViewModels/SearchCriteriaViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/SearchCriteriaViewModel.cs new file mode 100644 index 00000000..bfd1fb2d --- /dev/null +++ b/Aucma.Core.SheetMetal/ViewModels/SearchCriteriaViewModel.cs @@ -0,0 +1,77 @@ +using Aucma.Core.SheetMetal.Common; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace Aucma.Core.SheetMetal.ViewModels +{ + public partial class SearchCriteriaViewModel : ObservableObject + { + private AppConfigHelper appConfig =new AppConfigHelper(); + public SearchCriteriaViewModel() + { + + } + + #region 关闭当前页 + [RelayCommand] + private void CloseWindow(object parameter) + { + var window = parameter as Window; + if (window != null) + { + window.Close(); + } + } + #endregion + + #region 保存数据 + [RelayCommand] + private void SaveSearchCriteria() + { + var info = _configurations.ToList(); + string items = string.Empty; + foreach (var configuration in info) + { + items += configuration.ToString() + "%"; + } + appConfig.searchItems = string.Empty; + appConfig.searchItems = items; + + Init(); + } + + #endregion + + #region MyRegion + private ObservableCollection _configurations = new ObservableCollection(); + public ObservableCollection Configurations + { + get => _configurations; + set => SetProperty(ref _configurations, value); + } + #endregion + + #region 初始化 + private void Init() + { + Configurations = new ObservableCollection(); + + var searchItems = appConfig.searchItems; + + var split = searchItems.Split('%'); + + foreach (var item in split) + { + Configurations.Add(item); + } + } + #endregion + } +} diff --git a/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs index 0030a898..fd19be5d 100644 --- a/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs +++ b/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs @@ -18,6 +18,9 @@ using Admin.Core.Model.Model_New; using Admin.Core.Common; using CommunityToolkit.Mvvm.Messaging; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; +using MaterialDesignColors; +using Aucma.Core.SheetMetal.Views; +using Aucma.Core.SheetMetal.Common; namespace Aucma.Core.SheetMetal.ViewModels { @@ -27,6 +30,7 @@ namespace Aucma.Core.SheetMetal.ViewModels protected readonly IProductPlanInfoServices? _productPlanInfoServices; //protected readonly ISmTaskExecutionServices? _smTaskExecutionServices; protected readonly IExecutePlanInfoServices? _executePlanInfoServices; + private AppConfigHelper appConfig = new AppConfigHelper(); public SplitPlanViewModel() { @@ -48,7 +52,7 @@ namespace Aucma.Core.SheetMetal.ViewModels int residue = 0; if (execList == null) residue = 0; else residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount); - MaterialDataGrid.Add(new PlanMaintenanceModel() + MaterialDataGrid.Add(new ProductPlanInfoModel() { No = i, PlanCode= item.PlanCode, @@ -75,7 +79,7 @@ namespace Aucma.Core.SheetMetal.ViewModels int residue = 0; if (execList == null) residue = 0; else residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount); - MaterialDataGrid.Add(new PlanMaintenanceModel() + MaterialDataGrid.Add(new ProductPlanInfoModel() { No = i, PlanCode = item.PlanCode, @@ -93,15 +97,11 @@ namespace Aucma.Core.SheetMetal.ViewModels #endregion #region 初始化datagrid - private ObservableCollection materialDataGrid = new ObservableCollection(); - public ObservableCollection MaterialDataGrid + private ObservableCollection materialDataGrid = new ObservableCollection(); + public ObservableCollection MaterialDataGrid { - get { return materialDataGrid; } - set - { - materialDataGrid = value; - OnPropertyChanged();//属性通知 - } + get => materialDataGrid; + set => SetProperty(ref materialDataGrid, value); } #endregion @@ -177,8 +177,8 @@ namespace Aucma.Core.SheetMetal.ViewModels #endregion #region 获取当前行数据 赋值到textbox - private PlanMaintenanceModel selectedCells; - public PlanMaintenanceModel SelectedCells + private ProductPlanInfoModel selectedCells; + public ProductPlanInfoModel SelectedCells { get { return selectedCells; } set @@ -196,7 +196,111 @@ namespace Aucma.Core.SheetMetal.ViewModels public void CloseWindow() { WeakReferenceMessenger.Default.Send("close"); - } + } + #endregion + + + #region 参数定义 + + private string _search = string.Empty; + public string Search + { + get => _search; + set => SetProperty(ref _search, value); + } + /// + /// 下拉框 + /// + public string _materialTypeCombox; + public string MaterialTypeCombox + { + get => _materialTypeCombox; + set => SetProperty(ref _materialTypeCombox, value); + } + + private ObservableCollection _configurations = new ObservableCollection(); + public ObservableCollection Configurations + { + get => _configurations; + set => SetProperty(ref _configurations, value); + } + + private ProductPlanInfoModel selectedDataItem; + public ProductPlanInfoModel SelectedDataItem + { + get => selectedDataItem; + set => SetProperty(ref selectedDataItem, value); + } + #endregion + + #region 重置 + /// + /// 重置 + /// + [RelayCommand] + public void Reset() + { + LoadData(); + + Search = string.Empty; + MaterialTypeCombox = string.Empty; + this.LoadData(); + } #endregion + + #region 搜索条件设置 + /// + /// 搜索条件设置 + /// + [RelayCommand] + public void SearchCriteriaSet() + { + SearchCriteriaView searchCriteriaWindow = new SearchCriteriaView(); + bool? dialogResult = searchCriteriaWindow.ShowDialog(); + if (dialogResult == false) // 用户点击了“取消”按钮或关闭窗口 + { + LoadData(); + } + } + #endregion + + private void SaveSearchCriteria() + { + var info = _configurations.ToList(); + string items = string.Empty; + foreach (var configuration in info) + { + items += configuration.ToString() + "%"; + } + appConfig.searchItems = string.Empty; + appConfig.searchItems = items; + + Init(); + } + + private void Init() + { + Configurations = new ObservableCollection(); + + var searchItems = appConfig.searchItems; + + var split = searchItems.Split('%'); + + foreach (var item in split) + { + Configurations.Add(item); + } + } + + public void MouseClick(object obj) + { + var info = SelectedDataItem as ProductPlanInfoModel; + if (info != null) + { + QuantityIssuedView quantityIssuedWindow = new QuantityIssuedView(info); + quantityIssuedWindow.ShowDialog(); + } + + } } } diff --git a/Aucma.Core.SheetMetal/ViewModels/StatisticsPageViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/StatisticsPageViewModel.cs index 35c83269..e15eee44 100644 --- a/Aucma.Core.SheetMetal/ViewModels/StatisticsPageViewModel.cs +++ b/Aucma.Core.SheetMetal/ViewModels/StatisticsPageViewModel.cs @@ -29,17 +29,20 @@ namespace Aucma.Core.SheetMetal.ViewModels private async void LoadData() { var list = (await _productPlanInfoServices.QueryAsync(d=>d.ProductLineCode=="1001")).Take(1000); + int i = 1; foreach (var item in list) { - MaterialDataGrid.Add(new MaterialComplateInfo() { - ProductPlanCode = item.PlanCode, + MaterialDataGrid.Add(new MaterialComplateInfo() { + No = i, + ProductPlanCode = item.PlanCode, MaterialCode = item.MaterialCode, MaterialName = item.MaterialName, - PlanAmount = item.PlanAmount, + PlanAmount = item.PlanAmount, CompleteAmount = item.CompleteAmount, BeginTime = item.BeginTime.ToString(), EndTime = item.EndTime.ToString(), - }); + }); + i++; } } diff --git a/Aucma.Core.SheetMetal/Views/IndexPage.xaml b/Aucma.Core.SheetMetal/Views/IndexPage.xaml index 40f0f5ce..1f4f37d6 100644 --- a/Aucma.Core.SheetMetal/Views/IndexPage.xaml +++ b/Aucma.Core.SheetMetal/Views/IndexPage.xaml @@ -5,12 +5,13 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:local="clr-namespace:Aucma.Core.SheetMetal.Views" - mc:Ignorable="d" + mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei" d:DesignHeight="800" - d:DesignWidth="1000" > + d:DesignWidth="1500" > @@ -49,9 +50,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -196,29 +122,29 @@ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -241,7 +167,7 @@ - + - + - + - + @@ -372,29 +298,27 @@ RowHeight="50" AutoGenerateColumns="False" RowHeaderWidth="0" GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False" - SelectionMode="Single" IsReadOnly="True" + SelectionMode="Single" IsReadOnly="True" Foreground="White"> + - - + + - +