Merge branch 'main' of https://git.aycode.com/Adam/FruitBankHybridApp
This commit is contained in:
commit
401d78aebc
|
|
@ -26,6 +26,7 @@ public interface IFruitBankDataControllerCommon
|
|||
|
||||
#region ShippingItem
|
||||
public Task<List<ShippingItem>?> GetShippingItems();
|
||||
public Task<List<ShippingItem>?> GetShippingItemsByDocumentId(int shippingDocumentId);
|
||||
public Task<ShippingItem?> GetShippingItemById(int id);
|
||||
public Task<ShippingItem?> AddShippingItem(ShippingItem shippingItem);
|
||||
public Task<ShippingItem?> UpdateShippingItem(ShippingItem shippingItem);
|
||||
|
|
|
|||
|
|
@ -1,152 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace FruitBank.Common
|
||||
{
|
||||
public interface IMgFastObservableCollection
|
||||
{
|
||||
public void AddRange(IEnumerable other);
|
||||
public void Replace(IEnumerable other);
|
||||
public void RemoveRange(IEnumerable other);
|
||||
public void Synchronize(NotifyCollectionChangedEventArgs args);
|
||||
}
|
||||
|
||||
public interface IMgFastObservableCollection<T> : IMgFastObservableCollection
|
||||
{
|
||||
public void Replace(IEnumerable<T> other);
|
||||
public void Sort(IComparer<T> comparer);
|
||||
public void SortAndReplace(IEnumerable<T> other, IComparer<T> comparer);
|
||||
}
|
||||
|
||||
public class MgObservableCollection<T> : ObservableCollection<T>, IMgFastObservableCollection<T>
|
||||
{
|
||||
private bool _suppressChangedEvent;
|
||||
|
||||
public void Replace(IEnumerable<T> other)
|
||||
{
|
||||
_suppressChangedEvent = true;
|
||||
|
||||
Clear();
|
||||
AddRange(other);
|
||||
}
|
||||
|
||||
public void Replace(IEnumerable other)
|
||||
{
|
||||
_suppressChangedEvent = true;
|
||||
|
||||
Clear();
|
||||
foreach (T item in other) Add(item);
|
||||
|
||||
_suppressChangedEvent = false;
|
||||
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Count)));
|
||||
}
|
||||
|
||||
public void AddRange(IEnumerable other)
|
||||
{
|
||||
_suppressChangedEvent = true;
|
||||
|
||||
foreach (var item in other)
|
||||
{
|
||||
if (item is T tItem) Add(tItem);
|
||||
}
|
||||
|
||||
_suppressChangedEvent = false;
|
||||
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Count)));
|
||||
}
|
||||
|
||||
public void RemoveRange(IEnumerable other)
|
||||
{
|
||||
_suppressChangedEvent = true;
|
||||
|
||||
foreach (var item in other)
|
||||
{
|
||||
if (item is T tItem) Remove(tItem);
|
||||
}
|
||||
|
||||
_suppressChangedEvent = false;
|
||||
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Count)));
|
||||
}
|
||||
|
||||
public void SortAndReplace(IEnumerable<T> other, IComparer<T> comparer)
|
||||
{
|
||||
List<T> values = new(other);
|
||||
|
||||
values.Sort(comparer);
|
||||
Replace(values);
|
||||
}
|
||||
|
||||
public void Sort(IComparer<T> comparer)
|
||||
{
|
||||
List<T> values = new(this);
|
||||
|
||||
values.Sort(comparer);
|
||||
Replace(values);
|
||||
}
|
||||
|
||||
public void Synchronize(NotifyCollectionChangedEventArgs args)
|
||||
{
|
||||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add when args.NewItems != null:
|
||||
AddRange(args.NewItems);
|
||||
break;
|
||||
case NotifyCollectionChangedAction.Remove when args.OldItems != null:
|
||||
RemoveRange(args.OldItems);
|
||||
break;
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
Clear();
|
||||
break;
|
||||
case NotifyCollectionChangedAction.Replace:
|
||||
case NotifyCollectionChangedAction.Move:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
if (_suppressChangedEvent)
|
||||
return;
|
||||
|
||||
base.OnPropertyChanged(e);
|
||||
}
|
||||
|
||||
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (_suppressChangedEvent)
|
||||
return;
|
||||
|
||||
base.OnCollectionChanged(e);
|
||||
}
|
||||
|
||||
//protected override void ClearItems()
|
||||
//{
|
||||
// base.ClearItems();
|
||||
//}
|
||||
|
||||
//protected override void InsertItem(int index, T item)
|
||||
//{
|
||||
// base.InsertItem(index, item);
|
||||
//}
|
||||
|
||||
//protected override void MoveItem(int oldIndex, int newIndex)
|
||||
//{
|
||||
// base.MoveItem(oldIndex, newIndex);
|
||||
//}
|
||||
|
||||
//public override event NotifyCollectionChangedEventHandler? CollectionChanged
|
||||
//{
|
||||
// add => base.CollectionChanged += value;
|
||||
// remove => base.CollectionChanged -= value;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ public class SignalRTags : AcSignalRTags
|
|||
|
||||
public const int GetShippingItems = 50;
|
||||
public const int GetShippingItemById = 51;
|
||||
public const int GetShippingItemsByDocumentId = 52;
|
||||
public const int AddShippingItem = 55;
|
||||
public const int UpdateShippingItem = 56;
|
||||
public const int UpdateMeasuredShippingItem = 57;
|
||||
|
|
|
|||
|
|
@ -17,12 +17,13 @@
|
|||
<Columns>
|
||||
<DxGridDataColumn FieldName="Id" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" />
|
||||
<DxGridDataColumn FieldName="CustomerId" />
|
||||
<DxGridDataColumn FieldName="OrderTotal" />
|
||||
|
||||
<DxGridDataColumn FieldName="OrderStatus" />
|
||||
<DxGridDataColumn FieldName="IsMeasurable" ReadOnly="true" />
|
||||
<DxGridDataColumn FieldName="MeasuringStatus" ReadOnly="true" />
|
||||
@* <DxGridDataColumn FieldName="IsMeasured" ReadOnly="true" /> *@
|
||||
|
||||
<DxGridDataColumn FieldName="OrderTotal" Caption="Végösszeg (br.)"/>
|
||||
|
||||
<DxGridDataColumn FieldName="IsAllOrderItemAvgWeightValid" ReadOnly="true" Caption="AvgWeightValid" />
|
||||
|
||||
|
|
@ -111,6 +112,34 @@
|
|||
LoadingPanelVisibility.Visible = false;
|
||||
}
|
||||
|
||||
// void OnCustomizeElement(GridCustomizeElementEventArgs e)
|
||||
// {
|
||||
// if (e.ElementType == GridElementType.DataCell)
|
||||
// {
|
||||
// //if (some_condition)
|
||||
// e.Attributes["title"] = "some tooltip";
|
||||
// }
|
||||
// }
|
||||
|
||||
// void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||
// {
|
||||
// if (e.ElementType == GridElementType.DataCell)
|
||||
// {
|
||||
// var fieldName = ((DxGridDataColumn)e.Column).FieldName;
|
||||
// var cellIdentifier = e.VisibleIndex + ":" + fieldName;
|
||||
|
||||
// e.Attributes["data-id"] = cellIdentifier;
|
||||
// e.Attributes["onmouseenter"] = EventCallback.Factory.Create<MouseEventArgs>(
|
||||
// this,
|
||||
// async _ =>
|
||||
// {
|
||||
// hoveredCellInfo = fieldName + ": " + e.Grid.GetRowValue(e.VisibleIndex, fieldName);
|
||||
// selector = "td[data-id=\"" + cellIdentifier + "\"]";
|
||||
// await Hint.ShowAsync();
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
protected async Task OnActiveTabChanged(int activeTabIndex)
|
||||
{
|
||||
_activeTabIndex = activeTabIndex;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
</DxGridDataColumn>
|
||||
|
||||
@* <DxGridDataColumn FieldName="ProductName" /> *@
|
||||
<DxGridDataColumn FieldName="PriceInclTax" DisplayFormat="c" />
|
||||
<DxGridDataColumn FieldName="UnitPriceInclTax" DisplayFormat="c" />
|
||||
|
||||
<DxGridDataColumn FieldName="Quantity" />
|
||||
<DxGridDataColumn FieldName="NetWeight" />
|
||||
|
|
@ -41,6 +39,9 @@
|
|||
<DxGridDataColumn FieldName="IsMeasurable" ReadOnly="true" />
|
||||
<DxGridDataColumn FieldName="MeasuringStatus" ReadOnly="true" />
|
||||
@* <DxGridDataColumn FieldName="IsMeasured" ReadOnly="true" /> *@
|
||||
|
||||
<DxGridDataColumn FieldName="UnitPriceInclTax" Caption="Egységár (br.)" />
|
||||
<DxGridDataColumn FieldName="PriceInclTax" Caption="Végösszeg (br.)" />
|
||||
|
||||
<DxGridDataColumn FieldName="AverageWeight" ReadOnly="true" Visible="false" Caption="AvgWeight" />
|
||||
<DxGridDataColumn FieldName="AverageWeightDifference" ReadOnly="true" Visible="false" Caption="AvgWeightDiff" />
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
//var orderItemDtos = _orderItemDtos?.Where(oi => oi.ProductId == productId).ToList() ?? [];
|
||||
|
||||
var contextIds = new[] { (object)((ProductDto)(context.DataItem)).Id };
|
||||
<GridStockQuantityHistoryDtoTemplate ContextIds="@(contextIds)" IsMasterGrid="false" />
|
||||
<GridStockQuantityHistoryDtoTemplate ContextIds="@(contextIds)" ParentDataItem="@((ProductDto)(context.DataItem))" />
|
||||
}
|
||||
</DxTabPage>
|
||||
</DxTabs>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
@using AyCode.Utils.Extensions
|
||||
@using AyCode.Core.Helpers
|
||||
@using AyCode.Utils.Extensions
|
||||
@using FruitBank.Common.Dtos
|
||||
@using FruitBank.Common.Entities
|
||||
@using FruitBankHybrid.Shared.Databases
|
||||
|
|
@ -25,7 +26,8 @@
|
|||
@if (IsMasterGrid)
|
||||
{
|
||||
var shipping = ((Shipping)context.DataItem);
|
||||
var shippingDocuments = shipping?.ShippingDocuments?.ToList() ?? [];
|
||||
var shippingDocuments = new AcFastObservableCollection<ShippingDocument>();
|
||||
shippingDocuments.AddRange(shipping?.ShippingDocuments ?? []);
|
||||
|
||||
<DxTabs ActiveTabIndexChanged="(i) => OnActiveTabChanged(i)">
|
||||
<DxTabPage Text="Szállítólevelek">
|
||||
|
|
@ -36,7 +38,7 @@
|
|||
</DxTabPage>
|
||||
|
||||
<DxTabPage Text="Szállítmány tételek">
|
||||
<GridShippingItemTemplate ShippingItems="shippingDocuments?.SelectMany(sd => sd.ShippingItems ?? [])?.ToList() ?? []" IsMasterGrid="false" />
|
||||
<GridShippingItemTemplate ShippingItems="shippingDocuments?.SelectMany(sd => sd.ShippingItems ?? [])?.ToList() ?? []" ParentDataItem="shipping" />
|
||||
</DxTabPage>
|
||||
</DxTabs>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
@using FruitBankHybrid.Shared.Services.SignalRs
|
||||
@using System.Text
|
||||
@using AyCode.Core.Extensions
|
||||
@using AyCode.Core.Helpers
|
||||
@using FruitBank.Common.Models
|
||||
|
||||
@inject FruitBankSignalRClient FruitBankSignalRClient
|
||||
|
|
@ -73,12 +74,12 @@
|
|||
|
||||
<DxTabs ActiveTabIndexChanged="(i) => OnActiveTabChanged(i)">
|
||||
<DxTabPage Text="Szállítmány tételek">
|
||||
<GridShippingItemTemplate ShippingItems="shippingDocument.ShippingItems" IsMasterGrid="false" />
|
||||
<GridShippingItemTemplate ShippingItems="shippingDocument.ShippingItems" ParentDataItem="@shippingDocument" />
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Mérések">
|
||||
@{
|
||||
var shippingItemPallets = shippingDocument?.ShippingItems?.SelectMany(oi => oi.ShippingItemPallets ?? []).ToList() ?? [];
|
||||
<GridShippingItemPallets OrderItemPallets="shippingItemPallets" IsMasterGrid="false" />
|
||||
<GridShippingItemPallets ShippingItemPallets="shippingItemPallets" IsMasterGrid="false" />
|
||||
}
|
||||
</DxTabPage>
|
||||
|
||||
|
|
@ -127,6 +128,9 @@
|
|||
</MgGridBase>
|
||||
|
||||
@code {
|
||||
//EditRow dblClick
|
||||
//https://supportcenter.devexpress.com/ticket/details/t1097648/datagrid-for-blazor-how-to-start-editing-a-row-and-save-changes-without-the-command-column
|
||||
|
||||
//[Inject] public required ObjectLock ObjectLock { get; set; }
|
||||
[Inject] public required DatabaseClient Database { get; set; }
|
||||
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
||||
|
|
@ -135,7 +139,7 @@
|
|||
|
||||
[Parameter] public List<Shipping>? Shippings { get; set; }
|
||||
[Parameter] public List<Partner>? Partners { get; set; }
|
||||
[Parameter] public List<ShippingDocument>? ShippingDocuments { get; set; }
|
||||
[Parameter] public AcFastObservableCollection<ShippingDocument>? ShippingDocuments { get; set; }
|
||||
|
||||
[Parameter] public Func<List<Partner>?, Task>? OnUploadedFileParsed { get; set; }
|
||||
|
||||
|
|
@ -186,11 +190,14 @@
|
|||
|
||||
using (await ObjectLock.GetSemaphore<ShippingDocument>().UseWaitAsync())
|
||||
{
|
||||
if (ShippingDocuments == null) ShippingDocuments = await FruitBankSignalRClient.GetShippingDocuments() ?? [];
|
||||
if (ShippingDocuments == null)
|
||||
{
|
||||
ShippingDocuments = [];
|
||||
ShippingDocuments.AddRange(await FruitBankSignalRClient.GetShippingDocuments() ?? []);
|
||||
}
|
||||
else if (ShippingDocuments.Count == 0 || forceReload)
|
||||
{
|
||||
ShippingDocuments.Clear();
|
||||
ShippingDocuments.AddRange(await FruitBankSignalRClient.GetShippingDocuments() ?? []);
|
||||
ShippingDocuments.Replace(await FruitBankSignalRClient.GetShippingDocuments() ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
@using AyCode.Core.Loggers;
|
||||
@using AyCode.Core.Extensions
|
||||
@using AyCode.Core.Helpers
|
||||
@using AyCode.Core.Interfaces
|
||||
@using AyCode.Utils.Extensions
|
||||
@using FruitBank.Common.Dtos
|
||||
@using FruitBank.Common.Entities
|
||||
@using FruitBank.Common.Interfaces
|
||||
@using FruitBankHybrid.Shared.Components.Grids.ShippingItems
|
||||
@using FruitBankHybrid.Shared.Components.Toolbars
|
||||
@using FruitBankHybrid.Shared.Databases
|
||||
|
|
@ -18,17 +20,18 @@ ValidationEnabled="false" EditMode="GridEditMode.EditRow"
|
|||
EditModelSaving="Grid_EditModelSaving"
|
||||
FocusedRowChanged="Grid_FocusedRowChanged" *@
|
||||
|
||||
<GridShippingItem @ref="Grid" IsMasterGrid="IsMasterGrid" DataSource="ShippingItems" AutoSaveLayoutName="GridShippingItem"
|
||||
SignalRClient="FruitBankSignalRClient" Logger="_logger"
|
||||
CssClass="@GridCss" ValidationEnabled="false" EditMode="GridEditMode.EditRow"
|
||||
FocusedRowChanged="Grid_FocusedRowChanged">
|
||||
<GridShippingItem @ref="Grid" ParentDataItem="ParentDataItem" KeyFieldNameToParentId="@nameof(ShippingItem.ShippingDocumentId)"
|
||||
DataSource="ShippingItems" AutoSaveLayoutName="GridShippingItem" SignalRClient="FruitBankSignalRClient" Logger="_logger"
|
||||
CssClass="@GridCss" ValidationEnabled="false" EditMode="GridEditMode.EditRow"
|
||||
FocusedRowChanged="Grid_FocusedRowChanged" OnGridEditModelSaving="EditModelSaving">
|
||||
@* <MgGridBase Data="ShippingItems" IsMasterGrid="IsMasterGrid" CssClass="@GridCss" AutoSaveLayoutName="GridShippingItem"
|
||||
ValidationEnabled="false" EditMode="GridEditMode.EditRow"
|
||||
EditModelSaving="Grid_EditModelSaving"
|
||||
FocusedRowChanged="Grid_FocusedRowChanged"> *@
|
||||
<Columns>
|
||||
<DxGridDataColumn FieldName="Id" Caption="oiId" Width="125" />
|
||||
<DxGridDataColumn FieldName="ShippingDocumentId" Caption="ShippingDocument">
|
||||
<DxGridDataColumn FieldName="ShippingDocumentId" Caption="ShippingDocument"
|
||||
Visible="@(!ParentDataItemIsShippingDocument)" ReadOnly="@(ParentDataItemIsShippingDocument)">
|
||||
<EditSettings>
|
||||
<DxComboBoxSettings Data="ShippingDocuments"
|
||||
ValueFieldName="Id"
|
||||
|
|
@ -48,7 +51,8 @@ FocusedRowChanged="Grid_FocusedRowChanged" *@
|
|||
</EditSettings>
|
||||
</DxGridDataColumn>
|
||||
|
||||
@* <DxGridDataColumn FieldName="PalletId" Caption="pId" Width="125" /> *@
|
||||
<DxGridDataColumn FieldName="@("ShippingDocument.Partner.Name")" Caption="Patner" Width="125" ReadOnly="true" Visible="@(!ParentDataItemIsShippingDocument)" />
|
||||
|
||||
<DxGridDataColumn FieldName="ProductId" Caption="Product">
|
||||
<EditSettings>
|
||||
<DxComboBoxSettings Data="ProductDtos"
|
||||
|
|
@ -91,7 +95,20 @@ FocusedRowChanged="Grid_FocusedRowChanged" *@
|
|||
<DxGridDataColumn FieldName="Modified" ReadOnly="true" />
|
||||
<DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn>
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
@* <DataColumnCellDisplayTemplate>
|
||||
@{
|
||||
if (context.DataColumn.FieldName == nameof(ShippingItem.ShippingDocumentId))
|
||||
{
|
||||
<span>@(String.Format("{0:P2}", context.Value))</span>
|
||||
// format the value as percentage
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@context.DisplayText</span>
|
||||
}
|
||||
}
|
||||
</DataColumnCellDisplayTemplate>
|
||||
*@ <DetailRowTemplate>
|
||||
@{
|
||||
var shippingItemPallets = ((ShippingItem)context.DataItem).ShippingItemPallets;
|
||||
<GridShippingItemPallets ShippingItemPallets="shippingItemPallets" IsMasterGrid="false"></GridShippingItemPallets>
|
||||
|
|
@ -100,7 +117,7 @@ FocusedRowChanged="Grid_FocusedRowChanged" *@
|
|||
<ToolbarTemplate>
|
||||
@if (IsMasterGrid)
|
||||
{
|
||||
<FruitBankToolbarTemplate Grid="Grid" OnReloadDataClick="() => ReloadDataFromDb(true)"/>
|
||||
<FruitBankToolbarTemplate Grid="Grid" OnReloadDataClick="() => ReloadDataFromDb(true)" />
|
||||
}
|
||||
</ToolbarTemplate>
|
||||
<GroupSummary>
|
||||
|
|
@ -121,12 +138,15 @@ FocusedRowChanged="Grid_FocusedRowChanged" *@
|
|||
//[Inject] public required ObjectLock ObjectLock { get; set; }
|
||||
[Inject] public required DatabaseClient Database { get; set; }
|
||||
|
||||
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
||||
//[Parameter] public int GetAllMessageTag { get; set; }
|
||||
[Parameter] public IId<int>? ParentDataItem { get; set; }
|
||||
|
||||
[Parameter] public IEnumerable<ProductDto>? ProductDtos { get; set; }
|
||||
[Parameter] public List<ShippingItem>? ShippingItems { get; set; }
|
||||
[Parameter] public List<ShippingDocument>? ShippingDocuments { get; set; }
|
||||
[Parameter] public AcFastObservableCollection<ShippingDocument>? ShippingDocuments { get; set; }
|
||||
|
||||
public bool IsMasterGrid => ParentDataItem == null;
|
||||
public bool ParentDataItemIsShippingDocument => (ParentDataItem is ShippingDocument);
|
||||
string GridCss => !IsMasterGrid ? "hide-toolbar" : string.Empty;
|
||||
|
||||
const string ExportFileName = "ExportResult";
|
||||
|
|
@ -148,20 +168,28 @@ FocusedRowChanged="Grid_FocusedRowChanged" *@
|
|||
|
||||
public async Task ReloadDataFromDb(bool forceReload = false)
|
||||
{
|
||||
if (!IsMasterGrid) return;
|
||||
|
||||
using (await ObjectLock.GetSemaphore<ProductDto>().UseWaitAsync())
|
||||
{
|
||||
if (ProductDtos == null || !ProductDtos.Any() || forceReload) ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload);
|
||||
}
|
||||
|
||||
if (!IsMasterGrid)
|
||||
{
|
||||
if (ShippingDocuments == null && ParentDataItem is ShippingDocument shippingDocumentParent) ShippingDocuments = [shippingDocumentParent];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
using (await ObjectLock.GetSemaphore<ShippingDocument>().UseWaitAsync())
|
||||
{
|
||||
if (ShippingDocuments == null) ShippingDocuments = await FruitBankSignalRClient.GetShippingDocuments() ?? [];
|
||||
if (ShippingDocuments == null)
|
||||
{
|
||||
ShippingDocuments = [];
|
||||
ShippingDocuments.AddRange(await FruitBankSignalRClient.GetShippingDocuments() ?? []);
|
||||
}
|
||||
else if (ShippingDocuments.Count == 0 || forceReload)
|
||||
{
|
||||
ShippingDocuments.Clear();
|
||||
ShippingDocuments.AddRange(await FruitBankSignalRClient.GetShippingDocuments() ?? []);
|
||||
ShippingDocuments.Replace(await FruitBankSignalRClient.GetShippingDocuments() ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -206,4 +234,10 @@ FocusedRowChanged="Grid_FocusedRowChanged" *@
|
|||
|
||||
EditItemsEnabled = true;
|
||||
}
|
||||
|
||||
private void EditModelSaving(GridEditModelSavingEventArgs obj)
|
||||
{
|
||||
//obj.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ public class FruitBankListGridBase<TDataItem> : MgGridBase<SignalRDataSourceList
|
|||
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
||||
[Inject] public required IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Parameter] public bool IsMasterGrid { get; set; } = false;
|
||||
//[Parameter] public bool IsMasterGrid { get; set; } = false;
|
||||
[Parameter] public string AutoSaveLayoutName { get; set; }
|
||||
|
||||
private bool _isFirstInitializeParameterCore;
|
||||
|
|
@ -31,7 +31,7 @@ public class FruitBankListGridBase<TDataItem> : MgGridBase<SignalRDataSourceList
|
|||
// throw new NotImplementedException();
|
||||
//}
|
||||
|
||||
protected void OnCustomizeElement(GridCustomizeElementEventArgs e)
|
||||
protected void OnCustomizeElement(GridCustomizeElementEventArgs e)
|
||||
{
|
||||
//if (!IsMasterGrid) e.CssClass = "hideDetailButton";
|
||||
|
||||
|
|
@ -40,9 +40,9 @@ public class FruitBankListGridBase<TDataItem> : MgGridBase<SignalRDataSourceList
|
|||
e.CssClass = " alt-item";
|
||||
}
|
||||
|
||||
if(e.ElementType == GridElementType.DataRow && !LoggedInModel.IsDeveloper)
|
||||
{
|
||||
e.CssClass = "hideDetailButton";
|
||||
if (e.ElementType == GridElementType.DataRow && !LoggedInModel.IsDeveloper)
|
||||
{
|
||||
e.CssClass = "hideDetailButton";
|
||||
}
|
||||
|
||||
if (e.ElementType == GridElementType.HeaderCell)
|
||||
|
|
@ -105,11 +105,10 @@ public class FruitBankListGridBase<TDataItem> : MgGridBase<SignalRDataSourceList
|
|||
//VirtualScrollingEnabled = IsMasterGrid;
|
||||
PageSizeSelectorVisible = true;
|
||||
|
||||
if (!AutoSaveLayoutName.IsNullOrWhiteSpace())
|
||||
{
|
||||
LayoutAutoLoading = Grid_LayoutAutoLoading;
|
||||
LayoutAutoSaving = Grid_LayoutAutoSaving;
|
||||
}
|
||||
if (AutoSaveLayoutName.IsNullOrWhiteSpace()) AutoSaveLayoutName = $"Grid{typeof(TDataItem).Name}";
|
||||
|
||||
LayoutAutoLoading = Grid_LayoutAutoLoading;
|
||||
LayoutAutoSaving = Grid_LayoutAutoSaving;
|
||||
|
||||
_isFirstInitializeParameters = true;
|
||||
}
|
||||
|
|
@ -124,18 +123,18 @@ public class FruitBankListGridBase<TDataItem> : MgGridBase<SignalRDataSourceList
|
|||
//PreRendered = true;
|
||||
//StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async Task Grid_LayoutAutoLoading(GridPersistentLayoutEventArgs e)
|
||||
{
|
||||
var masterDetailName = IsMasterGrid ? "Master" : "Detail";
|
||||
var masterDetailName = IsMasterGrid ? "Master" : ParentDataItem!.GetType().Name;
|
||||
e.Layout = await LoadLayoutFromLocalStorageAsync($"{AutoSaveLayoutName}_{masterDetailName}_AutoSave_{LoggedInModel.CustomerDto?.Id ?? 0}");
|
||||
}
|
||||
|
||||
private async Task Grid_LayoutAutoSaving(GridPersistentLayoutEventArgs e)
|
||||
{
|
||||
var masterDetailName = IsMasterGrid ? "Master" : "Detail";
|
||||
var masterDetailName = IsMasterGrid ? "Master" : ParentDataItem!.GetType().Name;
|
||||
await SaveLayoutToLocalStorageAsync(e.Layout, $"{AutoSaveLayoutName}_{masterDetailName}_AutoSave_{LoggedInModel.CustomerDto?.Id ?? 0}");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,17 @@ public class GridStockQuantityHistoryDto : FruitBankListGridBase<StockQuantityHi
|
|||
//RemoveMessageTag = SignalRTags.;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
GetAllMessageTag = IsMasterGrid ? SignalRTags.GetStockQuantityHistoryDtos : SignalRTags.GetStockQuantityHistoryDtosByProductId;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||
{
|
||||
return base.SetParametersAsyncCore(parameters);
|
||||
|
||||
if (!IsFirstInitializeParameters)
|
||||
{
|
||||
//ShowFilterRow = true;
|
||||
|
|
@ -26,7 +35,5 @@ public class GridStockQuantityHistoryDto : FruitBankListGridBase<StockQuantityHi
|
|||
|
||||
//etc...
|
||||
}
|
||||
|
||||
return base.SetParametersAsyncCore(parameters);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
@using AyCode.Core.Loggers;
|
||||
@using AyCode.Core.Interfaces
|
||||
@using AyCode.Core.Loggers;
|
||||
@using AyCode.Utils.Extensions
|
||||
@using FruitBank.Common.Dtos
|
||||
@using FruitBankHybrid.Shared.Components.Grids.ShippingItems
|
||||
|
|
@ -10,7 +11,7 @@
|
|||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject FruitBankSignalRClient FruitBankSignalRClient
|
||||
|
||||
<GridStockQuantityHistoryDto @ref="Grid" ContextIds="ContextIds" IsMasterGrid="IsMasterGrid" DataSource="StockQuantityHistoryDtos" AutoSaveLayoutName="GridStockQuantityHistoryDto"
|
||||
<GridStockQuantityHistoryDto @ref="Grid" ContextIds="ContextIds" ParentDataItem="ParentDataItem" DataSource="StockQuantityHistoryDtos" AutoSaveLayoutName="GridStockQuantityHistoryDto"
|
||||
SignalRClient="FruitBankSignalRClient" Logger="_logger"
|
||||
CssClass="@GridCss" ValidationEnabled="false">
|
||||
<Columns>
|
||||
|
|
@ -54,11 +55,12 @@
|
|||
[Inject] public required DatabaseClient Database { get; set; }
|
||||
|
||||
[Parameter] public object[]? ContextIds { get; set; }
|
||||
[Parameter] public bool IsMasterGrid { get; set; }
|
||||
[Parameter] public IId<int>? ParentDataItem { get; set; }
|
||||
|
||||
[Parameter] public IEnumerable<ProductDto>? ProductDtos { get; set; }
|
||||
[Parameter] public List<StockQuantityHistoryDto>? StockQuantityHistoryDtos { get; set; }
|
||||
|
||||
public bool IsMasterGrid => ParentDataItem == null;
|
||||
string GridCss => !IsMasterGrid ? "hide-toolbar" : string.Empty;
|
||||
|
||||
public GridStockQuantityHistoryDto Grid { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using AyCode.Core.Interfaces;
|
||||
using DevExpress.Blazor;
|
||||
using FruitBank.Common.Entities;
|
||||
using FruitBank.Common.Interfaces;
|
||||
using FruitBank.Common.SignalRs;
|
||||
using FruitBankHybrid.Shared.Pages;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
|
@ -9,25 +10,66 @@ namespace FruitBankHybrid.Shared.Components.Grids.ShippingItems;
|
|||
|
||||
public class GridShippingItem : FruitBankListGridBase<ShippingItem>, IGrid
|
||||
{
|
||||
private bool _isFirstInitializeParameterCore;
|
||||
private bool _isFirstInitializeParameters;
|
||||
|
||||
public GridShippingItem () : base()
|
||||
{
|
||||
GetAllMessageTag = SignalRTags.GetShippingItems;
|
||||
AddMessageTag = SignalRTags.AddShippingItem;
|
||||
UpdateMessageTag = SignalRTags.UpdateShippingItem;
|
||||
|
||||
//RemoveMessageTag = SignalRTags.;
|
||||
}
|
||||
|
||||
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (!IsFirstInitializeParameters)
|
||||
if (IsMasterGrid) GetAllMessageTag = SignalRTags.GetShippingItems;
|
||||
else
|
||||
{
|
||||
ContextIds = [ParentDataItem!.Id];
|
||||
|
||||
if (ParentDataItem is IShippingDocument) GetAllMessageTag = SignalRTags.GetShippingItemsByDocumentId;
|
||||
//else if (ParentDataItem is IShipping) GetAllMessageTag = SignalRTags.GetShippingItemsByShippingId;
|
||||
}
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
base.OnParametersSet();
|
||||
|
||||
if (!_isFirstInitializeParameters)
|
||||
{
|
||||
//if (!IsMasterGrid && (ContextIds == null || ContextIds.Length == 0))
|
||||
//{
|
||||
// ContextIds = [ParentDataItem!.Id];
|
||||
// GetAllMessageTag = SignalRTags.GetShippingItemsByDocumentId;
|
||||
//}
|
||||
|
||||
_isFirstInitializeParameters = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task SetParametersAsyncCore(ParameterView parameters)
|
||||
{
|
||||
await base.SetParametersAsyncCore(parameters);
|
||||
|
||||
if (!_isFirstInitializeParameterCore)
|
||||
{
|
||||
//if (!IsMasterGrid && (ContextIds == null || ContextIds.Length == 0))
|
||||
//{
|
||||
// ContextIds = [ParentDataItem!.Id];
|
||||
// GetAllMessageTag = SignalRTags.GetShippingItemsByDocumentId;
|
||||
//}
|
||||
|
||||
//ShowFilterRow = true;
|
||||
//ShowGroupPanel = true;
|
||||
//AllowSort = false;
|
||||
|
||||
//etc...
|
||||
}
|
||||
|
||||
return base.SetParametersAsyncCore(parameters);
|
||||
_isFirstInitializeParameterCore = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ using Nop.Core.Domain.Orders;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
using AyCode.Core.Helpers;
|
||||
|
||||
namespace FruitBankHybrid.Shared.Databases;
|
||||
|
||||
|
|
@ -55,17 +56,17 @@ public class ShippingItemTable : SignalRDataSourceList<ShippingItemTableItem>
|
|||
}
|
||||
}
|
||||
|
||||
public class ProductDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : MgObservableCollection<ProductDtoTableItem>
|
||||
public class ProductDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : AcFastObservableCollection<ProductDtoTableItem>
|
||||
{
|
||||
private readonly SemaphoreSlim _semaphoreSlim = new(1);
|
||||
public async Task<ProductDtoTable> LoadDataAsync(bool onlyIfEmpty = true)
|
||||
{
|
||||
if (onlyIfEmpty && Count != 0) return this;
|
||||
if (onlyIfEmpty && Count > 0) return this;
|
||||
|
||||
using (await _semaphoreSlim.UseWaitAsync())
|
||||
{
|
||||
//Előfordulhat, h egy másik szálban már megtörtént a refresh... - J.
|
||||
if (onlyIfEmpty && Count != 0) return this;
|
||||
if (onlyIfEmpty && Count > 0) return this;
|
||||
|
||||
var items = (await fruitBankSignalRClient.GetProductDtoTableItems() ?? []);
|
||||
|
||||
|
|
@ -80,17 +81,17 @@ public class ProductDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : Mg
|
|||
return this;
|
||||
}
|
||||
}
|
||||
public class OrderDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : MgObservableCollection<OrderDtoTableItem>
|
||||
public class OrderDtoTable(FruitBankSignalRClient fruitBankSignalRClient) : AcFastObservableCollection<OrderDtoTableItem>
|
||||
{
|
||||
private readonly SemaphoreSlim _semaphoreSlim = new(1);
|
||||
|
||||
public async Task<OrderDtoTable> LoadDataAsync(bool onlyIfEmpty = true)
|
||||
{
|
||||
if (onlyIfEmpty && Count != 0) return this;
|
||||
if (onlyIfEmpty && Count > 0) return this;
|
||||
|
||||
using (await _semaphoreSlim.UseWaitAsync())
|
||||
{
|
||||
if (Count != 0) return this;
|
||||
if (Count > 0) return this;
|
||||
|
||||
var items = (await fruitBankSignalRClient.GetAllOrderDtoTableItems() ?? []);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@
|
|||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="MeasuringIn">
|
||||
<span class="icon counter-icon" aria-hidden="true"></span> Bejövő mérés
|
||||
<span class="icon counter-icon" aria-hidden="true"></span> Áru bevételezés
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="MeasuringOut">
|
||||
<span class="icon counter-icon" aria-hidden="true"></span> Kimenő mérés
|
||||
<span class="icon counter-icon" aria-hidden="true"></span> Áru kiadás
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ Welcome to your new app running on <em>@Factor</em> using <em>@Platform</em>.
|
|||
<div class="col-md-3"></div>
|
||||
<div class="col-md-3">
|
||||
<NavLink href="MeasuringIn">
|
||||
<DxButton Text="Bejövő mérés"></DxButton>
|
||||
<DxButton Text="Áru bevételezés"></DxButton>
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<NavLink href="MeasuringOut">
|
||||
<DxButton Text="Kimenő mérés"></DxButton>
|
||||
<DxButton Text="Áru kiadás"></DxButton>
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="col-md-3"></div>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
@using FruitBankHybrid.Shared.Services
|
||||
@using Mango.Nop.Core.Dtos
|
||||
|
||||
<h3>Bejövő mérés</h3>
|
||||
<h3>Áru bevételezés</h3>
|
||||
|
||||
<div style="margin-top: 50px;">
|
||||
<DxLoadingPanel @bind-Visible="LoadingPanelVisible"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
@using FruitBankHybrid.Shared.Components
|
||||
@using FruitBankHybrid.Shared.Services
|
||||
@using Nop.Core.Domain.Orders
|
||||
<h3>Kimenő mérés</h3>
|
||||
<h3>Áru kiadás</h3>
|
||||
|
||||
<DxDialogProvider />
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<GridShippingDocument @ref="gridShippingDocument" ShippingDocuments="ShippingDocuments" Shippings="Shippings" IsMasterGrid="true"></GridShippingDocument>
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Szállítólevél tételek">
|
||||
<GridShippingItemTemplate @ref="gridShippingItemTemplate" ShippingItems="ShippingItems" ShippingDocuments="ShippingDocuments" IsMasterGrid="true"></GridShippingItemTemplate>
|
||||
<GridShippingItemTemplate @ref="gridShippingItemTemplate" ShippingItems="ShippingItems" ShippingDocuments="ShippingDocuments"></GridShippingItemTemplate>
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Mérések">
|
||||
<GridShippingItemPallets @ref="gridShippingItemPallet" IsMasterGrid="true" ShippingItemPallets="ShippingItemPallets"></GridShippingItemPallets>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using AyCode.Core.Loggers;
|
||||
using AyCode.Core.Helpers;
|
||||
using AyCode.Core.Loggers;
|
||||
using DevExpress.Blazor;
|
||||
using DevExpress.ClipboardSource.SpreadsheetML;
|
||||
using FruitBank.Common.Dtos;
|
||||
|
|
@ -31,7 +32,7 @@ public partial class ShippingsAdmin : ComponentBase
|
|||
private GridShippingItemPallets gridShippingItemPallet;
|
||||
|
||||
public List<Shipping> Shippings { get; set; } = [];
|
||||
public List<ShippingDocument> ShippingDocuments { get; set; } = [];
|
||||
public AcFastObservableCollection<ShippingDocument> ShippingDocuments { get; set; } = [];
|
||||
public List<ShippingItem> ShippingItems { get; set; } = [];
|
||||
public List<ShippingItemPallet> ShippingItemPallets { get; set; } = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
|
|||
public Task<List<ShippingItem>?> GetShippingItems()
|
||||
=> GetAllAsync<List<ShippingItem>>(SignalRTags.GetShippingItems);
|
||||
|
||||
public Task<List<ShippingItem>?> GetShippingItemsByDocumentId(int shippingDocumentId)
|
||||
=> GetAllAsync<List<ShippingItem>>(SignalRTags.GetShippingItemsByDocumentId, [shippingDocumentId]);
|
||||
|
||||
public Task<ShippingItem?> GetShippingItemById(int id)
|
||||
=> GetByIdAsync<ShippingItem?>(SignalRTags.GetShippingItemById, id);
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ h1:focus {
|
|||
font-weight: 700;
|
||||
color: #161616;
|
||||
}
|
||||
|
||||
/* DevExpress and Bootstrap Themes */
|
||||
.alt-item > td:not(.dxbl-grid-empty-cell),
|
||||
.alt-item > td:not(.dxbl-grid-indent-cell) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue