change - 成品下线质检页面

dev
liuwf 1 year ago
parent 4c2c0c0939
commit 9ef89aa1b8

@ -1,32 +1,48 @@
using Admin.Core.Model;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Service;
using Aucma.Core.ProductOffLine.Models;
using Aucma.Core.ProductOffLine.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
namespace Aucma.Core.ProductOffLine.ViewModels
{
public partial class QualityPageViewModel : ObservableObject
{
public QualityPageViewModel() {
private readonly IBaseQualityInspectionItemInfoServices? _baseQualityInspectionItemInfoServices;
public QualityPageViewModel()
{
QualityPageView.getAllQualityEvent += test;
_baseQualityInspectionItemInfoServices = App.ServiceProvider.GetService<IBaseQualityInspectionItemInfoServices>();
AutoDirectionCommand = new RelayCommand(DirectionEdit);
SelectQualityCommand = new RelayCommand(SelectQuality);
init();
LoadData();
}
public void init()
{
public async Task<List<BaseQualityInspectionItemInfo>> test()
{
List<BaseQualityInspectionItemInfo> list = await _baseQualityInspectionItemInfoServices.query();
return list;
}
public async void init()
{
await _baseQualityInspectionItemInfoServices.query();
}
List<MaterialComplateInfo> materialComplateInfos = new List<MaterialComplateInfo>();
@ -83,7 +99,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
#endregion
#endregion
#region 加载DataGrid数据
private void LoadData()
{

@ -2,13 +2,16 @@
using Admin.Core.Model;
using Admin.Core.Service;
using Aucma.Core.ProductOffLine.Models;
using Aucma.Core.ProductOffLine.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
using NPOI.POIFS.Properties;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
@ -24,47 +27,86 @@ namespace Aucma.Core.ProductOffLine.ViewModels
{
public partial class SelectQualityViewModel : ObservableObject
{
public ICommand QueryCommand { get; set; }
public ICommand SaveCommand { get; set; }
private readonly IBaseQualityInspectionItemInfoServices? _baseQualityInspectionItemInfoServices;
public SelectQualityViewModel()
{
_baseQualityInspectionItemInfoServices = App.ServiceProvider.GetService<IBaseQualityInspectionItemInfoServices>();
private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices;
public SelectQualityViewModel() {
_baseMaterialInfoServices = App.ServiceProvider.GetService<IBaseMaterialInfoServices>();
QueryCommand = new RelayCommand(ExecuteQuery);
SaveCommand = new RelayCommand(ExecuteSave);
Init();
}
/// <summary>
/// 3.查询BASE_MATERIALINFO表存在的成品类型以供修改
/// </summary>
public void Init()
public async void Init()
{
ExecuteQuery();
}
private async void ExecuteQuery()
{
List<BaseQualityInspectionItemInfo> list = await _baseQualityInspectionItemInfoServices.query();
qualityItemGrid.Clear();
for (int i = 0; i < list.Count; i++)
{
qualityItemGrid.Add(new QualityInspectionModel() { No = i + 1, ObjId = list[i].ObjId, QualityDefectCode = list[i].QualityDefectCode, QualityDefectName = list[i].QualityDefectName, IsInSpection = list[i].IsInSpection == "0" ? "否" : "是" });
}
}
private async void ExecuteSave()
{
List<BaseQualityInspectionItemInfo> list = new List<BaseQualityInspectionItemInfo>();
// 处理保存按钮点击事件
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("保存失败");
}
}
#region 初始化datagrid
private ObservableCollection<DirectionEditModel> materialDataGrid = new ObservableCollection<DirectionEditModel>();
public ObservableCollection<DirectionEditModel> MaterialDataGrid
private ObservableCollection<QualityInspectionModel> qualityItemGrid = new ObservableCollection<QualityInspectionModel>();
public ObservableCollection<QualityInspectionModel> QualityItemGrid
{
get { return materialDataGrid; }
get { return qualityItemGrid; }
set
{
materialDataGrid = value;
qualityItemGrid = value;
OnPropertyChanged();//属性通知
}
}
#endregion
}
}

@ -14,7 +14,7 @@
<!--列头标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<Setter Property="BorderBrush" Value="#dddddd" />
<Setter Property="Height" Value="30"/>
<Setter Property="FontSize" Value="14"/>
@ -24,11 +24,11 @@
<Border Grid.Row="0" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="9*"/>
</Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="9*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
<TextBlock Text="基本配置" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
@ -48,8 +48,8 @@
<RadioButton Content="B库" Margin="5 0" Foreground="White" />
</WrapPanel>
</Border>
<Button Content="自动方向设置" Command="{Binding AutoDirectionCommand}" Margin="100,0,0,0" Background="Blue" Foreground="White" />
<Button Content="质检项设置" Command="{Binding SelectQualityCommand}" Background="Blue" Foreground="White" Width="120" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<Button Content="自动方向设置" Command="{Binding AutoDirectionCommand}" Margin="100,0,0,0" Background="Blue" Foreground="White"/>
<Button Content="质检项设置" Command="{Binding SelectQualityCommand}" Margin="50,0,0,0" Background="Blue" Foreground="White" Width="120" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</WrapPanel>
</Grid>
<Grid Grid.Row="2">
@ -64,7 +64,6 @@
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="0" CanUserAddRows="False"
Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}" >
<!-- 表头剧中-->
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center">
@ -80,16 +79,16 @@
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" Header="序号" Width="1*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="产品条码" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="产品名称" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="内胆预装检漏" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding MaterialName}" Header="成品检漏" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding SpaceCode}" Header="终检" Width="*"/>
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="产品条码" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="产品名称" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn x:Name="quality1" Binding="{Binding MaterialCode}" Header="内胆预装检漏" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn x:Name="quality2" Binding="{Binding MaterialName}" Header="成品检漏" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn x:Name="quality3" Binding="{Binding SpaceCode}" Header="终检" Width="*" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Grid>
</Border>
</UserControl>

@ -1,4 +1,8 @@
using Aucma.Core.ProductOffLine.ViewModels;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Service;
using Aucma.Core.ProductOffLine.ViewModels;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
@ -21,10 +25,35 @@ namespace Aucma.Core.ProductOffLine.Views
/// </summary>
public partial class QualityPageView : UserControl
{
public delegate Task<List<BaseQualityInspectionItemInfo>> getAllQuality();
public static event getAllQuality getAllQualityEvent;
public QualityPageView()
{
InitializeComponent();
this.DataContext = new QualityPageViewModel();
QualityPageViewModel viewmodel = new QualityPageViewModel();
this.DataContext = viewmodel;
qualityItem();
}
public async void qualityItem()
{
List<BaseQualityInspectionItemInfo> list = await getAllQualityEvent?.Invoke();
foreach (BaseQualityInspectionItemInfo item in list)
{
foreach (var column in qualityGrid.Columns)
{
DataGridColumn dataGridColumn = column as DataGridColumn;
if (dataGridColumn.Header.ToString().Equals(item.QualityDefectName) && "0".Equals(item.IsInSpection))
{
dataGridColumn.Visibility = Visibility.Collapsed;
}
}
}
// this.quality1.Visibility = Visibility.Collapsed;
}
}

@ -4,9 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Aucma.Core.ProductOffLine.Views"
mc:Ignorable="d"
Title="质检项目设置" Height="650" Width="900" Name="window" Background="White"
ResizeMode="NoResize" Topmost="True"
mc:Ignorable="d" Title="质检项目设置" Height="650" Width="600" Name="window" Background="White" ResizeMode="NoResize" Topmost="True"
>
<Border Margin="5" Background="#1254AB" CornerRadius="10">
<Border.Effect>
@ -14,8 +12,8 @@
</Border.Effect>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="87*"/>
<ColumnDefinition Width="803*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
@ -28,13 +26,50 @@
<!--计划列表-->
<Border Grid.Row="1" BorderBrush="#1254AB" BorderThickness="3" CornerRadius="5" Background="Transparent" Margin="1,1,5,5" Grid.ColumnSpan="2">
<DataGrid x:Name="dataShow" ItemsSource="{Binding Items}" AutoGenerateColumns="False" Background="Transparent"
<DataGrid Name="qualityItemGrid" ItemsSource="{Binding QualityItemGrid}" Background="Transparent"
FontSize="15" ColumnHeaderHeight="35"
RowHeight="31" RowHeaderWidth="0"
RowHeight="31" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="0" CanUserAddRows="False"
Foreground="#FFFFFF">
Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}" >
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center">
</Setter>
<Setter Property="Background" Value="Transparent" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" Header="序号" Width="1*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding QualityDefectCode}" Header="质检编号" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding QualityDefectName}" Header="质检名称" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn x:Name="test11" Binding="{Binding IsInSpection}" Header="是否校验" Width="*" />
</DataGrid.Columns>
</DataGrid>
<!--<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border x:Name="levelControl" VerticalAlignment="Center" >
<StackPanel >
<TextBlock x:Name="txtName" TextWrapping="Wrap" Text="{Binding MaterialName}" ToolTip="{Binding MaterialName}" />
<TextBlock Text="{Binding IsExec}" Visibility="Collapsed" />
</StackPanel>
</Border>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsExec}" Value="2">
<Setter TargetName="txtName" Property="Foreground" Value="Green" ></Setter>
-->
<!--<Setter TargetName="levelControl" Property="Background" Value="Green" ></Setter>-->
<!--
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>-->
</Border>
</Grid>

@ -1,4 +1,9 @@
using Aucma.Core.ProductOffLine.ViewModels;
using Admin.Core.IRepository;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Repository;
using Admin.Core.Service;
using Aucma.Core.ProductOffLine.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@ -8,6 +13,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
@ -20,10 +26,15 @@ namespace Aucma.Core.ProductOffLine.Views
/// </summary>
public partial class SelectQualityView : Window
{
public SelectQualityView()
{
InitializeComponent();
this.DataContext = new SelectQualityViewModel();
SelectQualityViewModel viewModel = new SelectQualityViewModel();
this.DataContext = viewModel;
}
}
}

Loading…
Cancel
Save