桌面端新增密炼计划获取
This commit is contained in:
@@ -178,6 +178,10 @@ public class StompWebSocketService : ISignalRService
|
||||
await SendFrameAsync(
|
||||
BuildSubscribeFrame("sub-mes-rubber-quick-test-stds", "/topic/sync/mes-rubber-quick-test-stds"),
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
// 密炼生产计划变更:订阅 /topic/sync/mes-mixing-production-plans
|
||||
await SendFrameAsync(
|
||||
BuildSubscribeFrame("sub-mes-xsl-mixing-production-plan", "/topic/sync/mes-mixing-production-plans"),
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// 订阅服务端 PONG 回复(应用层假在线检测)
|
||||
await SendFrameAsync(
|
||||
|
||||
@@ -20,6 +20,7 @@ using YY.Admin.Views.Print;
|
||||
using YY.Admin.Views.MixerMaterialTareStrategy;
|
||||
using YY.Admin.Views.RubberQuickTest;
|
||||
using YY.Admin.Views.RubberQuickTestStd;
|
||||
using YY.Admin.Views.MixingProductionPlan;
|
||||
|
||||
namespace YY.Admin
|
||||
{
|
||||
@@ -101,6 +102,8 @@ namespace YY.Admin
|
||||
containerRegistry.RegisterForNavigation<RubberQuickTestOperationView>();
|
||||
// 胶料快检实验标准(只读)
|
||||
containerRegistry.RegisterForNavigation<RubberQuickTestStdListView>();
|
||||
// 密炼计划(只读)
|
||||
containerRegistry.RegisterForNavigation<MixingProductionPlanListView>();
|
||||
// 打印设置
|
||||
containerRegistry.RegisterForNavigation<PrintSettingsView>();
|
||||
// 打印模板列表
|
||||
|
||||
@@ -29,6 +29,7 @@ using YY.Admin.Services.Service.WeightRecord;
|
||||
using YY.Admin.Services.Service.Print;
|
||||
using YY.Admin.Services.Service.RubberQuickTest;
|
||||
using YY.Admin.Services.Service.RubberQuickTestStd;
|
||||
using YY.Admin.Services.Service.MixingProductionPlan;
|
||||
|
||||
namespace YY.Admin.Module;
|
||||
|
||||
@@ -95,6 +96,10 @@ public class SyncModule : IModule
|
||||
containerRegistry.RegisterSingleton<IRubberQuickTestStdService, RubberQuickTestStdService>();
|
||||
containerRegistry.RegisterSingleton<RubberQuickTestStdSyncCoordinator>();
|
||||
|
||||
// 密炼计划(MES 只读同步)
|
||||
containerRegistry.RegisterSingleton<IMixingProductionPlanService, MixingProductionPlanService>();
|
||||
containerRegistry.RegisterSingleton<MixingProductionPlanSyncCoordinator>();
|
||||
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddTransient<DisconnectGuardHandler>();
|
||||
serviceCollection.AddHttpClient("JeecgApi", (sp, client) =>
|
||||
@@ -167,6 +172,8 @@ public class SyncModule : IModule
|
||||
_ = containerProvider.Resolve<PrintBizTemplateBindSyncCoordinator>();
|
||||
// 胶料快检实验标准只读同步协调器
|
||||
_ = containerProvider.Resolve<RubberQuickTestStdSyncCoordinator>();
|
||||
// 密炼计划只读同步协调器
|
||||
_ = containerProvider.Resolve<MixingProductionPlanSyncCoordinator>();
|
||||
}
|
||||
|
||||
private static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy()
|
||||
|
||||
@@ -162,6 +162,11 @@ namespace YY.Admin.ViewModels.Control
|
||||
["/xslmes/mesXslRubberQuickTestStd"] = "RubberQuickTestStdListView",
|
||||
["mesXslRubberQuickTestStd"] = "RubberQuickTestStdListView",
|
||||
|
||||
// 已实现页面:密炼计划(只读)
|
||||
["MixingProductionPlanListView"] = "MixingProductionPlanListView",
|
||||
["/xslmes/mesXslMixingProductionPlan"] = "MixingProductionPlanListView",
|
||||
["mesXslMixingProductionPlan"] = "MixingProductionPlanListView",
|
||||
|
||||
// 已实现页面:打印设置
|
||||
["PrintSettingsView"] = "PrintSettingsView",
|
||||
["/system/printSettings"] = "PrintSettingsView",
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
using HandyControl.Controls;
|
||||
using Prism.Events;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using YY.Admin.Core;
|
||||
using YY.Admin.Core.Entity;
|
||||
using YY.Admin.Core.Events;
|
||||
using YY.Admin.Core.Helper;
|
||||
using YY.Admin.Core.Services;
|
||||
using YY.Admin.Services.Service;
|
||||
|
||||
namespace YY.Admin.ViewModels.MixingProductionPlan;
|
||||
|
||||
public class MixingProductionPlanListViewModel : BaseViewModel
|
||||
{
|
||||
private readonly IMixingProductionPlanService _planService;
|
||||
private SubscriptionToken? _changedToken;
|
||||
|
||||
private ObservableCollection<MesXslMixingProductionPlan> _items = new();
|
||||
public ObservableCollection<MesXslMixingProductionPlan> Items
|
||||
{
|
||||
get => _items;
|
||||
set => SetProperty(ref _items, value);
|
||||
}
|
||||
|
||||
private long _total;
|
||||
public long Total { get => _total; set => SetProperty(ref _total, value); }
|
||||
|
||||
private int _pageNo = 1;
|
||||
public int PageNo { get => _pageNo; set => SetProperty(ref _pageNo, value); }
|
||||
|
||||
private int _pageSize = 20;
|
||||
public int PageSize { get => _pageSize; set => SetProperty(ref _pageSize, value); }
|
||||
|
||||
private DateTime? _filterPlanDateFrom;
|
||||
public DateTime? FilterPlanDateFrom { get => _filterPlanDateFrom; set => SetProperty(ref _filterPlanDateFrom, value); }
|
||||
|
||||
private DateTime? _filterPlanDateTo;
|
||||
public DateTime? FilterPlanDateTo { get => _filterPlanDateTo; set => SetProperty(ref _filterPlanDateTo, value); }
|
||||
|
||||
private string? _filterMachineName;
|
||||
public string? FilterMachineName { get => _filterMachineName; set => SetProperty(ref _filterMachineName, value); }
|
||||
|
||||
private int? _filterShiftFlag;
|
||||
public int? FilterShiftFlag { get => _filterShiftFlag; set => SetProperty(ref _filterShiftFlag, value); }
|
||||
|
||||
private string? _filterPlanNo;
|
||||
public string? FilterPlanNo { get => _filterPlanNo; set => SetProperty(ref _filterPlanNo, value); }
|
||||
|
||||
private string? _filterMaterialName;
|
||||
public string? FilterMaterialName { get => _filterMaterialName; set => SetProperty(ref _filterMaterialName, value); }
|
||||
|
||||
public ObservableCollection<KeyValuePair<string, int?>> ShiftOptions { get; } = new()
|
||||
{
|
||||
new KeyValuePair<string, int?>("全部", null),
|
||||
new KeyValuePair<string, int?>("早班", 1),
|
||||
new KeyValuePair<string, int?>("中班", 2),
|
||||
new KeyValuePair<string, int?>("晚班", 3)
|
||||
};
|
||||
|
||||
public DelegateCommand SearchCommand { get; }
|
||||
public DelegateCommand ResetCommand { get; }
|
||||
public DelegateCommand PrevPageCommand { get; }
|
||||
public DelegateCommand NextPageCommand { get; }
|
||||
|
||||
public MixingProductionPlanListViewModel(
|
||||
IMixingProductionPlanService planService,
|
||||
IContainerExtension container,
|
||||
IRegionManager regionManager) : base(container, regionManager)
|
||||
{
|
||||
_planService = planService;
|
||||
|
||||
SearchCommand = new DelegateCommand(async () => { PageNo = 1; await LoadAsync(); });
|
||||
ResetCommand = new DelegateCommand(async () =>
|
||||
{
|
||||
FilterPlanDateFrom = null;
|
||||
FilterPlanDateTo = null;
|
||||
FilterMachineName = null;
|
||||
FilterShiftFlag = null;
|
||||
FilterPlanNo = null;
|
||||
FilterMaterialName = null;
|
||||
PageNo = 1;
|
||||
await LoadAsync();
|
||||
});
|
||||
PrevPageCommand = new DelegateCommand(async () => { if (PageNo > 1) { PageNo--; await LoadAsync(); } });
|
||||
NextPageCommand = new DelegateCommand(async () => { if ((long)PageNo * PageSize < Total) { PageNo++; await LoadAsync(); } });
|
||||
|
||||
_changedToken = _eventAggregator.GetEvent<MixingProductionPlanChangedEvent>()
|
||||
.Subscribe(async _ => await LoadAsync(), ThreadOption.UIThread);
|
||||
|
||||
_ = InitializeAsync();
|
||||
}
|
||||
|
||||
private async Task InitializeAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
await UIHelper.WaitForRenderAsync();
|
||||
await LoadAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"密炼计划列表初始化失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LoadAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
IsLoading = true;
|
||||
var result = await _planService.PageAsync(
|
||||
PageNo, PageSize,
|
||||
FilterPlanDateFrom, FilterPlanDateTo,
|
||||
FilterMachineName, FilterShiftFlag,
|
||||
FilterPlanNo, FilterMaterialName);
|
||||
Items = new ObservableCollection<MesXslMixingProductionPlan>(result.Records);
|
||||
Total = result.Total;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error($"加载密炼计划失败:{ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void CleanUp()
|
||||
{
|
||||
base.CleanUp();
|
||||
if (_changedToken != null)
|
||||
{
|
||||
_eventAggregator.GetEvent<MixingProductionPlanChangedEvent>().Unsubscribe(_changedToken);
|
||||
_changedToken = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,10 @@ public class MixingPlanShiftOption
|
||||
public string? PlanId { get; set; }
|
||||
public string? OrderNo { get; set; }
|
||||
public string? FormulaName { get; set; }
|
||||
public string? MaterialName { get; set; }
|
||||
public string DisplayText => string.IsNullOrWhiteSpace(OrderNo)
|
||||
? FormulaName ?? string.Empty
|
||||
: $"{OrderNo} | {FormulaName}";
|
||||
? MaterialName ?? FormulaName ?? string.Empty
|
||||
: $"{OrderNo} | {MaterialName ?? FormulaName}";
|
||||
}
|
||||
|
||||
public class QuickTestInspectCellViewModel : BindableBase
|
||||
@@ -217,7 +218,7 @@ public class RubberQuickTestOperationViewModel : BaseViewModel
|
||||
public string? ProductionOrderNo => _selectedPlan?.OrderNo;
|
||||
public string? MachineName => _selectedPlan?.MachineName ?? SelectedMachine;
|
||||
public string? WorkShiftDisplay => SelectedShift?.Name ?? string.Empty;
|
||||
public string? RubberMaterialName => _selectedPlan?.FormulaName;
|
||||
public string? RubberMaterialName => _selectedPlan?.MaterialName ?? _selectedPlan?.FormulaName;
|
||||
|
||||
private string? _trainNo;
|
||||
public string? TrainNo
|
||||
@@ -286,32 +287,25 @@ public class RubberQuickTestOperationViewModel : BaseViewModel
|
||||
_allShiftOptions.Clear();
|
||||
foreach (var row in _allPlans)
|
||||
{
|
||||
AddShiftOption(row, "morning", "1", "早班", row.MorningPlanId, row.MorningOrderDate, row.MorningOrderNo, row.MorningFormulaName);
|
||||
AddShiftOption(row, "noon", "2", "中班", row.NoonPlanId, row.NoonOrderDate, row.NoonOrderNo, row.NoonFormulaName);
|
||||
AddShiftOption(row, "night", "3", "晚班", row.NightPlanId, row.NightOrderDate, row.NightOrderNo, row.NightFormulaName);
|
||||
if (string.IsNullOrWhiteSpace(row.PlanId)) continue;
|
||||
var shiftCode = row.ShiftFlag?.ToString() ?? string.Empty;
|
||||
_allShiftOptions.Add(new MixingPlanShiftOption
|
||||
{
|
||||
PlanRowId = row.Id ?? string.Empty,
|
||||
MachineId = row.MachineId,
|
||||
MachineName = row.MachineName,
|
||||
ShiftKey = shiftCode,
|
||||
ShiftCode = shiftCode,
|
||||
ShiftName = row.ShiftFlagText,
|
||||
OrderDate = row.PlanDate,
|
||||
PlanId = row.PlanId,
|
||||
OrderNo = row.OrderNo,
|
||||
FormulaName = row.FormulaName,
|
||||
MaterialName = row.MaterialName
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void AddShiftOption(
|
||||
MesXslMixingProductionPlan row, string shiftKey, string shiftCode, string shiftName,
|
||||
string? planId, DateTime? orderDate, string? orderNo, string? formulaName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(planId) || string.IsNullOrWhiteSpace(orderNo)) return;
|
||||
_allShiftOptions.Add(new MixingPlanShiftOption
|
||||
{
|
||||
PlanRowId = row.Id ?? string.Empty,
|
||||
MachineId = row.MachineId,
|
||||
MachineName = row.MachineName,
|
||||
ShiftKey = shiftKey,
|
||||
ShiftCode = shiftCode,
|
||||
ShiftName = shiftName,
|
||||
OrderDate = orderDate,
|
||||
PlanId = planId,
|
||||
OrderNo = orderNo,
|
||||
FormulaName = formulaName
|
||||
});
|
||||
}
|
||||
|
||||
private IEnumerable<MixingPlanShiftOption> FilteredByDate =>
|
||||
_allShiftOptions.Where(o => o.OrderDate?.Date == MixingDate.Date);
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
<UserControl x:Class="YY.Admin.Views.MixingProductionPlan.MixingProductionPlanListView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Style="{StaticResource BaseViewStyle}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border Grid.Row="0" CornerRadius="4" Margin="0 0 -10 0">
|
||||
<hc:Row>
|
||||
<hc:Col Layout="{hc:ColLayout Xs=12, Sm=8, Md=6, Lg=6, Xl=4}">
|
||||
<hc:DatePicker SelectedDate="{Binding FilterPlanDateFrom}"
|
||||
Margin="0 0 10 10"
|
||||
hc:InfoElement.Title="密炼日期起"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="80"
|
||||
hc:InfoElement.Placeholder="开始日期"/>
|
||||
</hc:Col>
|
||||
<hc:Col Layout="{hc:ColLayout Xs=12, Sm=8, Md=6, Lg=6, Xl=4}">
|
||||
<hc:DatePicker SelectedDate="{Binding FilterPlanDateTo}"
|
||||
Margin="0 0 10 10"
|
||||
hc:InfoElement.Title="密炼日期止"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="80"
|
||||
hc:InfoElement.Placeholder="结束日期"/>
|
||||
</hc:Col>
|
||||
<hc:Col Layout="{hc:ColLayout Xs=12, Sm=8, Md=6, Lg=6, Xl=4}">
|
||||
<hc:TextBox Text="{Binding FilterMachineName, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="0 0 10 10"
|
||||
hc:InfoElement.Title="机台名称"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="80"
|
||||
hc:InfoElement.Placeholder="机台名称"
|
||||
hc:InfoElement.ShowClearButton="True"/>
|
||||
</hc:Col>
|
||||
<hc:Col Layout="{hc:ColLayout Xs=12, Sm=8, Md=6, Lg=6, Xl=4}">
|
||||
<hc:ComboBox SelectedValuePath="Value"
|
||||
DisplayMemberPath="Key"
|
||||
ItemsSource="{Binding ShiftOptions}"
|
||||
SelectedValue="{Binding FilterShiftFlag}"
|
||||
Margin="0 0 10 10"
|
||||
hc:InfoElement.Title="班次"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="80"
|
||||
hc:InfoElement.Placeholder="全部"/>
|
||||
</hc:Col>
|
||||
<hc:Col Layout="{hc:ColLayout Xs=12, Sm=8, Md=6, Lg=6, Xl=4}">
|
||||
<hc:TextBox Text="{Binding FilterPlanNo, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="0 0 10 10"
|
||||
hc:InfoElement.Title="计划号"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="80"
|
||||
hc:InfoElement.Placeholder="计划号"
|
||||
hc:InfoElement.ShowClearButton="True"/>
|
||||
</hc:Col>
|
||||
<hc:Col Layout="{hc:ColLayout Xs=12, Sm=8, Md=6, Lg=6, Xl=4}">
|
||||
<hc:TextBox Text="{Binding FilterMaterialName, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="0 0 10 10"
|
||||
hc:InfoElement.Title="胶料名称"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="80"
|
||||
hc:InfoElement.Placeholder="胶料名称"
|
||||
hc:InfoElement.ShowClearButton="True"/>
|
||||
</hc:Col>
|
||||
</hc:Row>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Margin="0,10">
|
||||
<hc:UniformSpacingPanel Spacing="10">
|
||||
<Button Style="{StaticResource ButtonPrimary}" Command="{Binding SearchCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<md:PackIcon Kind="Search"/>
|
||||
<TextBlock Text="搜索" Style="{StaticResource IconButtonStyle}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ButtonDefault}" Command="{Binding ResetCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<md:PackIcon Kind="Refresh"/>
|
||||
<TextBlock Text="重置" Style="{StaticResource IconButtonStyle}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<TextBlock Text="数据来自 MES 密炼生产计划维护,桌面端只读;断网时显示本地缓存,联网后自动刷新"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource SecondaryTextBrush}"
|
||||
FontSize="12"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</Border>
|
||||
|
||||
<DataGrid Grid.Row="2"
|
||||
ItemsSource="{Binding Items}"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
CanUserAddRows="False"
|
||||
SelectionMode="Single"
|
||||
GridLinesVisibility="Horizontal"
|
||||
HorizontalGridLinesBrush="#FFEDEDED"
|
||||
VerticalGridLinesBrush="Transparent"
|
||||
HeadersVisibility="All"
|
||||
ColumnHeaderStyle="{StaticResource CusDataGridColumnHeaderStyle}"
|
||||
Style="{StaticResource CusDataGridStyle}"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Auto">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="密炼日期" Binding="{Binding PlanDateText}" CellStyle="{StaticResource CusDataGridCellStyle}" Width="110"/>
|
||||
<DataGridTextColumn Header="机台名称" Binding="{Binding MachineName}" CellStyle="{StaticResource CusDataGridCellStyle}" Width="140"/>
|
||||
<DataGridTextColumn Header="班次" Binding="{Binding ShiftFlagText}" CellStyle="{StaticResource CusDataGridCellStyle}" Width="80"/>
|
||||
<DataGridTextColumn Header="计划号" Binding="{Binding PlanNo}" CellStyle="{StaticResource CusDataGridCellStyle}" Width="140"/>
|
||||
<DataGridTextColumn Header="计划数量" Binding="{Binding PlanCount}" CellStyle="{StaticResource CusDataGridCellStyle}" Width="90"/>
|
||||
<DataGridTextColumn Header="胶料名称" Binding="{Binding MaterialName}" CellStyle="{StaticResource CusDataGridCellStyle}" Width="*"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
|
||||
<TextBlock Text="{Binding Total, StringFormat=共 {0} 条}" VerticalAlignment="Center" Margin="0,0,16,0"
|
||||
Foreground="{DynamicResource SecondaryTextBrush}"/>
|
||||
<Button Content="上一页" Command="{Binding PrevPageCommand}" Style="{StaticResource ButtonDefault}" Margin="0,0,4,0" Width="80"/>
|
||||
<TextBlock Text="{Binding PageNo, StringFormat=第 {0} 页}" VerticalAlignment="Center" Margin="8,0"
|
||||
Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Button Content="下一页" Command="{Binding NextPageCommand}" Style="{StaticResource ButtonDefault}" Width="80"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace YY.Admin.Views.MixingProductionPlan;
|
||||
|
||||
public partial class MixingProductionPlanListView : UserControl
|
||||
{
|
||||
public MixingProductionPlanListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user