Enhance file, shipping, stock, and Android deployment

- Added new file metadata fields and improved shipping entities
- Refined weight validation logic in OrderItemDto
- Extended SignalR for stock taking refresh/close operations
- Improved SignalR error handling and UI feedback
- Enhanced grid UI: links, audit info, date formatting, loading panels
- Disabled AOT for WebAssembly/Android; updated Android signing config
- Updated app versioning and SQL schema comparison
- NavMenu: "Leltározás" now admin-only
This commit is contained in:
Loretta 2026-03-06 14:57:01 +01:00
commit 1b68599acc
35 changed files with 663 additions and 463 deletions

View File

@ -11,7 +11,9 @@
<PackageReference Include="MessagePack" Version="3.1.4" /> <PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" /> <PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.11" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client.Core" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.11" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.Json" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.11" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.11" />
<!--<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.2.0" />--> <!--<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.2.0" />-->
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.11" />
@ -39,7 +41,7 @@
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.Server.dll</HintPath> <HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.Server.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.AspNetCore.SignalR.Core"> <Reference Include="Microsoft.AspNetCore.SignalR.Core">
<HintPath>C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\9.0.11\ref\net9.0\Microsoft.AspNetCore.SignalR.Core.dll</HintPath> <HintPath>C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\9.0.13\ref\net9.0\Microsoft.AspNetCore.SignalR.Core.dll</HintPath>
</Reference> </Reference>
<Reference Include="Mango.Nop.Core"> <Reference Include="Mango.Nop.Core">
<HintPath>..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Mango.Nop.Core.dll</HintPath> <HintPath>..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Mango.Nop.Core.dll</HintPath>

View File

