change-新发泡界面修改

dev
liuwf
parent 1a40eaa2a8
commit 3a43698050

@ -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")]

@ -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);

@ -74,6 +74,10 @@ namespace Aucma.Core.BoxFoam.Models
/// </summary>
public string? setEnable { get; set; }
/// <summary>
/// 夹具型号
/// </summary>
public string? boxType { get; set; }
}
}

@ -33,8 +33,10 @@ namespace Aucma.Core.BoxFoam.ViewModels
SubmitCommand = new RelayCommand<string>(obj => SubmitCommandExecute(obj));
SubmitCommand2 = new RelayCommand<string>(obj => SubmitCommandExecute2(obj));
SubmitCommand3 = new RelayCommand<string>(obj => SubmitCommandExecute3(obj));
SetBoxTypeCommand = new RelayCommand<string>(obj => SetBoxTypeCommandExecute(obj));
_baseSpaceDetailServices = App.ServiceProvider.GetService<IBaseSpaceDetailServices>();
_baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
SetBoxTypeViewModel.RefreshPageEvent += LoadSpaceStoreMedthAsync;
SelectTypeViewModel.RefreshPageEvent += LoadSpaceStoreMedthAsync;
this.LoadSpaceStoreMedthAsync();
}
@ -71,6 +73,19 @@ namespace Aucma.Core.BoxFoam.ViewModels
type.ShowDialog();
}
/// <summary>
/// 设置夹具型号
/// </summary>
public RelayCommand<string> 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";

@ -15,6 +15,21 @@ namespace Aucma.Core.BoxFoam.ViewModels
public partial class SearchCriteriaViewModel : ObservableObject
{
private AppConfigHelper appConfig =new AppConfigHelper();
/// <summary>
/// 委托,关闭窗口
/// </summary>
/// <param name="message"></param>
public delegate void close();
public event close closeEvent;
/// <summary>
/// 刷新货道设置物料型号页面
/// </summary>
/// <param name="message"></param>
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<string>("RefreshSearchItems");//刷新窗口
// 关闭窗口
closeEvent?.Invoke();
RefreshPageEvent?.Invoke();
}
#endregion
}

@ -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
{
/// <summary>
@ -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<object> 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<object>(MouseClick);
materialDataGrid = new ObservableCollection<BaseMaterialInfo>();
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 快捷查询
/// <summary>
/// 快捷查询
/// </summary>
/// <param name="selectedOption"></param>
/// <returns></returns>
[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<string>();
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<string> _configurations = new ObservableCollection<string>();
public ObservableCollection<string> Configurations
{
get => _configurations;
set => SetProperty(ref _configurations, value);
}
/// <summary>
/// 搜索条件设置
/// </summary>
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)

@ -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
{
/// <summary>
/// 委托,关闭窗口
/// </summary>
/// <param name="message"></param>
public delegate void close();
public event close closeEvent;
/// <summary>
/// 刷新货道页面
/// </summary>
/// <param name="message"></param>
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<IBaseSpaceInfoServices>();
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();
}
/// <summary>
/// 设置型号
/// </summary>
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();
}
}
}

@ -34,7 +34,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
_executePlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
Task.WaitAll(LoadData());
//加载快捷方式
SaveSearchCriteria();
SaveSearchCriteria();
WeakReferenceMessenger.Default.Register<string>(this, SaveSearchCriteria);
_objId = objId;
}

@ -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();
}
}
}

