From 92e9cfcec072b73a49b16f3edf26a01a62aafe73 Mon Sep 17 00:00:00 2001 From: wenjy Date: Thu, 11 Jan 2024 09:20:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?change=20-=20=E9=97=A8=E4=BD=93=E5=8F=91?= =?UTF-8?q?=E6=B3=A1PLC=E7=8A=B6=E6=80=81=EF=BC=8C=E8=80=81=E5=8F=91?= =?UTF-8?q?=E6=B3=A1=E5=B7=A5=E4=BD=8D=E7=BC=96=E5=8F=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Aucma.Core.DoorFoam/ViewModels/MainWindowViewModel.cs | 2 +- Aucma.Core.OldBoxFoam/appsettings.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Aucma.Core.DoorFoam/ViewModels/MainWindowViewModel.cs b/Aucma.Core.DoorFoam/ViewModels/MainWindowViewModel.cs index 6e4c3687..d980944c 100644 --- a/Aucma.Core.DoorFoam/ViewModels/MainWindowViewModel.cs +++ b/Aucma.Core.DoorFoam/ViewModels/MainWindowViewModel.cs @@ -81,7 +81,7 @@ namespace Aucma.Core.DoorFoam.ViewModels } else { - PlcState(false); + PlcState(true); } } /// diff --git a/Aucma.Core.OldBoxFoam/appsettings.json b/Aucma.Core.OldBoxFoam/appsettings.json index a6e1675e..d0651704 100644 --- a/Aucma.Core.OldBoxFoam/appsettings.json +++ b/Aucma.Core.OldBoxFoam/appsettings.json @@ -194,7 +194,7 @@ }, "StationInfo": { "ProductLineCode": "CX_01", - "StationCode": "1006" + "StationCode": "1105" }, "PLCServer": [ From 3a4369805019fffaf1b8c9aec89dee2de893b224 Mon Sep 17 00:00:00 2001 From: liuwf Date: Thu, 11 Jan 2024 13:52:17 +0800 Subject: [PATCH 2/3] =?UTF-8?q?change-=E6=96=B0=E5=8F=91=E6=B3=A1=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin.Core.Model/ViewModels/ChartsByTime.cs | 3 +- .../Business/CollectionFoamLine.cs | 7 +- Aucma.Core.BoxFoam/Models/SpaceInfoModel.cs | 4 + .../ViewModels/BeforeFoamingPageModelView.cs | 17 +++ .../ViewModels/SearchCriteriaViewModel.cs | 19 +++ .../ViewModels/SelectTypeViewModel.cs | 87 ++++++++++- .../ViewModels/SetBoxTypeViewModel.cs | 135 ++++++++++++++++++ .../ViewModels/SplitPlanViewModel.cs | 2 +- .../Views/SearchCriteriaView.xaml.cs | 9 +- .../Views/UserPage/BeforeFoamingPageView.xaml | 47 +++--- .../Views/UserPage/SelectType.xaml | 36 ++++- .../Views/UserPage/SelectType.xaml.cs | 9 +- .../Views/UserPage/SetBoxType.xaml | 110 ++++++++++++++ .../Views/UserPage/SetBoxType.xaml.cs | 38 +++++ .../Models/ChartsByTimeAmount.cs | 34 +++++ .../ViewModels/IndexPageViewModel.cs | 72 +++++++--- .../Views/IndexPageView.xaml | 2 +- .../ViewModels/SplitPlanViewModel.cs | 2 +- 18 files changed, 571 insertions(+), 62 deletions(-) create mode 100644 Aucma.Core.BoxFoam/ViewModels/SetBoxTypeViewModel.cs create mode 100644 Aucma.Core.BoxFoam/Views/UserPage/SetBoxType.xaml create mode 100644 Aucma.Core.BoxFoam/Views/UserPage/SetBoxType.xaml.cs create mode 100644 Aucma.Core.ProductOffLine/Models/ChartsByTimeAmount.cs diff --git a/Admin.Core.Model/ViewModels/ChartsByTime.cs b/Admin.Core.Model/ViewModels/ChartsByTime.cs index a02839b5..8db0e381 100644 --- a/Admin.Core.Model/ViewModels/ChartsByTime.cs +++ b/Admin.Core.Model/ViewModels/ChartsByTime.cs @@ -12,7 +12,8 @@ namespace Admin.Core.Model.ViewModels { [SugarColumn(ColumnName = "PRODUCTLINE_CODE")] public string productLineCode { get; set; } - + [SugarColumn(ColumnName = "PRODUCT_DATE")] + public string date { get; set; } [SugarColumn(ColumnName = "PRODUCT_HOUR")] public string hour { get; set; } [SugarColumn(ColumnName = "PRODUCT_AMOUNT")] diff --git a/Aucma.Core.BoxFoam/Business/CollectionFoamLine.cs b/Aucma.Core.BoxFoam/Business/CollectionFoamLine.cs index 085002dd..45348f88 100644 --- a/Aucma.Core.BoxFoam/Business/CollectionFoamLine.cs +++ b/Aucma.Core.BoxFoam/Business/CollectionFoamLine.cs @@ -64,8 +64,11 @@ namespace Aucma.Core.BoxFoam.Business var plc3 = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("泡前库Plc")); spaceDetailModel = ReadStoreTypeAndCount(plc3); - // 更新货道库存 - updateStoreAmount(spaceDetailModel); + if (spaceDetailModel.Count > 0) + { + // 更新货道库存 + updateStoreAmount(spaceDetailModel); + } // InitData(spaceDetailModel); //RefreshSpaceEvent?.Invoke(spaceDetailModel); diff --git a/Aucma.Core.BoxFoam/Models/SpaceInfoModel.cs b/Aucma.Core.BoxFoam/Models/SpaceInfoModel.cs index 571b9076..f166d8fe 100644 --- a/Aucma.Core.BoxFoam/Models/SpaceInfoModel.cs +++ b/Aucma.Core.BoxFoam/Models/SpaceInfoModel.cs @@ -74,6 +74,10 @@ namespace Aucma.Core.BoxFoam.Models /// public string? setEnable { get; set; } + /// + /// 夹具型号 + /// + public string? boxType { get; set; } } } diff --git a/Aucma.Core.BoxFoam/ViewModels/BeforeFoamingPageModelView.cs b/Aucma.Core.BoxFoam/ViewModels/BeforeFoamingPageModelView.cs index 509b9204..d4c92f46 100644 --- a/Aucma.Core.BoxFoam/ViewModels/BeforeFoamingPageModelView.cs +++ b/Aucma.Core.BoxFoam/ViewModels/BeforeFoamingPageModelView.cs @@ -33,8 +33,10 @@ namespace Aucma.Core.BoxFoam.ViewModels SubmitCommand = new RelayCommand(obj => SubmitCommandExecute(obj)); SubmitCommand2 = new RelayCommand(obj => SubmitCommandExecute2(obj)); SubmitCommand3 = new RelayCommand(obj => SubmitCommandExecute3(obj)); + SetBoxTypeCommand = new RelayCommand(obj => SetBoxTypeCommandExecute(obj)); _baseSpaceDetailServices = App.ServiceProvider.GetService(); _baseSpaceInfoServices = App.ServiceProvider.GetService(); + SetBoxTypeViewModel.RefreshPageEvent += LoadSpaceStoreMedthAsync; SelectTypeViewModel.RefreshPageEvent += LoadSpaceStoreMedthAsync; this.LoadSpaceStoreMedthAsync(); } @@ -71,6 +73,19 @@ namespace Aucma.Core.BoxFoam.ViewModels type.ShowDialog(); } + + /// + /// 设置夹具型号 + /// + public RelayCommand SetBoxTypeCommand { get; set; } + + private void SetBoxTypeCommandExecute(string spaceCode) + { + SetBoxType boxTypePage = new SetBoxType(spaceCode); + boxTypePage.ShowDialog(); + Console.WriteLine(spaceCode); + } + #endregion #region 加载泡前库货道信息 @@ -96,6 +111,8 @@ namespace Aucma.Core.BoxFoam.ViewModels model.typeCodeB = item.typeCodeB; model.typeCodeC = item.typeCodeC; model.unusualFlag = item.UnusualFlag == 2 ? "Red" : "White"; + // 夹具型号 + model.boxType = item.BoxType; if (item.SpaceStatus == 2) { model.setEnable = "False"; diff --git a/Aucma.Core.BoxFoam/ViewModels/SearchCriteriaViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/SearchCriteriaViewModel.cs index c326c581..4faf1f49 100644 --- a/Aucma.Core.BoxFoam/ViewModels/SearchCriteriaViewModel.cs +++ b/Aucma.Core.BoxFoam/ViewModels/SearchCriteriaViewModel.cs @@ -15,6 +15,21 @@ namespace Aucma.Core.BoxFoam.ViewModels public partial class SearchCriteriaViewModel : ObservableObject { private AppConfigHelper appConfig =new AppConfigHelper(); + + /// + /// 委托,关闭窗口 + /// + /// + public delegate void close(); + public event close closeEvent; + + /// + /// 刷新货道设置物料型号页面 + /// + /// + public delegate void RefreshPage(); + public static event RefreshPage RefreshPageEvent; + public SearchCriteriaViewModel() { Init(); @@ -74,6 +89,10 @@ namespace Aucma.Core.BoxFoam.ViewModels Configurations.Add(item); } WeakReferenceMessenger.Default.Send("RefreshSearchItems");//刷新窗口 + + // 关闭窗口 + closeEvent?.Invoke(); + RefreshPageEvent?.Invoke(); } #endregion } diff --git a/Aucma.Core.BoxFoam/ViewModels/SelectTypeViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/SelectTypeViewModel.cs index 233dfb50..79479066 100644 --- a/Aucma.Core.BoxFoam/ViewModels/SelectTypeViewModel.cs +++ b/Aucma.Core.BoxFoam/ViewModels/SelectTypeViewModel.cs @@ -2,8 +2,12 @@ using Admin.Core.IService; using Admin.Core.Model; using Admin.Core.Service; +using Aucma.Core.BoxFoam.Common; +using Aucma.Core.BoxFoam.Views; +using Aucma.Core.BoxFoam.Views.UserPage; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; using log4net; using Microsoft.Extensions.DependencyInjection; using Microsoft.IdentityModel.Logging; @@ -17,7 +21,7 @@ using System.Windows; namespace Aucma.Core.BoxFoam.ViewModels { - public class SelectTypeViewModel : ObservableObject + public partial class SelectTypeViewModel : ObservableObject { /// @@ -38,6 +42,9 @@ namespace Aucma.Core.BoxFoam.ViewModels public RelayCommand QueryCommand { get; set; } public RelayCommand deleteCommand { get; set; } public RelayCommand SaveCommand { get; set; } + + public RelayCommand SearchCriteriaSetCommand { get; set; } + private string storeCode = Appsettings.app("StoreInfo", "BeforeStoreCode");//泡前库code private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(BaseSpaceInfoServices)); @@ -50,6 +57,7 @@ namespace Aucma.Core.BoxFoam.ViewModels public RelayCommand MouseClickCommand { get; set; } private string spaceCodes = string.Empty; + private AppConfigHelper appConfig = new AppConfigHelper(); public SelectTypeViewModel() { @@ -62,10 +70,15 @@ namespace Aucma.Core.BoxFoam.ViewModels QueryCommand = new RelayCommand(searchData); SaveCommand = new RelayCommand(updateDirection); deleteCommand = new RelayCommand(deleteModel); - spaceCodes = spaceCode; + SearchCriteriaSetCommand = new RelayCommand(SearchCriteriaSet); + spaceCodes = spaceCode; MouseClickCommand = new RelayCommand(MouseClick); materialDataGrid = new ObservableCollection(); - Console.WriteLine(spaceCode); + SearchCriteriaViewModel.RefreshPageEvent += SaveSearchCriteria; + Console.WriteLine(spaceCode); + //加载快捷方式 + SaveSearchCriteria(); + Load(); if (ncount == 1) { @@ -80,6 +93,51 @@ namespace Aucma.Core.BoxFoam.ViewModels IsSelectedOptionC = true; } } + + #region 快捷查询 + /// + /// 快捷查询 + /// + /// + /// + [RelayCommand] + public async Task RadioButton(string selectedOption) + { + string productLineCode = Appsettings.app("StationInfo", "StationCode"); + MaterialDataGrid.Clear(); + string station = Appsettings.app("StationInfo", "StationCode"); + if (!string.IsNullOrEmpty(selectedOption)) + { + var infos = await _baseMaterialInfoServices.QueryAsync(x => x.MaterialSubclass == "200" && x.MaterialName.Contains(selectedOption)); + MaterialDataGrid.Clear(); + Application.Current.Dispatcher.Invoke(() => + { + foreach (BaseMaterialInfo info in infos) + { + MaterialDataGrid.Add(info); + } + }); + } + + } + + #endregion + private void SaveSearchCriteria() + { + Configurations = new ObservableCollection(); + var searchItems = appConfig.searchItems; + var split = searchItems.Split('%'); + + foreach (var item in split) + { + if (!string.IsNullOrEmpty(item)) + { + Configurations.Add(item); + } + } + } + + public async void Load() { var infos = await _baseMaterialInfoServices.QueryAsync(x=>x.MaterialSubclass=="200"); @@ -135,6 +193,23 @@ namespace Aucma.Core.BoxFoam.ViewModels set => SetProperty(ref searchText, value); } + private ObservableCollection _configurations = new ObservableCollection(); + public ObservableCollection Configurations + { + get => _configurations; + set => SetProperty(ref _configurations, value); + } + + + /// + /// 搜索条件设置 + /// + public void SearchCriteriaSet() + { + SearchCriteriaView searchCriteriaWindow = new SearchCriteriaView(); + searchCriteriaWindow.ShowDialog(); + } + #region 单选框 private bool _isSelectedOptionA; @@ -248,19 +323,19 @@ namespace Aucma.Core.BoxFoam.ViewModels { space.MaterialType = PlanInfo.MaterialCode; space.typeNameA = PlanInfo.MaterialName; - space.BoxType = SearchText; + // space.BoxType = SearchText; } else if (IsSelectedOptionB) { space.typeCodeB = PlanInfo.MaterialCode; space.typeNameB = PlanInfo.MaterialName; - space.BoxType = SearchText; + // space.BoxType = SearchText; } else if (IsSelectedOptionC) { space.typeCodeC = PlanInfo.MaterialCode; space.typeNameC = PlanInfo.MaterialName; - space.BoxType = SearchText; + // space.BoxType = SearchText; } bool result = await _baseSpaceInfoServices.UpdateSpaceInfo(space); if (result) diff --git a/Aucma.Core.BoxFoam/ViewModels/SetBoxTypeViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/SetBoxTypeViewModel.cs new file mode 100644 index 00000000..9d75d72b --- /dev/null +++ b/Aucma.Core.BoxFoam/ViewModels/SetBoxTypeViewModel.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 log4net; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.IdentityModel.Logging; +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.BoxFoam.ViewModels +{ + public class SetBoxTypeViewModel : ObservableObject + { + + /// + /// 委托,关闭窗口 + /// + /// + public delegate void close(); + public event close closeEvent; + + /// + /// 刷新货道页面 + /// + /// + public delegate void RefreshPage(); + public static event RefreshPage RefreshPageEvent; + + public RelayCommand deleteCommand { get; set; } + public RelayCommand SaveCommand { get; set; } + private string storeCode = Appsettings.app("StoreInfo", "BeforeStoreCode");//泡前库code + + private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(BaseSpaceInfoServices)); + + + + private readonly IBaseSpaceInfoServices _baseSpaceInfoServices; + + private string spaceCodes = string.Empty; + + public SetBoxTypeViewModel() + { + + } + + public SetBoxTypeViewModel(string spaceCode) + { + _baseSpaceInfoServices = App.ServiceProvider.GetService(); + SaveCommand = new RelayCommand(updateDirection); + deleteCommand = new RelayCommand(deleteModel); + + spaceCodes = spaceCode; + + Load(); + + } + + #region 参数定义 + + private string _spaceCode; + public string SpaceCode + { + get => _spaceCode; + set => SetProperty(ref _spaceCode, value); + } + private string _boxType; + public string BoxType + { + get => _boxType; + set => SetProperty(ref _boxType, value); + } + #endregion + + + public async void Load() + { + BaseSpaceInfo space = _baseSpaceInfoServices.FirstAsync(x=>x.SpaceCode.Equals(spaceCodes) && x.StoreCode.Equals(storeCode) ).Result; + _spaceCode = space.SpaceCode; + _boxType = space.BoxType; + + } + + + + private async void deleteModel() + { + BaseSpaceInfo space = _baseSpaceInfoServices.FirstAsync(x => x.SpaceCode.Equals(spaceCodes) && x.StoreCode.Equals(storeCode)).Result; + space.BoxType = string.Empty; + bool result = _baseSpaceInfoServices.UpdateAsync(space).Result; + if (result) + { + MessageBox.Show("清除夹具型号成功"); + } + + ////关闭窗口 + closeEvent?.Invoke(); + ////刷新界面 + RefreshPageEvent?.Invoke(); + } + /// + /// 设置型号 + /// + private async void updateDirection() + { + + if (_boxType==null ||_boxType.Length!=3) + { + MessageBox.Show("请输入三位夹具型号"); + return; + } + BaseSpaceInfo space = _baseSpaceInfoServices.FirstAsync(x => x.SpaceCode.Equals(spaceCodes) && x.StoreCode.Equals(storeCode)).Result; + space.BoxType = _boxType; + bool result = _baseSpaceInfoServices.UpdateAsync(space).Result; + if (result) + { + MessageBox.Show("夹具型号设置成功"); + } + + ////关闭窗口 + closeEvent?.Invoke(); + ////刷新界面 + RefreshPageEvent?.Invoke(); + } + + + } +} diff --git a/Aucma.Core.BoxFoam/ViewModels/SplitPlanViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/SplitPlanViewModel.cs index 4d309957..12bb2588 100644 --- a/Aucma.Core.BoxFoam/ViewModels/SplitPlanViewModel.cs +++ b/Aucma.Core.BoxFoam/ViewModels/SplitPlanViewModel.cs @@ -34,7 +34,7 @@ namespace Aucma.Core.BoxFoam.ViewModels _executePlanInfoServices = App.ServiceProvider.GetService(); Task.WaitAll(LoadData()); //加载快捷方式 - SaveSearchCriteria(); + SaveSearchCriteria(); WeakReferenceMessenger.Default.Register(this, SaveSearchCriteria); _objId = objId; } diff --git a/Aucma.Core.BoxFoam/Views/SearchCriteriaView.xaml.cs b/Aucma.Core.BoxFoam/Views/SearchCriteriaView.xaml.cs index ce4961d0..2e254ef3 100644 --- a/Aucma.Core.BoxFoam/Views/SearchCriteriaView.xaml.cs +++ b/Aucma.Core.BoxFoam/Views/SearchCriteriaView.xaml.cs @@ -10,8 +10,15 @@ namespace Aucma.Core.BoxFoam.Views { public SearchCriteriaView() { + SearchCriteriaViewModel viewModel =new SearchCriteriaViewModel(); InitializeComponent(); - this.DataContext = new SearchCriteriaViewModel(); + this.DataContext = viewModel; + viewModel.closeEvent += closeWindow; + } + + private void closeWindow() + { + this.Close(); } } } diff --git a/Aucma.Core.BoxFoam/Views/UserPage/BeforeFoamingPageView.xaml b/Aucma.Core.BoxFoam/Views/UserPage/BeforeFoamingPageView.xaml index c05a0511..9e5ea6c5 100644 --- a/Aucma.Core.BoxFoam/Views/UserPage/BeforeFoamingPageView.xaml +++ b/Aucma.Core.BoxFoam/Views/UserPage/BeforeFoamingPageView.xaml @@ -75,10 +75,10 @@ - + @@ -94,7 +94,7 @@ - + @@ -158,7 +158,7 @@ - @@ -166,7 +166,7 @@ - @@ -174,7 +174,7 @@ - @@ -188,33 +188,36 @@ - - - + + - + + - + - + - + + + @@ -229,7 +232,7 @@ - + + --> + --> diff --git a/Aucma.Core.BoxFoam/Views/UserPage/SelectType.xaml b/Aucma.Core.BoxFoam/Views/UserPage/SelectType.xaml index eaf00b86..c129607d 100644 --- a/Aucma.Core.BoxFoam/Views/UserPage/SelectType.xaml +++ b/Aucma.Core.BoxFoam/Views/UserPage/SelectType.xaml @@ -99,9 +99,41 @@ -