@ -101,11 +101,10 @@ public class OrderItemDto : MgOrderItemDto<ProductDto>, IOrderItemDto
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore] [NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
[ToonDescription(BusinessRule = "get => IsMeasurable ? double.Round(ProductDto!.AverageWeight - AverageWeight, 1) : 0")] [ToonDescription(BusinessRule = "get => IsMeasurable ? double.Round(ProductDto!.AverageWeight - AverageWeight, 1) : 0")]
public double AverageWeightDifference => IsMeasurable ? double.Round(ProductDto!.AverageWeight - AverageWeight, 1) : 0; public double AverageWeightDifference => IsMeasurable ? double.Round(ProductDto!.AverageWeight - AverageWeight, 1) : 0;
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore] [NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
[ToonDescription(BusinessRule = "get => !IsMeasurable || (ProductDto!.AverageWeight > 0 && ((AverageWeightDifference / ProductDto!.AverageWeight) * 100) < ProductDto!.AverageWeightTreshold)")] [ToonDescription(BusinessRule = "get => !IsMeasurable || (ProductDto!.AverageWeight > 0 && ((AverageWeightDifference / ProductDto!.AverageWeight) * 100) < ProductDto!.AverageWeightTreshold)")]
public bool AverageWeightIsValid => !IsMeasurable || public bool AverageWeightIsValid => !IsMeasurable || (ProductDto!.AverageWeight > 0 && Math.Abs((AverageWeightDifference / ProductDto!.AverageWeight) * 100) < ProductDto!.AverageWeightTreshold);
(ProductDto!.AverageWeight > 0 && ((AverageWeightDifference / ProductDto!.AverageWeight) * 100) < ProductDto!.AverageWeightTreshold);
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore] [NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
[ToonDescription(Purpose = "Status flag", BusinessRule = "get => OrderItemPallets.Count > 0 && OrderItemPallets.All(oip => oip.IsAudited)")] [ToonDescription(Purpose = "Status flag", BusinessRule = "get => OrderItemPallets.Count > 0 && OrderItemPallets.All(oip => oip.IsAudited)")]

View File

@ -11,9 +11,11 @@ namespace FruitBank.Common.Entities;
public class Files : MgEntityBase, IFiles public class Files : MgEntityBase, IFiles
{ {
public string FileName { get; set; } public string FileName { get; set; }
public string FileSubPath { get; set; }
public string FileExtension { get; set; } public string FileExtension { get; set; }
public string RawText { get; set; } public string RawText { get; set; }
public string FileHash { get; set; }
public bool IsCompressed { get; set; }
[SkipValuesOnUpdate] [SkipValuesOnUpdate]
public DateTime Created { get; set; } public DateTime Created { get; set; }

View File

@ -1,4 +1,5 @@
using AyCode.Core.Serializers.Toons; using AyCode.Interfaces.EntityComment;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces; using FruitBank.Common.Interfaces;
using LinqToDB.Mapping; using LinqToDB.Mapping;
using Mango.Nop.Core.Entities; using Mango.Nop.Core.Entities;
@ -8,11 +9,13 @@ namespace FruitBank.Common.Entities;
[ToonDescription("Shipping record with documents and measurement tracking", Purpose = "Represents a physical inbound delivery event (truck arrival) at the warehouse, tracking the vehicle and the overall measurement status of the shipment")] [ToonDescription("Shipping record with documents and measurement tracking", Purpose = "Represents a physical inbound delivery event (truck arrival) at the warehouse, tracking the vehicle and the overall measurement status of the shipment")]
[Table(Name = FruitBankConstClient.ShippingDbTableName)] [Table(Name = FruitBankConstClient.ShippingDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingDbTableName)] [System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingDbTableName)]
public class Shipping : MgEntityBase, IShipping public class Shipping : MgEntityBase, IShipping, IEntityComment
{ {
public DateTime ShippingDate { get; set; } public DateTime ShippingDate { get; set; } = DateTime.Now;
public string LicencePlate { get; set; } public string LicencePlate { get; set; }
public bool IsAllMeasured { get; set; } public bool IsAllMeasured { get; set; }
public string? Comment { get; set; } = string.Empty;
public string? CargoCompany { get; set; }
public DateTime? MeasuredDate { get; set; } public DateTime? MeasuredDate { get; set; }

View File

@ -16,7 +16,7 @@ public class ShippingDocument : MgEntityBase, IShippingDocument
public string DocumentIdNumber { get; set; } public string DocumentIdNumber { get; set; }
public string PdfFileName { get; set; } public string PdfFileName { get; set; }
public DateTime ShippingDate { get; set; } public DateTime ShippingDate { get; set; } = DateTime.Now;
public string Country { get; set; } public string Country { get; set; }
public int TotalPallets { get; set; } public int TotalPallets { get; set; }

View File

@ -6,6 +6,9 @@ namespace FruitBank.Common.Interfaces;
public interface IFiles: IEntityInt, ITimeStampInfo public interface IFiles: IEntityInt, ITimeStampInfo
{ {
public string FileName { get; set; } public string FileName { get; set; }
public string FileSubPath { get; set; }
public string FileExtension { get; set; } public string FileExtension { get; set; }
public string RawText { get; set; } public string RawText { get; set; }
public string FileHash { get; set; }
public bool IsCompressed { get; set; }
} }

View File

@ -8,6 +8,7 @@ public interface IStockSignalREndpointCommon
public Task<List<StockTaking>?> GetStockTakings(bool loadRelations); public Task<List<StockTaking>?> GetStockTakings(bool loadRelations);
public Task<List<StockTaking>?> GetStockTakingsByProductId(int productId); public Task<List<StockTaking>?> GetStockTakingsByProductId(int productId);
public Task<StockTaking?> AddStockTaking(StockTaking stockTaking); public Task<StockTaking?> AddStockTaking(StockTaking stockTaking);
public Task<StockTakingItem?> RefreshStockTakingItem(int stockTakingItemId);
public Task<StockTaking?> UpdateStockTaking(StockTaking stockTaking); public Task<StockTaking?> UpdateStockTaking(StockTaking stockTaking);
public Task<List<StockTakingItem>?> GetStockTakingItems(); public Task<List<StockTakingItem>?> GetStockTakingItems();
@ -19,6 +20,7 @@ public interface IStockSignalREndpointCommon
public Task<List<StockTakingItemPallet>?> GetStockTakingItemPallets(); public Task<List<StockTakingItemPallet>?> GetStockTakingItemPallets();
public Task<List<StockTakingItemPallet>?> GetStockTakingItemPalletsByProductId(int productId); public Task<List<StockTakingItemPallet>?> GetStockTakingItemPalletsByProductId(int productId);
public Task<StockTaking?> CloseStockTaking(int stockTakingId);
public Task<StockTakingItemPallet?> AddStockTakingItemPallet(StockTakingItemPallet stockTakingItemPallet); public Task<StockTakingItemPallet?> AddStockTakingItemPallet(StockTakingItemPallet stockTakingItemPallet);
public Task<StockTakingItemPallet?> UpdateStockTakingItemPallet(StockTakingItemPallet stockTakingItemPallet); public Task<StockTakingItemPallet?> UpdateStockTakingItemPallet(StockTakingItemPallet stockTakingItemPallet);
} }

View File

@ -2,8 +2,16 @@
namespace FruitBank.Common.Models.SignalRs; namespace FruitBank.Common.Models.SignalRs;
public class SignalRMessageToClientWithText<T>(string? message, T? content) public class SignalRMessageToClientWithText<T>
{ {
public string? Message { get; set; } = message; public SignalRMessageToClientWithText()
public T? Content { get; set; } = content; {}
public SignalRMessageToClientWithText(string? message, T? content) : this()
{
Message = message;
Content = content;
}
public string? Message { get; set; }
public T? Content { get; set; }
} }

View File

@ -92,13 +92,14 @@ public class SignalRTags : AcSignalRTags
public const int GetStockTakings = 170; public const int GetStockTakings = 170;
public const int AddStockTaking = 171; public const int AddStockTaking = 171;
public const int UpdateStockTaking = 172; public const int RefreshStockTakingItem = 172;
public const int CloseStockTaking = 173; public const int UpdateStockTaking = 173;
public const int GetStockTakingItems = 174; public const int CloseStockTaking = 174;
public const int GetStockTakingItemsById = 175; public const int GetStockTakingItems = 175;
public const int GetStockTakingItemsByProductId = 176; public const int GetStockTakingItemsById = 176;
public const int GetStockTakingItemsByStockTakingId = 177; public const int GetStockTakingItemsByProductId = 177;
public const int AddOrUpdateMeasuredStockTakingItemPallet = 178; public const int GetStockTakingItemsByStockTakingId = 178;
public const int AddOrUpdateMeasuredStockTakingItemPallet = 179;
public const int AuthenticateUser = 195; public const int AuthenticateUser = 195;

View File

@ -20,7 +20,7 @@
<Columns> <Columns>
<MgGridDataColumn FieldName="Id" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" <MgGridDataColumn FieldName="Id" SortIndex="0" SortOrder="GridColumnSortOrder.Descending"
UrlLink=@(FruitBankConstClient.BaseUrl+"/Admin/Order/Edit/{Id}") /> UrlLink=@(FruitBankConstClient.BaseUrl+"/Admin/Order/Edit/{Id}") />
<DxGridDataColumn FieldName="CustomerId" /> <MgGridDataColumn FieldName="CustomerId" UrlLink=@(FruitBankConstClient.BaseUrl + "/Admin/Customer/Edit/{CustomerId}") />
<DxGridDataColumn FieldName="@("Customer.Company")" Caption="Company" ReadOnly="true" /> <DxGridDataColumn FieldName="@("Customer.Company")" Caption="Company" ReadOnly="true" />
<DxGridDataColumn FieldName="OrderStatus" /> <DxGridDataColumn FieldName="OrderStatus" />
<DxGridDataColumn FieldName="IsMeasurable" ReadOnly="true" /> <DxGridDataColumn FieldName="IsMeasurable" ReadOnly="true" />
@ -31,10 +31,10 @@
<DxGridDataColumn FieldName="IsAllOrderItemAvgWeightValid" ReadOnly="true" Caption="AvgWeightValid" /> <DxGridDataColumn FieldName="IsAllOrderItemAvgWeightValid" ReadOnly="true" Caption="AvgWeightValid" />
<DxGridDataColumn FieldName="RevisorId" ReadOnly="true" /> <MgGridDataColumn FieldName="RevisorId" ReadOnly="true" UrlLink=@(FruitBankConstClient.BaseUrl + "/Admin/Customer/Edit/{RevisorId}") />
<DxGridDataColumn FieldName="MeasurementOwnerId" ReadOnly="true" /> <MgGridDataColumn FieldName="MeasurementOwnerId" ReadOnly="true" UrlLink=@(FruitBankConstClient.BaseUrl + "/Admin/Customer/Edit/{MeasurementOwnerId}") />
<DxGridDataColumn FieldName="DateOfReceipt" /> <DxGridDataColumn FieldName="DateOfReceipt" DisplayFormat="yyyy.MM.dd hh:mm" />
<DxGridDataColumn FieldName="CreatedOnUtc" ReadOnly="true" /> <DxGridDataColumn FieldName="CreatedOnUtc" ReadOnly="true" DisplayFormat="yyyy.MM.dd hh:mm" />
<DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn> <DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn>
</Columns> </Columns>
<DetailRowTemplate> <DetailRowTemplate>
@ -107,19 +107,22 @@
private async Task ReloadDataFromDb(bool forceReload = false) private async Task ReloadDataFromDb(bool forceReload = false)
{ {
LoadingPanelVisibility.Visible = true; LoadingPanelVisibility.Visible = true;
using (await ObjectLock.GetSemaphore<OrderDto>().UseWaitAsync())
if (IsMasterGrid)
{ {
if (OrderDtos == null) OrderDtos = await FruitBankSignalRClient.GetAllOrderDtos() ?? []; using (await ObjectLock.GetSemaphore<OrderDto>().UseWaitAsync())
else if (OrderDtos.Count == 0 || forceReload)
{ {
OrderDtos.Clear(); if (OrderDtos == null) OrderDtos = await FruitBankSignalRClient.GetAllOrderDtos() ?? [];
OrderDtos.AddRange(await FruitBankSignalRClient.GetAllOrderDtos() ?? []); else if (OrderDtos.Count == 0 || forceReload)
{
OrderDtos.Clear();
OrderDtos.AddRange(await FruitBankSignalRClient.GetAllOrderDtos() ?? []);
}
} }
//if (forceReload)
Grid?.Reload();
} }
//if (forceReload)
Grid?.Reload();
LoadingPanelVisibility.Visible = false; LoadingPanelVisibility.Visible = false;
} }

View File

@ -1,6 +1,7 @@
@using AyCode.Blazor.Components.Components.Grids @using AyCode.Blazor.Components.Components.Grids
@using AyCode.Core.Helpers @using AyCode.Core.Helpers
@using AyCode.Utils.Extensions @using AyCode.Utils.Extensions
@using FruitBank.Common
@using FruitBank.Common.Dtos @using FruitBank.Common.Dtos
@using FruitBank.Common.Models @using FruitBank.Common.Models
@using FruitBankHybrid.Shared.Components.Grids.GenericAttributes @using FruitBankHybrid.Shared.Components.Grids.GenericAttributes
@ -18,7 +19,7 @@
FilterMenuButtonDisplayMode="@(IsMasterGrid ? GridFilterMenuButtonDisplayMode.Never : GridFilterMenuButtonDisplayMode.Always)"> FilterMenuButtonDisplayMode="@(IsMasterGrid ? GridFilterMenuButtonDisplayMode.Never : GridFilterMenuButtonDisplayMode.Always)">
<Columns> <Columns>
<DxGridDataColumn FieldName="Id" /> <DxGridDataColumn FieldName="Id" />
<DxGridDataColumn FieldName="OrderId" /> <MgGridDataColumn FieldName="OrderId" UrlLink=@(FruitBankConstClient.BaseUrl + "/Admin/Order/Edit/{OrderId}") />
<DxGridDataColumn FieldName="@("OrderDto.Customer.Company")" Caption="Company" ReadOnly="true" /> <DxGridDataColumn FieldName="@("OrderDto.Customer.Company")" Caption="Company" ReadOnly="true" />
<DxGridDataColumn FieldName="ProductId"> <DxGridDataColumn FieldName="ProductId">
<EditSettings> <EditSettings>
@ -49,7 +50,7 @@
<DxGridDataColumn FieldName="AverageWeightDifference" ReadOnly="true" Visible="false" Caption="AvgWeightDiff" /> <DxGridDataColumn FieldName="AverageWeightDifference" ReadOnly="true" Visible="false" Caption="AvgWeightDiff" />
<DxGridDataColumn FieldName="AverageWeightIsValid" ReadOnly="true" Caption="AvgWeightValid" /> <DxGridDataColumn FieldName="AverageWeightIsValid" ReadOnly="true" Caption="AvgWeightValid" />
<DxGridDataColumn FieldName="IsAudited" ReadOnly="true" /> <DxGridDataColumn FieldName="IsAudited" ReadOnly="true" />
<DxGridDataColumn FieldName="@("OrderDto.CreatedOnUtc")" Caption="Rendelés ideje" ReadOnly="true" /> <DxGridDataColumn FieldName="@("OrderDto.CreatedOnUtc")" Caption="Rendelés ideje" ReadOnly="true" DisplayFormat="yyyy.MM.dd hh:mm" />
<DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn> <DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn>
</Columns> </Columns>
<DetailRowTemplate> <DetailRowTemplate>

View File

@ -1,5 +1,6 @@
@using AyCode.Blazor.Components.Components.Grids @using AyCode.Blazor.Components.Components.Grids
@using AyCode.Utils.Extensions @using AyCode.Utils.Extensions
@using FruitBank.Common
@using FruitBank.Common.Dtos @using FruitBank.Common.Dtos
@using FruitBank.Common.Entities @using FruitBank.Common.Entities
@using FruitBank.Common.Models @using FruitBank.Common.Models
@ -32,6 +33,10 @@
<DxGridDataColumn FieldName="IsMeasured" ReadOnly="true" /> <DxGridDataColumn FieldName="IsMeasured" ReadOnly="true" />
<DxGridDataColumn FieldName="IsAudited" ReadOnly="true" /> <DxGridDataColumn FieldName="IsAudited" ReadOnly="true" />
<MgGridDataColumn FieldName="@nameof(OrderItemPallet.ModifierId)" ReadOnly="true" UrlLink=@(FruitBankConstClient.BaseUrl + "/Admin/Customer/Edit/{ModifierId}") />
<DxGridDataColumn FieldName="@nameof(OrderItemPallet.Modified)" ReadOnly="true" DisplayFormat="yyyy.MM.dd hh:mm" />
<DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn> <DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn>
</Columns> </Columns>
<ToolbarTemplate> <ToolbarTemplate>

View File

@ -179,11 +179,11 @@
var productDto = (ProductDto)e.DataItem; var productDto = (ProductDto)e.DataItem;
if (e.Grid.IsDetailRowExpanded(e.VisibleIndex)) // if (e.Grid.IsDetailRowExpanded(e.VisibleIndex))
{ // {
_currentOrderDtos = null; // _currentOrderDtos = null;
_currentOrderDtos = productDto != null ? await GetOrderDtosFromDbAsync(productDto.Id) : []; // _currentOrderDtos = productDto != null ? await GetOrderDtosFromDbAsync(productDto.Id) : [];
} // }
} }
protected async Task OnActiveTabChanged(int activeTabIndex, int productId) protected async Task OnActiveTabChanged(int activeTabIndex, int productId)
@ -192,11 +192,11 @@
switch (_activeTabIndex) switch (_activeTabIndex)
{ {
case 0: case 1:
//_currentOrderDtos = null; _currentOrderDtos = null;
_currentOrderDtos = await GetOrderDtosFromDbAsync(productId); _currentOrderDtos = await GetOrderDtosFromDbAsync(productId);
break; break;
case 1: case 2:
_currentOrderItemDtos = null; _currentOrderItemDtos = null;
_currentOrderItemDtos = await GetOrderItemDtosFromDbAsync(productId); _currentOrderItemDtos = await GetOrderItemDtosFromDbAsync(productId);
break; break;

View File

@ -47,7 +47,7 @@
<EditSettings> <EditSettings>
<DxComboBoxSettings Data="Shippings" <DxComboBoxSettings Data="Shippings"
ValueFieldName="Id" ValueFieldName="Id"
TextFieldName="ShippingDate" TextFieldName="LicencePlate"
DropDownBodyCssClass="dd-body-class" DropDownBodyCssClass="dd-body-class"
ListRenderMode="ListRenderMode.Entire" ListRenderMode="ListRenderMode.Entire"
SearchMode="ListSearchMode.AutoSearch" SearchMode="ListSearchMode.AutoSearch"
@ -57,13 +57,14 @@
<DxListEditorColumn FieldName="@nameof(Shipping.Id)" /> <DxListEditorColumn FieldName="@nameof(Shipping.Id)" />
<DxListEditorColumn FieldName="@nameof(Shipping.ShippingDate)" /> <DxListEditorColumn FieldName="@nameof(Shipping.ShippingDate)" />
<DxListEditorColumn FieldName="@nameof(Shipping.LicencePlate)" /> <DxListEditorColumn FieldName="@nameof(Shipping.LicencePlate)" />
<DxListEditorColumn FieldName="@nameof(Shipping.Comment)" />
</Columns> </Columns>
</DxComboBoxSettings> </DxComboBoxSettings>
</EditSettings> </EditSettings>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="DocumentIdNumber" /> <DxGridDataColumn FieldName="DocumentIdNumber" />
<DxGridDataColumn FieldName="ShippingDate" /> <DxGridDataColumn FieldName="ShippingDate" Caption="LoadDate" />
<DxGridDataColumn FieldName="Country" /> <DxGridDataColumn FieldName="Country" />
<DxGridDataColumn FieldName="TotalPallets" /> <DxGridDataColumn FieldName="TotalPallets" />

View File

@ -1,10 +1,14 @@
@using AyCode.Utils.Extensions @using AyCode.Blazor.Components.Components.Grids
@using AyCode.Utils.Extensions
@using FruitBank.Common
@using FruitBank.Common.Dtos @using FruitBank.Common.Dtos
@using FruitBank.Common.Entities @using FruitBank.Common.Entities
@using FruitBank.Common.Models
@using FruitBankHybrid.Shared.Databases @using FruitBankHybrid.Shared.Databases
@using FruitBankHybrid.Shared.Services.SignalRs @using FruitBankHybrid.Shared.Services.SignalRs
@inject FruitBankSignalRClient FruitBankSignalRClient @inject FruitBankSignalRClient FruitBankSignalRClient
@inject LoggedInModel LoggedInModel
<MgGridBase @ref="gridOrderItemPallet" Data="ShippingItemPallets" IsMasterGrid="IsMasterGrid" AutoSaveLayoutName="GridShippingItemPallets" <MgGridBase @ref="gridOrderItemPallet" Data="ShippingItemPallets" IsMasterGrid="IsMasterGrid" AutoSaveLayoutName="GridShippingItemPallets"
PageSize="@(IsMasterGrid ? 15 : 50)" ShowFilterRow="IsMasterGrid" ShowGroupPanel="IsMasterGrid" PageSize="@(IsMasterGrid ? 15 : 50)" ShowFilterRow="IsMasterGrid" ShowGroupPanel="IsMasterGrid"
@ -26,6 +30,10 @@
<DxGridDataColumn FieldName="NetWeight" /> <DxGridDataColumn FieldName="NetWeight" />
<DxGridDataColumn FieldName="IsMeasured" ReadOnly="true" /> <DxGridDataColumn FieldName="IsMeasured" ReadOnly="true" />
<MgGridDataColumn FieldName="@nameof(ShippingItemPallet.ModifierId)" ReadOnly="true" UrlLink=@(FruitBankConstClient.BaseUrl + "/Admin/Customer/Edit/{ModifierId}") />
<DxGridDataColumn FieldName="@nameof(ShippingItemPallet.Modified)" ReadOnly="true" DisplayFormat="yyyy.MM.dd hh:mm" />
<DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn> <DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn>
</Columns> </Columns>
<GroupSummary> <GroupSummary>

View File

@ -17,79 +17,80 @@
@inject FruitBankSignalRClient FruitBankSignalRClient @inject FruitBankSignalRClient FruitBankSignalRClient
<MgGridWithInfoPanel ShowInfoPanel="@IsMasterGrid"> <MgGridWithInfoPanel ShowInfoPanel="@IsMasterGrid">
<GridContent> <GridContent>
<GridShippingItemBase @ref="Grid" ParentDataItem="ParentDataItem" DataSource="ShippingItems" AutoSaveLayoutName="GridShippingItem" <GridShippingItemBase @ref="Grid" ParentDataItem="ParentDataItem" DataSource="ShippingItems" AutoSaveLayoutName="GridShippingItem"
SignalRClient="FruitBankSignalRClient" Logger="_logger" SignalRClient="FruitBankSignalRClient" Logger="_logger"
CssClass="@GridCss" ValidationEnabled="false" CustomizeElement="Grid_CustomizeElement" CssClass="@GridCss" ValidationEnabled="false" CustomizeElement="Grid_CustomizeElement"
OnGridFocusedRowChanged="Grid_FocusedRowChanged"> OnGridFocusedRowChanged="Grid_FocusedRowChanged">
<Columns> <Columns>
<DxGridDataColumn FieldName="Id" Caption="oiId" Width="125" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" ReadOnly="true" /> <DxGridDataColumn FieldName="Id" Caption="oiId" Width="125" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" ReadOnly="true" />
<DxGridDataColumn FieldName="ShippingDocumentId" Caption="ShippingDocument" <DxGridDataColumn FieldName="ShippingDocumentId" Caption="ShippingDocument"
Visible="@(!ParentDataItemIsShippingDocument)" ReadOnly="@(ParentDataItemIsShippingDocument)"> Visible="@(!ParentDataItemIsShippingDocument)" ReadOnly="@(ParentDataItemIsShippingDocument)">
<EditSettings> <EditSettings>
<DxComboBoxSettings Data="ShippingDocuments" <DxComboBoxSettings Data="ShippingDocuments"
ValueFieldName="Id" ValueFieldName="Id"
TextFieldName="@nameof(ShippingDocument.PdfFileName)" TextFieldName="@nameof(ShippingDocument.PdfFileName)"
DropDownBodyCssClass="dd-body-class" DropDownBodyCssClass="dd-body-class"
ListRenderMode="ListRenderMode.Entire" ListRenderMode="ListRenderMode.Entire"
SearchMode="ListSearchMode.AutoSearch" SearchMode="ListSearchMode.AutoSearch"
SearchFilterCondition="ListSearchFilterCondition.Contains" SearchFilterCondition="ListSearchFilterCondition.Contains"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"> ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto">
<Columns> <Columns>
<DxListEditorColumn FieldName="@nameof(ShippingDocument.Id)" /> <DxListEditorColumn FieldName="@nameof(ShippingDocument.Id)" />
<DxListEditorColumn FieldName="@nameof(ShippingDocument.DocumentIdNumber)" /> <DxListEditorColumn FieldName="@nameof(ShippingDocument.DocumentIdNumber)" />
<DxListEditorColumn FieldName="@nameof(ShippingDocument.PdfFileName)" /> <DxListEditorColumn FieldName="@nameof(ShippingDocument.PdfFileName)" />
<DxListEditorColumn FieldName="@("Partner.Name")" /> <DxListEditorColumn FieldName="@("Partner.Name")" />
</Columns> </Columns>
</DxComboBoxSettings> </DxComboBoxSettings>
</EditSettings> </EditSettings>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="@("ShippingDocument.Partner.Name")" Caption="Patner" Width="125" ReadOnly="true" Visible="@(!ParentDataItemIsShippingDocument)" /> <DxGridDataColumn FieldName="@("ShippingDocument.Partner.Name")" Caption="Patner" Width="125" ReadOnly="true" Visible="@(!ParentDataItemIsShippingDocument)" />
<DxGridDataColumn FieldName="ProductId" Caption="Product"> <DxGridDataColumn FieldName="ProductId" Caption="Product">
<EditSettings> <EditSettings>
<DxComboBoxSettings Data="ProductDtos" <DxComboBoxSettings Data="ProductDtos"
ValueFieldName="Id" ValueFieldName="Id"
TextFieldName="Name" TextFieldName="Name"
DropDownBodyCssClass="dd-body-class" DropDownBodyCssClass="dd-body-class"
ListRenderMode="ListRenderMode.Entire" ListRenderMode="ListRenderMode.Entire"
SearchMode="ListSearchMode.AutoSearch" SearchMode="ListSearchMode.AutoSearch"
SearchFilterCondition="ListSearchFilterCondition.Contains" SearchFilterCondition="ListSearchFilterCondition.Contains"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"> ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto">
<Columns> <Columns>
<DxListEditorColumn FieldName="@nameof(ProductDto.Id)" /> <DxListEditorColumn FieldName="@nameof(ProductDto.Id)" />
<DxListEditorColumn FieldName="@nameof(ProductDto.Name)" /> <DxListEditorColumn FieldName="@nameof(ProductDto.Name)" />
<DxListEditorColumn FieldName="@nameof(ProductDto.AvailableQuantity)" /> <DxListEditorColumn FieldName="@nameof(ProductDto.AvailableQuantity)" />
<DxListEditorColumn FieldName="@nameof(ProductDto.StockQuantity)" /> <DxListEditorColumn FieldName="@nameof(ProductDto.StockQuantity)" />
<DxListEditorColumn FieldName="@nameof(ProductDto.IncomingQuantity)" /> <DxListEditorColumn FieldName="@nameof(ProductDto.IncomingQuantity)" />
<DxListEditorColumn FieldName="@nameof(ProductDto.NetWeight)" /> <DxListEditorColumn FieldName="@nameof(ProductDto.NetWeight)" />
<DxListEditorColumn FieldName="@nameof(ProductDto.IsMeasurable)" /> <DxListEditorColumn FieldName="@nameof(ProductDto.IsMeasurable)" />
</Columns> </Columns>
</DxComboBoxSettings> </DxComboBoxSettings>
</EditSettings> </EditSettings>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="NameOnDocument" MinWidth="120" Caption="Name(OnDoc)" /> <DxGridDataColumn FieldName="NameOnDocument" MinWidth="120" Caption="Name(OnDoc)" />
<DxGridDataColumn FieldName="Name" MinWidth="120" Caption="Name" Visible="false" /> <DxGridDataColumn FieldName="Name" MinWidth="120" Caption="Name" Visible="false" />
<DxGridDataColumn FieldName="PalletsOnDocument" Caption="Raklap(OnDoc)" /> <DxGridDataColumn FieldName="PalletsOnDocument" Caption="Raklap(OnDoc)" />
<DxGridDataColumn FieldName="QuantityOnDocument" Caption="Mennyiség(OnDoc)" /> <DxGridDataColumn FieldName="QuantityOnDocument" Caption="Mennyiség(OnDoc)" />
<DxGridDataColumn FieldName="NetWeightOnDocument" Caption="Net.súly(OnDoc)" /> <DxGridDataColumn FieldName="NetWeightOnDocument" Caption="Net.súly(OnDoc)" />
<DxGridDataColumn FieldName="GrossWeightOnDocument" Caption="Br.súly(OnDoc)" /> <DxGridDataColumn FieldName="GrossWeightOnDocument" Caption="Br.súly(OnDoc)" />
<DxGridDataColumn FieldName="MeasuringCount" Caption="Mérések száma" /> <DxGridDataColumn FieldName="MeasuringCount" Caption="Mérések száma" />
<DxGridDataColumn FieldName="MeasuredQuantity" Name="MeasuredQuantity" Caption="Mért mennyiség" ReadOnly="true" /> <DxGridDataColumn FieldName="MeasuredQuantity" Name="MeasuredQuantity" Caption="Mért mennyiség" ReadOnly="true" />
<DxGridDataColumn FieldName="MeasuredNetWeight" Name="MeasuredNetWeight" Caption="Mért net.súly(kg)" ReadOnly="true" /> <DxGridDataColumn FieldName="MeasuredNetWeight" Name="MeasuredNetWeight" Caption="Mért net.súly(kg)" ReadOnly="true" />
<DxGridDataColumn FieldName="MeasuredGrossWeight" Name="MeasuredGrossWeight" Caption="Mért br.súly(kg)" ReadOnly="true" /> <DxGridDataColumn FieldName="MeasuredGrossWeight" Name="MeasuredGrossWeight" Caption="Mért br.súly(kg)" ReadOnly="true" />
<DxGridDataColumn FieldName="IsMeasurable" ReadOnly="true" /> <DxGridDataColumn FieldName="IsMeasurable" ReadOnly="true" />
<DxGridDataColumn FieldName="IsMeasured" ReadOnly="true" /> <DxGridDataColumn FieldName="IsMeasured" ReadOnly="true" />
<DxGridDataColumn FieldName="UnitPriceOnDocument" Caption="Bekerülési ár" />
<DxGridDataColumn FieldName="Created" ReadOnly="true" /> <DxGridDataColumn FieldName="Created" ReadOnly="true" Visible="false" />
<DxGridDataColumn FieldName="Modified" ReadOnly="true" /> <DxGridDataColumn FieldName="Modified" ReadOnly="true" Visible="false" />
<DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn> <DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn>
</Columns> </Columns>
@* <DataColumnCellDisplayTemplate> @* <DataColumnCellDisplayTemplate>
@{ @{
if (context.DataColumn.FieldName == nameof(ShippingItem.ShippingDocumentId)) if (context.DataColumn.FieldName == nameof(ShippingItem.ShippingDocumentId))
{ {
@ -103,185 +104,185 @@
} }
</DataColumnCellDisplayTemplate> </DataColumnCellDisplayTemplate>
*@ <DetailRowTemplate> *@ <DetailRowTemplate>
@{ @{
var shippingItemPallets = ((ShippingItem)context.DataItem).ShippingItemPallets; var shippingItemPallets = ((ShippingItem)context.DataItem).ShippingItemPallets;
<GridShippingItemPallets ShippingItemPallets="shippingItemPallets" IsMasterGrid="false"></GridShippingItemPallets> <GridShippingItemPallets ShippingItemPallets="shippingItemPallets" IsMasterGrid="false"></GridShippingItemPallets>
} }
</DetailRowTemplate> </DetailRowTemplate>
<ToolbarTemplate> <ToolbarTemplate>
@if (IsMasterGrid) @if (IsMasterGrid)
{ {
<MgGridToolbarTemplate Grid="Grid" @ref="toolbar" OnReloadDataClick="() => ReloadDataFromDb(true)" /> <MgGridToolbarTemplate Grid="Grid" @ref="toolbar" OnReloadDataClick="() => ReloadDataFromDb(true)" />
} }
</ToolbarTemplate> </ToolbarTemplate>
<GroupSummary> <GroupSummary>
<DxGridSummaryItem SummaryType="GridSummaryItemType.Sum" <DxGridSummaryItem SummaryType="GridSummaryItemType.Sum"
FieldName="MeasuredQuantity" FieldName="MeasuredQuantity"
FooterColumnName="Quantity" /> FooterColumnName="Quantity" />
<DxGridSummaryItem SummaryType="GridSummaryItemType.Sum" <DxGridSummaryItem SummaryType="GridSummaryItemType.Sum"
FieldName="MeasuredGrossWeight" FieldName="MeasuredGrossWeight"
FooterColumnName="GrossWeight" /> FooterColumnName="GrossWeight" />
<DxGridSummaryItem SummaryType="GridSummaryItemType.Sum" <DxGridSummaryItem SummaryType="GridSummaryItemType.Sum"
FieldName="MeasuredNetWeight" FieldName="MeasuredNetWeight"
FooterColumnName="NetWeight" /> FooterColumnName="NetWeight" />
</GroupSummary> </GroupSummary>
</GridShippingItemBase> </GridShippingItemBase>
</GridContent> </GridContent>
</MgGridWithInfoPanel> </MgGridWithInfoPanel>
@code { @code {
//[Inject] public required ObjectLock ObjectLock { get; set; } //[Inject] public required ObjectLock ObjectLock { get; set; }
[Inject] public required DatabaseClient Database { get; set; } [Inject] public required DatabaseClient Database { get; set; }
//[Parameter] public int GetAllMessageTag { get; set; } //[Parameter] public int GetAllMessageTag { get; set; }
[Parameter] public IId<int>? ParentDataItem { get; set; } [Parameter] public IId<int>? ParentDataItem { get; set; }
[Parameter] public IEnumerable<ProductDto>? ProductDtos { get; set; } [Parameter] public IEnumerable<ProductDto>? ProductDtos { get; set; }
[Parameter] public AcObservableCollection<ShippingItem>? ShippingItems { get; set; } [Parameter] public AcObservableCollection<ShippingItem>? ShippingItems { get; set; }
[Parameter] public AcObservableCollection<ShippingDocument>? ShippingDocuments { get; set; } [Parameter] public AcObservableCollection<ShippingDocument>? ShippingDocuments { get; set; }
public bool IsMasterGrid => ParentDataItem == null; public bool IsMasterGrid => ParentDataItem == null;
public bool ParentDataItemIsShippingDocument => (ParentDataItem is ShippingDocument); public bool ParentDataItemIsShippingDocument => (ParentDataItem is ShippingDocument);
string GridCss => !IsMasterGrid ? "hide-toolbar" : string.Empty; string GridCss => !IsMasterGrid ? "hide-toolbar" : string.Empty;
MgGridToolbarTemplate toolbar; MgGridToolbarTemplate toolbar;
const string ExportFileName = "ExportResult"; const string ExportFileName = "ExportResult";
string _localStorageKey = "GridShippingItem_"; string _localStorageKey = "GridShippingItem_";
string GridSearchText = ""; string GridSearchText = "";
bool EditItemsEnabled { get; set; } = true; bool EditItemsEnabled { get; set; } = true;
int FocusedRowVisibleIndex { get; set; } int FocusedRowVisibleIndex { get; set; }
public GridShippingItemBase Grid { get; set; } public GridShippingItemBase Grid { get; set; }
private LoggerClient<GridShippingItemTemplate> _logger; private LoggerClient<GridShippingItemTemplate> _logger;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
_logger = new LoggerClient<GridShippingItemTemplate>(LogWriters.ToArray()); _logger = new LoggerClient<GridShippingItemTemplate>(LogWriters.ToArray());
await ReloadDataFromDb(false); await ReloadDataFromDb(false);
} }
public async Task ReloadDataFromDb(bool forceReload = false) public async Task ReloadDataFromDb(bool forceReload = false)
{ {
//using (await ObjectLock.GetSemaphore<ProductDto>().UseWaitAsync()) //using (await ObjectLock.GetSemaphore<ProductDto>().UseWaitAsync())
{ {
if (ProductDtos == null || !ProductDtos.Any() || forceReload) ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload); if (ProductDtos == null || !ProductDtos.Any() || forceReload) ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload);
} }
if (!IsMasterGrid) if (!IsMasterGrid)
{ {
if (ShippingDocuments == null && ParentDataItem is ShippingDocument shippingDocumentParent) ShippingDocuments = [shippingDocumentParent]; if (ShippingDocuments == null && ParentDataItem is ShippingDocument shippingDocumentParent) ShippingDocuments = [shippingDocumentParent];
return; return;
} }
using (await ObjectLock.GetSemaphore<ShippingDocument>().UseWaitAsync()) using (await ObjectLock.GetSemaphore<ShippingDocument>().UseWaitAsync())
{ {
if (ShippingDocuments == null) if (ShippingDocuments == null)
{ {
ShippingDocuments = new AcObservableCollection<ShippingDocument>(await FruitBankSignalRClient.GetShippingDocuments() ?? []); ShippingDocuments = new AcObservableCollection<ShippingDocument>(await FruitBankSignalRClient.GetShippingDocuments() ?? []);
} }
else if (ShippingDocuments.Count == 0 || forceReload) else if (ShippingDocuments.Count == 0 || forceReload)
{ {
ShippingDocuments.Replace(await FruitBankSignalRClient.GetShippingDocuments() ?? []); ShippingDocuments.Replace(await FruitBankSignalRClient.GetShippingDocuments() ?? []);
} }
} }
if (Grid == null) return; if (Grid == null) return;
using (await ObjectLock.GetSemaphore<ShippingItem>().UseWaitAsync()) using (await ObjectLock.GetSemaphore<ShippingItem>().UseWaitAsync())
if (forceReload) await Grid.ReloadDataSourceAsync(); if (forceReload) await Grid.ReloadDataSourceAsync();
if (forceReload) Grid.Reload(); if (forceReload) Grid.Reload();
} }
static void Grid_CustomizeElement(GridCustomizeElementEventArgs e) static void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
{ {
if (e.ElementType != GridElementType.DataCell) return; if (e.ElementType != GridElementType.DataCell) return;
if (e.Column.Name != nameof(ShippingItem.MeasuredNetWeight) && if (e.Column.Name != nameof(ShippingItem.MeasuredNetWeight) &&
e.Column.Name != nameof(ShippingItem.MeasuredGrossWeight) && e.Column.Name != nameof(ShippingItem.MeasuredGrossWeight) &&
e.Column.Name != nameof(ShippingItem.MeasuredQuantity)) return; e.Column.Name != nameof(ShippingItem.MeasuredQuantity)) return;
var isMeasured = (bool)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.IsMeasured)); var isMeasured = (bool)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.IsMeasured));
if (!isMeasured) return; if (!isMeasured) return;
switch (e.Column.Name) switch (e.Column.Name)
{ {
case nameof(ShippingItem.MeasuredNetWeight) or nameof(ShippingItem.MeasuredGrossWeight): case nameof(ShippingItem.MeasuredNetWeight) or nameof(ShippingItem.MeasuredGrossWeight):
{ {
var isMeasurable = (bool)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.IsMeasurable)); var isMeasurable = (bool)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.IsMeasurable));
if (!isMeasurable) return; if (!isMeasurable) return;
var valueOnDocument = 0d; var valueOnDocument = 0d;
var measuredValue = 0d; var measuredValue = 0d;
if (e.Column.Name == nameof(ShippingItem.MeasuredGrossWeight)) if (e.Column.Name == nameof(ShippingItem.MeasuredGrossWeight))
{ {
valueOnDocument = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.GrossWeightOnDocument)); valueOnDocument = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.GrossWeightOnDocument));
measuredValue = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredGrossWeight)); measuredValue = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredGrossWeight));
} }
else else
{ {
valueOnDocument = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.NetWeightOnDocument)); valueOnDocument = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.NetWeightOnDocument));
measuredValue = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredNetWeight)); measuredValue = (double)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredNetWeight));
} }
if (valueOnDocument > 0 && valueOnDocument > measuredValue) e.CssClass = "text-danger"; if (valueOnDocument > 0 && valueOnDocument > measuredValue) e.CssClass = "text-danger";
//else if (valueOnDocument <= measuredValue) e.CssClass = "text-success"; else if (valueOnDocument > 0 && valueOnDocument < measuredValue) e.CssClass = "text-success";
break; break;
} }
case nameof(ShippingItem.MeasuredQuantity): case nameof(ShippingItem.MeasuredQuantity):
{ {
var quantityOnDocument = (int)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.QuantityOnDocument)); var quantityOnDocument = (int)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.QuantityOnDocument));
var measuredQuantity = (int)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredQuantity)); var measuredQuantity = (int)e.Grid.GetRowValue(e.VisibleIndex, nameof(ShippingItem.MeasuredQuantity));
if (quantityOnDocument > 0 && quantityOnDocument > measuredQuantity) e.CssClass = "text-danger"; if (quantityOnDocument > 0 && quantityOnDocument > measuredQuantity) e.CssClass = "text-danger";
//else if (quantityOnDocument <= measuredQuantity) e.CssClass = "text-success"; //else if (quantityOnDocument <= measuredQuantity) e.CssClass = "text-success";
break; break;
} }
} }
} }
async Task Grid_FocusedRowChanged(GridFocusedRowChangedEventArgs args) async Task Grid_FocusedRowChanged(GridFocusedRowChangedEventArgs args)
{ {
if ((args.Grid.IsEditing() || args.Grid.IsEditingNewRow()) && (args.DataItem as IId<int>).Id > 0) if ((args.Grid.IsEditing() || args.Grid.IsEditingNewRow()) && (args.DataItem as IId<int>).Id > 0)
await args.Grid.SaveChangesAsync(); await args.Grid.SaveChangesAsync();
if (toolbar != null) if (toolbar != null)
{ {
var shippingItem = (args.DataItem as ShippingItem)!; var shippingItem = (args.DataItem as ShippingItem)!;
toolbar.EnableDelete = shippingItem.MeasuringStatus == MeasuringStatus.NotStarted; toolbar.EnableDelete = shippingItem.MeasuringStatus == MeasuringStatus.NotStarted;
} }
FocusedRowVisibleIndex = args.VisibleIndex; FocusedRowVisibleIndex = args.VisibleIndex;
EditItemsEnabled = true; EditItemsEnabled = true;
} }
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e) async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
{ {
} }
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e) async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
{ {
ShippingItem? resultShippingItem = null; ShippingItem? resultShippingItem = null;
if (!e.IsNew) if (!e.IsNew)
{ {
resultShippingItem = await FruitBankSignalRClient.UpdateShippingItem((ShippingItem)e.EditModel); resultShippingItem = await FruitBankSignalRClient.UpdateShippingItem((ShippingItem)e.EditModel);
} }
else else
{ {
resultShippingItem = await FruitBankSignalRClient.AddShippingItem((ShippingItem)e.EditModel); resultShippingItem = await FruitBankSignalRClient.AddShippingItem((ShippingItem)e.EditModel);
EditItemsEnabled = true; EditItemsEnabled = true;
} }
// if (resultShippingItem != null) // if (resultShippingItem != null)
// ShippingItems!.UpdateCollection(resultShippingItem, false); // ShippingItems!.UpdateCollection(resultShippingItem, false);
EditItemsEnabled = true; EditItemsEnabled = true;
} }
} }

