修改已知问题
This commit is contained in:
@@ -41,7 +41,6 @@ namespace FATrace.WPLApp.ViewModels
|
||||
_ea = ea;
|
||||
|
||||
LiveMessages = new ObservableCollection<string>();
|
||||
LineTempCodes = new ObservableCollection<LineTempCode>();
|
||||
|
||||
RefreshCommand = new DelegateCommand(async () => await RefreshStatsAsync());
|
||||
ClearLogsCommand = new DelegateCommand(() => LiveMessages.Clear());
|
||||
@@ -168,7 +167,6 @@ namespace FATrace.WPLApp.ViewModels
|
||||
try
|
||||
{
|
||||
await RefreshStatsAsync();
|
||||
await RefreshLineTempCodesAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -206,11 +204,6 @@ namespace FATrace.WPLApp.ViewModels
|
||||
public bool PlcConnected { get => _plcConnected; set { _plcConnected = value; RaisePropertyChanged(); } }
|
||||
|
||||
public ObservableCollection<string> LiveMessages { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 产线临时条码队列(内包扫码入队,外箱扫码确认后出队)
|
||||
/// </summary>
|
||||
public ObservableCollection<LineTempCode> LineTempCodes { get; }
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
@@ -285,52 +278,6 @@ namespace FATrace.WPLApp.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从数据库刷新产线临时队列(LineTempCode 表)并同步到 UI。
|
||||
/// </summary>
|
||||
private async Task RefreshLineTempCodesAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = await Task.Run(() =>
|
||||
{
|
||||
return _fsql.Select<LineTempCode>()
|
||||
.OrderBy(a => a.Id)
|
||||
.Limit(200)
|
||||
.ToList();
|
||||
});
|
||||
|
||||
void apply()
|
||||
{
|
||||
LineTempCodes.Clear();
|
||||
foreach (var item in list)
|
||||
{
|
||||
LineTempCodes.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
var dispatcher = Application.Current?.Dispatcher;
|
||||
if (dispatcher == null)
|
||||
{
|
||||
apply();
|
||||
return;
|
||||
}
|
||||
|
||||
if (dispatcher.CheckAccess())
|
||||
{
|
||||
apply();
|
||||
}
|
||||
else
|
||||
{
|
||||
await dispatcher.InvokeAsync(apply).Task.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Error($"刷新 LineTempCode 队列失败: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
public override async void OnNavigatedTo(Prism.Regions.NavigationContext navigationContext)
|
||||
{
|
||||
try
|
||||
@@ -351,7 +298,6 @@ namespace FATrace.WPLApp.ViewModels
|
||||
LatestWeightScanCode = _data.WeightScanCode;
|
||||
LatestBoxScanCode = _data.BoxScanCode;
|
||||
LatestBoxSprayCode = _data.BoxSprayCode;
|
||||
await RefreshLineTempCodesAsync();
|
||||
TryHookConsole();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user