add-添加投料模式切换按钮

dev
liuwf 1 month ago
parent d6f0632f8e
commit b91ba72fe5

@ -31,6 +31,8 @@
<Label Content="选择库位" FontSize="20" VerticalAlignment="Center" Foreground="White" /> <Label Content="选择库位" FontSize="20" VerticalAlignment="Center" Foreground="White" />
<TextBox x:Name="queryParam" FontSize="20" BorderThickness="3" Text="" Width="100" HorizontalAlignment="Left" VerticalContentAlignment="Center" Style="{StaticResource TextBoxStyle}" Foreground="White"/> <TextBox x:Name="queryParam" FontSize="20" BorderThickness="3" Text="" Width="100" HorizontalAlignment="Left" VerticalContentAlignment="Center" Style="{StaticResource TextBoxStyle}" Foreground="White"/>
<Button Content="手动投料" FontSize="16" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="35" Background="LimeGreen" BorderBrush="#007DFA" Margin="10,0,10,0" Command="{Binding QueryStringCommand}" CommandParameter="{Binding Text, ElementName=queryParam}" /> <Button Content="手动投料" FontSize="16" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="35" Background="LimeGreen" BorderBrush="#007DFA" Margin="10,0,10,0" Command="{Binding QueryStringCommand}" CommandParameter="{Binding Text, ElementName=queryParam}" />
<Button Content="投料模式切换" FontSize="20" Foreground="White" Width="150" Height="35" Background="#ffa200" BorderBrush="#007DFA" Margin="200,0,10,0" Command="{Binding ChangeModeCommand}" />
</WrapPanel> </WrapPanel>
<Border Grid.Row="1" BorderBrush="White" BorderThickness="1,1,0,1" CornerRadius="5"> <Border Grid.Row="1" BorderBrush="White" BorderThickness="1,1,0,1" CornerRadius="5">

@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Business; using SlnMesnac.Business;
using SlnMesnac.Model.domain; using SlnMesnac.Model.domain;
using SlnMesnac.Model.dto; using SlnMesnac.Model.dto;
using SlnMesnac.WPF.MessageTips;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -134,21 +135,24 @@ namespace SlnMesnac.WPF.ViewModel
/// <param name="palletTasks"></param> /// <param name="palletTasks"></param>
private async Task RefreshWcsTaskDataGrid() private async Task RefreshWcsTaskDataGrid()
{ {
List<WcsTask> agvList = await sqlSugarClient.AsTenant().GetConnection("mes").Queryable<WcsTask>().Where(x => x.NextPointId == 8 || x.NextPointId==9).ToListAsync(); try
await App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
WcsTaskDataGrid.Clear(); List<WcsTask> agvList = await sqlSugarClient.AsTenant().GetConnection("mes").Queryable<WcsTask>().Where(x => x.NextPointId == 8 || x.NextPointId == 9).ToListAsync();
foreach (var agv in agvList) await App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
WcsTaskDataGrid.Add(agv); WcsTaskDataGrid.Clear();
} foreach (var agv in agvList)
})); {
WcsTaskDataGrid.Add(agv);
}
}));
}catch(Exception ex)
{
Msg.MsgShow($"刷新AGV状态信息异常{ex.Message}", 2, 3);
}
} }
} }
} }

@ -2,6 +2,7 @@
using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Command;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Business; using SlnMesnac.Business;
using SlnMesnac.Config;
using SlnMesnac.Model.domain; using SlnMesnac.Model.domain;
using SlnMesnac.Model.dto; using SlnMesnac.Model.dto;
using SlnMesnac.Model.enums; using SlnMesnac.Model.enums;
@ -47,7 +48,7 @@ namespace SlnMesnac.WPF.ViewModel
private readonly IWmsRawPreferredOutService? wmsRawPreferredOutService; private readonly IWmsRawPreferredOutService? wmsRawPreferredOutService;
private readonly ISqlSugarClient? sqlSugarClient; private readonly ISqlSugarClient? sqlSugarClient;
private readonly DebugConfig debugConfig = DebugConfig.Instance;
public ManualDeliveryViewModel() public ManualDeliveryViewModel()
{ {
wmsRawPreferredOutService = App.ServiceProvider.GetService<IWmsRawPreferredOutService>(); wmsRawPreferredOutService = App.ServiceProvider.GetService<IWmsRawPreferredOutService>();
@ -58,6 +59,7 @@ namespace SlnMesnac.WPF.ViewModel
// ConfirmCommand = new RelayCommand<object>(Confirm); // ConfirmCommand = new RelayCommand<object>(Confirm);
DeleteCommand = new RelayCommand<object>(Delete); DeleteCommand = new RelayCommand<object>(Delete);
ChangeModeCommand = new RelayCommand<object>(ChangeMode);
} }
private void Init() private void Init()
@ -105,7 +107,12 @@ namespace SlnMesnac.WPF.ViewModel
#region 事件定义 #region 事件定义
public RelayCommand<string> QueryStringCommand { get; set; } public RelayCommand<string> QueryStringCommand { get; set; }
/// <summary>
/// 投料模式切换
/// </summary>
public RelayCommand<object> ChangeModeCommand { get; set; }
/// <summary> /// <summary>
/// 关闭事件 /// 关闭事件
@ -275,5 +282,13 @@ namespace SlnMesnac.WPF.ViewModel
Init(); Init();
} }
} }
private void ChangeMode(object parameter)
{
debugConfig.ProductMode = debugConfig.ProductMode=="1"?"2":"1";
}
} }
} }

Loading…
Cancel
Save