View File

@ -48,7 +48,7 @@
<ToolbarTemplate> <ToolbarTemplate>
@if (IsMasterGrid) @if (IsMasterGrid)
{ {
<MgGridToolbarTemplate Grid="Grid" OnReloadDataClick="() => ReloadDataFromDb(true)" /> <MgGridToolbarTemplate Grid="Grid" OnReloadDataClick="() => ReloadDataFromDb(true)" EnableDelete="false" EnableEdit="false" EnableNew="false" />
} }
</ToolbarTemplate> </ToolbarTemplate>
@* <GroupSummary> @* <GroupSummary>

View File

@ -1,4 +1,6 @@
<iframe src="https://localhost:59579/Admin/FileManager/ImageTextExtraction" title="Ai process form" width="100%" height="100%"></iframe> @using FruitBank.Common
@code {
<iframe src="@baseUrl" title="Ai process form" width="100%" height="100%"></iframe>
@code {
public string baseUrl = FruitBankConstClient.BaseUrl + "/Admin/FileManager/ImageTextExtraction";
} }

View File

@ -72,15 +72,16 @@
</table> </table>
} }
<MgLazyLoadContent @ref="_lazyContentRef" @* <MgLazyLoadContent @ref="_lazyContentRef"
MinHeight="800px" MinHeight="800px"
RootMargin="50px" RootMargin="50px"
OnContentVisible="OnPdfContainerVisibleAsync" OnContentVisible="OnPdfContainerVisibleAsync"
ContainerStyle="margin-top: 30px;"> ContainerStyle="margin-top: 30px;">
<div id="pdfContainer" style="width: 100%; height: 800px; overflow-y: auto;"> <div id="pdfContainer" style="width: 100%; height: 800px; overflow-y: auto;">
</div> </div>
</MgLazyLoadContent> </MgLazyLoadContent>*@
</AfterColumnsTemplate>
</AfterColumnsTemplate>
@* <FooterTemplate Context="ctx"> @* <FooterTemplate Context="ctx">
<div class="p-2 border-top d-flex gap-2"> <div class="p-2 border-top d-flex gap-2">
@ -94,7 +95,7 @@
{ {
private readonly string[] _pdfFiles = private readonly string[] _pdfFiles =
[ [
"1_Albaran_AH25007715.pdf", "1_Albaran_AH25007715.pdf",
"2_BANK FRA.pdf", "2_BANK FRA.pdf",
"3_BP-30M35_20251113_163816.pdf" "3_BP-30M35_20251113_163816.pdf"
]; ];
@ -110,16 +111,26 @@
private async Task OnDataItemChangedAsync(object? dataItem) private async Task OnDataItemChangedAsync(object? dataItem)
{ {
@if (dataItem is not ShippingDocument && dataItem is not ShippingItem) return; if (dataItem is not ShippingDocument && dataItem is not ShippingItem) return;
// Store the PDF to render ShippingDocument? shippingDocument = null;
_randomPdf = _pdfFiles[Random.Shared.Next(_pdfFiles.Length)];
_currentPdfToRender = $"_content/FruitBankHybrid.Shared/uploads/{_randomPdf}";
// If MgLazyLoadContent is already visible, render the PDF immediately if (dataItem is ShippingItem shippingItem) shippingDocument = shippingItem.ShippingDocument;
if (_lazyContentRef is { IsVisible: true }) else shippingDocument = dataItem as ShippingDocument;
if (shippingDocument == null) return;
if (_lazyContentRef != null && shippingDocument.ShippingDocumentToFiles?.Count > 0)
{ {
await _lazyContentRef.TriggerContentVisibleAsync(); // Store the PDF to render
_randomPdf = _pdfFiles[Random.Shared.Next(_pdfFiles.Length)];
_currentPdfToRender = $"_content/FruitBankHybrid.Shared/uploads/{_randomPdf}";
// If MgLazyLoadContent is already visible, render the PDF immediately
if (_lazyContentRef is { IsVisible: true })
{
await _lazyContentRef.TriggerContentVisibleAsync();
}
} }
} }

View File

@ -23,12 +23,13 @@
<Columns> <Columns>
<DxGridDataColumn FieldName="Id" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" ReadOnly="true" /> <DxGridDataColumn FieldName="Id" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" ReadOnly="true" />
<DxGridDataColumn FieldName="ShippingDate" /> <DxGridDataColumn FieldName="ShippingDate" Caption="Beérkezés"/>
<DxGridDataColumn FieldName="LicencePlate" /> <DxGridDataColumn FieldName="LicencePlate" Caption="Rendszám" />
<DxGridDataColumn FieldName="Comment" Caption="Megjegyzés" ReadOnly="false" />
<DxGridDataColumn FieldName="IsAllMeasured" ReadOnly="true" /> <DxGridDataColumn FieldName="CargoCompany" Caption="Fuvarozó" ReadOnly="false" />
<DxGridDataColumn FieldName="Created" ReadOnly="true" /> <DxGridDataColumn FieldName="IsAllMeasured" Caption="Mérések kész" ReadOnly="true" />
<DxGridDataColumn FieldName="Modified" ReadOnly="true" /> <DxGridDataColumn FieldName="Created" Caption="Létrehozva" ReadOnly="true" />
<DxGridDataColumn FieldName="Modified" Caption="Módosítva" ReadOnly="true" />
<DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn> <DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn>
</Columns> </Columns>
<DetailRowTemplate> <DetailRowTemplate>

View File

@ -48,7 +48,7 @@
<ToolbarTemplate> <ToolbarTemplate>
@if (IsMasterGrid) @if (IsMasterGrid)
{ {
<MgGridToolbarTemplate Grid="Grid" OnReloadDataClick="() => ReloadDataFromDb(true)" /> <MgGridToolbarTemplate Grid="Grid" OnReloadDataClick="() => ReloadDataFromDb(true)" EnableDelete="false" EnableEdit="false" EnableNew="false" />
} }
</ToolbarTemplate> </ToolbarTemplate>
</GridStockTakingItemBase> </GridStockTakingItemBase>

View File

@ -12,7 +12,7 @@
@typeparam TPalletItem where TPalletItem : class, IMeasuringItemPalletBase @typeparam TPalletItem where TPalletItem : class, IMeasuringItemPalletBase
<DxFormLayout Context="ctxFromLayoutPallet" Data="@PalletItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100 measuring-form-layout" <DxFormLayout Context="ctxFromLayoutPallet" Data="@PalletItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100 measuring-form-layout"
ItemUpdating="@((pair) => OnItemUpdating(pair.Key, pair.Value, PalletItem))" Enabled="IsEditable"> ItemUpdating="@((pair) => OnItemUpdating(pair.Key, pair.Value, PalletItem))" Enabled="Editable">
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1" BeginRow="true"> <DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1" BeginRow="true">
<b>@(MeasuringIndex). MÉRÉS</b> <b>@(MeasuringIndex). MÉRÉS</b>
@ -21,24 +21,24 @@
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.PalletWeight)))" <DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.PalletWeight)))"
Field="@nameof(ShippingItemPallet.PalletWeight)" Field="@nameof(ShippingItemPallet.PalletWeight)"
Enabled="@(IsEditable && IsMeasurable && ProductId > 0)" Visible="@(IsMeasurable)" Enabled="@(Editable && IsMeasurable && ProductId > 0)" Visible="@(IsMeasurable)"
Caption="Rakl.súly(kg)" ColSpanMd="2" /> Caption="Rakl.súly(kg)" ColSpanMd="2" />
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.TareWeight)))" <DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.TareWeight)))"
Field="@nameof(ShippingItemPallet.TareWeight)" Field="@nameof(ShippingItemPallet.TareWeight)"
Enabled="@(IsEditable && IsMeasurable && ProductId > 0)" Visible="@(IsMeasurable)" Enabled="@(Editable && IsMeasurable && ProductId > 0)" Visible="@(IsMeasurable)"
Caption="Tára(kg)" ColSpanMd="2" /> Caption="Tára(kg)" ColSpanMd="2" />
@* <DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1" /> *@ @* <DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1" /> *@
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.TrayQuantity)))" <DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.TrayQuantity)))"
Field="@nameof(ShippingItemPallet.TrayQuantity)" Field="@nameof(ShippingItemPallet.TrayQuantity)"
Enabled="@(IsEditable && ProductId > 0)" Enabled="@(Editable && ProductId > 0)"
Caption="Rekesz/csomag" ColSpanMd="2" /> Caption="Rekesz/csomag" ColSpanMd="2" />
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.GrossWeight)))" <DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.GrossWeight)))"
Field="@nameof(ShippingItemPallet.GrossWeight)" Field="@nameof(ShippingItemPallet.GrossWeight)"
Enabled="@(IsEditable && IsMeasurable && ProductId > 0)" Visible="@(IsMeasurable)" Enabled="@(Editable && IsMeasurable && ProductId > 0)" Visible="@(IsMeasurable)"
Caption="Br.súly(kg)" ColSpanMd="2"> Caption="Br.súly(kg)" ColSpanMd="2">
</DxFormLayoutItem> </DxFormLayoutItem>
@ -48,19 +48,19 @@
</DxFormLayoutItem> </DxFormLayoutItem>
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="@(HasAuditButton ? 1 : 2)"> <DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="@(HasAuditButton ? 1 : 2)">
<DxButton Enabled="@(IsEditable && BtnSaveEnabled)" Text="@(PalletItem.Id == 0 ? "Mentés" : "Módosít")" Click="() => PalletItemSaveClick()" CssClass="w-100" /> <DxButton Enabled="@(Editable && BtnSaveEnabled)" Text="@(PalletItem.Id == 0 ? "Mentés" : "Módosít")" Click="() => PalletItemSaveClick()" CssClass="w-100" />
</DxFormLayoutItem> </DxFormLayoutItem>
@if (HasAuditButton) @if (HasAuditButton)
{ {
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1"> <DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1">
<DxButton Enabled="@(IsEditable && OrderItemPallet!.IsMeasuredAndValid(IsMeasurable) && !OrderItemPallet.IsAudited && IsMaxTrayQuantityValid)" <DxButton Enabled="@(Editable && OrderItemPallet!.IsMeasuredAndValid(IsMeasurable) && !OrderItemPallet.IsAudited && IsMaxTrayQuantityValid)"
Text="@(OrderItemPallet!.IsAudited ? "Jóváhagyva" : "Jóváhagy")" Click="() => PalletItemAuditedClick()" CssClass="w-100" /> Text="@(OrderItemPallet!.IsAudited ? "Jóváhagyva" : "Jóváhagy")" Click="() => PalletItemAuditedClick()" CssClass="w-100" />
</DxFormLayoutItem> </DxFormLayoutItem>
} }
</DxFormLayout> </DxFormLayout>
@code { @code {
[Inject] public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; } [Inject] public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; }
[Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; } [Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; }
[Inject] public required LoggedInModel LoggedInModel { get; set; } [Inject] public required LoggedInModel LoggedInModel { get; set; }
@ -73,15 +73,19 @@
[Parameter] public int? AddOrUpdateSignalRTag { get; set; } = null; [Parameter] public int? AddOrUpdateSignalRTag { get; set; } = null;
[Parameter] public int? MaxTrayQuantity { get; set; } = null; [Parameter] public int? MaxTrayQuantity { get; set; } = null;
[Parameter] public bool IsEditable { get; set; } = true; [Parameter] public bool Editable { get; set; } = true;
//[Parameter] public EventCallback OnPalletItemSaveClick { get; set; }
[Parameter] public Func<TPalletItem?, Task>? OnPalletItemSaved { get; set; } [Parameter] public Func<TPalletItem?, Task>? OnPalletItemSaved { get; set; }
[Parameter] public Func<TPalletItem, Task>? OnPalletItemValueChanged { get; set; } [Parameter] public Func<TPalletItem, Task>? OnPalletItemValueChanged { get; set; }
[Parameter] public Func<TPalletItem?, Task>? OnPalletItemAuditedClick { get; set; } [Parameter] public Func<TPalletItem?, Task>? OnPalletItemAudited { get; set; }
/// <summary>
/// Before Save or Audit
/// </summary>
[Parameter] public Func<TPalletItem?, Task>? OnPalletItemSaveOrAuditClick { get; set; }
//public bool LoadingPanelVisible { get; set; } = false; //public bool LoadingPanelVisible { get; set; } = false;
//public bool IsEditable => !HasAuditButton || (OrderItemPallet.IsAudited); //public bool Editable => !HasAuditButton || (OrderItemPallet.IsAudited);
public bool BtnSaveEnabled { get; set; } public bool BtnSaveEnabled { get; set; }
@ -93,7 +97,7 @@
private bool GetBtnSaveEnabled() private bool GetBtnSaveEnabled()
{ {
return IsEditable && PalletItem.IsValidMeasuringValues(IsMeasurable) && !PalletItem.IsMeasured && IsMaxTrayQuantityValid; return Editable && PalletItem.IsValidMeasuringValues(IsMeasurable) && !PalletItem.IsMeasured && IsMaxTrayQuantityValid;
} }
private bool IsMaxTrayQuantityValid => (!MaxTrayQuantity.HasValue || PalletItem.TrayQuantity <= MaxTrayQuantity.Value); private bool IsMaxTrayQuantityValid => (!MaxTrayQuantity.HasValue || PalletItem.TrayQuantity <= MaxTrayQuantity.Value);
@ -119,6 +123,8 @@
PalletItem.ModifierId = LoggedInModel.CustomerDto?.Id; PalletItem.ModifierId = LoggedInModel.CustomerDto?.Id;
if (OnPalletItemSaveOrAuditClick != null) await OnPalletItemSaveOrAuditClick.Invoke(PalletItem);
var responseShippingItemPallet = await FruitBankSignalRClient.PostDataAsync(AddOrUpdateSignalRTag!.Value, PalletItem); var responseShippingItemPallet = await FruitBankSignalRClient.PostDataAsync(AddOrUpdateSignalRTag!.Value, PalletItem);
if (responseShippingItemPallet != null) PalletItem.Id = responseShippingItemPallet.Id; //Az UpdateCollection miatt kell, hogy megtalálja mit kell kicserélni! - J. if (responseShippingItemPallet != null) PalletItem.Id = responseShippingItemPallet.Id; //Az UpdateCollection miatt kell, hogy megtalálja mit kell kicserélni! - J.
//else _logger.Error($"Sikertelen volt a raklap adatainak mentése!"); //else _logger.Error($"Sikertelen volt a raklap adatainak mentése!");
@ -126,7 +132,7 @@
if (OnPalletItemSaved != null) await OnPalletItemSaved.Invoke(responseShippingItemPallet); if (OnPalletItemSaved != null) await OnPalletItemSaved.Invoke(responseShippingItemPallet);
//LoadingPanelVisible = false; //LoadingPanelVisible = false;
StateHasChanged(); await InvokeAsync(StateHasChanged);
} }
protected async Task OnItemUpdating(string fieldName, object newValue, TPalletItem palletItem) protected async Task OnItemUpdating(string fieldName, object newValue, TPalletItem palletItem)
@ -172,15 +178,17 @@
private async Task PalletItemAuditedClick() private async Task PalletItemAuditedClick()
{ {
if (OnPalletItemAuditedClick != null) if (OnPalletItemAudited != null)
{ {
if (OrderItemPallet == null) throw new Exception($"PalletItemComponent->PalletItemAuditedClick(); OrderItemPallet == null"); if (OrderItemPallet == null) throw new Exception($"PalletItemComponent->PalletItemAuditedClick(); OrderItemPallet == null");
if (await DialogService.ShowConfirmBoxAsync("Megerősítés", "Biztoan jóváhagyja a mérést? Jóváhagyás után a mérés nem módosítható!", MessageBoxRenderStyle.Info)) if (await DialogService.ShowConfirmBoxAsync("Megerősítés", "Biztoan jóváhagyja a mérést? Jóváhagyás után a mérés nem módosítható!", MessageBoxRenderStyle.Info))
{ {
if (OnPalletItemSaveOrAuditClick != null) await OnPalletItemSaveOrAuditClick.Invoke(PalletItem);
OrderItemPallet.RevisorId = LoggedInModel.CustomerDto!.Id; OrderItemPallet.RevisorId = LoggedInModel.CustomerDto!.Id;
StateHasChanged(); //Az Audit button miatt kell a StateHasChanged(), most már van RevisorId és emiatt disabled lesz... await InvokeAsync(StateHasChanged); //Az Audit button miatt kell a StateHasChanged(), most már van RevisorId és emiatt disabled lesz...
PalletItem.SetParentPropToNull(); PalletItem.SetParentPropToNull();
@ -191,7 +199,7 @@
await DialogService.ShowMessageBoxAsync("Hiba", "Adatok mentése sikertelen volt, ellenőrizze a mérés adatait!", MessageBoxRenderStyle.Danger); await DialogService.ShowMessageBoxAsync("Hiba", "Adatok mentése sikertelen volt, ellenőrizze a mérés adatait!", MessageBoxRenderStyle.Danger);
} }
if (OnPalletItemAuditedClick != null) await OnPalletItemAuditedClick.Invoke(responseShippingItemPallet); await OnPalletItemAudited.Invoke(responseShippingItemPallet);
} }
} }
} }

