Compare commits
5 Commits
15dbec5aad
...
910a7aa852
| Author | SHA1 | Date |
|---|---|---|
|
|
910a7aa852 | |
|
|
c5da19a3ee | |
|
|
f5e356555c | |
|
|
c364145699 | |
|
|
ab6fb3ab88 |
|
|
@ -4,6 +4,7 @@ using AyCode.Services.SignalRs;
|
||||||
using DevExpress.Data.Helpers;
|
using DevExpress.Data.Helpers;
|
||||||
using FruitBank.Common.Entities;
|
using FruitBank.Common.Entities;
|
||||||
using FruitBank.Common.Enums;
|
using FruitBank.Common.Enums;
|
||||||
|
using FruitBank.Common.Interfaces;
|
||||||
using FruitBank.Common.Server.Interfaces;
|
using FruitBank.Common.Server.Interfaces;
|
||||||
using FruitBank.Common.Server.Services.SignalRs;
|
using FruitBank.Common.Server.Services.SignalRs;
|
||||||
using FruitBank.Common.SignalRs;
|
using FruitBank.Common.SignalRs;
|
||||||
|
|
@ -43,6 +44,8 @@ public class StockSignalREndpointServer(StockTakingDbContext ctx, SignalRSendToC
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result) return await ctx.StockTakings.GetByIdAsync(stockTakingId, false);
|
if (result) return await ctx.StockTakings.GetByIdAsync(stockTakingId, false);
|
||||||
|
|
||||||
|
_logger.Error($"StockTaking closing ERROR! stockTakingId: {stockTakingId}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,6 +67,12 @@ public class StockSignalREndpointServer(StockTakingDbContext ctx, SignalRSendToC
|
||||||
|
|
||||||
foreach (var productDto in productDtos)
|
foreach (var productDto in productDtos)
|
||||||
{
|
{
|
||||||
|
//if (productDto.StockQuantity < 0 && productDto.IncomingQuantity > 0)
|
||||||
|
//{
|
||||||
|
// _logger.Info($"Beszállítás alatt lévő 'virtuális' készlet, nem leltározzuk! product: [#{productDto.Id}] {productDto.Name}; StockQuantity: {productDto.StockQuantity}; IncomingQuantity: {productDto.IncomingQuantity}");
|
||||||
|
// continue;
|
||||||
|
//}
|
||||||
|
|
||||||
var stockTakingItem = new StockTakingItem
|
var stockTakingItem = new StockTakingItem
|
||||||
{
|
{
|
||||||
StockTakingId = stockTaking.Id,
|
StockTakingId = stockTaking.Id,
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,8 @@ public class OrderDtoDbTable : MgDtoDbTableBase<OrderDto, Order>
|
||||||
&& o.OrderStatusId != (int)OrderStatus.Cancelled
|
&& o.OrderStatusId != (int)OrderStatus.Cancelled
|
||||||
&& o.GenericAttributes.Any(ga => ga.Key == nameof(OrderDto.DateOfReceipt) && DateTime.Parse(ga.Value) >= fromDate.Date));
|
&& o.GenericAttributes.Any(ga => ga.Key == nameof(OrderDto.DateOfReceipt) && DateTime.Parse(ga.Value) >= fromDate.Date));
|
||||||
|
|
||||||
public IQueryable<OrderDto> GetAllByProductId(int productId, bool loadRelations = true) => GetAll(loadRelations).Where(o => o.OrderItemDtos.Any(oi => oi.ProductId == productId));
|
public IQueryable<OrderDto> GetAllByProductId(int productId, bool loadRelations = true)
|
||||||
|
=> GetAll(loadRelations).Where(o => o.OrderItemDtos.Any(oi => oi.ProductId == productId));
|
||||||
|
|
||||||
public IQueryable<OrderDto> GetAllByProductIds(IEnumerable<int> productIds, bool loadRelations = true)
|
public IQueryable<OrderDto> GetAllByProductIds(IEnumerable<int> productIds, bool loadRelations = true)
|
||||||
=> GetAll(loadRelations).Where(o => o.OrderItemDtos.Any(oi => productIds.Contains(oi.ProductId)));
|
=> GetAll(loadRelations).Where(o => o.OrderItemDtos.Any(oi => productIds.Contains(oi.ProductId)));
|
||||||
|
|
|
||||||
|
|
@ -83,18 +83,24 @@ public class StockTakingDbContext : MgDbContextBase,
|
||||||
|
|
||||||
public async Task CloseStockTaking(int stockTakingId)
|
public async Task CloseStockTaking(int stockTakingId)
|
||||||
{
|
{
|
||||||
|
Logger.Info($"CloseStockTaking invoked! stockTakingId: {stockTakingId}");
|
||||||
|
|
||||||
|
var count = 0;
|
||||||
|
|
||||||
var stockTaking = await StockTakings.GetByIdAsync(stockTakingId, true);
|
var stockTaking = await StockTakings.GetByIdAsync(stockTakingId, true);
|
||||||
|
|
||||||
if (!stockTaking.IsReadyForClose()) throw new Exception($"Not all IsRequiredForMeasuring items are IsMeasured! IsReadyForClose: false;");
|
if (!stockTaking.IsReadyForClose()) throw new Exception($"Not all IsRequiredForMeasuring items are IsMeasured! IsReadyForClose: false;");
|
||||||
|
|
||||||
var count = 0;
|
//TODO: Mi legyen az invalid item-ekkel? - J.
|
||||||
foreach (var stockTakingItem in stockTaking.StockTakingItems!.Where(stockTakingItem => stockTakingItem is { IsMeasured: true, IsInvalid: false }))
|
foreach (var stockTakingItem in stockTaking.StockTakingItems!.Where(stockTakingItem => stockTakingItem is { IsMeasured: true, IsInvalid: false }))
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
//await _fruitBankDbContext.UpdateStockQuantityAndWeightAsync(stockTakingItem.Product!, stockTakingItem.QuantityDiff,
|
await _fruitBankDbContext.UpdateStockQuantityAndWeightAsync(stockTakingItem.Product!, stockTakingItem.QuantityDiff,
|
||||||
// $"Leltár által módosítva! stockTakingId: #{stockTaking.Id}, stockTakingItemId: #{stockTakingItem.Id}",
|
$"Leltár által módosítva! stockTakingId: #{stockTaking.Id}, stockTakingItemId: #{stockTakingItem.Id}",
|
||||||
// stockTakingItem.NetWeightDiff);
|
stockTakingItem.NetWeightDiff);
|
||||||
|
|
||||||
|
Logger.Debug($"CloseStockTaking.UpdateStockQuantityAndWeightAsync; {stockTakingItem.Product}; qntDiff: {stockTakingItem.QuantityDiff} db; netWeightDiff: {stockTakingItem.NetWeightDiff} kg");
|
||||||
}
|
}
|
||||||
|
|
||||||
stockTaking.IsClosed = true;
|
stockTaking.IsClosed = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue