change-成品下线加订单统计,条码搜索功能

dev
liuwf 11 months ago
parent 1ef4c6f9ab
commit be2d89db25

@ -27,7 +27,7 @@ namespace Aucma.Core.ProductOffLine.ConvertTo
bsm.BeginTime = values[0].ToString();
bsm.EndTime = values[1].ToString();
return bsm;
}
return null;

@ -8,6 +8,7 @@ namespace Aucma.Core.ProductOffLine.Models
{
public class StatisticModel
{
// public string? ProductCode { get; set; }
/// <summary>
/// 开始时间
/// </summary>

@ -2,6 +2,7 @@
using Admin.Core.Model;
using Admin.Core.Model.Model_New;
using Aucma.Core.ProductOffLine.Models;
using Aucma.Core.ProductOffLine.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
@ -22,15 +23,26 @@ namespace Aucma.Core.ProductOffLine.ViewModels
// 成品下线操作mes数据
private readonly IOffLineInfoServices? _offLineInfoServices = App.ServiceProvider.GetService<IOffLineInfoServices>();
public RelayCommand ResetCommand { get; set; }
public StatisticsPageViewModel()
{
_offLineInfoServices = App.ServiceProvider.GetService<IOffLineInfoServices>();
MainWindowViewModel.RefreshChartsEvent += LoadData;
ResetCommand = new RelayCommand(Reset);
LoadData();
}
List<MaterialComplateInfo> materialComplateInfos = new List<MaterialComplateInfo>();
public void Reset()
{
ProductSNCode = string.Empty;
LoadData();
}
#region 加载DataGrid数据
private void LoadData()
{
@ -95,6 +107,17 @@ namespace Aucma.Core.ProductOffLine.ViewModels
OnPropertyChanged();//属性通知
}
}
#region 物料条码
private string _productSNCode;
public string ProductSNCode
{
get => _productSNCode;
set => SetProperty(ref _productSNCode, value);
}
#endregion
// 按照型号统计
private ObservableCollection<TempInfo> totalItem = new ObservableCollection<TempInfo>() { };
public ObservableCollection<TempInfo> TotalItem
@ -132,36 +155,44 @@ namespace Aucma.Core.ProductOffLine.ViewModels
[RelayCommand]
private void ExecQuery(object obj)
{
List<OffLineInfo> list = null;
var result = (StatisticModel)obj;
if (string.IsNullOrEmpty(result.BeginTime) && string.IsNullOrEmpty(result.EndTime))
{
return;
}
else if (string.IsNullOrEmpty(result.BeginTime))
{
DateTime EndTime = Convert.ToDateTime(result.EndTime);
list = _offLineInfoServices.QueryAsync(x => x.ProductScanTime <= EndTime.AddDays(1)).Result;
}
else if (string.IsNullOrEmpty(result.EndTime))
if (!string.IsNullOrEmpty(_productSNCode))
{
DateTime BeginTime = Convert.ToDateTime(result.BeginTime);
list = _offLineInfoServices.QueryAsync(x => x.ProductScanTime >= BeginTime).Result;
list = _offLineInfoServices.QueryAsync(x => x.ProductSNCode == _productSNCode).Result;
}
else
{
DateTime BeginTime = Convert.ToDateTime(result.BeginTime);
DateTime EndTime = Convert.ToDateTime(result.EndTime);
if (BeginTime > EndTime)
var result = (StatisticModel)obj;
if (result == null) return;
if (string.IsNullOrEmpty(result.BeginTime) && string.IsNullOrEmpty(result.EndTime))
{
MessageBox.Show("结束时间要大于开始时间!");
return;
}
list = _offLineInfoServices.QueryAsync(x => x.ProductScanTime >= BeginTime && x.ProductScanTime <= EndTime.AddDays(1)).Result;
}
else if (string.IsNullOrEmpty(result.BeginTime))
{
DateTime EndTime = Convert.ToDateTime(result.EndTime);
list = _offLineInfoServices.QueryAsync(x => x.ProductScanTime <= EndTime.AddDays(1)).Result;
}
else if (string.IsNullOrEmpty(result.EndTime))
{
DateTime BeginTime = Convert.ToDateTime(result.BeginTime);
list = _offLineInfoServices.QueryAsync(x => x.ProductScanTime >= BeginTime).Result;
}
else
{
DateTime BeginTime = Convert.ToDateTime(result.BeginTime);
DateTime EndTime = Convert.ToDateTime(result.EndTime);
if (BeginTime > EndTime)
{
MessageBox.Show("结束时间要大于开始时间!");
return;
}
list = _offLineInfoServices.QueryAsync(x => x.ProductScanTime >= BeginTime && x.ProductScanTime <= EndTime.AddDays(1)).Result;
}
}
if (list != null)
{
list = list.OrderByDescending(x => x.ProductScanTime).ToList();

@ -61,14 +61,18 @@ namespace Aucma.Core.ProductOffLine.Views
{
directionSelected = true;
this.Close();
if (direction == "外侧提升机箱体")
Task.Run(() =>
{
SendPlcPassEvent?.Invoke(2, "A");
}
else
{
SendPlcPassEvent?.Invoke(1, "A");
}
if (direction == "外侧提升机箱体")
{
SendPlcPassEvent?.Invoke(2, "A");
}
else
{
SendPlcPassEvent?.Invoke(1, "A");
}
});
}

@ -19,5 +19,10 @@ namespace Aucma.Core.ProductOffLine.Views
Login login = new Login();
login.ShowDialog();
}
private void Minimized_Click(object sender, RoutedEventArgs e)
{
}
}
}

@ -7,7 +7,7 @@
xmlns:local="clr-namespace:Aucma.Core.ProductOffLine.Views"
xmlns:cvt="clr-namespace:Aucma.Core.ProductOffLine.ConvertTo"
mc:Ignorable="d" FontFamily="Microsoft YaHei" Background="#1152AC"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="800" d:DesignWidth="1500">
<UserControl.Resources>
<cvt:MultiBindingConverter x:Key="QueryConvert"></cvt:MultiBindingConverter>
@ -124,9 +124,13 @@
</Binding>
</DatePicker.SelectedDate>
</DatePicker>
<Button Margin="10 0"
Content="查询" Command="{Binding ExecQueryCommand}"
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
<TextBlock Text="条码:" Margin="30 0 0 0" Foreground="White" FontSize="20" VerticalAlignment="Center"/>
<TextBox x:Name="ProductSNCode" Text="{Binding ProductSNCode,Mode=TwoWay}" Width="300" FontSize="20" Foreground="White" HorizontalAlignment="Center">
</TextBox>
<Button Margin="30 0 0 0 " Width="100"
Content="查询" Command="{Binding ExecQueryCommand}" FontSize="20"
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}"
Style="{StaticResource MaterialDesignRaisedSecondaryDarkButton}"
ToolTip="Resource name: MaterialDesignRaisedSecondaryDarkButton">
<Button.CommandParameter>
@ -136,6 +140,8 @@
</MultiBinding>
</Button.CommandParameter>
</Button>
<Button Content="重置" FontSize="20" Margin="20 0 0 0" x:Name="Minimized" Command="{Binding ResetCommand}" CommandParameter="{Binding Name,ElementName=Minimized}" Width="100" Background="#FF9900" BorderBrush="#FF9900" />
</WrapPanel>
<UniformGrid Grid.Row="1">
<DataGrid Grid.Row="0" ItemsSource="{Binding ListItems}" Background="#00000000"

Loading…
Cancel
Save