View File

@ -12,17 +12,26 @@
@using FruitBankHybrid.Shared.Services.SignalRs @using FruitBankHybrid.Shared.Services.SignalRs
@using Mango.Nop.Core.Entities @using Mango.Nop.Core.Entities
<DxLoadingPanel @bind-Visible="LoadingPanelVisible"
IsContentBlocked="true"
ApplyBackgroundShading="true"
IndicatorAreaVisible="true"
IsContentVisible="true"
IndicatorAnimationType="WaitIndicatorAnimationType.Spin"
Text="Adatok szinkronizálása folyamatban...">
<DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-100"> <DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-100">
<DxFormLayoutItem Caption="Termék:" ColSpanMd="2"> <DxFormLayoutItem Caption="Termék:" ColSpanMd="2">
@* CaptionCssClass="@(SelectedProductDto?.IsMeasured == true ? "text-success" : "")"> *@ @* CaptionCssClass="@(SelectedProductDto?.IsMeasured == true ? "text-success" : "")"> *@
<DxComboBox Data="@_stockTakings" <DxComboBox @ref="cbStockTakings"
Data="@_stockTakings"
TextFieldName="@nameof(StockTaking.StartDateTime)" TextFieldName="@nameof(StockTaking.StartDateTime)"
CssClass="cw-480" CssClass="cw-480"
DropDownBodyCssClass="dd-body-class" DropDownBodyCssClass="dd-body-class"
Context="ctxProduct" Context="ctxProduct"
InputId="cbProduct" InputId="cbProduct"
Value="@SelectedStockTaking" Value="@SelectedStockTaking"
ValueChanged="@(async (StockTaking stockTaking) => await StockTakingComboValueChanged(stockTaking))"> ValueChanged="@(async (StockTaking stockTaking) => await StockTakingComboValueChanged(stockTaking, null))">
</DxComboBox> </DxComboBox>
</DxFormLayoutItem> </DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="4"> <DxFormLayoutItem ColSpanMd="4">
@ -32,18 +41,24 @@
CssClass="cw-480" CssClass="cw-480"
DropDownBodyCssClass="dd-body-class" DropDownBodyCssClass="dd-body-class"
Context="ctxProduct2" Context="ctxProduct2"
InputId="cbProduct2"> InputId="cbProduct2"
SearchMode="ListSearchMode.AutoSearch"
SearchFilterCondition="ListSearchFilterCondition.Contains"
SearchTextParseMode="ListSearchTextParseMode.Default"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
DropDownTriggerMode="DropDownTriggerMode.Click"
@ref="cbStockTakingItems">
</DxComboBox> </DxComboBox>
</DxFormLayoutItem> </DxFormLayoutItem>
@* TextFieldName="StockTakingItem.Product.Name" *@ @* TextFieldName="StockTakingItem.Product.Name" *@
<DxFormLayoutItem ColSpanMd="1"> <DxFormLayoutItem ColSpanMd="1">
<DxButton Text="Új" Enabled="@(_stockTakings.All(x => x.IsClosed))" Click="() => NewStockTakingClick()"></DxButton> <DxButton Text="Új" Enabled="@(!_btnDisabled && _stockTakings.All(x => x.IsClosed))" Click="() => NewStockTakingClick()"></DxButton>
</DxFormLayoutItem> </DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="1"> @* <DxFormLayoutItem ColSpanMd="1">
<DxButton Text="Módosít" Enabled="@(SelectedStockTaking?.IsClosed ?? false)" Click="() => UpdateStockTakingClick()"></DxButton> <DxButton Text="Módosít" Enabled="@((SelectedStockTaking?.IsClosed ?? false) && false)" Click="() => UpdateStockTakingClick()"></DxButton>
</DxFormLayoutItem> </DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="1"> *@ <DxFormLayoutItem ColSpanMd="1">
<DxButton Text="Lezárás" Enabled="@(SelectedStockTaking?.IsReadyForClose() ?? false)" Click="() => StockTakingCloseClick()"></DxButton> <DxButton Text="Lezárás" Enabled="@(!_btnDisabled && (!SelectedStockTaking?.IsClosed ?? false) && (SelectedStockTaking?.IsReadyForClose() ?? false))" Click="() => StockTakingCloseClick(SelectedStockTaking!.Id)"></DxButton>
</DxFormLayoutItem> </DxFormLayoutItem>
</DxFormLayout> </DxFormLayout>
@ -58,10 +73,17 @@
<div> <div>
@{ @{
var a = $"Várható rekesz: {SelectedStockTakingItem.TotalOriginalQuantity} ({SelectedStockTakingItem.OriginalStockQuantity} + {SelectedStockTakingItem.InProcessOrdersQuantity}), Várható net.súly: {SelectedStockTakingItem.OriginalNetWeight} kg."; var a = $"Várható rekesz: {SelectedStockTakingItem.TotalOriginalQuantity} ({SelectedStockTakingItem.OriginalStockQuantity} + {SelectedStockTakingItem.InProcessOrdersQuantity}), Várható net.súly: {SelectedStockTakingItem.OriginalNetWeight} kg.";
<span>@a</span> <span>@a</span>
} }
@if (SelectedStockTakingItem.IsInvalid)
{
<div class="text-danger" style="margin-top: 15px">A várható mennyiség nem lehet negatív! A hibás adatok javítása után nyomja meg a "Frissítés" gombot.</div>
<DxButton Text="Frissítés" Click="() => RefreshErrorItemClick(SelectedStockTakingItem)"></DxButton>
}
</div> </div>
<DxFormLayout Data="@SelectedStockTakingItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100"> <DxFormLayout Data="@SelectedStockTakingItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100" Enabled="@((!SelectedStockTaking?.IsClosed ?? false))">
<DxFormLayoutItem Context="ctxShippingItemFromLayoutItem" ColSpanMd="12"> <DxFormLayoutItem Context="ctxShippingItemFromLayoutItem" ColSpanMd="12">
@for (var index = 0; index < (SelectedStockTakingItem?.StockTakingItemPallets?.Count ?? 0); index++) @for (var index = 0; index < (SelectedStockTakingItem?.StockTakingItemPallets?.Count ?? 0); index++)
{ {
@ -70,6 +92,7 @@
<PalletItemComponent IsMeasurable="@SelectedStockTakingItem!.IsMeasurable" <PalletItemComponent IsMeasurable="@SelectedStockTakingItem!.IsMeasurable"
MeasuringIndex="@localI" MeasuringIndex="@localI"
Editable="@(!SelectedStockTaking?.IsClosed ?? false)"
PalletItem="@currentShippingItemPallet" PalletItem="@currentShippingItemPallet"
ProductId="@SelectedStockTakingItem.Product!.Id" ProductId="@SelectedStockTakingItem.Product!.Id"
AddOrUpdateSignalRTag="SignalRTags.AddOrUpdateMeasuredStockTakingItemPallet" AddOrUpdateSignalRTag="SignalRTags.AddOrUpdateMeasuredStockTakingItemPallet"
@ -94,6 +117,7 @@
</DxFormLayout> </DxFormLayout>
} }
</div> </div>
</DxLoadingPanel>
@code @code
{ {
@ -102,6 +126,12 @@
[Inject] public required IDialogService DialogService { get; set; } = null!; [Inject] public required IDialogService DialogService { get; set; } = null!;
[Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; } [Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; }
bool _btnDisabled = false;
bool LoadingPanelVisible = false;
DxComboBox<StockTaking, StockTaking> cbStockTakings;
DxComboBox<StockTakingItem, StockTakingItem> cbStockTakingItems;
List<StockTaking> _stockTakings { get; set; } = []; List<StockTaking> _stockTakings { get; set; } = [];
List<StockTakingItem> _stockTakingItems { get; set; } = []; List<StockTakingItem> _stockTakingItems { get; set; } = [];
List<StockTakingItemPallet> _stockTakingItemPallets { get; set; } = []; List<StockTakingItemPallet> _stockTakingItemPallets { get; set; } = [];
@ -115,55 +145,100 @@
public async Task ReloadDataFromDb(bool forceReload) public async Task ReloadDataFromDb(bool forceReload)
{ {
LoadingPanelVisibility.Visible = true; LoadingPanelVisible = true;
_stockTakings = await FruitBankSignalRClient.GetStockTakings(false) ?? []; _stockTakings = await FruitBankSignalRClient.GetStockTakings(false) ?? [];
await StockTakingComboValueChanged(_stockTakings.FirstOrDefault()); await StockTakingComboValueChanged(_stockTakings.FirstOrDefault(), null);
LoadingPanelVisibility.Visible = false; LoadingPanelVisible = false;
}
private async Task RefreshErrorItemClick(StockTakingItem errorTakingItem)
{
var stockTakingItem = await FruitBankSignalRClient.RefreshStockTakingItem(errorTakingItem.Id);
if (stockTakingItem == null)
{
await DialogService.ShowMessageBoxAsync("Hiba", "Adatok frissése sikertelen volt!", MessageBoxRenderStyle.Danger);
return;
}
await StockTakingComboValueChanged(SelectedStockTaking, stockTakingItem.Id);
if (stockTakingItem.IsInvalid)
await DialogService.ShowMessageBoxAsync("Figyelem", "A termék továbbra is hibás!", MessageBoxRenderStyle.Warning);
} }
private async Task NewStockTakingClick() private async Task NewStockTakingClick()
{ {
var stockTaking = new StockTaking(); _btnDisabled = true;
stockTaking.StartDateTime = DateTime.Now;
stockTaking.Creator = LoggedInModel.CustomerDto!.Id;
var resultStockTakings = await FruitBankSignalRClient.AddStockTaking(stockTaking); try
if (resultStockTakings == null) return; {
LoadingPanelVisible = true;
_stockTakings.UpdateCollection(resultStockTakings, false); var stockTaking = new StockTaking
await StockTakingComboValueChanged(_stockTakings.FirstOrDefault(x => x.Id == stockTaking.Id)); {
StartDateTime = DateTime.Now,
Creator = LoggedInModel.CustomerDto!.Id
};
var resultStockTakings = await FruitBankSignalRClient.AddStockTaking(stockTaking);
if (resultStockTakings == null)
{
await DialogService.ShowMessageBoxAsync("Hiba", "Új leltár létrehozása sikertelen volt!", MessageBoxRenderStyle.Danger);
return;
}
_stockTakings.UpdateCollection(resultStockTakings, false);
await StockTakingComboValueChanged(_stockTakings.FirstOrDefault(x => x.Id == resultStockTakings.Id), null);
}
finally
{
_btnDisabled = false;
LoadingPanelVisible = false;
}
//cbStockTakings.Reload();
await InvokeAsync(StateHasChanged);
} }
private async Task UpdateStockTakingClick() private async Task StockTakingCloseClick(int stockTakingId)
{ {
// var resultStockTaking = await FruitBankSignalRClient.AddStockTaking(stockTaking); _btnDisabled = true;
// if (resultStockTaking == null) return;
// _stockTakings.Add(resultStockTaking); try
StateHasChanged(); {
LoadingPanelVisible = true;
var resultStockTaking = await FruitBankSignalRClient.CloseStockTaking(stockTakingId);
if (resultStockTaking == null)
{
await DialogService.ShowMessageBoxAsync("Hiba", "A leltár lezárása sikertelen volt, ellenőrizze a leltár adatait!", MessageBoxRenderStyle.Danger);
return;
}
_stockTakings.UpdateCollection(resultStockTaking, false);
await StockTakingComboValueChanged(_stockTakings.FirstOrDefault(x => x.Id == resultStockTaking.Id), null);
}
finally
{
_btnDisabled = false;
LoadingPanelVisible = false;
}
await InvokeAsync(StateHasChanged);
} }
private async Task StockTakingCloseClick() private async Task StockTakingComboValueChanged(StockTaking? newValue, int? selectedStockTakingItemId)
{
// var resultStockTaking = await FruitBankSignalRClient.AddStockTaking(stockTaking);
// if (resultStockTaking == null) return;
// _stockTakings.Add(resultStockTaking);
StateHasChanged();
}
private async Task StockTakingComboValueChanged(StockTaking? newValue)
{ {
SelectedStockTaking = newValue; SelectedStockTaking = newValue;
SelectedStockTaking?.StockTakingItems = await FruitBankSignalRClient.GetStockTakingItemsByStockTakingId(SelectedStockTaking.Id); SelectedStockTaking?.StockTakingItems = await FruitBankSignalRClient.GetStockTakingItemsByStockTakingId(SelectedStockTaking.Id);
PrepareStockTakingItems(SelectedStockTaking); PrepareStockTakingItems(SelectedStockTaking);
SelectedStockTakingItem = _stockTakingItems.FirstOrDefault(); SelectedStockTakingItem = selectedStockTakingItemId.HasValue ? _stockTakingItems.FirstOrDefault(x => x.Id == selectedStockTakingItemId.Value) : _stockTakingItems.FirstOrDefault();
StateHasChanged(); await InvokeAsync(StateHasChanged);
} }
private void PrepareStockTakingItems(StockTaking? stockTaking) private void PrepareStockTakingItems(StockTaking? stockTaking)
@ -191,19 +266,22 @@
} }
} }
private Task OnStockTakingItemPalletValueChanged(StockTakingItemPallet stockTakingItemPallet, StockTakingItem stockTakingItem) private async Task OnStockTakingItemPalletValueChanged(StockTakingItemPallet stockTakingItemPallet, StockTakingItem stockTakingItem)
{ {
// MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(stockTakingItem); // MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(stockTakingItem);
// BtnSaveEnabled = stockTakingItem.IsValidMeasuringValues() && stockTakingItemPallet.IsValidMeasuringValues(stockTakingItem.IsMeasurable); // BtnSaveEnabled = stockTakingItem.IsValidMeasuringValues() && stockTakingItemPallet.IsValidMeasuringValues(stockTakingItem.IsMeasurable);
StateHasChanged(); //cbStockTakingItems.Reload();
return Task.CompletedTask; await InvokeAsync(StateHasChanged);
//return Task.CompletedTask;
} }
private async Task OnStockTakingItemPalletSaved(StockTakingItemPallet? responseStockTakingItemPallet) private async Task OnStockTakingItemPalletSaved(StockTakingItemPallet? responseStockTakingItemPallet)
{ {
if (responseStockTakingItemPallet != null) if (responseStockTakingItemPallet != null)
{ {
//responseStockTakingItemPallet.IsMeasured = true;
responseStockTakingItemPallet.StockTakingItem = SelectedStockTakingItem; responseStockTakingItemPallet.StockTakingItem = SelectedStockTakingItem;
SelectedStockTakingItem!.MeasuredStockQuantity = responseStockTakingItemPallet.TrayQuantity; SelectedStockTakingItem!.MeasuredStockQuantity = responseStockTakingItemPallet.TrayQuantity;
@ -216,7 +294,10 @@
} }
else await DialogService.ShowMessageBoxAsync("Hiba", "Adatok mentése sikertelen volt, ellenőrizze a mérés adatait!", MessageBoxRenderStyle.Danger); else await DialogService.ShowMessageBoxAsync("Hiba", "Adatok mentése sikertelen volt, ellenőrizze a mérés adatait!", MessageBoxRenderStyle.Danger);
//cbStockTakingItems.Reload();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
await cbStockTakingItems.FocusAsync();
} }
} }

