first edit

This commit is contained in:
Курнат Андрей
2026-01-31 16:11:36 +03:00
commit f0e11d6379
148 changed files with 6986 additions and 0 deletions

10
XLIMS.PSV/AssemblyInfo.cs Normal file
View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@@ -0,0 +1,16 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:XLIMS.PSV.ViewModels"
xmlns:v="clr-namespace:XLIMS.PSV.Views">
<DataTemplate DataType="{x:Type vm:BrowseSerialViewModel}">
<v:BrowseSerialView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:BrowseTprzViewModel}">
<v:BrowseTprzView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:BadViewModel}">
<v:BadView/>
</DataTemplate>
</ResourceDictionary>

View File

@@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.ComponentModel;
using System.Xml.Linq;
using Microsoft.Win32;
using System.IO;
using XLIMS.MVVM.Base;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
namespace XLIMS.PSV.ViewModels
{
public class BadViewModel : ViewModelBase
{
#region Constructor
public BadViewModel(ILimsService limsService, DataSet data)
{
_limsService = limsService;
_currentData = data;
if (_currentData.Gdn == null)
{
_povDoc = new DocumentSet() { Division = _currentData.Device.Division,Name="Извещение" };
_currentData.DocumentPov = _povDoc;
}
else if (_currentData.DocumentPov != null) _povDoc = _currentData.DocumentPov;
LoadDataAsync();
}
#endregion //Constructor
#region Fields
private readonly ILimsService _limsService;
private DataSet _currentData;
private bool _isValid;
private PersonalSet _currentPersonal;
private DocumentSet _povDoc;
private BookSet _currentBook;
#endregion //Fields
#region Properties
public string Title => $"{_currentData.Device.Tip} №{_currentData.Device.Serial} {_currentData.Device.Name}";
public ObservableCollection<PersonalSet> AllPersonals { get; set; }
public ObservableCollection<BookSet> AllBooks { get; set; }
public BookSet CurrentBook
{
get => _currentBook;
set { _currentBook = value; OnPropertyChanged(); }
}
public PersonalSet CurrentPersonal
{
get => _currentPersonal;
set
{
_currentPersonal = value;
if (_currentPersonal != null) { _currentData.Person = _currentPersonal.Person; }
OnPropertyChanged();
}
}
public DateTime? PovDate
{
get => _currentData.Date;
set
{
_currentData.Date = value;
OnPropertyChanged();
}
}
public string Reason
{
get => _currentData.Reason;
set
{
_currentData.Reason = value;
OnPropertyChanged();
}
}
public string Number
{
get => _povDoc.Number;
set
{
_povDoc.Number = value;
OnPropertyChanged();
}
}
public DateTime? DocDate
{
get => _povDoc.DocDate;
set
{
_povDoc.DocDate = value;
OnPropertyChanged();
}
}
private async Task LoadDataAsync()
{
var personalTask = await _limsService.Personals.GetAllAsync();
var bookTask=await _limsService.Books.GetAllAsync();
AllPersonals=new ObservableCollection<PersonalSet>(personalTask);
AllBooks=new ObservableCollection<BookSet>(bookTask);
OnPropertyChanged(nameof(AllPersonals));
OnPropertyChanged(nameof(AllBooks));
}
private async Task SaveAsync()
{
if (_currentData.Gdn == null)
{
_currentData.Gdn = false;
await _limsService.Datas.UpdateAsync(_currentData);
var result = MessageBox.Show("Распечатать извещение?", "Внимание!", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.OK)
{
try
{
//await Task.Run(() => new Izv(_newDMS, _repository).Print());
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
}
else { await _limsService.Datas.UpdateAsync(_currentData); }
}
#endregion //properties
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync, () => CurrentPersonal != null && !string.IsNullOrEmpty(Number));
#endregion //Commands
#region IDataErrorInfo
#endregion
}
}

View File

@@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.PSV.ViewModels
{
public class BrowseSerialViewModel : ViewModelBase, IDisposable
{
private readonly ILimsService _limsService;
private int _divisionId;
private DeviceSet _currentSerial = null;
private string _search = string.Empty;
private CancellationTokenSource? _searchCts = null;
private bool _disposed = false;
public ObservableCollection<DeviceSet> AllSerial { get; } = new();
public ICollectionView SerialView { get; }
public DeviceSet? CurrentSerial
{
get => _currentSerial;
set
{
_currentSerial = value;
OnPropertyChanged();
}
}
public string Search
{
get => _search;
set
{
_search = value;
DebounceSearch();
OnPropertyChanged();
}
}
public BrowseSerialViewModel(ILimsService limsService, int divisionId)
{
_limsService = limsService;
_divisionId = divisionId;
SerialView = CollectionViewSource.GetDefaultView(AllSerial);
SerialView.Filter = SerialFilter;
LoadSerialsAsync();
}
private async Task LoadSerialsAsync()
{
AllSerial.Clear();
var devList = await _limsService.Devices.GetAllAsync();
foreach (var dev in devList.Where(e=>e.DivisionId==_divisionId))
{
AllSerial.Add(dev);
}
SerialView.Refresh();
}
private bool SerialFilter(object item)
{
if (item is not DeviceSet dev) return false;
if (string.IsNullOrWhiteSpace(Search)) return true;
var search = Search.Trim();
return (dev.Serial?.Contains(search, StringComparison.OrdinalIgnoreCase) == true)
|| (dev.Dpzn?.Contains(search, StringComparison.OrdinalIgnoreCase) == true)
|| (dev.Tip?.Contains(search, StringComparison.OrdinalIgnoreCase) == true)
|| (dev.Name?.Contains(search, StringComparison.OrdinalIgnoreCase) == true);
}
private ICommand? _saveCommand = null;
public ICommand SaveCommand => _saveCommand ??= new RelayCommand(_ => Save(), _ => CurrentSerial != null);
private void Save()
{
}
private async void DebounceSearch()
{
_searchCts?.Cancel();
_searchCts = new CancellationTokenSource();
try
{
await Task.Delay(300, _searchCts.Token);
SerialView.Refresh();
}
catch (TaskCanceledException) { }
}
public void Dispose()
{
if (_disposed) return;
_disposed = true;
GC.SuppressFinalize(this);
}
}
}

View File

@@ -0,0 +1,179 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Input;
using System.Runtime.CompilerServices;
using System.Threading;
using XLIMS.MVVM.Base;
using XLIMS.DATA.Models;
using XLIMS.CONTRACT;
namespace XLIMS.PSV.ViewModels
{
public class BrowseTprzViewModel : ViewModelBase, IDataErrorInfo, IDisposable
{
private readonly ILimsService _limsService;
private readonly ObservableCollection<Tprz> _allTprz = new();
private Tprz? _currentTprz = null;
private string _search = string.Empty;
private string _serial = string.Empty;
private bool _isValid;
private CancellationTokenSource? _searchCts;
private CancellationTokenSource? _loadCts;
private string _lastFilter = string.Empty;
public BrowseTprzViewModel(ILimsService limsService)
{
_limsService = limsService;
AllTPRZView = CollectionViewSource.GetDefaultView(_allTprz);
AllTPRZView.Filter = TprzFilter;
LoadTPRZAsync();
}
private async Task LoadTPRZAsync()
{
_loadCts?.Cancel();
_loadCts = new CancellationTokenSource();
try
{
_allTprz.Clear();
var items = await _limsService.Tprzs.GetAllAsync();
foreach (var item in items)
_allTprz.Add(item);
AllTPRZView.Refresh();
}
catch (OperationCanceledException) { }
catch (Exception)
{
// Логирование или отображение ошибки пользователю
}
}
public ICollectionView AllTPRZView { get; }
public Tprz? CurrentTPRZ
{
get => _currentTprz;
set
{
_currentTprz = value;
OnPropertyChanged();
}
}
public string Search
{
get => _search;
set
{
_search = value ?? string.Empty;
DebouncedRefresh();
OnPropertyChanged();
}
}
private async void DebouncedRefresh()
{
_searchCts?.Cancel();
_searchCts = new CancellationTokenSource();
try
{
await Task.Delay(300, _searchCts.Token);
AllTPRZView.Refresh();
}
catch (TaskCanceledException) { }
}
public string Serial
{
get => _serial;
set
{
_serial = value?.Trim() ?? string.Empty;
OnPropertyChanged();
}
}
private bool TprzFilter(object obj)
{
if (obj is not Tprz tprz) return false;
var filter = Search?.Trim() ?? string.Empty;
if (_lastFilter != filter)
_lastFilter = filter;
if (string.IsNullOrWhiteSpace(_lastFilter)) return true;
return (tprz.Dpzn?.Contains(_lastFilter, StringComparison.OrdinalIgnoreCase) == true)
|| (tprz.IdtipNavigation.Tp?.Contains(_lastFilter, StringComparison.OrdinalIgnoreCase) == true)
|| (tprz.IdtipNavigation?.IdspnmtpNavigation?.Nmtp?.Contains(_lastFilter, StringComparison.OrdinalIgnoreCase) == true);
}
private RelayCommand? _saveCommand;
public ICommand SaveCommand => _saveCommand ??= new RelayCommand(_ => Save(), _ => _isValid && CurrentTPRZ != null);
private void Save()
{
}
private new void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
base.OnPropertyChanged(propertyName);
if (propertyName == nameof(Serial) || propertyName == nameof(CurrentTPRZ))
CommandManager.InvalidateRequerySuggested();
}
#region IDataErrorInfo
public string Error => string.Empty;
private void ValidateAll()
{
_isValid = Validate();
CommandManager.InvalidateRequerySuggested();
}
public string this[string columnName]
{
get
{
string msg = string.Empty;
switch (columnName)
{
case nameof(Serial):
if (string.IsNullOrWhiteSpace(Serial))
msg = "Поле не может быть пустым!";
break;
}
ValidateAll();
return msg;
}
}
private bool Validate()
{
// Добавьте комплексную валидацию всех нужных полей
return !string.IsNullOrWhiteSpace(Serial);
}
#endregion
private bool _disposed = false;
public void Dispose()
{
if (_disposed) return;
_disposed = true;
_searchCts?.Dispose();
_loadCts?.Dispose();
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
using XLIMS.MVVM.Base;
namespace XLIMS.PSV.ViewModels
{
public class DocPovViewModel:ViewModelBase
{
#region Constructor
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
#endregion //Fields
#region Properties
#endregion //Properties
#region Methods
#endregion //Methods
#region Commands
#endregion //Commands
}
}

View File

@@ -0,0 +1,192 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Xml.Linq;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace XLIMS.PSV.ViewModels
{
public class GoodViewModel:ViewModelBase
{
#region Constructor
public GoodViewModel(ILimsService limsService, DataSet data)
{
_limsService = limsService;
_currentData = data;
if (_currentData.Gdn == null) _povDoc = new DocumentSet() { Division = _currentData.Device.Division };
else if (_currentData.DocumentPov != null) _povDoc = _currentData.DocumentPov;
LoadDataAsync();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private DataSet _currentData;
private PersonalSet _currentPersonal;
private DocumentSet _povDoc;
private BookSet _currentBook;
#endregion //Fields
#region Properties
public string Title => $"{_currentData.Device.Tip} №{_currentData.Device.Serial} {_currentData.Device.Name}";
public ObservableCollection<PersonalSet> AllPersonals { get; set; } = new();
public ObservableCollection<BookSet> AllBooks { get; set; } = new();
public BookSet CurrentBook
{
get => _currentBook;
set { _currentBook = value; OnPropertyChanged(); }
}
public PersonalSet CurrentPersonal
{
get => _currentPersonal;
set
{
_currentPersonal = value;
if (_currentPersonal != null) { _currentData.Person = _currentPersonal.Person; }
OnPropertyChanged();
}
}
public DateTime? PovDate
{
get => _currentData.Date;
set
{
_currentData.Date = value;
OnPropertyChanged();
}
}
public int? Nkl
{
get { return _currentData.Nkl; }
set
{
_currentData.Nkl = value;
OnPropertyChanged();
}
}
public string Number
{
get => _povDoc.Number;
set
{
_povDoc.Number = value;
OnPropertyChanged();
}
}
public DateTime? DocDate
{
get => _povDoc.DocDate;
set
{
_povDoc.DocDate = value;
OnPropertyChanged();
}
}
#endregion //Properties
#region Methods
private async Task LoadDataAsync()
{
var personalTask = await _limsService.Personals.GetAllAsync();
var bookTask = await _limsService.Books.GetAllAsync();
AllPersonals = new ObservableCollection<PersonalSet>(personalTask);
AllBooks = new ObservableCollection<BookSet>(bookTask);
OnPropertyChanged(nameof(PersonalSet));
OnPropertyChanged(nameof(BookSet));
}
private async Task SaveAsync()
{
if (_currentData.Gdn == null)
{
_currentData.Gdn = true;
await _limsService.Datas.AddAsync(_currentData);
}
else { await _limsService.Datas.UpdateAsync(_currentData); }
if (!string.IsNullOrEmpty(Number))
{
await _limsService.Documents.AddAsync(_povDoc);
if (MessageBox.Show("Распечатать свидетельство?", "Внимание!", MessageBoxButton.OKCancel).ToString() == "OK")
{
try
{
// await Task.Run(() => new Svid(_newDMS, _repository).Print());
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
}
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync,() => CurrentPersonal != null);
#endregion //Commands
#region IDEI
//public string Error => string.Join(Environment.NewLine, GetValidationErrors());
//public string this[string columnName]
//{
// get
// {
// string msg = null;
// if (columnName == nameof(NND))
// {
// if (_repository.Dms.Any(a => a.Nnd ==CurrentBook+NND))
// {
// msg = "Документ с таким номером уже есть в базе!";
// }
// }
// if (columnName == "DTMKFK")
// {
// if (DTMKFK < _currentEKZMK.DTPRM)
// {
// msg = "Дата поверки не может быть раньше даты приемки!";
// }
// }
// if (columnName == nameof(Temp))
// {
// if (Temp == 0)
// {
// msg = "Данные о теммпературе не могут быть равны нулю!";
// }
// }
// if (columnName == nameof(Hum))
// {
// if (Hum == 0)
// {
// msg = "Данные о влажности не могут быть равны нулю!";
// }
// }
// if (columnName == nameof(Press))
// {
// if (Press == 0)
// {
// msg = "Данные о давлении не могут быть равны нулю!";
// }
// }
// return msg;
// }
//}
#endregion //IDEI
}
}

View File

@@ -0,0 +1,158 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
using XLIMS.PSV.Views;
namespace XLIMS.PSV.ViewModels
{
public class MainViewModel : ViewModelBase,IActivityViewModel
{
#region Constructor
public MainViewModel(ILimsService limsService, IDialogService dialogService)
{
_limsService = limsService;
_dialogService = dialogService;
LoadSide();
_limsService.Datas.SetChanged += Datas_SetChanged;
}
private void Datas_SetChanged()
{
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly IDialogService _dialogService;
private SideItemViewModel _currentSideItem;
private DocumentSet _currentPsv;
private IGrouping<string,DataSet> _currentGroupPov;
private DataSet _currentPov;
#endregion //Fields
#region Properties
public ObservableCollection<SideItemViewModel> SideItems { get; set; } = new();
public SideItemViewModel CurrentSideItem
{
get => _currentSideItem;
set
{
_currentSideItem = value;
if (_currentSideItem != null) { LoadPsvAsync(_currentSideItem.Index); }
OnPropertyChanged();
}
}
public ObservableCollection<DocumentSet> AllPsvs { get; set; } = new();
public DocumentSet CurrentPsv
{
get => _currentPsv;
set
{
_currentPsv = value;
if (_currentPsv != null) { LoadDataAsync(_currentPsv); }
OnPropertyChanged();
}
}
public ObservableCollection<IGrouping<string,DataSet>> GroupedPovs { get; set; }
public IGrouping<string, DataSet> CurrentGroupPov
{
get => _currentGroupPov;
set { _currentGroupPov = value; OnPropertyChanged(); }
}
public DataSet CurrentPov
{
get => _currentPov;
set { _currentPov = value; OnPropertyChanged(); }
}
public string Title => "ПСВ";
public object View => new MainView();
#endregion //Properties
#region Methods
public void LoadSide()
{
var side=new List<SideItemViewModel>();
side.Add(new SideItemViewModel(1,"Срочные"));
side.Add(new SideItemViewModel(2,"Открытые"));
side.Add(new SideItemViewModel(3,"Архив"));
SideItems = new ObservableCollection<SideItemViewModel>(side);
OnPropertyChanged(nameof(SideItems));
}
public async Task LoadPsvAsync(int index)
{
try
{
var psvsTask = await _limsService.Documents.GetAllAsync();
if (index == 1)
{
AllPsvs = new ObservableCollection<DocumentSet>(psvsTask.Where(e => e.Name == "ПСВ" && (DateTime.Today - e.DocDate).Value.TotalDays > 15));
}
if (index == 2)
{
AllPsvs = new ObservableCollection<DocumentSet>(psvsTask.Where(e => e.Name == "ПСВ"));
}
if (index == 3)
{
AllPsvs = new ObservableCollection<DocumentSet>(psvsTask.Where(e => e.Name == "ПСВ" && e.Status == "close"));
}
}
finally
{
OnPropertyChanged(nameof(AllPsvs));
}
}
public async Task LoadDataAsync(DocumentSet psv)
{
try
{
var povsTask = await Task.Run<IEnumerable<DataSet>>(()=>psv.DataSetDocuments.ToList());
GroupedPovs = new ObservableCollection<IGrouping<string, DataSet>>(povsTask.GroupBy(e => e.Device.Dpzn + e.Device.Hrtc + e.Device.Gsrs));
}
finally
{
OnPropertyChanged(nameof(GroupedPovs));
}
}
private void AddPsv()
{
_dialogService.ShowDialog(new PsvViewModel(_limsService, _dialogService));
}
private void EditPsv()
{
_dialogService.ShowDialog(new PsvViewModel(_limsService, _dialogService,CurrentPsv));
}
private async Task DelPsvAsync()
{
await _limsService.Documents.RemoveAsync(CurrentPsv);
AllPsvs.Remove(CurrentPsv);
}
private void GoodPov() { }
private void BadPov()
{
_dialogService.ShowDialog(new BadViewModel(_limsService,CurrentPov));
}
#endregion //Methods
#region Commands
public ICommand AddPsvCommand => new RelayCommand(p => AddPsv());
public ICommand EditPsvCommand => new RelayCommand(p => EditPsv(),p=>CurrentPsv!=null);
public ICommand BadCommand => new RelayCommand(p => BadPov());
public ICommand DelPsvCommand => new AsyncRelayCommand(DelPsvAsync,()=>CurrentPsv!=null);
#endregion //Commands
}
}

View File

@@ -0,0 +1,239 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Input;
using XLIMS.PSV.Windows;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
using XLIMS.CONTRACT;
namespace XLIMS.PSV.ViewModels
{
public class PsvViewModel : ViewModelBase
{
#region Constructor
public PsvViewModel(ILimsService limsService, IDialogService dialogService, DocumentSet document=null)
{
_limsService = limsService;
_dialogService = dialogService;
if (document != null)
{
_document = document;
}
else
{
_document = new DocumentSet() {Name="ПСВ"};
}
LoadDataAsync();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private DocumentSet _document;
private readonly ILimsService _limsService;
private readonly IDialogService _dialogService;
private int _devicesCount;
private DivisionSet _currentDivision;
private Tprz _currentTprz;
private DeviceSet _currentDevice;
private IGrouping<string, DataSet> _currentGroupedPov;
private DataSet _currentPov;
private PersonalSet _currentPersonal;
#endregion //Fields
#region Properties
public ObservableCollection<IGrouping<string, DataSet>> GroupedPovs { get; set; } = new();
public int ID => _document.Id;
public ObservableCollection<DivisionSet> AllDivisions { get; set; } = new();
public ObservableCollection<PersonalSet> AllPersonals { get; set; } = new();
public ObservableCollection<DataSet> AllPovs { get; set; } = new();
public DivisionSet CurrentDivision
{
get => _document.Division;
set
{
_document.Division = value;
OnPropertyChanged();
}
}
public PersonalSet CurrentPersonal
{
get
{
return _currentPersonal;
}
set
{
_currentPersonal = value;
if(_currentPersonal!=null) { _document.InPerson = _currentPersonal.Person; }
OnPropertyChanged();
}
}
public IGrouping<string, DataSet> CurrentGroupedPov
{
get => _currentGroupedPov;
set
{
_currentGroupedPov = value; OnPropertyChanged();
}
}
public DataSet CurrentPov
{
get => _currentPov;
set
{
_currentPov = value;
OnPropertyChanged();
}
}
public string? Number
{
get=>_document.Number;
set { _document.Number = value; OnPropertyChanged(); }
}
public DateTime? Date
{
get => _document.DocDate;
set { _document.DocDate = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
private async Task BrowseTprz()
{
var vm = new BrowseTprzViewModel(_limsService);
if (_dialogService.ShowDialog(vm, out _) != true || vm.CurrentTPRZ == null)
return;
var tprz = vm.CurrentTPRZ;
var serial = vm.Serial;
bool ExistsInList() => AllPovs.Any(p =>
p.Device.Serial == serial &&
p.Device.Dpzn == tprz.Dpzn &&
p.Device.Gsrs == tprz.Gsrs &&
p.Device.Hrtc == tprz.Hrtc);
if (ExistsInList())
{
MessageBox.Show("Документ уже содержит выбранный экземпляр!",
"Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
var dataSets = await _limsService.Datas.GetAllAsync();
if (dataSets.Any(d =>
d.Device.Serial == serial &&
d.Device.Dpzn == tprz.Dpzn &&
d.Device.Gsrs == tprz.Gsrs &&
d.Device.Hrtc == tprz.Hrtc &&
d.Device.Division == CurrentDivision &&
d.Gdn == null))
{
MessageBox.Show($"Прибор с номером №{serial} уже находится в поверке!",
"Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
var devices = await _limsService.Devices.GetAllAsync();
var dev = devices.FirstOrDefault(d =>
d.Serial == serial &&
d.Dpzn == tprz.Dpzn &&
d.Gsrs == tprz.Gsrs &&
d.Hrtc == tprz.Hrtc &&
d.Division == CurrentDivision)
?? new DeviceSet
{
Oi = tprz.IdtipNavigation.IdspoiNavigation.Nmoi,
Name = tprz.IdtipNavigation.IdspnmtpNavigation.Nmtp,
Tip = tprz.IdtipNavigation.Tp,
Serial = serial,
Dpzn = tprz.Dpzn,
Hrtc = tprz.Hrtc,
Division = CurrentDivision
};
AllPovs.Add(new DataSet() {Device=dev,Document=_document });
GroupedPovs = new ObservableCollection<IGrouping<string, DataSet>>(AllPovs.GroupBy(e => e.Device.Dpzn + e.Device.Hrtc + e.Device.Gsrs));
CurrentGroupedPov = GroupedPovs.FirstOrDefault();
OnPropertyChanged(nameof(GroupedPovs));
OnPropertyChanged(nameof(CurrentGroupedPov));
}
private async Task BrowseSerial()
{
var vm = new BrowseSerialViewModel(_limsService,CurrentDivision.Id);
if (_dialogService.ShowDialog(vm, out _) != true || vm.CurrentSerial == null)
return;
// Проверка на дублирование в текущем документе
bool alreadyExists = AllPovs.Any(e => e.Device == vm.CurrentSerial);
if (alreadyExists)
{
MessageBox.Show("Документ уже содержит выбранный экземпляр!",
"Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
var dataSets = await _limsService.Datas.GetAllAsync();
if (vm.CurrentSerial.DataSets.Any(d =>d.Gdn == null))
{
MessageBox.Show($"Прибор с номером №{vm.CurrentSerial.Serial} уже находится в поверке!",
"Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
AllPovs.Add(new DataSet() { Device = vm.CurrentSerial, Document = _document });
GroupedPovs = new ObservableCollection<IGrouping<string, DataSet>>(AllPovs.GroupBy(e => e.Device.Dpzn + e.Device.Hrtc + e.Device.Gsrs));
CurrentGroupedPov = GroupedPovs.FirstOrDefault();
OnPropertyChanged(nameof(GroupedPovs));
OnPropertyChanged(nameof(CurrentGroupedPov));
}
private async Task LoadDataAsync()
{
var povsTask = await Task.Run<IEnumerable<DataSet>>(() => _document.DataSetDocuments.ToList());
AllPersonals = new ObservableCollection<PersonalSet>(await _limsService.Personals.GetAllAsync());
AllDivisions = new ObservableCollection<DivisionSet>(await _limsService.Divisions.GetAllAsync());
AllPovs=new ObservableCollection<DataSet>(povsTask);
GroupedPovs = new ObservableCollection<IGrouping<string, DataSet>>(AllPovs.GroupBy(e => e.Device.Dpzn + e.Device.Hrtc + e.Device.Gsrs));
CurrentPersonal = AllPersonals.FirstOrDefault(f => f.Person == _document.InPerson);
OnPropertyChanged(nameof(AllDivisions));
OnPropertyChanged(nameof(AllPersonals));
OnPropertyChanged(nameof(GroupedPovs));
OnPropertyChanged(nameof(CurrentPersonal));
}
private async Task Save()
{
foreach (var pov in AllPovs)
{
if(pov.Id==0) await _limsService.Datas.AddAsync(pov);
else await _limsService.Datas.UpdateAsync(pov);
}
if(_document.Id== 0) {await _limsService.Documents.AddAsync(_document); }
else await _limsService.Documents.UpdateAsync(_document);
}
private async Task DelPov()
{
if(CurrentPov.Id!=0)
{
await _limsService.Datas.RemoveAsync(CurrentPov);
AllPovs.Remove(CurrentPov);
}
}
#endregion //Methods
#region Commands
public ICommand BrowseTprzCommand => new AsyncRelayCommand(BrowseTprz, ()=>CurrentDivision != null);
public ICommand BrowseSerialCommand => new AsyncRelayCommand(BrowseSerial,()=>CurrentDivision!=null);
public ICommand SaveCommand => new AsyncRelayCommand(Save);
#endregion //Commands
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Text;
using XLIMS.MVVM.Base;
namespace XLIMS.PSV.ViewModels
{
public class SideItemViewModel:ViewModelBase
{
#region Constructor
public SideItemViewModel(int index,string title)
{
_index = index;
_title = title;
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private int _index;
private string _title;
#endregion //Fields
#region Properties
public string Title
{
get => _title;
set { _title = value; OnPropertyChanged(); }
}
public int Index
{
get => _index;
set { _index = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
#endregion //Methods
#region Commands
#endregion //Commands
}
}

View File

@@ -0,0 +1,58 @@
<UserControl
x:Class="XLIMS.PSV.Views.BadView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Margin="10" MinWidth="350">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="2">
<TextBlock Text="Причина непригодности:" />
<TextBox Margin="2"
Text="{Binding Reason, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<StackPanel Grid.Row="3" Grid.ColumnSpan="3">
<TextBlock Text="Дата поверки:"/>
<DatePicker
Margin="0,5,0,5"
VerticalAlignment="Center"
SelectedDate="{Binding PovDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<StackPanel Grid.Row="4" Grid.ColumnSpan="3">
<TextBlock Text="Поверитель:"/>
<ComboBox
Margin="0,5,0,5"
VerticalAlignment="Center"
DisplayMemberPath="Person"
ItemsSource="{Binding AllPersonals}"
SelectedItem="{Binding CurrentPersonal, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<StackPanel Grid.Row="6" Grid.ColumnSpan="3">
<TextBlock Text="Извещение о непригодности:"/>
<DockPanel LastChildFill="True">
<ComboBox ItemsSource="{Binding AllBooks}"
SelectedItem="{Binding CurrentBook,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
DockPanel.Dock="Left" Width="125" Margin="0,0,5,0"/>
<TextBox Text="{Binding Number,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</DockPanel>
<TextBlock Text="Дата извещения:"/>
<DatePicker
Margin="0,5,0,5"
VerticalAlignment="Center"
SelectedDate="{Binding DocDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace XLIMS.PSV.Views
{
/// <summary>
/// Логика взаимодействия для BadView.xaml
/// </summary>
public partial class BadView : UserControl
{
public BadView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,90 @@
<UserControl
x:Class="XLIMS.PSV.Views.BrowseSerialView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid Width="800">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="400" MinHeight="300" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Border Grid.Row="0">
<TextBox
Width="350"
MinWidth="100"
Margin="10"
HorizontalAlignment="Right"
Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Border>
<DataGrid
Grid.Row="1"
AutoGenerateColumns="False"
CanUserAddRows="False"
GridLinesVisibility="All"
ItemsSource="{Binding SerialView}"
RowHeaderWidth="0"
SelectedItem="{Binding CurrentSerial, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectionMode="Single"
SelectionUnit="FullRow">
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}" FontWeight="Bold"/>
<TextBlock Text=" ("/>
<TextBlock Text="{Binding Path=ItemCount}"/>
<TextBlock Text=")"/>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</DataGrid.GroupStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="ГР" Binding="{Binding Gsrs}"/>
<!--<DataGridTemplateColumn Width="auto" Header="Госреестр">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<DataGridTemplateColumn Width="*" Header="Наименование">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" TextTrimming="CharacterEllipsis" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="200" Header="Обозначение типа">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Tip}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="200" Header="Диапазон (мод.)">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Dpzn}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" Header="Характеристики">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Hrtc}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" Header="Зав. номер">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Serial}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace XLIMS.PSV.Views
{
public partial class BrowseSerialView : UserControl
{
public BrowseSerialView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,80 @@
<UserControl
x:Class="XLIMS.PSV.Views.BrowseTprzView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid Width="800">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="400" MinHeight="300" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Border Grid.Row="0">
<TextBox
Width="350"
MinWidth="100"
Margin="10"
HorizontalAlignment="Right"
Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Border>
<DataGrid
Grid.Row="1"
AutoGenerateColumns="False"
CanUserAddRows="False"
GridLinesVisibility="All"
ItemsSource="{Binding AllTPRZView}"
RowHeaderWidth="0"
SelectedItem="{Binding CurrentTPRZ, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
EnableRowVirtualization="True"
EnableColumnVirtualization="True"
VirtualizingPanel.IsVirtualizingWhenGrouping="True"
VirtualizingPanel.VirtualizationMode="Standard"
VirtualizingPanel.IsVirtualizing="True"
SelectionMode="Single"
SelectionUnit="FullRow">
<DataGrid.Columns>
<DataGridTemplateColumn Width="auto" Header="Госреестр">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding GSRS}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="Наименование">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding IdtipNavigation.IdspnmtpNavigation.Nmtp}" TextTrimming="CharacterEllipsis" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="200" Header="Обозначение типа">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding IdtipNavigation.Tp}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="200" Header="Диапазон (мод.)">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Dpzn}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" Header="Характеристики">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Hrtc}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Border Grid.Row="2">
<TextBox
Margin="10"
Text="{Binding Serial, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
</Border>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace XLIMS.PSV.Views
{
/// <summary>
/// Логика взаимодействия для BrowseTPRZView.xaml
/// </summary>
public partial class BrowseTprzView : UserControl
{
public BrowseTprzView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,76 @@
<UserControl
x:Class="XLIMS.PSV.Views.GoodView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Margin="10" MinWidth="350">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" >
<TextBlock Text="Температура:"/>
<TextBox Margin="2"
Text="{Binding Temp, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
</StackPanel>
<StackPanel Grid.Row="1" >
<TextBlock Text="Влажность:" />
<TextBox Margin="2"
Text="{Binding Hum, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
</StackPanel>
<StackPanel Grid.Row="2">
<TextBlock Text="Давление:" />
<TextBox Margin="2"
Text="{Binding Press, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
</StackPanel>
<StackPanel Grid.Row="3" Grid.ColumnSpan="3">
<TextBlock Text="Дата поверки:"/>
<DatePicker
Margin="0,5,0,5"
VerticalAlignment="Center"
SelectedDate="{Binding DTMKFK, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
</StackPanel>
<StackPanel Grid.Row="4" Grid.ColumnSpan="3">
<TextBlock Text="Поверитель:"/>
<ComboBox
Margin="0,5,0,5"
VerticalAlignment="Center"
DisplayMemberPath="Prfio"
ItemsSource="{Binding AllPRSN}"
SelectedItem="{Binding CurrentPRSN, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<StackPanel Grid.Row="5" Grid.ColumnSpan="3">
<TextBlock Text="Номер наклейки:"/>
<TextBox
Margin="0,5,0,5"
VerticalAlignment="Center"
Text="{Binding NNNKL, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
TextWrapping="WrapWithOverflow" />
</StackPanel>
<StackPanel Grid.Row="6" Grid.ColumnSpan="3">
<TextBlock Text="Свидетельство о поверке:"/>
<DockPanel LastChildFill="True">
<ComboBox ItemsSource="{Binding AllBooks}"
SelectedItem="{Binding CurrentBook,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
DockPanel.Dock="Left" Width="125" Margin="0,0,5,0"/>
<TextBox Text="{Binding NND,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}"/>
</DockPanel>
<TextBlock Text="Дата свидетельства:"/>
<DatePicker
Margin="0,5,0,5"
VerticalAlignment="Center"
SelectedDate="{Binding DTD, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
</StackPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace XLIMS.PSV.Views
{
/// <summary>
/// Логика взаимодействия для GoodView.xaml
/// </summary>
public partial class GoodView : UserControl
{
public GoodView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,151 @@
<UserControl x:Class="XLIMS.PSV.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DockPanel LastChildFill="True">
<Menu DockPanel.Dock="Top">
<MenuItem Header="Новая ПСВ"
Command="{Binding AddPsvCommand}"/>
<MenuItem Header="Изменить ПСВ"
Command="{Binding EditPsvCommand}"/>
<MenuItem Header="Удалить ПСВ"
Command="{Binding DelPsvCommand}"/>
</Menu>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" MinWidth="200" MaxWidth="400"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="300" MinWidth="200" MaxWidth="400"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*" MinWidth="200" />
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<GridSplitter Grid.Column="1" Width="3"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"/>
<GridSplitter Grid.Column="3" Width="3"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"/>
<GridSplitter Grid.Column="5" Width="3"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"/>
<Border Grid.Column="0">
<ListBox ItemsSource="{Binding SideItems}"
SelectedItem="{Binding CurrentSideItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
BorderThickness="0">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Title}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<Border Grid.Column="2">
<ListBox ItemsSource="{Binding AllPsvs}"
SelectedItem="{Binding CurrentPsv,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
BorderThickness="0">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Number}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<Border Grid.Column="4">
<DataGrid AutoGenerateColumns="False"
ItemsSource="{Binding GroupedPovs}"
SelectedItem="{Binding CurrentGroupPov,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
BorderThickness="0">
<DataGrid.Columns>
<DataGridTemplateColumn Width="auto" Header="Госреестр">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Gsrs}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="Наименование">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Name}" TextTrimming="CharacterEllipsis" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="200" Header="Обозначение типа">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Tip}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="200" Header="Диапазон (мод.)">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Dpzn}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" Header="Характеристики">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Hrtc}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" Header="Кол-во">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Count}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Border>
<Border Grid.Column="6">
<DataGrid AutoGenerateColumns="False"
ItemsSource="{Binding CurrentGroupPov}"
SelectedItem="{Binding CurrentPov,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
BorderThickness="0">
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem Header="Забракован"
Command="{Binding BadCommand}"/>
</ContextMenu>
</DataGrid.ContextMenu>
<DataGrid.Columns>
<DataGridTemplateColumn Width="200" Header="Заводской номер">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Serial}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" Header="Дата поверки">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Date}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="200" Header="Поверитель">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Person}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="Результат">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Gdn}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Border>
</Grid>
</DockPanel>
</UserControl>

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace XLIMS.PSV.Views
{
/// <summary>
/// Логика взаимодействия для MainView.xaml
/// </summary>
public partial class MainView : UserControl
{
public MainView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,42 @@
<Window
x:Class="XLIMS.PSV.Windows.EditWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{Binding Title}"
DataContext="{Binding}"
ShowInTaskbar="True"
SizeToContent="WidthAndHeight"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowStyle="ToolWindow">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Resources/PsvDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<DockPanel LastChildFill="True">
<DockPanel
Margin="10"
DockPanel.Dock="Bottom"
LastChildFill="False">
<Button
Width="85"
Click="Button_Click_1"
Command="{Binding CancelCommand}"
Content="Отмена"
DockPanel.Dock="Right"
IsCancel="True" />
<Button
Width="85"
Margin="0,0,10,0"
Click="Button_Click_2"
Command="{Binding SaveCommand}"
Content="ОК"
DockPanel.Dock="Right"
IsDefault="True" />
</DockPanel>
<ContentControl Content="{Binding}" />
</DockPanel>
</Window>

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace XLIMS.PSV.Windows
{
/// <summary>
/// Логика взаимодействия для EditWindow.xaml
/// </summary>
public partial class EditWindow : Window
{
public EditWindow()
{
InitializeComponent();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
DialogResult = false;
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
DialogResult = true;
}
}
}

View File

@@ -0,0 +1,209 @@
<Window x:Class="XLIMS.PSV.Windows.PsvWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<DockPanel LastChildFill="True">
<DockPanel
Margin="10"
DockPanel.Dock="Bottom"
LastChildFill="False">
<Button
Width="85"
Command="{Binding CancelCommand}"
Click="Button_Click_1"
Content="Отмена"
DockPanel.Dock="Right"
IsCancel="True" />
<Button
Width="85"
Margin="0,0,10,0"
Command="{Binding SaveCommand}"
Click="Button_Click_2"
Content="Принять"
DockPanel.Dock="Right"
IsDefault="True" />
</DockPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition MinHeight="300" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="Transparent">
<DockPanel Margin="15" LastChildFill="False">
<DockPanel DockPanel.Dock="Top" LastChildFill="True">
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="Подразделение:" />
<ComboBox ItemsSource="{Binding AllDivisions}"
SelectedItem="{Binding CurrentDivision, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Kdl}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DockPanel>
<DockPanel
Margin="0,15,0,0"
DockPanel.Dock="Top"
LastChildFill="False">
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="Номер:" />
<TextBox
Width="350"
MinWidth="100"
DockPanel.Dock="Left"
Text="{Binding Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
<TextBlock
Margin="15,0,5,0"
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="Дата:" />
<DatePicker DockPanel.Dock="Left" SelectedDate="{Binding Date, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</DockPanel>
<DockPanel
Margin="0,15,0,0"
DockPanel.Dock="Top"
LastChildFill="False">
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="Принял:" />
<ComboBox
Width="200"
ItemsSource="{Binding AllPersonals}"
SelectedItem="{Binding CurrentPersonal, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Person}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DockPanel>
</DockPanel>
</Border>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70*"/>
<ColumnDefinition Width="30*"/>
</Grid.ColumnDefinitions>
<DataGrid
AutoGenerateColumns="False"
CanUserAddRows="False"
GridLinesVisibility="All"
ItemsSource="{Binding GroupedPovs}"
RowHeaderWidth="0"
SelectedItem="{Binding CurrentGroupedPov, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectionMode="Single"
SelectionUnit="FullRow">
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding BrowseTprzCommand}" Header="Добавить СИ по типу" />
<MenuItem Command="{Binding BrowseSerialCommand}" Header="Добавить СИ по зав. номеру" />
<Separator />
<MenuItem Command="{Binding DelCommand}" Header="Удалить" />
</ContextMenu>
</DataGrid.ContextMenu>
<DataGrid.Columns>
<DataGridTemplateColumn Width="auto" Header="Госреестр">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Gsrs}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="Наименование">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Name}" TextTrimming="CharacterEllipsis" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="200" Header="Обозначение типа">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Tip}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="200" Header="Диапазон (мод.)">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Dpzn}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" Header="Характеристики">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Hrtc}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--<DataGridTextColumn
Width="200"
Binding="{Binding Zip, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Header="Комплектность" />-->
<DataGridTemplateColumn Width="200" Header="Кол-во">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Count}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<DataGrid Grid.Column="1" Margin="3,0,0,0"
AutoGenerateColumns="False"
CanUserAddRows="False"
GridLinesVisibility="All"
ItemsSource="{Binding CurrentGroupedPov}"
RowHeaderWidth="0"
SelectedItem="{Binding CurrentPov, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectionMode="Single"
SelectionUnit="FullRow">
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding BrowseTprzCommand}" Header="Добавить СИ по типу" />
<MenuItem Command="{Binding BrowseSerialCommand}" Header="Добавить СИ по зав. номеру" />
<Separator />
<MenuItem Command="{Binding DelCommand}" Header="Удалить" />
</ContextMenu>
</DataGrid.ContextMenu>
<DataGrid.Columns>
<DataGridTemplateColumn Width="200" Header="Зав. номер">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Device.Serial}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="Комплектность">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Zip}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
<Border Grid.Row="2">
<DockPanel Margin="15" LastChildFill="False">
<TextBlock DockPanel.Dock="Left" Text="Кол-во:" />
<TextBlock
Margin="5,0,0,0"
DockPanel.Dock="Left"
Text="{Binding Count}" />
</DockPanel>
</Border>
</Grid>
</DockPanel>
</Window>

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace XLIMS.PSV.Windows
{
/// <summary>
/// Логика взаимодействия для PsvWindow.xaml
/// </summary>
public partial class PsvWindow : Window
{
public PsvWindow()
{
InitializeComponent();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
DialogResult = false;
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
DialogResult = true;
}
}
}

View File

@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\XLIMS.CONTRACT\XLIMS.CONTRACT.csproj" />
<ProjectReference Include="..\XLIMS.DATA\XLIMS.DATA.csproj" />
<ProjectReference Include="..\XLIMS.MVVM\XLIMS.MVVM.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Windows\PsvWindow.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
</Project>