完善 MCS 桌面代理与开炼机动作同步,修复原料相关菜单权限,桌面端新增上辅机 MES 菜单。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-27 15:56:05 +08:00
parent 7a9c19e4f3
commit 442a4c8ae2
113 changed files with 10169 additions and 91 deletions

View File

@@ -0,0 +1,100 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using HandyControl.Controls;
using YY.Admin.Core;
using YY.Admin.Core.Helper;
using YY.Admin.Services.Service.EquipmentDb;
namespace YY.Admin.ViewModels.McsActMill;
public class McsActMillListViewModel : BaseViewModel
{
private readonly IMcsActMillService _service;
private ObservableCollection<McsActMillRow> _items = new();
public ObservableCollection<McsActMillRow> 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 string? _filterActName;
public string? FilterActName { get => _filterActName; set => SetProperty(ref _filterActName, value); }
private string? _filterActAddrText;
public string? FilterActAddrText { get => _filterActAddrText; set => SetProperty(ref _filterActAddrText, value); }
public DelegateCommand SearchCommand { get; }
public DelegateCommand ResetCommand { get; }
public DelegateCommand PrevPageCommand { get; }
public DelegateCommand NextPageCommand { get; }
public McsActMillListViewModel(
IMcsActMillService service,
IContainerExtension container,
IRegionManager regionManager) : base(container, regionManager)
{
_service = service;
SearchCommand = new DelegateCommand(async () => { PageNo = 1; await LoadAsync(); });
ResetCommand = new DelegateCommand(async () =>
{
FilterActName = null;
FilterActAddrText = 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(); } });
_ = 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;
int? actAddr = null;
if (!string.IsNullOrWhiteSpace(FilterActAddrText)
&& int.TryParse(FilterActAddrText.Trim(), out var parsed))
{
actAddr = parsed;
}
var result = await _service.PageAsync(PageNo, PageSize, FilterActName, actAddr);
Items = new ObservableCollection<McsActMillRow>(result.Records);
Total = result.Total;
}
catch (Exception ex)
{
Growl.Error($"加载开炼机动作中间表失败:{ex.Message}");
}
finally
{
IsLoading = false;
}
}
}