View File

@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Components;
namespace FruitBankHybrid.Shared.Layout; namespace FruitBankHybrid.Shared.Layout;
public partial class MainLayout : LayoutComponentBase public partial class MainLayout : LayoutComponentBase, IDisposable
{ {
[Inject] public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; } [Inject] public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; }
[Inject] public required NavigationManager NavManager { get; set; } [Inject] public required NavigationManager NavManager { get; set; }
@ -70,43 +70,57 @@ public partial class MainLayout : LayoutComponentBase
{ {
if (messageTag != SignalRTags.NotificationReceived || !LoggedInModel.IsLoggedIn) return; if (messageTag != SignalRTags.NotificationReceived || !LoggedInModel.IsLoggedIn) return;
var notificationMessage = responseDataMessage?.GetResponseData<SignalRMessageToClientWithText<OrderDto>>(); try
if (notificationMessage == null)
{ {
_logger.Error($"notificationMessage == null"); var notificationMessage = responseDataMessage?.GetResponseData<SignalRMessageToClientWithText<OrderDto>>();
return; if (notificationMessage == null)
{
_logger.Error($"MainLayout.SignalRClientOnMessageReceived; notificationMessage == null; messageTag: {messageTag}");
return;
}
toastOrderNumber = null;
toastDateOfReceipt = null;
toastMessage = notificationMessage.Message;
var orderDto = notificationMessage.Content;
var hasPermission = orderDto == null || (orderDto.HasMeasuringAccess(LoggedInModel.CustomerDto!.Id, LoggedInModel.IsRevisor) || orderDto.MeasurementOwnerId == 0);
if (orderDto != null && hasPermission)
{
toastOrderNumber = orderDto.CustomOrderNumber;
toastDateOfReceipt = orderDto.DateOfReceipt;
}
if (!hasPermission) return;
_logger.Debug($"MainLayout.SignalRClientOnMessageReceived; NotificationMessage received. {toastMessage}");
await InvokeAsync(() =>
{
orderNotificationToast?.Show();
StateHasChanged();
});
} }
catch (Exception ex)
toastOrderNumber = null;
toastDateOfReceipt = null;
toastMessage = notificationMessage.Message;
var orderDto = notificationMessage.Content;
var hasPermission = orderDto == null || (orderDto.HasMeasuringAccess(LoggedInModel.CustomerDto!.Id, LoggedInModel.IsRevisor) || orderDto.MeasurementOwnerId == 0);
if (orderDto != null && hasPermission)
{ {
toastOrderNumber = orderDto.CustomOrderNumber; _logger.Error($"MainLayout.SignalRClientOnMessageReceived ERROR; messageTag: {messageTag}", ex);
toastDateOfReceipt = orderDto.DateOfReceipt;
} }
if (!hasPermission) return;
_logger.Debug($"NotificationMessage received. {toastMessage}");
await InvokeAsync(() =>
{
orderNotificationToast?.Show();
StateHasChanged();
});
} }
private async void OnLogoutClick() private async void OnLogoutClick()
{ {
await LoggedInModel.LogOutAsync(); try
RefreshMainLayout(); {
NavManager.NavigateTo("/Login"); await LoggedInModel.LogOutAsync();
RefreshMainLayout();
NavManager.NavigateTo("/Login");
}
catch (Exception e)
{
_logger.Error($"OnLogoutClick error");
}
} }
public void RefreshMainLayout() public void RefreshMainLayout()

