Measuring improvements

This commit is contained in:
Loretta 2025-09-19 14:44:04 +02:00
parent 72071e7a79
commit 4410d662d8
16 changed files with 316 additions and 143 deletions

View File

@ -1,56 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FruitBank.Common\FruitBank.Common.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FruitBank.Common\FruitBank.Common.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Models.Server">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Models.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services.Server">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.Server.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.SignalR.Core">
<HintPath>C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\9.0.8\ref\net9.0\Microsoft.AspNetCore.SignalR.Core.dll</HintPath>
</Reference>
<Reference Include="Mango.Nop.Core">
<HintPath>..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Mango.Nop.Core.dll</HintPath>
</Reference>
<Reference Include="Nop.Core">
<HintPath>..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Nop.Core.dll</HintPath>
</Reference>
<Reference Include="Nop.Core">
<HintPath>..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Mango.Nop.Core.dll</HintPath>
</Reference>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Models.Server">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Models.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services.Server">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.Server.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.SignalR.Core">
<HintPath>C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\9.0.9\ref\net9.0\Microsoft.AspNetCore.SignalR.Core.dll</HintPath>
</Reference>
<Reference Include="Mango.Nop.Core">
<HintPath>..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Mango.Nop.Core.dll</HintPath>
</Reference>
<Reference Include="Nop.Core">
<HintPath>..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Nop.Core.dll</HintPath>
</Reference>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
</ItemGroup>
</Project>

View File

@ -1,9 +1,12 @@
using AyCode.Core.Interfaces;
using FruitBank.Common.Interfaces;
using LinqToDB;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Orders;
using System.ComponentModel.DataAnnotations;
using DataType = LinqToDB.DataType;
namespace FruitBank.Common.Entities;
@ -17,13 +20,24 @@ public class ShippingItem : MgEntityBase, IShippingItem
public int ShippingDocumentId { get; set; }
public string Name { get; set; }
[Column(DataType = DataType.DecFloat)]
public double NetWeight { get; set; }
[Column(DataType = DataType.DecFloat)]
public double GrossWeight { get; set; }
[Column(DataType = DataType.DecFloat, CanBeNull = true)]
[Required]
[Range(1, 100000, ErrorMessage = "The MeasuredNetWeight value should be a number between 1 and 100,000.")]
public double? MeasuredNetWeight { get; set; }
[Column(DataType = DataType.DecFloat, CanBeNull = true)]
[Required]
[Range(1, 100000, ErrorMessage = "The MeasuredGrossWeight value should be a number between 1 and 100,000.")]
public double? MeasuredGrossWeight { get; set; }
public bool IsMeasured { get; set; }
[Association(ThisKey = nameof(ShippingDocumentId), OtherKey = nameof(ShippingDocument.Id))]
[LinqToDB.Mapping.Association(ThisKey = nameof(ShippingDocumentId), OtherKey = nameof(ShippingDocument.Id))]
public ShippingDocument? ShippingDocument { get; set; }

View File

@ -11,8 +11,8 @@
<PackageReference Include="linq2db.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
<ItemGroup>

View File

@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
</Project>

View File

@ -143,6 +143,8 @@ namespace FruitBankHybrid.Shared.Tests
Assert.IsNotNull(shippingItem);
Assert.IsTrue(shippingItem.Id == shippingItemeId);
Assert.IsTrue(shippingItem.NetWeight > 0, "NetWeight == 0");
Assert.IsTrue(shippingItem.GrossWeight > 0, "GrossWeight == 0");
return shippingItem;
}
@ -155,10 +157,12 @@ namespace FruitBankHybrid.Shared.Tests
var newName = GetFixtureName(shippingItem.Name);
shippingItem.Name = newName;
//shippingItem.MeasuredGrossWeight = 5;
await _signalRClient.UpdateShippingItem(shippingItem);
shippingItem = await GetShippingItemByIdTest(shippingItemId);
Assert.IsTrue(shippingItem.Name == newName);
//Assert.IsTrue(shippingItem.MeasuredGrossWeight is 5);
shippingItem.Name = GetOriginalName(shippingItem.Name);
await _signalRClient.UpdateShippingItem(shippingItem);

View File

@ -45,4 +45,31 @@
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.14.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.Testing.Extensions.TrxReport" Version="1.8.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="MSTest.Analyzers" Version="3.10.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Update="MSTest.TestAdapter" Version="3.10.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="MSTest.TestFramework" Version="3.10.4" />
</ItemGroup>
</Project>

