From 5c186a1fa6b7cfc7dc135ecda049686e219ce224 Mon Sep 17 00:00:00 2001 From: "i.roger" Date: Wed, 13 May 2026 13:57:04 +0700 Subject: [PATCH] edit_page --- docker-compose.yml | 2 + medica-info/Components/Layout/NavMenu.razor | 5 + medica-info/Components/Pages/Apteka.razor | 6 +- medica-info/Components/Pages/Uslugi.razor | 135 ++++++++++++++++++++ 4 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 medica-info/Components/Pages/Uslugi.razor diff --git a/docker-compose.yml b/docker-compose.yml index d69e111..a37e9d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,3 +4,5 @@ services: build: context: . dockerfile: medica-info/Dockerfile + volumes: + - 'M:/:/app/Data/Medica_info' diff --git a/medica-info/Components/Layout/NavMenu.razor b/medica-info/Components/Layout/NavMenu.razor index 7faced7..dd74926 100644 --- a/medica-info/Components/Layout/NavMenu.razor +++ b/medica-info/Components/Layout/NavMenu.razor @@ -19,6 +19,11 @@ Аптека + diff --git a/medica-info/Components/Pages/Apteka.razor b/medica-info/Components/Pages/Apteka.razor index 9fdb438..0f7b5b8 100644 --- a/medica-info/Components/Pages/Apteka.razor +++ b/medica-info/Components/Pages/Apteka.razor @@ -5,7 +5,7 @@ Apteka -

Центральный склад НСК

+

Центральный склад

@@ -65,6 +65,7 @@ else @code { private List apteka = new List(); private string lekInput { set; get; } = string.Empty; + private string lekInputMNN { set; get; } = string.Empty; private string otdValue { set; get; } = string.Empty; private string data { set; get; } = string.Empty; @@ -94,7 +95,7 @@ else private async Task LoadAndFilterAptekaAsync(string? filter, string? filterOTD) { // string file = @"\\192.168.232.33\medica.info\Apteka\price.xml"; - string file = @"/app/Apteka/price.xml"; + string file = @"/app/Data/Medica_info/Apteka/price.xml"; XmlDocument xml = new XmlDocument(); xml.Load(file); XmlElement? root = xml.DocumentElement; @@ -174,6 +175,7 @@ else { float val = float.Parse(value); int vali =(int)MathF.Round(val); + if (vali == 0) return value; return vali.ToString(); } diff --git a/medica-info/Components/Pages/Uslugi.razor b/medica-info/Components/Pages/Uslugi.razor new file mode 100644 index 0000000..2b2455d --- /dev/null +++ b/medica-info/Components/Pages/Uslugi.razor @@ -0,0 +1,135 @@ +@page "/uslugi" +@using System.Xml +@using Microsoft.AspNetCore.Components.Web +@rendermode RenderMode.InteractiveServer + +uslugi + +

Услуги

+ + + +
+ + + +
+ +@if (apteka == null || apteka.Count == 0) +{ +

Данные не найдены или загружаются...

+} +else +{ +

Актуальная информация по базе в ООО "Медика НСК", на

+
+ + + + + + + + + + + @foreach (var item in apteka) + { + + + + + + + } + +
Код услугиНазваниеСтоимостьДаба изменения цены
@item.code@item.name@item.amount@item.date_up
+
+} + +@code { + private List apteka = new List(); + private string data { set; get; } = string.Empty; + private string UslugiInput { set; get; } = string.Empty; + + + protected override async Task OnInitializedAsync() + { + string filter = string.IsNullOrWhiteSpace(UslugiInput) ? null : UslugiInput.Trim(); + await LoadAndFilterUslugiAsync(filter); + } + + private async Task OnSearchClicked() + { + string filter = string.IsNullOrWhiteSpace(UslugiInput) ? null : UslugiInput.Trim(); + await LoadAndFilterUslugiAsync(filter); + } + private async Task HandleKeyPress(KeyboardEventArgs keyboardEventArgs) + { + if (keyboardEventArgs.Code == "Enter") + { + await OnSearchClicked(); + } + } + + + private async Task LoadAndFilterUslugiAsync(string? filter) + { + // string file = @"\\192.168.232.33\medica.info\Apteka\price.xml"; + string file = @"/app/Data/Medica_info/PriceNSK/price.xml"; + XmlDocument xml = new XmlDocument(); + xml.Load(file); + XmlElement? root = xml.DocumentElement; + apteka.Clear(); + if (root != null) + { + foreach (XmlElement row in root.ChildNodes) + { + + if (row.Name != "ROW") + continue; + + var prodNode = row.SelectSingleNode("TEXT"); + if (prodNode == null) + continue; + + if (!string.IsNullOrEmpty(filter) && + !prodNode.InnerText.Contains(filter, StringComparison.OrdinalIgnoreCase)) + { + continue; + } + + UslugiFore item = new UslugiFore(); + foreach (XmlNode child in row.ChildNodes) + { + switch (child.Name) + { + case "CODE": + item.code = child.InnerText; + break; + case "TEXT": + item.name = child.InnerText; + break; + case "PRICE_4078": + item.amount = child.InnerText; + break; + case "PR_UPD": + item.date_up = child.InnerText; + break; + } + } + apteka.Add(item); + } + } + + StateHasChanged(); + await Task.CompletedTask; + } + private class UslugiFore + { + public string code { get; set; } = string.Empty; + public string name { get; set; } = string.Empty; + public string amount { get; set; } = string.Empty; + public string date_up { get; set; } = string.Empty; + } +}