View File

@ -37,7 +37,7 @@
</NavLink> </NavLink>
</div> </div>
@if (LoggedInModel.IsDeveloper) @if (LoggedInModel.IsAdministrator)
{ {
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="StockTaking" title="Leltározás"> <NavLink class="nav-link" href="StockTaking" title="Leltározás">

View File

@ -127,7 +127,7 @@
else else
{ {
string? orderNote; string? orderNote;
if (!(orderNote = SelectedOrder?.OrderNotes.LastOrDefault(x=>x.Note.StartsWith('*'))?.Note).IsNullOrWhiteSpace()) if (!(orderNote = SelectedOrder?.OrderNotes.LastOrDefault(x => x.Note.StartsWith('*'))?.Note).IsNullOrWhiteSpace())
{ {
<div class="container-fluid p-0" style="margin-top: 20px"> <div class="container-fluid p-0" style="margin-top: 20px">
<b> Megjegyzés: </b><span>@(orderNote) </span> <b> Megjegyzés: </b><span>@(orderNote) </span>
@ -159,7 +159,8 @@
var isValid = selectedOrderItemDto.IsValidMeasuringValues(); var isValid = selectedOrderItemDto.IsValidMeasuringValues();
var isValidAndMeasured = isValid && selectedOrderItemDto.IsMeasuredAndValid(); // && selectedOrderItemDto.; var isValidAndMeasured = isValid && selectedOrderItemDto.IsMeasuredAndValid(); // && selectedOrderItemDto.;
if (isValidAndMeasured) cssClass = "text-success"; if (isValid && !selectedOrderItemDto.AverageWeightIsValid) cssClass = "text-warning";
else if (isValidAndMeasured) cssClass = "text-success";
else if (isValid) cssClass = string.Empty; else if (isValid) cssClass = string.Empty;
var displayText = $"{selectedOrderItemDto.ProductName} - [{trayQuantity}/{selectedOrderItemDto.Quantity} rekesz, {(selectedOrderItemDto.IsMeasurable ? "net.súly: " + selectedOrderItemDto.NetWeight + "kg." : "nem mérendő!")}]"; var displayText = $"{selectedOrderItemDto.ProductName} - [{trayQuantity}/{selectedOrderItemDto.Quantity} rekesz, {(selectedOrderItemDto.IsMeasurable ? "net.súly: " + selectedOrderItemDto.NetWeight + "kg." : "nem mérendő!")}]";
@ -175,7 +176,8 @@
{ {
var selectedOrderItem = (OrderItemDto)(context.DataItem); var selectedOrderItem = (OrderItemDto)(context.DataItem);
<DxFormLayout Context="ctxFormLayout" Data="@selectedOrderItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100"> <DxFormLayout Context="ctxFormLayout" Data="@selectedOrderItem" CaptionPosition="CaptionPosition.Vertical"
CssClass="w-100">
<DxFormLayoutItem Context="ctxFormLayoutItem" ColSpanMd="12"> <DxFormLayoutItem Context="ctxFormLayoutItem" ColSpanMd="12">
@for (var index = 0; index < (selectedOrderItem?.OrderItemPallets?.Count ?? 0); index++) @for (var index = 0; index < (selectedOrderItem?.OrderItemPallets?.Count ?? 0); index++)
{ {
@ -184,14 +186,15 @@
<PalletItemComponent IsMeasurable="@selectedOrderItem.IsMeasurable" <PalletItemComponent IsMeasurable="@selectedOrderItem.IsMeasurable"
MeasuringIndex="@localI" MeasuringIndex="@localI"
IsEditable="@(!currentOrderItemPallet.IsAudited && !(SelectedOrder?.IsComplete ?? false))" Editable="@(_enablePalletItems && !currentOrderItemPallet.IsAudited && !(SelectedOrder?.IsComplete ?? false))"
PalletItem="@currentOrderItemPallet" PalletItem="@currentOrderItemPallet"
ProductId="@selectedOrderItem.ProductId" ProductId="@selectedOrderItem.ProductId"
MaxTrayQuantity="@selectedOrderItem.Quantity" MaxTrayQuantity="@selectedOrderItem.Quantity"
AddOrUpdateSignalRTag="SignalRTags.AddOrUpdateMeasuredOrderItemPallet" AddOrUpdateSignalRTag="SignalRTags.AddOrUpdateMeasuredOrderItemPallet"
OnPalletItemSaveOrAuditClick="pallet => OnOrderItemSaveOrAuditClick(pallet, selectedOrderItem)"
OnPalletItemSaved="pallet => OnOrderItemPalletSaved(pallet, selectedOrderItem)" OnPalletItemSaved="pallet => OnOrderItemPalletSaved(pallet, selectedOrderItem)"
OnPalletItemValueChanged="pallet => OnOrderItemPalletValueChanged(pallet, selectedOrderItem)" OnPalletItemValueChanged="pallet => OnOrderItemPalletValueChanged(pallet, selectedOrderItem)"
OnPalletItemAuditedClick="pallet => OnPalletItemAuditedClick(pallet, selectedOrderItem)"> OnPalletItemAudited="pallet => OnOrderItemAudited(pallet, selectedOrderItem)">
</PalletItemComponent> </PalletItemComponent>
} }
</DxFormLayoutItem> </DxFormLayoutItem>

View File

@ -17,9 +17,10 @@ using Nop.Core.Domain.Orders;
namespace FruitBankHybrid.Shared.Pages namespace FruitBankHybrid.Shared.Pages
{ {
public partial class MeasuringOut : ComponentBase public partial class MeasuringOut : ComponentBase, IDisposable
{ {
private readonly Lock _lock = new Lock(); private readonly Lock _lock = new Lock();
[Inject] public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; } [Inject] public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; }
[Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; } [Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; }
[Inject] public required NavigationManager NavManager{ get; set; } [Inject] public required NavigationManager NavManager{ get; set; }
@ -29,6 +30,7 @@ namespace FruitBankHybrid.Shared.Pages
private LoggerClient _logger = null!; private LoggerClient _logger = null!;
private string _errorText; private string _errorText;
private bool _enablePalletItems = true;
private int _lastDaysCount = 1; private int _lastDaysCount = 1;
public bool HasMeasuringAccess; public bool HasMeasuringAccess;
public bool LoadingPanelVisible { get; set; } = true; public bool LoadingPanelVisible { get; set; } = true;
@ -59,99 +61,106 @@ namespace FruitBankHybrid.Shared.Pages
if (messageTag != SignalRTags.SendOrderItemDeleted && messageTag != SignalRTags.SendOrderChanged && messageTag != SignalRTags.SendOrderItemChanged && if (messageTag != SignalRTags.SendOrderItemDeleted && messageTag != SignalRTags.SendOrderChanged && messageTag != SignalRTags.SendOrderItemChanged &&
messageTag != SignalRTags.SendOrderItemPalletChanged && messageTag != SignalRTags.SendProductChanged) return; messageTag != SignalRTags.SendOrderItemPalletChanged && messageTag != SignalRTags.SendProductChanged) return;
_logger.DebugConditional($"SignalRClientOnMessageReceived received. {responseDataMessage}"); _logger.DebugConditional($"MeasuringOut.SignalRClientOnMessageReceived received. {responseDataMessage}");
OrderDto? orderDto; try
OrderItem? orderItem;
OrderItemDto? orderItemDto;
switch (messageTag)
{ {
case SignalRTags.SendOrderItemDeleted: OrderDto? orderDto;
orderItem = responseDataMessage?.GetResponseData<OrderItem>(); OrderItem? orderItem;
if (orderItem == null) break; OrderItemDto? orderItemDto;
lock (_lock) switch (messageTag)
{ {
orderDto = SelectedDayOrders.FirstOrDefault(o => o.OrderItemDtos.Any(oi => oi.Id == orderItem.Id)); case SignalRTags.SendOrderItemDeleted:
orderDto?.OrderItemDtos.RemoveAll(oi => oi.Id == orderItem.Id); orderItem = responseDataMessage?.GetResponseData<OrderItem>();
} if (orderItem == null) break;
await InvokeAsync(StateHasChanged); lock (_lock)
return; {
case SignalRTags.SendOrderChanged: orderDto = SelectedDayOrders.FirstOrDefault(o => o.OrderItemDtos.Any(oi => oi.Id == orderItem.Id));
orderDto = responseDataMessage?.GetResponseData<OrderDto>(); orderDto?.OrderItemDtos.RemoveAll(oi => oi.Id == orderItem.Id);
if (orderDto == null) break; }
if (orderDto.DateOfReceipt == null) return; await InvokeAsync(StateHasChanged);
return;
case SignalRTags.SendOrderChanged:
orderDto = responseDataMessage?.GetResponseData<OrderDto>();
if (orderDto == null) break;
lock (_lock) if (orderDto.DateOfReceipt == null) return;
{
if (_measuringDates.All(x => x.DateTime.Date != orderDto.DateOfReceipt.Value.Date))
_measuringDates.Add(new MeasuringDateSelectorModel(orderDto.Id, orderDto.DateOfReceipt.Value.Date, orderDto.IsMeasured));
if (SelectedDate != orderDto.DateOfReceipt.Value.Date) return; lock (_lock)
{
if (_measuringDates.All(x => x.DateTime.Date != orderDto.DateOfReceipt.Value.Date))
_measuringDates.Add(new MeasuringDateSelectorModel(orderDto.Id, orderDto.DateOfReceipt.Value.Date, orderDto.IsMeasured));
//Elég lenne ez is, csak a CopyTo a Collection - ökben lévő elemeket hozzáfűzi és duplikálva lesznek... -J. if (SelectedDate != orderDto.DateOfReceipt.Value.Date) return;
if (SelectedOrder?.Id == orderDto.Id) orderDto.CopyTo(SelectedOrder);
else SelectedDayOrders.UpdateCollection(orderDto, false);
//var selectedOrderId = SelectedOrder?.Id; //Elég lenne ez is, csak a CopyTo a Collection - ökben lévő elemeket hozzáfűzi és duplikálva lesznek... -J.
//SelectedDayOrders.UpdateCollection(orderDto, false); if (SelectedOrder?.Id == orderDto.Id) orderDto.CopyTo(SelectedOrder);
else SelectedDayOrders.UpdateCollection(orderDto, false);
//if (selectedOrderId.GetValueOrDefault(-1) == orderDto.Id) SelectedOrder = orderDto; //var selectedOrderId = SelectedOrder?.Id;
} //SelectedDayOrders.UpdateCollection(orderDto, false);
await InvokeAsync(StateHasChanged); //if (selectedOrderId.GetValueOrDefault(-1) == orderDto.Id) SelectedOrder = orderDto;
return; }
case SignalRTags.SendOrderItemChanged:
orderItemDto = responseDataMessage?.GetResponseData<OrderItemDto>();
if (orderItemDto == null) break;
lock (_lock) await InvokeAsync(StateHasChanged);
{ return;
var localOrderDto = SelectedDayOrders.FirstOrDefault(o => o.OrderItemDtos.Any(oi => oi.Id == orderItemDto.Id)); case SignalRTags.SendOrderItemChanged:
var localOrderItemDto = localOrderDto?.OrderItemDtos.FirstOrDefault(x => x.Id == orderItemDto.Id); orderItemDto = responseDataMessage?.GetResponseData<OrderItemDto>();
if (orderItemDto == null) break;
if (localOrderItemDto == null) return;
//orderItemDto.OrderDto = localOrderDto!; lock (_lock)
{
var localOrderDto = SelectedDayOrders.FirstOrDefault(o => o.OrderItemDtos.Any(oi => oi.Id == orderItemDto.Id));
var localOrderItemDto = localOrderDto?.OrderItemDtos.FirstOrDefault(x => x.Id == orderItemDto.Id);
localOrderItemDto.Quantity = orderItemDto.Quantity; if (localOrderItemDto == null) return;
localOrderItemDto.GenericAttributes.UpdateBaseEntityCollection(orderItemDto.GenericAttributes, false);
}
await InvokeAsync(StateHasChanged); //orderItemDto.OrderDto = localOrderDto!;
return;
case SignalRTags.SendOrderItemPalletChanged:
var orderItemPallet = responseDataMessage?.GetResponseData<OrderItemPallet>();
if (orderItemPallet == null) break;
lock (_lock) localOrderItemDto.Quantity = orderItemDto.Quantity;
{ localOrderItemDto.GenericAttributes.UpdateBaseEntityCollection(orderItemDto.GenericAttributes, false);
var orderItemDtos = SelectedDayOrders.FirstOrDefault(x => x.OrderItemDtos.Any(oi => oi.Id == orderItemPallet.OrderItemId))?.OrderItemDtos; }
orderItemDto = orderItemDtos?.FirstOrDefault(oi => oi.Id == orderItemPallet.OrderItemId);
if (orderItemDto == null) return;
orderItemPallet.OrderItemDto = orderItemDto; await InvokeAsync(StateHasChanged);
var orderItemPalletsCount = orderItemDto.OrderItemPallets.Count; return;
case SignalRTags.SendOrderItemPalletChanged:
var orderItemPallet = responseDataMessage?.GetResponseData<OrderItemPallet>();
if (orderItemPallet == null) break;
if (orderItemDto.OrderItemPallets[orderItemPalletsCount - 1].Id == 0) orderItemDto.OrderItemPallets.Insert(orderItemPalletsCount - 1, orderItemPallet); lock (_lock)
else orderItemDto.OrderItemPallets.UpdateCollection(orderItemPallet, false); {
} var orderItemDtos = SelectedDayOrders.FirstOrDefault(x => x.OrderItemDtos.Any(oi => oi.Id == orderItemPallet.OrderItemId))?.OrderItemDtos;
await InvokeAsync(StateHasChanged); orderItemDto = orderItemDtos?.FirstOrDefault(oi => oi.Id == orderItemPallet.OrderItemId);
return; if (orderItemDto == null) return;
case SignalRTags.SendProductChanged:
var productDto = responseDataMessage?.GetResponseData<ProductDto>();
if (productDto == null) break;
await InvokeAsync(StateHasChanged); orderItemPallet.OrderItemDto = orderItemDto;
return; var orderItemPalletsCount = orderItemDto.OrderItemPallets.Count;
if (orderItemDto.OrderItemPallets[orderItemPalletsCount - 1].Id == 0) orderItemDto.OrderItemPallets.Insert(orderItemPalletsCount - 1, orderItemPallet);
else orderItemDto.OrderItemPallets.UpdateCollection(orderItemPallet, false);
}
await InvokeAsync(StateHasChanged);
return;
case SignalRTags.SendProductChanged:
var productDto = responseDataMessage?.GetResponseData<ProductDto>();
if (productDto == null) break;
await InvokeAsync(StateHasChanged);
return;
}
_logger.Error($"MeasuringOut.SignalRClientOnMessageReceived message == null; messageTag: {messageTag}");
}
catch (Exception ex)
{
_logger.Error($"MeasuringOut.SignalRClientOnMessageReceived ERROR; messageTag: {messageTag}", ex);
} }
_logger.Error($"SignalRClientOnMessageReceived message == null");
} }
private async Task RefreshOrdersFromDb(DateTime dateTime, int lastDaysCount) private async Task RefreshOrdersFromDb(DateTime dateTime, int lastDaysCount)
@ -241,12 +250,25 @@ namespace FruitBankHybrid.Shared.Pages
return Task.CompletedTask; return Task.CompletedTask;
} }
private async Task OnPalletItemAuditedClick(OrderItemPallet? orderItemPallet, OrderItemDto selectedOrderItemDto) private async Task OnOrderItemAudited(OrderItemPallet? orderItemPallet, OrderItemDto selectedOrderItemDto)
{ {
if (orderItemPallet == null) return; if (orderItemPallet == null) return;
_enablePalletItems = false;
await InvokeAsync(StateHasChanged);
await OnOrderItemPalletSaved(orderItemPallet, selectedOrderItemDto); await OnOrderItemPalletSaved(orderItemPallet, selectedOrderItemDto);
} }
private async Task OnOrderItemSaveOrAuditClick(OrderItemPallet? orderItemPallet, OrderItemDto selectedOrderItemDto)
{
if (orderItemPallet != null)
{
_enablePalletItems = false;
await InvokeAsync(StateHasChanged);
}
}
private async Task OnOrderItemPalletSaved(OrderItemPallet? orderItemPallet, OrderItemDto selectedOrderItemDto) private async Task OnOrderItemPalletSaved(OrderItemPallet? orderItemPallet, OrderItemDto selectedOrderItemDto)
{ {
if (orderItemPallet != null) if (orderItemPallet != null)
@ -258,7 +280,8 @@ namespace FruitBankHybrid.Shared.Pages
} }
else await DialogService.ShowMessageBoxAsync("Hiba", "Adatok mentése sikertelen volt, ellenőrizze a mérés adatait!", MessageBoxRenderStyle.Danger); else await DialogService.ShowMessageBoxAsync("Hiba", "Adatok mentése sikertelen volt, ellenőrizze a mérés adatait!", MessageBoxRenderStyle.Danger);
StateHasChanged(); _enablePalletItems = true;
await InvokeAsync(StateHasChanged);
} }
private Task AddNewPalletItemClick(OrderItemDto selectedOrderItemDto) private Task AddNewPalletItemClick(OrderItemDto selectedOrderItemDto)
@ -359,5 +382,10 @@ namespace FruitBankHybrid.Shared.Pages
orderDto.GenericAttributes.UpdateBaseEntityCollection(genericAttributes, false); orderDto.GenericAttributes.UpdateBaseEntityCollection(genericAttributes, false);
} }
} }
public void Dispose()
{
FruitBankSignalRClient.OnMessageReceived -= SignalRClientOnMessageReceived;
}
} }
} }