View File

@ -14,9 +14,9 @@
<PackageReference Include="DevExpress.Blazor" Version="25.1.*" />
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
<ItemGroup>

View File

@ -3,51 +3,46 @@
<h3>Bejelentkezés</h3>
<div class="row cw-480" style="margin-top: 30px;">
<div class="col-md-6">
<DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-500">
<DxFormLayoutItem Caption="Válasszon felhasználót:" ColSpanMd="6">
<DxComboBox Data="@Users"
@bind-Value="@SelectedUser"
Text="Select Employee"
ValueFieldName="@nameof(CustomerDto.Id)"
TextFieldName="@nameof(CustomerDto.FullName)"
CssClass="cw-480"
CssClass="cw-320"
InputId="cbItemTemplate">
<ItemDisplayTemplate>
<ItemDisplayTemplate Context="ctxCombo">
<div class="combobox-item-template">
<img src="@GetImageFileName(context.DataItem)" alt="@context.DataItem.Email" />
<img src="@GetImageFileName(ctxCombo.DataItem)" alt="@ctxCombo.DataItem.Email" />
<div class="combobox-item-template-text">
<span>@context.DataItem.FullName</span>
<span class="combobox-item-template-employee-phone">@context.DataItem.Email</span>
<span>@ctxCombo.DataItem.FullName</span>
<span class="combobox-item-template-employee-phone">@ctxCombo.DataItem.Email</span>
</div>
</div>
</ItemDisplayTemplate>
</DxComboBox>
</div>
</DxFormLayoutItem>
<div class="col-md-6">
<DxFormLayoutItem Caption="Adja meg a jelszavát:" ColSpanMd="6">
<DxTextBox @bind-Text="@PasswordValue"
@onkeydown="OnPasswordKeyDown"
@onkeydown="OnPasswordKeyDown"
Password="true"
CssClass="cw-320"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
BindValueMode="BindValueMode.OnInput"
NullText="Enter password"
InputId="tbPassword" />
</DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="12" BeginRow="true">
<DxButton Text="Bejelentkezés" Click="OnLoginClick" CssClass="w-100" />
</DxFormLayoutItem>
</DxFormLayout>
<div class="row w-100" style="margin-top: 30px;">
<div class="col-md-12">
<b>@(LoginModelResponse?.CustomerDto == null ? LoginModelResponse?.ErrorMessage : LoginModelResponse?.CustomerDto.FullName)</b>
</div>
<div class="row cw-480" style="margin-top: 20px;">
<div class="col-md-12">
<DxButton Text="Bejelentkezés"
Click="OnLoginClick"
CssClass="w-100" />
</div>
</div>
<div class="row cw-480" style="margin-top: 30px;">
<div class="col-md-12">
<b>@(LoginModelResponse?.CustomerDto == null ? LoginModelResponse?.ErrorMessage : LoginModelResponse?.CustomerDto.FullName)</b>
</div>
</div>
</div>

View File