@ -75,10 +75,10 @@
</StackPanel>
<Border Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<!--<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>-->
<Border Grid.Column="0" BorderBrush="#0288d1" BorderThickness="1" Margin="5">
<Border.Effect>
<DropShadowEffect Color="#1254AB" ShadowDepth="0" BlurRadius="5" Opacity="0.5" Direction="0"></DropShadowEffect>
@ -94,7 +94,7 @@
<!--控件模板-->
<ItemsControl.ItemTemplate>
<DataTemplate>
<Control x:Name="ctrl" Width="600" Height="200" VerticalAlignment="Top"></Control>
<Control x:Name="ctrl" Width="600" Height="400" VerticalAlignment="Top"></Control>
<DataTemplate.Triggers>
<!--根据不同类型选择不同模板-->
<DataTrigger Binding="{Binding spaceType}" Value="1">
@ -158,7 +158,7 @@
<TextBlock Text="型号1" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" Grid.Row="0" BorderBrush="White" BorderThickness="1">
<Button Command="{Binding DataContext.SubmitCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent">
<Button Command="{Binding DataContext.SubmitCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent" Height="auto">
<TextBlock Text="{Binding materialType}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</Border>
@ -166,7 +166,7 @@
<TextBlock Text="型号2" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" Grid.Row="1" BorderBrush="White" BorderThickness="1">
<Button Command="{Binding DataContext.SubmitCommand2, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent">
<Button Command="{Binding DataContext.SubmitCommand2, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent" Height="auto">
<TextBlock Text="{Binding typeCodeB}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</Border>
@ -174,7 +174,7 @@
<TextBlock Text="型号3" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" Grid.Row="2" BorderBrush="White" BorderThickness="1">
<Button Command="{Binding DataContext.SubmitCommand3, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent">
<Button Command="{Binding DataContext.SubmitCommand3, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent" Height="auto">
<TextBlock Text="{Binding typeCodeC}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</Border>
@ -188,33 +188,36 @@
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<!--<ColumnDefinition/>-->
<!--<ColumnDefinition/>
<ColumnDefinition/>-->
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="White" BorderThickness="1" >
<TextBlock Text="状态" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Text="设置夹具箱型" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" BorderBrush="White" BorderThickness="1">
<Button Command="{Binding DataContext.SetBoxTypeCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent" Height="auto" >
<TextBlock Text="{Binding boxType}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Button>
</Border>
<Border Grid.Column="2" BorderBrush="White" BorderThickness="1">
<TextBlock Text="货道状态" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="3" BorderBrush="White" BorderThickness="1">
</Border>
<Border Grid.Column="4" BorderBrush="White" BorderThickness="1">
<!--<Border Grid.Column="4" BorderBrush="White" BorderThickness="1">
</Border>
<Border Grid.Column="5" BorderBrush="White" BorderThickness="1">
</Border>-->
<!--<Border Grid.Column="5" BorderBrush="White" BorderThickness="1">
<Button Command="{Binding DataContext.SpaceDetailCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding spaceCode}" BorderBrush="Transparent" BorderThickness="0" Background="Transparent">
<TextBlock Text="明细" FontSize="18" Foreground="Green" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Button>
</Border>
<Border Grid.Column="6" BorderBrush="White" BorderThickness="1">
</Border>-->
<!--<Border Grid.Column="6" BorderBrush="White" BorderThickness="1">
</Border>
</Border>-->
</Grid>
</Border>
</Grid>
@ -229,7 +232,7 @@
</ItemsControl>
</Border>
<Border Grid.Column="1" BorderBrush="#0288d1" BorderThickness="1" Margin="5">
<!--<Border Grid.Column="1" BorderBrush="#0288d1" BorderThickness="1" Margin="5">
<Border.Effect>
<DropShadowEffect Color="#1254AB" ShadowDepth="0" BlurRadius="5" Opacity="0.5" Direction="0"></DropShadowEffect>
</Border.Effect>
@ -248,17 +251,17 @@
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False"
Foreground="#FFFFFF" >
<!--resourceStyle 399行修改选中字体颜色-->
--><!--resourceStyle 399行修改选中字体颜色--><!--
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding SpaceCode}" Header="货道编号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" />
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="物料编号" Width="*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" />
<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料名称" Width="*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" />
<!--<DataGridTextColumn Binding="{Binding materialType}" Header="物料类型" Width="1*" IsReadOnly="True"/>-->
--><!--<DataGridTextColumn Binding="{Binding materialType}" Header="物料类型" Width="1*" IsReadOnly="True"/>--><!--
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</Border>-->
</Grid>
</Border>