View File

@ -10,12 +10,6 @@
<div style="margin-top: 30px;"> <div style="margin-top: 30px;">
<DxLoadingPanel @bind-Visible="LoadingPanelVisibility.Visible"
IsContentBlocked="true"
ApplyBackgroundShading="true"
IndicatorAreaVisible="false"
Text="Adatok szinkronizálása folyamatban...">
<DxTabs RenderMode="TabsRenderMode.OnDemand"> <DxTabs RenderMode="TabsRenderMode.OnDemand">
<DxTabPage Text="Leltározás"> <DxTabPage Text="Leltározás">
<StockTakingTemplate></StockTakingTemplate> <StockTakingTemplate></StockTakingTemplate>
@ -31,6 +25,4 @@
} }
</DxTabPage> </DxTabPage>
</DxTabs> </DxTabs>
</DxLoadingPanel>
</div> </div>

View File

@ -292,6 +292,7 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
} }
public Task<StockTaking?> AddStockTaking(StockTaking stockTaking) => PostDataAsync(SignalRTags.AddStockTaking, stockTaking); public Task<StockTaking?> AddStockTaking(StockTaking stockTaking) => PostDataAsync(SignalRTags.AddStockTaking, stockTaking);
public Task<StockTakingItem?> RefreshStockTakingItem(int stockTakingItemId) => GetByIdAsync<StockTakingItem>(SignalRTags.RefreshStockTakingItem, stockTakingItemId);
public Task<StockTaking?> UpdateStockTaking(StockTaking stockTaking) => PostDataAsync(SignalRTags.UpdateStockTaking, stockTaking); public Task<StockTaking?> UpdateStockTaking(StockTaking stockTaking) => PostDataAsync(SignalRTags.UpdateStockTaking, stockTaking);
@ -326,6 +327,10 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
throw new NotImplementedException(); throw new NotImplementedException();
} }
public Task<StockTaking?> CloseStockTaking(int stockTakingId)
=> PostDataAsync<int, StockTaking?>(SignalRTags.CloseStockTaking, stockTakingId);
public async Task<StockTakingItemPallet?> AddStockTakingItemPallet(StockTakingItemPallet stockTakingItemPallet) public async Task<StockTakingItemPallet?> AddStockTakingItemPallet(StockTakingItemPallet stockTakingItemPallet)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@ -7,7 +7,7 @@
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile> <NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode> <StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
<RunAOTCompilation>true</RunAOTCompilation> <RunAOTCompilation>false</RunAOTCompilation>
<WasmStripILAfterAOT>true</WasmStripILAfterAOT> <WasmStripILAfterAOT>true</WasmStripILAfterAOT>
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders> <OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
</PropertyGroup> </PropertyGroup>