@ -5,56 +5,93 @@
@using FruitBankHybrid.Shared.Services
@using Mango.Nop.Core.Dtos
<h3>Bejövő mérés</h3>
<div class="row cw-480" style="margin-top: 50px;">
<div class="col-md-4">
<label for="cbNotMeasuredShippings" class="demo-text mb-1">Szállítmány</label>
<DxComboBox Data="@NotMeasuredShippings"
@bind-Value="@SelectedShipping"
Text="Select shipping"
ValueFieldName="@nameof(Shipping.Id)"
TextFieldName="@nameof(Shipping.ShippingDate)"
CssClass="cw-480"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<Shipping> args) => OnSelectedShippingChanged(args))"
InputId="cbNotMeasuredShippings">
<ItemDisplayTemplate>
<div class="combobox-item-template">
<div class="combobox-item-template-text">
<span>@($"{context.DataItem.ShippingDate} [{context.DataItem.LicencePlate}]")</span>
@* <span class="combobox-item-template-employee-phone">@(string.Join("; ", context.DataItem?.ShippingDocuments?.Select(x => x.Partner?.Name ?? string.Empty)))</span> *@
<div style="margin-top: 50px;">
<DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-100">
<DxFormLayoutItem ColSpanMd="12">
<DxCheckBox CheckedChanged="@((bool t) => OnChkAllShippingChanged(t))">Összes szállítmány listázása</DxCheckBox>
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Szállítmány:" ColSpanMd="4" BeginRow="true">
<DxComboBox Data="@NotMeasuredShippings"
@bind-Value="@SelectedShipping"
Text="Select shipping"
ValueFieldName="@nameof(Shipping.Id)"
TextFieldName="@nameof(Shipping.ShippingDate)"
CssClass="cw-480"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<Shipping> args) => OnSelectedShippingChanged(args))"
InputId="cbNotMeasuredShippings">
<ItemDisplayTemplate Context="ctxCombo">
<div class="combobox-item-template">
<div class="combobox-item-template-text">
<span>@($"{ctxCombo.DataItem.ShippingDate} [{ctxCombo.DataItem.LicencePlate}]")</span>
@* <span class="combobox-item-template-employee-phone">@(string.Join("; ", context.DataItem?.ShippingDocuments?.Select(x => x.Partner?.Name ?? string.Empty)))</span> *@
</div>
</div>
</div>
</ItemDisplayTemplate>
</DxComboBox>
</div>
</ItemDisplayTemplate>
</DxComboBox>
</DxFormLayoutItem>
<div class="col-md-4">
<label for="cbShippingDocument" class="demo-text mb-1">Dokumentum</label>
<DxComboBox Data="@SelectedShipping?.ShippingDocuments"
@bind-Value="@SelectedShippingDocument"
Text="Select document"
ValueFieldName="@nameof(ShippingDocument.Id)"
TextFieldName="@(nameof(ShippingDocument.Partner) + '.' + nameof(Partner.Name))"
CssClass="cw-480"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<ShippingDocument> args) => OnSelectedShippingDocumentChanged(args))"
InputId="cbShippingDocument" />
</div>
<DxFormLayoutItem Caption="Dokumentum:" ColSpanMd="4">
<DxComboBox Data="@SelectedShipping?.ShippingDocuments"
@bind-Value="@SelectedShippingDocument"
Text="Select document"
ValueFieldName="@nameof(ShippingDocument.Id)"
TextFieldName="@(nameof(ShippingDocument.Partner) + '.' + nameof(Partner.Name))"
CssClass="cw-480"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<ShippingDocument> args) => OnSelectedShippingDocumentChanged(args))"
InputId="cbShippingDocument"/>
</DxFormLayoutItem>
<div class="col-md-4">
<label for="cbShippingItem" class="demo-text mb-1">Termék</label>
<DxComboBox Data="@SelectedShippingDocument?.ShippingItems"
@bind-Value="@SelectedShippingItem"
Text="Select item"
ValueFieldName="@nameof(ShippingItem.Id)"
TextFieldName="@(nameof(ShippingItem.Name))"
CssClass="cw-480"
InputId="cbShippingItem" />
</div>
<DxFormLayoutItem Caption="Termék:" ColSpanMd="4">
<DxComboBox Data="@SelectedShippingDocument?.ShippingItems"
@bind-Value="@SelectedShippingItem"
Text="Select item"
ValueFieldName="@nameof(ShippingItem.Id)"
TextFieldName="@(nameof(ShippingItem.Name))"
CssClass="cw-480"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<ShippingItem> args) => OnSelectedShippingItemChanged(args))"
InputId="cbShippingItem"/>
</DxFormLayoutItem>
</DxFormLayout>
</div>
<div class="row cw-480" style="margin-top: 100px;">
<div style="margin-top: 100px;">
@if (SelectedShippingItem != null)
{
<EditForm Model="@SelectedShippingItem" Context="FrmContext"
OnValidSubmit="@HandleValidSubmit"
OnInvalidSubmit="@HandleInvalidSubmit">
<DataAnnotationsValidator/>
<DxFormLayout Data="@SelectedShippingItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100" ItemUpdating="@((pair) => OnItemUpdating(pair.Key, pair.Value))">
<DxFormLayoutItem Field="@nameof(ShippingItem.Name)" Caption="Item Name:" ColSpanMd="4" />
<DxFormLayoutItem Field="@nameof(ShippingItem.GrossWeight)" Caption="GrossWeight:" ColSpanMd="4" />
<DxFormLayoutItem Field="@nameof(ShippingItem.NetWeight)" Caption="NetWeight:" ColSpanMd="4" />
<DxFormLayoutItem Field="@nameof(ShippingItem.MeasuredGrossWeight)" Caption="MeasuredGrossWeight:" ColSpanMd="4">
</DxFormLayoutItem>
<DxFormLayoutItem Field="@nameof(ShippingItem.MeasuredNetWeight)" Caption="MeasuredNetWeight:" ColSpanMd="4">
</DxFormLayoutItem>
<DxFormLayoutItem Field="@nameof(ShippingItem.IsMeasured)" Caption="IsMeasured:" ColSpanMd="4">
</DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="12" BeginRow="true">
<ValidationSummary />
</DxFormLayoutItem>
<DxFormLayoutItem ColSpanMd="12" BeginRow="true">
<DxButton Text="Mentés" Enabled="BtnSaveEnabled" SubmitFormOnClick="true" CssClass="w-100" />
</DxFormLayoutItem>
</DxFormLayout>
</EditForm>
}
</div>
@*
<div class="row w-100" style="margin-top: 100px;">
<div class="col-md-12">
<input @bind="_userName" placeholder="Your name" />
<input @bind="_message" placeholder="Partner ID..." />
@ -62,7 +99,7 @@
</div>
</div>
<div class="row cw-480">
<div class="row w-100">
<div class="col-md-12">
<ul>
@foreach (var m in _messages)
@ -71,4 +108,5 @@
}
</ul>
</div>
</div>
</div>
*@

