Update Fix2 Expedition And ScanGS!
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 7m12s
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 7m12s
This commit is contained in:
parent
e075453d49
commit
f1e7e65c4f
@ -4,6 +4,7 @@
|
||||
@using Domain.Entities
|
||||
@using Services.Lookups
|
||||
@using Services.Stock.Expeditions
|
||||
|
||||
@using phronCare.UIBlazor.Pages.Stock.Shared
|
||||
|
||||
@inject NavigationManager Navigation
|
||||
@ -43,9 +44,7 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Ticket ID</label>
|
||||
<InputText class="form-control"
|
||||
@bind-Value="ticketIdString"
|
||||
@bind-Value:event="oninput" />
|
||||
<InputText class="form-control" @bind-Value="ticketIdString" @bind-Value:event="oninput" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -104,7 +103,8 @@
|
||||
<div class="card-body p-2">
|
||||
@if (Details.Any())
|
||||
{
|
||||
<table class="table table-sm table-bordered">
|
||||
<div class="expedition-table-wrap">
|
||||
<table class="table table-sm table-bordered expedition-table">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Producto</th>
|
||||
@ -113,7 +113,7 @@
|
||||
<th>Serial</th>
|
||||
<th>Vencimiento</th>
|
||||
<th>Ubicación</th>
|
||||
<th></th>
|
||||
<th style="width: 40px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -127,12 +127,15 @@
|
||||
<td>@item.Expiration?.ToString("yyyy-MM-dd")</td>
|
||||
<td>@item.LocationId</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-danger" @onclick="() => RemoveItem(item)">✕</button>
|
||||
<button class="btn btn-link p-0" style="color: red;" title="Eliminar" @onclick="() => RemoveItem(item)">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -220,48 +223,6 @@
|
||||
// TODO: Lógica de guardado de la expedición completa
|
||||
}
|
||||
|
||||
// private async Task OpenStockItemSelectorModal()
|
||||
// {
|
||||
|
||||
// var parameters = new ModalParameters();
|
||||
// parameters.Add(nameof(StockItemSelectorModal.SetItems), ProductSetItems); // o null
|
||||
// //parameters.Add(nameof(StockItemSelectorModal.LocationId), SelectedLocationId);
|
||||
|
||||
// var options = new ModalOptions()
|
||||
// {
|
||||
// Size = ModalSize.Large,
|
||||
// HideHeader = true
|
||||
// };
|
||||
|
||||
// var modal = Modal.Show<StockItemSelectorModal>("", parameters, options);
|
||||
|
||||
// var result = await modal.Result;
|
||||
|
||||
// if (!result.Cancelled && result.Data is List<StockItemSelectionDto> selectedItems)
|
||||
// {
|
||||
// foreach (var s in selectedItems)
|
||||
// {
|
||||
// var detail = new ELSExpeditionDetail
|
||||
// {
|
||||
// ProductId = s.ProductId,
|
||||
// Quantity = s.Quantity, // si es Serial*, probablemente 1
|
||||
// Batch = s.Batch,
|
||||
// Expiration = s.Expiration.HasValue
|
||||
// ? DateOnly.FromDateTime(s.Expiration.Value)
|
||||
// : (DateOnly?)null,
|
||||
// TraceabilityType=s.TraceabilityType, //agregado al model pero no es registrable en la entidad
|
||||
// Serial = s.Serial, // si es Serial*, probablemente null
|
||||
// LocationId = s.LocationId // si tu detalle lo maneja
|
||||
// };
|
||||
|
||||
// Details.Add(detail);
|
||||
// }
|
||||
|
||||
// StateHasChanged();
|
||||
// toastService.ShowSuccess($"{selectedItems.Count} item(s) agregados a la expedición.");
|
||||
// }
|
||||
|
||||
// }
|
||||
private async Task OpenStockItemSelectorModal()
|
||||
{
|
||||
var parameters = new ModalParameters();
|
||||
@ -299,10 +260,9 @@
|
||||
StockKeys.BuildBusinessKey(d.ProductId, d.LocationId, d.Batch ?? string.Empty, d.Expiration, d.Serial ?? string.Empty) == key
|
||||
);
|
||||
|
||||
// Normalizo cantidad pedida desde el modal (total final)
|
||||
var newQty = s.Quantity < 0 ? 0 : s.Quantity;
|
||||
|
||||
// Serial ⇒ siempre 1 (ignora lo que venga)
|
||||
// Serial ⇒ siempre 1
|
||||
if (!string.IsNullOrWhiteSpace(s.Serial))
|
||||
newQty = 1;
|
||||
|
||||
@ -310,24 +270,29 @@
|
||||
{
|
||||
if (newQty == 0)
|
||||
{
|
||||
// Si el modal dejó en 0, se elimina la fila
|
||||
if (existing.Quantity > 0)
|
||||
{
|
||||
// ⚠️ Caso snapshot con 0 → ignorar, mantener la fila
|
||||
continue;
|
||||
}
|
||||
|
||||
// 0 explícito válido → borrar
|
||||
Details.Remove(existing);
|
||||
}
|
||||
else
|
||||
{
|
||||
// SET (no sumar): que quede exactamente como en el modal
|
||||
// SET: exactamente lo que vino del modal
|
||||
existing.Quantity = newQty;
|
||||
existing.ProductName = s.ProductName; // opcional, por si viene actualizado
|
||||
existing.ProductName = s.ProductName;
|
||||
existing.Batch = s.Batch;
|
||||
existing.Serial = s.Serial;
|
||||
existing.Expiration = exp;
|
||||
existing.LocationId = s.LocationId;
|
||||
existing.TraceabilityType = s.TraceabilityType; // UI only
|
||||
existing.TraceabilityType = s.TraceabilityType;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si no existía y la cantidad es > 0, crear nueva fila
|
||||
if (newQty > 0)
|
||||
{
|
||||
Details.Add(new ELSExpeditionDetail
|
||||
@ -337,12 +302,11 @@
|
||||
Quantity = newQty,
|
||||
Batch = s.Batch,
|
||||
Expiration = exp,
|
||||
TraceabilityType = s.TraceabilityType, // UI only (no DB)
|
||||
TraceabilityType = s.TraceabilityType,
|
||||
Serial = s.Serial,
|
||||
LocationId = s.LocationId
|
||||
});
|
||||
}
|
||||
// Si newQty == 0 y no existía, no hay nada que hacer
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -381,5 +345,4 @@
|
||||
};
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
.expedition-table-wrap {
|
||||
max-height: 200px; /* controla la altura visible */
|
||||
overflow-y: auto; /* genera el scrollbar vertical */
|
||||
}
|
||||
|
||||
/* Sticky header */
|
||||
.expedition-table thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background: #f8f9fa; /* mismo color que .table-light */
|
||||
}
|
||||
@ -33,4 +33,8 @@
|
||||
<ProjectReference Include="..\Domain\Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\Stock\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user