View File

@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<!--<PublishTrimmed>true</PublishTrimmed>--> <!--<PublishTrimmed>true</PublishTrimmed>-->
<RunAOTCompilation>true</RunAOTCompilation> <RunAOTCompilation>false</RunAOTCompilation>
<WasmStripILAfterAOT>true</WasmStripILAfterAOT> <WasmStripILAfterAOT>true</WasmStripILAfterAOT>
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders> <OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
</PropertyGroup> </PropertyGroup>

View File

@ -19,10 +19,10 @@
<ApplicationId>com.mango.fruitbank</ApplicationId> <ApplicationId>com.mango.fruitbank</ApplicationId>
<!-- Versions --> <!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> <ApplicationDisplayVersion>1.0.1</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion> <ApplicationVersion>1</ApplicationVersion>
<RunAOTCompilation>true</RunAOTCompilation> <RunAOTCompilation>false</RunAOTCompilation>
<WasmStripILAfterAOT>true</WasmStripILAfterAOT> <WasmStripILAfterAOT>true</WasmStripILAfterAOT>
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders> <OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
@ -42,6 +42,7 @@
<GenerateTestArtifacts>True</GenerateTestArtifacts> <GenerateTestArtifacts>True</GenerateTestArtifacts>
<HoursBetweenUpdateChecks>24</HoursBetweenUpdateChecks> <HoursBetweenUpdateChecks>24</HoursBetweenUpdateChecks>
<WindowsPackageType>MSIX</WindowsPackageType> <WindowsPackageType>MSIX</WindowsPackageType>
<AndroidSigningKeyStore>fruitbank.keystore</AndroidSigningKeyStore>
</PropertyGroup> </PropertyGroup>
@ -62,12 +63,19 @@
<AndroidUseAapt2>True</AndroidUseAapt2> <AndroidUseAapt2>True</AndroidUseAapt2>
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi> <AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<AndroidKeyStore>true</AndroidKeyStore>
<AndroidSigningKeyStore>fruitbank.keystore</AndroidSigningKeyStore>
<AndroidSigningKeyAlias>fruitbank</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>Asdasd123456</AndroidSigningKeyPass>
<AndroidSigningStorePass>Asdasd123456</AndroidSigningStorePass>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net10.0-android|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net10.0-android|AnyCPU'">
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi> <AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
<AndroidUseAapt2>True</AndroidUseAapt2> <AndroidUseAapt2>True</AndroidUseAapt2>
<AndroidPackageFormat>apk</AndroidPackageFormat> <AndroidPackageFormat>apk</AndroidPackageFormat>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<AndroidKeyStore>True</AndroidKeyStore>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -6,7 +6,7 @@
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap"> IgnorableNamespaces="uap rescap">
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" /> <Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.1.0" />
<mp:PhoneIdentity PhoneProductId="10836226-17FE-45AD-8C96-8DB8D4D78222" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> <mp:PhoneIdentity PhoneProductId="10836226-17FE-45AD-8C96-8DB8D4D78222" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Binary file not shown.

View File

@ -3,12 +3,12 @@
<Version>10</Version> <Version>10</Version>
<SourceModelProvider> <SourceModelProvider>
<ConnectionBasedModelProvider> <ConnectionBasedModelProvider>
<ConnectionString>Data Source=195.26.231.218;Initial Catalog=FruitBank_DEV;Integrated Security=False;Persist Security Info=False;User ID=sa;Pooling=False;Trust Server Certificate=True</ConnectionString> <ConnectionString>Data Source=195.26.231.218;Initial Catalog=FruitBank_DEV;Integrated Security=False;Persist Security Info=False;User ID=sa;Pooling=False;Multiple Active Result Sets=False;Trust Server Certificate=True</ConnectionString>
</ConnectionBasedModelProvider> </ConnectionBasedModelProvider>
</SourceModelProvider> </SourceModelProvider>
<TargetModelProvider> <TargetModelProvider>
<ConnectionBasedModelProvider> <ConnectionBasedModelProvider>
<ConnectionString>Data Source=195.26.231.218;Initial Catalog=FruitBank_PROD;Integrated Security=False;Persist Security Info=False;User ID=sa;Pooling=False;Trust Server Certificate=True</ConnectionString> <ConnectionString>Data Source=195.26.231.218;Initial Catalog=FruitBank_PROD;Integrated Security=False;Persist Security Info=False;User ID=sa;Pooling=False;Multiple Active Result Sets=False;Trust Server Certificate=True</ConnectionString>
</ConnectionBasedModelProvider> </ConnectionBasedModelProvider>
</TargetModelProvider> </TargetModelProvider>
<SchemaCompareSettingsService> <SchemaCompareSettingsService>
@ -1105,5 +1105,13 @@
<Name>dbo</Name> <Name>dbo</Name>
<Name>DF_fbShipping_IsAllMeasured</Name> <Name>DF_fbShipping_IsAllMeasured</Name>
</SelectedItem> </SelectedItem>
<SelectedItem Type="Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlTable, Microsoft.Data.Tools.Schema.Sql, Version=170.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91">
<Name>dbo</Name>
<Name>tmp_guestsAddressesToDelete</Name>
</SelectedItem>
<SelectedItem Type="Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlTable, Microsoft.Data.Tools.Schema.Sql, Version=170.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91">
<Name>dbo</Name>
<Name>tmp_guestsToDelete</Name>
</SelectedItem>
</ExcludedTargetElements> </ExcludedTargetElements>
</SchemaComparison> </SchemaComparison>