View File

@ -17,6 +17,7 @@ using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Forms;
using static System.Net.Mime.MediaTypeNames;
using static System.Runtime.InteropServices.JavaScript.JSType;
using ILogger = FruitBank.Common.Loggers.ILogger;
@ -35,6 +36,9 @@ namespace FruitBankHybrid.Shared.Pages
private ShippingDocument? SelectedShippingDocument { get; set; }
private ShippingItem? SelectedShippingItem { get; set; }
protected bool BtnSaveEnabled { get; set; }
protected bool ChkAllShipping { get; set; }
private string _userName = "Partner name";
private string _message = string.Empty;
private readonly List<(string User, string Text)> _messages = [];
@ -44,24 +48,118 @@ namespace FruitBankHybrid.Shared.Pages
_logger = new LoggerClient<MeasuringIn>(LogWriters.ToArray());
_logger.Info("OnInitializedAsync");
NotMeasuredShippings = await FruitBankSignalRClient.GetNotMeasuredShippings() ?? [];
SelectedShipping = NotMeasuredShippings?.FirstOrDefault();
await RefreshShippingsFromDb(ChkAllShipping);
await base.OnInitializedAsync();
}
public void OnSelectedShippingChanged(SelectedDataItemChangedEventArgs<Shipping> eventArgs)
private async Task RefreshShippingsFromDb(bool getAllShipping)
{
SelectedShippingDocument = eventArgs.DataItem.ShippingDocuments?.FirstOrDefault();
SelectedShippingItem = SelectedShippingDocument?.ShippingItems?.FirstOrDefault();
if (getAllShipping) NotMeasuredShippings = await FruitBankSignalRClient.GetShippings() ?? [];
else NotMeasuredShippings = await FruitBankSignalRClient.GetNotMeasuredShippings() ?? [];
SelectedShipping = NotMeasuredShippings.FirstOrDefault();
}
public void OnSelectedShippingDocumentChanged(SelectedDataItemChangedEventArgs<ShippingDocument> eventArgs)
private async Task OnChkAllShippingChanged(bool value)
{
ChkAllShipping = value;
await RefreshShippingsFromDb(ChkAllShipping);
}
private void OnSelectedShippingChanged(SelectedDataItemChangedEventArgs<Shipping> eventArgs)
{
SelectedShippingDocument = eventArgs.DataItem?.ShippingDocuments?.FirstOrDefault();
}
private void OnSelectedShippingDocumentChanged(SelectedDataItemChangedEventArgs<ShippingDocument> eventArgs)
{
SelectedShippingItem = eventArgs.DataItem?.ShippingItems?.FirstOrDefault();
}
private async Task OnSelectedShippingItemChanged(SelectedDataItemChangedEventArgs<ShippingItem> eventArgs)
{
BtnSaveEnabled = false;
if (eventArgs.DataItem == null)
{
SelectedShippingItem = null;
return;
}
await RefreshSelectedShippingItemMeasuredValuesFromDb(eventArgs.DataItem.Id);
}
private async Task RefreshSelectedShippingItemMeasuredValuesFromDb(int shippingItemId)
{
RefreshSelectedShippingItemMeasuredValuesFromDb(await FruitBankSignalRClient.GetShippingItemById(shippingItemId));
}
private void RefreshSelectedShippingItemMeasuredValuesFromDb(ShippingItem? shippingItemFromDb)
{
if (SelectedShippingItem == null || shippingItemFromDb == null) return;
SelectedShippingItem.MeasuredNetWeight = shippingItemFromDb.MeasuredNetWeight;
SelectedShippingItem.MeasuredGrossWeight = shippingItemFromDb.MeasuredGrossWeight;
SelectedShippingItem.IsMeasured = shippingItemFromDb.IsMeasured;
if (SelectedShippingItem is { IsMeasured: true })
{
SelectedShippingDocument?.ShippingItems?.Remove(SelectedShippingItem);
SelectedShippingItem = SelectedShippingDocument?.ShippingItems?.FirstOrDefault();
}
StateHasChanged();
}
private async Task UpdateShippingItem(ShippingItem? shippingItem)
{
if (shippingItem is { MeasuredGrossWeight: > 0, MeasuredNetWeight: > 0 })
{
BtnSaveEnabled = false;
shippingItem.IsMeasured = shippingItem is { MeasuredGrossWeight: > 0, MeasuredNetWeight: > 0 };
RefreshSelectedShippingItemMeasuredValuesFromDb(await FruitBankSignalRClient.UpdateShippingItem(shippingItem));
}
}
private async Task HandleValidSubmit()
{
await UpdateShippingItem(SelectedShippingItem);
}
private void HandleInvalidSubmit()
{
//FormValidationState = @"Form data is invalid";
}
protected void OnItemUpdating(string fieldName, object newValue)
{
BtnSaveEnabled = false;
if (SelectedShippingItem == null) return;
switch (fieldName)
{
case nameof(ShippingItem.Name):
SelectedShippingItem.Name = newValue.ToString() ?? string.Empty;
break;
case nameof(ShippingItem.GrossWeight):
SelectedShippingItem.GrossWeight = (double)newValue;
break;
case nameof(ShippingItem.NetWeight):
SelectedShippingItem.NetWeight = (double)newValue;
break;
case nameof(ShippingItem.MeasuredGrossWeight):
SelectedShippingItem.MeasuredGrossWeight = (double)newValue;
break;
case nameof(ShippingItem.MeasuredNetWeight):
SelectedShippingItem.MeasuredNetWeight = (double)newValue;
break;
}
//if (SelectedShippingItem.MeasuredGrossWeight > 0 && SelectedShippingItem.MeasuredNetWeight > 0)
BtnSaveEnabled = true;
}
private async Task GetPartner()
{
var measuringModel = new MeasuringModel();

View File

@ -12,8 +12,8 @@
<PackageReference Include="DevExpress.Blazor" Version="25.1.*" />
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
<ItemGroup>

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddDevExpressBlazor();
builder.Services.AddDevExpressBlazor(configure => configure.SizeMode = DevExpress.Blazor.SizeMode.Large);
// Add device-specific services used by the FruitBankHybrid.Shared project
builder.Services.AddSingleton<IFormFactor, FormFactor>();

View File

@ -17,9 +17,9 @@
<PackageReference Include="DevExpress.Blazor" Version="25.1.*" />
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
<ItemGroup>

View File

@ -9,7 +9,7 @@ using FruitBankHybrid.Web.Services;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents().AddInteractiveServerComponents().AddInteractiveWebAssemblyComponents();
builder.Services.AddDevExpressBlazor();
builder.Services.AddDevExpressBlazor(configure => configure.SizeMode = DevExpress.Blazor.SizeMode.Large);
builder.Services.AddMvc();
builder.Services.AddSingleton<IFormFactor, FormFactor>();

View File

@ -63,9 +63,9 @@
<!--<PackageReference Include="DevExpress.Maui.Controls" Version="25.1.3" />
<PackageReference Include="DevExpress.Maui.Editors" Version="25.1.3" />
<PackageReference Include="DevExpress.Maui.CollectionView" Version="25.1.3" />-->
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.50" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.110" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.110" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
</ItemGroup>
<ItemGroup>

View File

@ -39,7 +39,7 @@ namespace FruitBankHybrid
builder.Services.AddMauiBlazorWebView();
builder.Services.AddDevExpressBlazor();
builder.Services.AddDevExpressBlazor(configure => configure.SizeMode = DevExpress.Blazor.SizeMode.Large);
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();