From 120922407aa114932f3447f881e9103d15c5cc8a Mon Sep 17 00:00:00 2001 From: liuwf Date: Wed, 6 Dec 2023 16:49:32 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E6=88=90=E5=93=81=E4=B8=8B?= =?UTF-8?q?=E7=BA=BF=E6=A0=B7=E5=BC=8F=EF=BC=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseQualityInspectionItemInfoServices.cs | 2 +- .../Views/StatisticsPageView.xaml | 6 +- .../Business/offLineBusiness.cs | 15 +- Aucma.Core.ProductOffLine/Models/TempInfo.cs | 5 + .../ViewModels/DirectionEditViewModel.cs | 35 +---- .../ViewModels/IndexPageViewModel.cs | 2 +- .../ViewModels/QualityPageViewModel.cs | 115 ++++++-------- .../ViewModels/SelectQualityViewModel.cs | 37 +---- .../Views/DirectionEditView.xaml | 128 ++++++++++++---- .../Views/DirectionEditView.xaml.cs | 3 +- .../Views/DirectionItemWindow.xaml | 2 +- .../Views/IndexPageView.xaml | 53 +++---- .../Views/MainWindow.xaml | 30 ++-- .../Views/QualityPageView.xaml | 83 ++++------ .../Views/QualityPageView.xaml.cs | 21 +-- .../Views/QualityWindow.xaml | 2 +- .../Views/SelectQualityView.xaml | 129 ++++++++++++---- .../Views/SelectQualityView.xaml.cs | 2 +- .../Views/StatisticsPageView.xaml | 142 ++++++++++-------- 19 files changed, 418 insertions(+), 394 deletions(-) diff --git a/Admin.Core.Service/Service_New/BaseQualityInspectionItemInfoServices.cs b/Admin.Core.Service/Service_New/BaseQualityInspectionItemInfoServices.cs index e804475c..f3c50f79 100644 --- a/Admin.Core.Service/Service_New/BaseQualityInspectionItemInfoServices.cs +++ b/Admin.Core.Service/Service_New/BaseQualityInspectionItemInfoServices.cs @@ -34,7 +34,7 @@ namespace Admin.Core.Service /// public async Task> query() { - List list = await _baseQualityInspectionItemInfoRepository.QueryAsync(x => x.ParentId == "0" && x.IsFlag == 0); + List list = await _baseQualityInspectionItemInfoRepository.QueryAsync(x => x.IsFlag == 0); return list; } diff --git a/Aucma.Core.CodeBinding/Views/StatisticsPageView.xaml b/Aucma.Core.CodeBinding/Views/StatisticsPageView.xaml index 40ee708d..4ee3d307 100644 --- a/Aucma.Core.CodeBinding/Views/StatisticsPageView.xaml +++ b/Aucma.Core.CodeBinding/Views/StatisticsPageView.xaml @@ -6,7 +6,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Aucma.Core.CodeBinding.Views" xmlns:cvt="clr-namespace:Aucma.Core.CodeBinding.ConvertTo" - mc:Ignorable="d" Background="#1152AC" + mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei" d:DesignHeight="450" d:DesignWidth="800"> @@ -94,7 +94,7 @@ - + - + public async Task HandleMaterialBarCode(string BarCode,TempInfo TempOffLineInfo) { - try - { + try + { + // 1.先质检 + TempOffLineInfo.QualityResult = "成功"; Thread.Sleep(10000); TempOffLineInfo.ProductSNCode = BarCode.Trim(); //产品SN条码*1 TempOffLineInfo.ProductScanTime = System.DateTime.Now; // 扫码时间*2 diff --git a/Aucma.Core.ProductOffLine/Models/TempInfo.cs b/Aucma.Core.ProductOffLine/Models/TempInfo.cs index bd777b14..1a97945b 100644 --- a/Aucma.Core.ProductOffLine/Models/TempInfo.cs +++ b/Aucma.Core.ProductOffLine/Models/TempInfo.cs @@ -129,5 +129,10 @@ namespace Aucma.Core.ProductOffLine.Models /// 按型号统计使用的数量 /// public int Count { get; set; } + /// + /// 扫码质检结果QualityResult + /// + /// + public string QualityResult { get; set; } } } diff --git a/Aucma.Core.ProductOffLine/ViewModels/DirectionEditViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/DirectionEditViewModel.cs index 77e8e50f..a1797754 100644 --- a/Aucma.Core.ProductOffLine/ViewModels/DirectionEditViewModel.cs +++ b/Aucma.Core.ProductOffLine/ViewModels/DirectionEditViewModel.cs @@ -23,14 +23,13 @@ namespace Aucma.Core.ProductOffLine.ViewModels { public ICommand QueryCommand { get; set; } public RelayCommand MouseClickCommand { get; set; } - public ICommand SaveCommand { get; set; } - + private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices; public DirectionEditViewModel() { _baseMaterialInfoServices = App.ServiceProvider.GetService(); QueryCommand = new RelayCommand(ExecuteQuery); MouseClickCommand = new RelayCommand(MouseClick); - SaveCommand = new RelayCommand(ExecuteSave); + Init(); } /// @@ -68,36 +67,6 @@ namespace Aucma.Core.ProductOffLine.ViewModels } - private async void ExecuteSave() - { - List list = new List(); - // 处理保存按钮点击事件 - foreach (DirectionEditModel item in MaterialDataGrid) - { - if ((!"A".Equals(item.SpaceCode) && !"B".Equals(item.SpaceCode))) - { - MessageBox.Show("产品编号:" + item.MaterialCode + " 产品型号:" + item.MaterialName + " 入库方向必须为A或B"); - return; - } - list.Add(new BaseMaterialInfo() - { - ObjId = item.ObjId, - MaterialCode = item.MaterialCode, - MaterialName = item.MaterialName, - InboundDirection = item.SpaceCode, - MaterialType = "FERT" - }); - } - bool result = await _baseMaterialInfoServices.UpdateAsync(list); - if(result) - { - MessageBox.Show("保存成功"); - } - else - { - MessageBox.Show("保存失败"); - } - } #region 参数定义 private string _search = string.Empty; public string Search diff --git a/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs index 97e710a8..b3dbf712 100644 --- a/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs +++ b/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs @@ -362,7 +362,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels { Application.Current.Dispatcher.Invoke(() => { - ListItems.Add(new TempInfo() { No = ListItems.Count + 1, ProductOrderNo = record.ProductOrderNo, ProductSNCode = record.ProductSNCode, ProductModel = record.ProductModel, ProductRemark = record.ProductRemark, ProductScanTime = record.ProductScanTime }); + ListItems.Add(new TempInfo() { No = ListItems.Count + 1, ProductOrderNo = record.ProductOrderNo, ProductSNCode = record.ProductSNCode, ProductModel = record.ProductModel, ProductRemark = record.ProductRemark, QualityResult = "成功", ProductScanTime = record.ProductScanTime }); }); } diff --git a/Aucma.Core.ProductOffLine/ViewModels/QualityPageViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/QualityPageViewModel.cs index bfe4ffa4..b0de67a9 100644 --- a/Aucma.Core.ProductOffLine/ViewModels/QualityPageViewModel.cs +++ b/Aucma.Core.ProductOffLine/ViewModels/QualityPageViewModel.cs @@ -30,19 +30,20 @@ namespace Aucma.Core.ProductOffLine.ViewModels private readonly IBaseQualityInspectionItemInfoServices? _baseQualityInspectionItemInfoServices; private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices; OffLineBusiness offLineBusiness = OffLineBusiness.Instance; + private IndexPageView firstPage = new IndexPageView();//首页 + private DirectionEditView directionEditView = new DirectionEditView(); + private SelectQualityView selectQualityView = new SelectQualityView(); public QualityPageViewModel() { - // 手动模式默认A库 - IsSelectedOptionA = true; + UserContent1 = directionEditView; + UserContent2 = selectQualityView; // 传入库方向 offLineBusiness.getDirectioneEvent += getInstoreDirection; QualityPageView.getAllQualityEvent += test; _baseQualityInspectionItemInfoServices = App.ServiceProvider.GetService(); _baseMaterialInfoServices = App.ServiceProvider.GetService(); - AutoDirectionCommand = new RelayCommand(DirectionEdit); - SelectQualityCommand = new RelayCommand(SelectQuality); + init(); - LoadData(); } @@ -52,35 +53,50 @@ namespace Aucma.Core.ProductOffLine.ViewModels /// public String getInstoreDirection(string materialType) { + string direction = string.Empty; Application.Current.Dispatcher.Invoke(() => { - // 设置了入库模式 - if (SelectedMaterialType != null && SelectedMaterialType.Content.ToString() == "手动模式") - { - // 获取手动方向 - direction = IsSelectedOptionA == true ? "A" : "B"; - } - else + // 设置了入库自动模式模式 + if (SelectedMaterialType != null && SelectedMaterialType.Content.ToString() == "自动模式") { - // 未设置方向模式或者设置自动模式,默认自动 BaseMaterialInfo info = _baseMaterialInfoServices.Query(x => x.MaterialCode == materialType).FirstOrDefault(); - if (info != null) + if (info != null&& !string.IsNullOrEmpty(info.InboundDirection)) // 设置过了方向 { direction = info.InboundDirection; } - else // 自动模式未设置入库方向,默认为A - { - direction = "A"; - } + + } + else // 设置手动模式 + { + if (IsSelectedOptionA == true) direction = "A"; + if (IsSelectedOptionB == true) direction = "B"; } - }); - return direction; } + #region 更换界面 + + public System.Windows.Controls.UserControl _content1; + + public System.Windows.Controls.UserControl UserContent1 + { + get => _content1; + set => SetProperty(ref _content1, value); + } + + public System.Windows.Controls.UserControl _content2; + + public System.Windows.Controls.UserControl UserContent2 + { + get => _content2; + set => SetProperty(ref _content2, value); + } + + #endregion + public async Task> test() { List list = await _baseQualityInspectionItemInfoServices.query(); @@ -91,30 +107,17 @@ namespace Aucma.Core.ProductOffLine.ViewModels public async void init() { await _baseQualityInspectionItemInfoServices.query(); + //Task.Run(() => + //{ + // Thread.Sleep(5000); + // string A = getInstoreDirection("9001001802"); + // Console.WriteLine(A); + //}); } List materialComplateInfos = new List(); #region 参数定义 - /// - /// 自动方向设置 - /// - public RelayCommand AutoDirectionCommand { get; set; } - private void DirectionEdit() - { - DirectionEditView directionEditView = new DirectionEditView(); - directionEditView.ShowDialog(); - } - - /// - /// 质检项目设置 - /// - public RelayCommand SelectQualityCommand { get; set; } - private void SelectQuality() - { - SelectQualityView selectQualityView = new SelectQualityView(); - selectQualityView.ShowDialog(); - } /// /// 分垛模式(自动模式,手动模式)SelectedMaterialType.content.tostring() @@ -175,42 +178,10 @@ namespace Aucma.Core.ProductOffLine.ViewModels } #endregion - #region 初始化datagrid - private ObservableCollection materialDataGrid = new ObservableCollection(); - public ObservableCollection MaterialDataGrid - { - get { return materialDataGrid; } - set - { - materialDataGrid = value; - OnPropertyChanged();//属性通知 - } - } - #endregion + #endregion - #region 加载DataGrid数据 - private async void LoadData() - { - //Task.Run(() => - //{ - // Thread.Sleep(5000); - // getInstoreDirection("9000004529"); - //}); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 1, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 2, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 60, CompleteAmount = 40 }); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 3, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 4, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 40, CompleteAmount = 10 }); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 5, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 30, CompleteAmount = 10 }); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 6, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 20 }); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 7, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 10, CompleteAmount = 10 }); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 8, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 9, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 80, CompleteAmount = 10 }); - //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 10, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); - - } - #endregion #region 查询 /// diff --git a/Aucma.Core.ProductOffLine/ViewModels/SelectQualityViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/SelectQualityViewModel.cs index cb5d3be0..2be25b35 100644 --- a/Aucma.Core.ProductOffLine/ViewModels/SelectQualityViewModel.cs +++ b/Aucma.Core.ProductOffLine/ViewModels/SelectQualityViewModel.cs @@ -30,7 +30,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels public ICommand QueryCommand { get; set; } public RelayCommand MouseClickCommand { get; set; } - public ICommand SaveCommand { get; set; } + private readonly IBaseQualityInspectionItemInfoServices? _baseQualityInspectionItemInfoServices; public SelectQualityViewModel() @@ -39,8 +39,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels QueryCommand = new RelayCommand(ExecuteQuery); MouseClickCommand = new RelayCommand(MouseClick); - SaveCommand = new RelayCommand(ExecuteSave); - + Init(); } @@ -74,38 +73,6 @@ namespace Aucma.Core.ProductOffLine.ViewModels } - private async void ExecuteSave() - { - List list = new List(); - // 处理保存按钮点击事件 - foreach (QualityInspectionModel item in qualityItemGrid) - { - if ((!"是".Equals(item.IsInSpection) && !"否".Equals(item.IsInSpection))) - { - MessageBox.Show("质检编号:" + item.QualityDefectCode + " 质检名称:" + item.QualityDefectName + " 是否质检应该是或者否"); - return; - } - list.Add(new BaseQualityInspectionItemInfo() - { - ObjId = item.ObjId, - QualityDefectCode = item.QualityDefectCode, - QualityDefectName = item.QualityDefectName, - ParentId = "0", - IsFlag = 0, - IsInSpection = item.IsInSpection == "是" ? "1" : "0" - }); - } - bool result = await _baseQualityInspectionItemInfoServices.UpdateAsync(list); - if (result) - { - MessageBox.Show("保存成功"); - } - else - { - MessageBox.Show("保存失败"); - } - } - private QualityInspectionModel selectedDataItem; diff --git a/Aucma.Core.ProductOffLine/Views/DirectionEditView.xaml b/Aucma.Core.ProductOffLine/Views/DirectionEditView.xaml index bc334618..cb66f3b6 100644 --- a/Aucma.Core.ProductOffLine/Views/DirectionEditView.xaml +++ b/Aucma.Core.ProductOffLine/Views/DirectionEditView.xaml @@ -1,20 +1,96 @@ - + mc:Ignorable="d" FontFamily="Microsoft YaHei" + Name="window" Background="Transparent" d:DesignHeight="800" d:DesignWidth="600"> + + + + + + + + + + + + + + + + + + + - + @@ -24,35 +100,21 @@