Warehouses #1

Merged
trent merged 159 commits from Warehouses into master 2026-01-10 20:24:17 +00:00
Showing only changes of commit 2bf87c0091 - Show all commits

View File

@@ -44,6 +44,8 @@
<ToolbarItems> <ToolbarItems>
<ToolbarItem Type="ItemType.Button" Text="Zapisz zmiany" Id="SaveButton" <ToolbarItem Type="ItemType.Button" Text="Zapisz zmiany" Id="SaveButton"
PrefixIcon="e-icons e-save" OnClick="SaveChanges"/> PrefixIcon="e-icons e-save" OnClick="SaveChanges"/>
<ToolbarItem Type="ItemType.Button" Text="Podziel Linię" Id="SplitLineButton"
PrefixIcon="e-icons e-split-horizontal" OnClick="ShowSplitDialog" Disabled="IsDisabled"/>
<ToolbarItem Type="ItemType.Button" Id="Generuj XLS i Wyślij" PrefixIcon="e-icons e-export-xls" <ToolbarItem Type="ItemType.Button" Id="Generuj XLS i Wyślij" PrefixIcon="e-icons e-export-xls"
Text="Generuj XLS i Wyślij" OnClick="ExportXls"/> Text="Generuj XLS i Wyślij" OnClick="ExportXls"/>
</ToolbarItems> </ToolbarItems>
@@ -80,7 +82,7 @@
<GridFilterSettings Type="FilterType.Excel"/> <GridFilterSettings Type="FilterType.Excel"/>
<GridPageSettings PageSize="10"/> <GridPageSettings PageSize="10"/>
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/> <GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
<GridEvents OnBatchSave="OnBatchSave" TValue="WzRowMeyleDto"></GridEvents> <GridEvents RowSelected="OnRowSelected" OnBatchSave="OnBatchSave" TValue="WzRowMeyleDto"></GridEvents>
</SfGrid> </SfGrid>
</CardContent> </CardContent>
@@ -106,11 +108,16 @@
<DialogButton Content="OK" IsPrimary="true" OnClick="@HideModal"/> <DialogButton Content="OK" IsPrimary="true" OnClick="@HideModal"/>
</DialogButtons> </DialogButtons>
</SfDialog> </SfDialog>
<SfDialog Width="500px" Title="Błąd" IsModal="true" @bind-Visible="VisibilityValidation" AllowPrerender="true"> <SfDialog Width="500px" Title="Błąd" IsModal="true" @bind-Visible="VisibilityValidation" AllowPrerender="true">
<DialogTemplates> <DialogTemplates>
<Content> <Content>
<p>Błąd: Proszę zeskanować poprawny Numer Partii SL (istniejący w tabeli) lub poprawny numer Partii Meyle zaczynający się od <b>@($"{DateTime.Now.Year - 2000}X")</b>!</p> <p>Błąd skanowania! Wystąpił jeden z wyjątków:</p>
<ul>
<li><p>Zeskanowano niepoprawny Numer Partii SL (nieistniejący w tabeli)</p></li>
<li><p>Zeskanowano niepoprawny numer Partii Meyle (niezaczynający się od <b>@($"{DateTime.Now.Year - 2000}X")</b>)</p></li>
<li><p>Numer Palety nie jest większy niż 0</p></li>
</ul>
</Content> </Content>
</DialogTemplates> </DialogTemplates>
<DialogButtons> <DialogButtons>
@@ -118,6 +125,20 @@
</DialogButtons> </DialogButtons>
</SfDialog> </SfDialog>
<SfDialog Width="500px" Title="Podziel Linię" IsModal="true" @bind-Visible="VisibilityLineSplitter" AllowPrerender="true">
<DialogTemplates>
<Content>
<label for="textBox" class="form-label">Podziel linię <b>@SelectedRow?.FaIndex</b> podając ilość sztuk dla nowej linii:</label>
<SfTextBox ID="newQuantity" Type="InputType.Number" @bind-Value="@NewQuantity"
CssClass="e-outline"/>
</Content>
</DialogTemplates>
<DialogButtons>
<DialogButton Content="Zapisz" IsPrimary="true" OnClick="@SplitLine"/>
<DialogButton Content="Anuluj" OnClick="@HideModal"></DialogButton>
</DialogButtons>
</SfDialog>
<CardFooter> <CardFooter>
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small> <small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
</CardFooter> </CardFooter>
@@ -140,17 +161,23 @@
private bool Visibility { get; set; } private bool Visibility { get; set; }
private bool VisibilityValidation { get; set; } private bool VisibilityValidation { get; set; }
private bool VisibilityLineSplitter { get; set; }
private string? EmailAddresses { get; set; } = string.Empty; private string? EmailAddresses { get; set; } = string.Empty;
private string PalletNumber { get; set; } = "0"; private string PalletNumber { get; set; } = "0";
private string LastScannedValue { get; set; } = string.Empty; private string LastScannedValue { get; set; } = string.Empty;
private string ScannedValue { get; set; } = string.Empty; private string ScannedValue { get; set; } = string.Empty;
private string NewQuantity { get; set; } = "0";
private bool IsDisabled => SelectedRow == null;
private void HideModal() private void HideModal()
{ {
Visibility = false; Visibility = false;
VisibilityValidation = false; VisibilityValidation = false;
VisibilityLineSplitter = false;
} }
protected override async Task OnAfterRenderAsync(bool firstRender) protected override async Task OnAfterRenderAsync(bool firstRender)
@@ -214,6 +241,8 @@
{ {
if (string.IsNullOrWhiteSpace(obj.Value)) return; if (string.IsNullOrWhiteSpace(obj.Value)) return;
int palletNumber = int.Parse(PalletNumber);
TransactionModelsByPartNumber.TryGetValue(obj.Value.Trim(), out List<TransactionModel>? materialTransactionsByPartNumber); TransactionModelsByPartNumber.TryGetValue(obj.Value.Trim(), out List<TransactionModel>? materialTransactionsByPartNumber);
TransactionModel? materialTransactionByPartNumber = materialTransactionsByPartNumber?.FirstOrDefault(); TransactionModel? materialTransactionByPartNumber = materialTransactionsByPartNumber?.FirstOrDefault();
@@ -223,20 +252,21 @@
var rowIndex = WzRowsMeyle.FindIndex(x => x.FaIndex == materialTransactionByPartNumber.ItemNumber && x.Quantity == materialTransactionByPartNumber.Quantity); var rowIndex = WzRowsMeyle.FindIndex(x => x.FaIndex == materialTransactionByPartNumber.ItemNumber && x.Quantity == materialTransactionByPartNumber.Quantity);
//rowIndex = WzRowsMeyle.FindIndex(x => x.FaIndex == "FA23956.18" && x.Quantity == 130); //rowIndex = WzRowsMeyle.FindIndex(x => x.FaIndex == "FA23956.18" && x.Quantity == 130);
if (rowIndex == -1) if (rowIndex == -1 || palletNumber <= 0)
{ {
VisibilityValidation = true; VisibilityValidation = true;
LastScannedValue = ScannedValue; LastScannedValue = ScannedValue;
ScannedValue = string.Empty; ScannedValue = string.Empty;
await _scanner.FocusAsync(); await _scanner.FocusAsync();
return; return;
} }
SelectedRow = WzRowsMeyle[rowIndex]; SelectedRow = WzRowsMeyle[rowIndex];
SelectedRow.PartNumberSl = ScannedValue; SelectedRow.PartNumberSl = ScannedValue;
SelectedRow.PalletNumber = palletNumber;
if (ChangedRecords.All(x => x.TransactionNumber != SelectedRow.TransactionNumber)) if (ChangedRecords.All(x => x.TransactionNumber != SelectedRow.TransactionNumber))
{ {
@@ -300,13 +330,6 @@
return scannedValue.StartsWith(format); return scannedValue.StartsWith(format);
} }
private async Task<MaterialTransactionDto?> GetMaterialTransactionByPartNumber(string partNumber)
{
MaterialTransactionDto? materialTransaction = await WarehouseService.GetMaterialTransactionByPartNumberAsync(partNumber).ConfigureAwait(false);
return materialTransaction;
}
private async Task<IDictionary<string, List<TransactionModel>>> GetTransactionModels() private async Task<IDictionary<string, List<TransactionModel>>> GetTransactionModels()
{ {
return await WarehouseService.GetTransactionsModels(); return await WarehouseService.GetTransactionsModels();
@@ -320,4 +343,47 @@
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
await _grid.Refresh(); await _grid.Refresh();
} }
private async Task SplitLine(MouseEventArgs arg)
{
int newQuantity = int.Parse(NewQuantity);
if (newQuantity > 0 && SelectedRow != null)
{
WzRowMeyleDto splitRow = new WzRowMeyleDto
{
ID = Guid.NewGuid(),
FK_Header = SelectedRow.FK_Header,
Quantity = newQuantity,
FaIndex = SelectedRow.FaIndex,
ItemNumber = SelectedRow.ItemNumber,
OrderNumber = SelectedRow.OrderNumber,
PalletNumber = SelectedRow.PalletNumber,
WzNumber = SelectedRow.WzNumber,
TransactionNumber = SelectedRow.TransactionNumber
};
WzRowsMeyle.Add(splitRow);
SelectedRow.Quantity -= newQuantity;
ChangedRecords.Add(SelectedRow);
await WarehouseService.CreateWzRowsMeyleAsync(new List<WzRowMeyleDto> { splitRow });
await UpdateRows(ChangedRecords);
}
VisibilityLineSplitter = false;
}
private void ShowSplitDialog(ClickEventArgs obj)
{
VisibilityLineSplitter = true;
NewQuantity = "0";
}
private void OnRowSelected(RowSelectEventArgs<WzRowMeyleDto> obj)
{
SelectedRow = obj.Data;
}
} }