@ -99,9 +99,41 @@
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" Grid.Column="0">
<TextBox Width="200" Height="25" Margin="10 0 0 0" Text="{Binding SearchText}" Foreground="White" VerticalAlignment="Center" FontSize="18"/>
<Button Content="查 询" Command="{Binding QueryCommand}" Background="#007DFA" BorderBrush="#007DFA" VerticalAlignment="Center" Foreground="White" Height="30" Width="100" Margin="0 0 50 0"/>
<Button Content="清除型号" Command="{Binding deleteCommand}" Background="#FF9900" Foreground="white" BorderBrush="#FF9900" VerticalAlignment="Center" Height="30" Width="100" />
<Button Content="查 询" Command="{Binding QueryCommand}" Background="#007DFA" BorderBrush="#007DFA" VerticalAlignment="Center" Foreground="White" Height="30" Width="100" Margin="0 0 20 0"/>
<Button Content="清除型号" Command="{Binding deleteCommand}" Background="#FF9900" Foreground="white" BorderBrush="#FF9900" VerticalAlignment="Center" Height="30" Width="100" Margin="0 0 20 0"/>
<Button Content="配 置" Command="{Binding SearchCriteriaSetCommand}" Background="#FF36B5C1" BorderBrush="#FF36B5C1" Margin="20,0,0,0" FontSize="18" Height="30" Width="100" BorderThickness="1" />
</StackPanel>
<!--快捷搜索型号-->
<Border Grid.Row="0" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" VerticalAlignment="Center" Margin="10 0 0 0">
<TextBlock Text="快捷查询" VerticalAlignment="Center" Foreground="#FFFFFF" FontSize="18" />
</StackPanel>
<WrapPanel Grid.Column="1" VerticalAlignment="Center" Margin="0 5">
<ItemsControl ItemsSource="{Binding Configurations}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton
Content="{Binding}"
Command="{Binding DataContext.RadioButtonCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
CommandParameter="{Binding}"
GroupName="MaterialTypeRadioButton"
Margin="25,0" FontSize="18" Foreground="#FFFFFF"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</WrapPanel>
</Grid>
</Border>
<!--计划列表-->
<Border Grid.Row="1" Grid.Column="0" BorderThickness="0" CornerRadius="5" Margin="1,1,5,5" >
<DataGrid ItemsSource="{Binding MaterialDataGrid}" Height="{Binding Path=ActualHeight, ElementName=HeightPanel}"

@ -1,4 +1,5 @@
using Aucma.Core.BoxFoam.ViewModels;
using CommunityToolkit.Mvvm.Messaging;
using System;
using System.Collections.Generic;
using System.Linq;
@ -27,13 +28,17 @@ namespace Aucma.Core.BoxFoam.Views.UserPage
viewModel = new SelectTypeViewModel(ncount, spaceCode);
this.DataContext = viewModel;
viewModel.closeEvent += closeWindow;
WeakReferenceMessenger.Default.Register<object>(this, Recive);
}
private void Recive(object recipient, object message)
{
this.Close();
}
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
viewModel.MouseClick(sender);
}
private void closeWindow()
{
this.Close();

@ -0,0 +1,110 @@
<Window x:Class="Aucma.Core.BoxFoam.Views.UserPage.SetBoxType"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Aucma.Core.BoxFoam.Views.UserPage"
mc:Ignorable="d" FontFamily="Microsoft YaHei" Title="设置夹具型号"
Name="window" Background="#1254AB" d:DesignHeight="400" d:DesignWidth="400" Width="600" Height="600" WindowStartupLocation="CenterScreen">
<Window.Resources>
<Style TargetType="{x:Type Slider}">
<Style.Resources>
<!-- 重写重复触发按钮的样式 -->
<Style x:Key="RepeatButtonStyle" TargetType="{x:Type RepeatButton}">
<Setter Property="Focusable" Value="false" />
<Setter Property="IsTabStop" Value="false" />
<Setter Property="Padding" Value="0" />
<Setter Property="Width" Value="30" />
</Style>
</Style.Resources>
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
<Setter Property="SmallChange" Value="1" />
</Style>
<Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
<!--<Setter Property="Height" Value="40"/>-->
<Setter Property="FontSize" Value="16"/>
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
<Style TargetType="DataGrid">
<!--网格线颜色-->
<Setter Property="CanUserResizeColumns" Value="false"/>
<Setter Property="Background" Value="#1152AC" />
<Setter Property="BorderBrush" Value="#4285DE" />
<Setter Property="Foreground" Value="White"/>
<Setter Property="HorizontalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#4285DE"/>
</Setter.Value>
</Setter>
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#1152AC"/>
</Setter.Value>
</Setter>
</Style>
<!--列头标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<!--<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>-->
<!--<Setter Property="Background" Value="#dddddd"/>
<Setter Property="Foreground" Value="Black"/>-->
<!--<Setter Property="BorderThickness" Value="1" />-->
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="BorderBrush" Value="#dddddd" />
<Setter Property="Height" Value="48"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Background" Value="#4285DE"/>
<Setter Property="Foreground" Value="White"/>
</Style>
<!--单元格样式-->
<Style TargetType="DataGridCell">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Gray" />
<Setter Property="Height" Value="40"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}" >
<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#4285DE"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Border Margin="5" Background="#1254AB" CornerRadius="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="货道编号:" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox x:Name="MaterialCode" Text="{Binding SpaceCode}" Foreground="white" BorderBrush="White" IsReadOnly="True" Margin="15 0 0 0 " FontSize="18" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="150"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="夹具箱型:" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="MaterialName" Text="{Binding BoxType}" Foreground="white" BorderBrush="White" Margin="15 0 0 0 " FontSize="18" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="150"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="保 存" FontSize="18" Command="{Binding SaveCommand}" Background="#FF36B5C1" BorderBrush="#FF36B5C1" Foreground="white" Margin="0,0,10,0" Height="50" Width="100" />
<Button Content="清除型号" FontSize="18" Command="{Binding deleteCommand}" Background="#FF9900" Foreground="white" BorderBrush="#FF9900" Margin="0,0,10,0" Height="50" Width="100"/>
</StackPanel>
</Grid>
</Border>
</Window>

@ -0,0 +1,38 @@
using Aucma.Core.BoxFoam.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Aucma.Core.BoxFoam.Views.UserPage
{
/// <summary>
/// SetBoxType.xaml 的交互逻辑
/// </summary>
public partial class SetBoxType : Window
{
private SetBoxTypeViewModel viewModel = null;
public SetBoxType(string spaceCode)
{
InitializeComponent();
viewModel = new SetBoxTypeViewModel(spaceCode);
this.DataContext = viewModel;
viewModel.closeEvent += closeWindow;
}
private void closeWindow()
{
this.Close();
}
}
}

@ -0,0 +1,34 @@
using NPOI.OpenXmlFormats.Dml.Chart;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.ProductOffLine.Models
{
/// <summary>
/// 成品下线按小时统计
/// </summary>
[SugarTable("GET_OFFLINE_HOURAMOUNT", "AUCMA_SCADA")]
public class ChartsByTimeAmount
{
/// <summary>
/// 产线
/// </summary>
public string ProductCode { get; set; }
/// <summary>
/// 日期
/// </summary>
public DateTime ProductDate { get; set; }
/// <summary>
/// 每小时产量
/// </summary>
public int ProductAmount { get; set; }
}
}

@ -36,6 +36,7 @@ using System.Collections.ObjectModel;
using Aucma.Core.ProductOffLine.Models;
using System.Globalization;
using Admin.Core.Model.ViewModels;
using ChartsByTime = Admin.Core.Model.ViewModels.ChartsByTime;
/*
@ -233,7 +234,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
/// <summary>
/// 型号统计柱状图X轴日期
/// </summary>
private List<string> materialNameList;
private List<string> materialNameList = new List<string>();
public List<string> MaterialNameList
{
@ -317,6 +318,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
await App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
LoadData();
#region 小时产量统计
List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
if (listTime == null) return;
// var aa =_offLineInfoServices.Query(x=>x.ProductScanTime>= listTime[0].startTime && x.ProductScanTime<= listTime[11].startTime)
@ -324,14 +326,27 @@ namespace Aucma.Core.ProductOffLine.ViewModels
List<Admin.Core.Model.ViewModels.ChartsByTime> list = _offLineInfoServices.QueryCharts(listTime[0].startTime, listTime[11].startTime).Result;
if (list == null) return;
var hourList = list.Where(x => int.Parse(x.hour) >= listTime[0].startTime.Hour && int.Parse(x.hour) <= listTime[11].startTime.Hour && x.productLineCode.Equals("CX_02"));
List<ChartsByTimeAmount> hourList1 = new List<ChartsByTimeAmount>();
foreach(ChartsByTime item in list)
{
DateTime date = DateTime.ParseExact(item.date + ":00:00", "yyyy-MM-dd/HH:mm:ss", CultureInfo.InvariantCulture);
ChartsByTimeAmount hour = new ChartsByTimeAmount();
hour.ProductCode = item.productLineCode;
hour.ProductDate = date;
hour.ProductAmount = item.Amount;
hourList1.Add(hour);
}
if (hourList1 == null) return;
var hourList = hourList1.Where(x => x.ProductCode.Equals("CX_02") && x.ProductDate>= listTime[0].startTime && x.ProductDate <= listTime[11].startTime);
List<string> xList = new List<string>();
ChartValues<int> achievement2 = new ChartValues<int>();
foreach (var item in hourList)
{
xList.Add(item.hour);
achievement2.Add(item.Amount);
xList.Add(item.ProductDate.Hour.ToString());
achievement2.Add(item.ProductAmount);
}
var column2 = new ColumnSeries();
@ -345,7 +360,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
{
for (int i = 0; i < hourList.Count(); i++)
{
Achievement.FirstOrDefault().Values[i] = hourList.ElementAt(i).Amount;
Achievement.FirstOrDefault().Values[i] = hourList.ElementAt(i).ProductAmount;
}
}
else
@ -354,35 +369,46 @@ namespace Aucma.Core.ProductOffLine.ViewModels
}
ProductionHourList = xList;
#endregion
#region 型号统计
List<string> nameList = new List<string>();
ChartValues<int> achievement = new ChartValues<int>();
var column = new ColumnSeries();
ChartValues<double> achievement = new ChartValues<double>();
Random random = new Random();
for (int i = 0; i < 5; i++)
List<OffLineInfo> offList = _offLineInfoServices.QueryAsync(x=>x.ProductScanTime>= listTime[0].startTime && x.ProductScanTime <= listTime[11].startTime).Result;
var modelList = offList.GroupBy(x=>x.ProductRemark);
foreach(var item in modelList)
{
achievement.Add(random.Next(60, 100));
achievement.Add(item.Count());
nameList.Add(item.Key);
}
var column = new ColumnSeries();
column.DataLabels = true;
column.Title = "型号";
column.Values = achievement;
column.Foreground = Brushes.White;
ModelStatistics.Clear();
// x轴
MaterialNameList = null;
ModelStatistics.Add(column);
MaterialNameList = new List<string>()
{
"SC-230,11W/H成品",
"SC-439箱体",
"SC-439U壳",
"SC-439背板",
"SC-439VAM,元气森林,C",
};
MaterialNameList = nameList;
// y轴
if (ModelStatistics.Count > 0)
{
for (int i = 0; i < modelList.Count(); i++)
{
Achievement.FirstOrDefault().Values[i] = modelList.ElementAt(i).Count();
}
}
else
{
ModelStatistics.Add(column);
}
}));
#endregion
}
//private async void InitEveryDayMethod()
//{

@ -277,7 +277,7 @@
<TextBlock Text="当日型号产量统计" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" >
<lvc:CartesianChart Series="{Binding ModelStatistics, UpdateSourceTrigger=PropertyChanged}" Margin="5">
<lvc:CartesianChart Series="{Binding ModelStatistics, UpdateSourceTrigger=PropertyChanged}" Margin="5" DisableAnimations="True">
<lvc:CartesianChart.AxisX>
<lvc:Axis Labels="{Binding MaterialNameList}" FontSize="15">
<lvc:Axis.Separator>

@ -41,7 +41,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
_executePlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
Task.WaitAll(LoadData());
//加载快捷方式
SaveSearchCriteria();
SaveSearchCriteria();
WeakReferenceMessenger.Default.Register<string>(this, SaveSearchCriteria);
_radioButtonStatus = 1;
}

Loading…
Cancel
Save