initial commit
This commit is contained in:
+59
@@ -0,0 +1,59 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class DeliveryOrderCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class DeliveryOrderCreateInvenTransRequest : IRequest<DeliveryOrderCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class DeliveryOrderCreateInvenTransValidator : AbstractValidator<DeliveryOrderCreateInvenTransRequest>
|
||||
{
|
||||
public DeliveryOrderCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeliveryOrderCreateInvenTransHandler : IRequestHandler<DeliveryOrderCreateInvenTransRequest, DeliveryOrderCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public DeliveryOrderCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<DeliveryOrderCreateInvenTransResult> Handle(DeliveryOrderCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.DeliveryOrderCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new DeliveryOrderCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class DeliveryOrderDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class DeliveryOrderDeleteInvenTransRequest : IRequest<DeliveryOrderDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class DeliveryOrderDeleteInvenTransValidator : AbstractValidator<DeliveryOrderDeleteInvenTransRequest>
|
||||
{
|
||||
public DeliveryOrderDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeliveryOrderDeleteInvenTransHandler : IRequestHandler<DeliveryOrderDeleteInvenTransRequest, DeliveryOrderDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public DeliveryOrderDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<DeliveryOrderDeleteInvenTransResult> Handle(DeliveryOrderDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.DeliveryOrderDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new DeliveryOrderDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class DeliveryOrderUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class DeliveryOrderUpdateInvenTransRequest : IRequest<DeliveryOrderUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class DeliveryOrderUpdateInvenTransValidator : AbstractValidator<DeliveryOrderUpdateInvenTransRequest>
|
||||
{
|
||||
public DeliveryOrderUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeliveryOrderUpdateInvenTransHandler : IRequestHandler<DeliveryOrderUpdateInvenTransRequest, DeliveryOrderUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public DeliveryOrderUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<DeliveryOrderUpdateInvenTransResult> Handle(DeliveryOrderUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.DeliveryOrderUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new DeliveryOrderUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class GoodsReceiveCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class GoodsReceiveCreateInvenTransRequest : IRequest<GoodsReceiveCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class GoodsReceiveCreateInvenTransValidator : AbstractValidator<GoodsReceiveCreateInvenTransRequest>
|
||||
{
|
||||
public GoodsReceiveCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class GoodsReceiveCreateInvenTransHandler : IRequestHandler<GoodsReceiveCreateInvenTransRequest, GoodsReceiveCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public GoodsReceiveCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<GoodsReceiveCreateInvenTransResult> Handle(GoodsReceiveCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.GoodsReceiveCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new GoodsReceiveCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class GoodsReceiveDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class GoodsReceiveDeleteInvenTransRequest : IRequest<GoodsReceiveDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class GoodsReceiveDeleteInvenTransValidator : AbstractValidator<GoodsReceiveDeleteInvenTransRequest>
|
||||
{
|
||||
public GoodsReceiveDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class GoodsReceiveDeleteInvenTransHandler : IRequestHandler<GoodsReceiveDeleteInvenTransRequest, GoodsReceiveDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public GoodsReceiveDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<GoodsReceiveDeleteInvenTransResult> Handle(GoodsReceiveDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.GoodsReceiveDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new GoodsReceiveDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class GoodsReceiveUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class GoodsReceiveUpdateInvenTransRequest : IRequest<GoodsReceiveUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class GoodsReceiveUpdateInvenTransValidator : AbstractValidator<GoodsReceiveUpdateInvenTransRequest>
|
||||
{
|
||||
public GoodsReceiveUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class GoodsReceiveUpdateInvenTransHandler : IRequestHandler<GoodsReceiveUpdateInvenTransRequest, GoodsReceiveUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public GoodsReceiveUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<GoodsReceiveUpdateInvenTransResult> Handle(GoodsReceiveUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.GoodsReceiveUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new GoodsReceiveUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class NegativeAdjustmentCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentCreateInvenTransRequest : IRequest<NegativeAdjustmentCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentCreateInvenTransValidator : AbstractValidator<NegativeAdjustmentCreateInvenTransRequest>
|
||||
{
|
||||
public NegativeAdjustmentCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentCreateInvenTransHandler : IRequestHandler<NegativeAdjustmentCreateInvenTransRequest, NegativeAdjustmentCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public NegativeAdjustmentCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<NegativeAdjustmentCreateInvenTransResult> Handle(NegativeAdjustmentCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.NegativeAdjustmentCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new NegativeAdjustmentCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class NegativeAdjustmentDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentDeleteInvenTransRequest : IRequest<NegativeAdjustmentDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentDeleteInvenTransValidator : AbstractValidator<NegativeAdjustmentDeleteInvenTransRequest>
|
||||
{
|
||||
public NegativeAdjustmentDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentDeleteInvenTransHandler : IRequestHandler<NegativeAdjustmentDeleteInvenTransRequest, NegativeAdjustmentDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public NegativeAdjustmentDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<NegativeAdjustmentDeleteInvenTransResult> Handle(NegativeAdjustmentDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.NegativeAdjustmentDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new NegativeAdjustmentDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class NegativeAdjustmentUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentUpdateInvenTransRequest : IRequest<NegativeAdjustmentUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentUpdateInvenTransValidator : AbstractValidator<NegativeAdjustmentUpdateInvenTransRequest>
|
||||
{
|
||||
public NegativeAdjustmentUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentUpdateInvenTransHandler : IRequestHandler<NegativeAdjustmentUpdateInvenTransRequest, NegativeAdjustmentUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public NegativeAdjustmentUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<NegativeAdjustmentUpdateInvenTransResult> Handle(NegativeAdjustmentUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.NegativeAdjustmentUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new NegativeAdjustmentUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class PositiveAdjustmentCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentCreateInvenTransRequest : IRequest<PositiveAdjustmentCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentCreateInvenTransValidator : AbstractValidator<PositiveAdjustmentCreateInvenTransRequest>
|
||||
{
|
||||
public PositiveAdjustmentCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentCreateInvenTransHandler : IRequestHandler<PositiveAdjustmentCreateInvenTransRequest, PositiveAdjustmentCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public PositiveAdjustmentCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<PositiveAdjustmentCreateInvenTransResult> Handle(PositiveAdjustmentCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.PositiveAdjustmentCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new PositiveAdjustmentCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class PositiveAdjustmentDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentDeleteInvenTransRequest : IRequest<PositiveAdjustmentDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentDeleteInvenTransValidator : AbstractValidator<PositiveAdjustmentDeleteInvenTransRequest>
|
||||
{
|
||||
public PositiveAdjustmentDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentDeleteInvenTransHandler : IRequestHandler<PositiveAdjustmentDeleteInvenTransRequest, PositiveAdjustmentDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public PositiveAdjustmentDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<PositiveAdjustmentDeleteInvenTransResult> Handle(PositiveAdjustmentDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.PositiveAdjustmentDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new PositiveAdjustmentDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class PositiveAdjustmentUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentUpdateInvenTransRequest : IRequest<PositiveAdjustmentUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentUpdateInvenTransValidator : AbstractValidator<PositiveAdjustmentUpdateInvenTransRequest>
|
||||
{
|
||||
public PositiveAdjustmentUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentUpdateInvenTransHandler : IRequestHandler<PositiveAdjustmentUpdateInvenTransRequest, PositiveAdjustmentUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public PositiveAdjustmentUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<PositiveAdjustmentUpdateInvenTransResult> Handle(PositiveAdjustmentUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.PositiveAdjustmentUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new PositiveAdjustmentUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class PurchaseReturnCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class PurchaseReturnCreateInvenTransRequest : IRequest<PurchaseReturnCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class PurchaseReturnCreateInvenTransValidator : AbstractValidator<PurchaseReturnCreateInvenTransRequest>
|
||||
{
|
||||
public PurchaseReturnCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class PurchaseReturnCreateInvenTransHandler : IRequestHandler<PurchaseReturnCreateInvenTransRequest, PurchaseReturnCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public PurchaseReturnCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<PurchaseReturnCreateInvenTransResult> Handle(PurchaseReturnCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.PurchaseReturnCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new PurchaseReturnCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class PurchaseReturnDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class PurchaseReturnDeleteInvenTransRequest : IRequest<PurchaseReturnDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class PurchaseReturnDeleteInvenTransValidator : AbstractValidator<PurchaseReturnDeleteInvenTransRequest>
|
||||
{
|
||||
public PurchaseReturnDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class PurchaseReturnDeleteInvenTransHandler : IRequestHandler<PurchaseReturnDeleteInvenTransRequest, PurchaseReturnDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public PurchaseReturnDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<PurchaseReturnDeleteInvenTransResult> Handle(PurchaseReturnDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.PurchaseReturnDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new PurchaseReturnDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class PurchaseReturnUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class PurchaseReturnUpdateInvenTransRequest : IRequest<PurchaseReturnUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class PurchaseReturnUpdateInvenTransValidator : AbstractValidator<PurchaseReturnUpdateInvenTransRequest>
|
||||
{
|
||||
public PurchaseReturnUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class PurchaseReturnUpdateInvenTransHandler : IRequestHandler<PurchaseReturnUpdateInvenTransRequest, PurchaseReturnUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public PurchaseReturnUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<PurchaseReturnUpdateInvenTransResult> Handle(PurchaseReturnUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.PurchaseReturnUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new PurchaseReturnUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class SalesReturnCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class SalesReturnCreateInvenTransRequest : IRequest<SalesReturnCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class SalesReturnCreateInvenTransValidator : AbstractValidator<SalesReturnCreateInvenTransRequest>
|
||||
{
|
||||
public SalesReturnCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class SalesReturnCreateInvenTransHandler : IRequestHandler<SalesReturnCreateInvenTransRequest, SalesReturnCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public SalesReturnCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<SalesReturnCreateInvenTransResult> Handle(SalesReturnCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.SalesReturnCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new SalesReturnCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class SalesReturnDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class SalesReturnDeleteInvenTransRequest : IRequest<SalesReturnDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class SalesReturnDeleteInvenTransValidator : AbstractValidator<SalesReturnDeleteInvenTransRequest>
|
||||
{
|
||||
public SalesReturnDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class SalesReturnDeleteInvenTransHandler : IRequestHandler<SalesReturnDeleteInvenTransRequest, SalesReturnDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public SalesReturnDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<SalesReturnDeleteInvenTransResult> Handle(SalesReturnDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.SalesReturnDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new SalesReturnDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class SalesReturnUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class SalesReturnUpdateInvenTransRequest : IRequest<SalesReturnUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? WarehouseId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class SalesReturnUpdateInvenTransValidator : AbstractValidator<SalesReturnUpdateInvenTransRequest>
|
||||
{
|
||||
public SalesReturnUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.WarehouseId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class SalesReturnUpdateInvenTransHandler : IRequestHandler<SalesReturnUpdateInvenTransRequest, SalesReturnUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public SalesReturnUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<SalesReturnUpdateInvenTransResult> Handle(SalesReturnUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.SalesReturnUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.WarehouseId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new SalesReturnUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class ScrappingCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class ScrappingCreateInvenTransRequest : IRequest<ScrappingCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class ScrappingCreateInvenTransValidator : AbstractValidator<ScrappingCreateInvenTransRequest>
|
||||
{
|
||||
public ScrappingCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class ScrappingCreateInvenTransHandler : IRequestHandler<ScrappingCreateInvenTransRequest, ScrappingCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public ScrappingCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<ScrappingCreateInvenTransResult> Handle(ScrappingCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.ScrappingCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new ScrappingCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class ScrappingDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class ScrappingDeleteInvenTransRequest : IRequest<ScrappingDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class ScrappingDeleteInvenTransValidator : AbstractValidator<ScrappingDeleteInvenTransRequest>
|
||||
{
|
||||
public ScrappingDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class ScrappingDeleteInvenTransHandler : IRequestHandler<ScrappingDeleteInvenTransRequest, ScrappingDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public ScrappingDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<ScrappingDeleteInvenTransResult> Handle(ScrappingDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.ScrappingDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new ScrappingDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class ScrappingUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class ScrappingUpdateInvenTransRequest : IRequest<ScrappingUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class ScrappingUpdateInvenTransValidator : AbstractValidator<ScrappingUpdateInvenTransRequest>
|
||||
{
|
||||
public ScrappingUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class ScrappingUpdateInvenTransHandler : IRequestHandler<ScrappingUpdateInvenTransRequest, ScrappingUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public ScrappingUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<ScrappingUpdateInvenTransResult> Handle(ScrappingUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.ScrappingUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new ScrappingUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class StockCountCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class StockCountCreateInvenTransRequest : IRequest<StockCountCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? QtySCCount { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class StockCountCreateInvenTransValidator : AbstractValidator<StockCountCreateInvenTransRequest>
|
||||
{
|
||||
public StockCountCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.QtySCCount).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class StockCountCreateInvenTransHandler : IRequestHandler<StockCountCreateInvenTransRequest, StockCountCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public StockCountCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<StockCountCreateInvenTransResult> Handle(StockCountCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.StockCountCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.ProductId,
|
||||
request.QtySCCount,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new StockCountCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class StockCountDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class StockCountDeleteInvenTransRequest : IRequest<StockCountDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class StockCountDeleteInvenTransValidator : AbstractValidator<StockCountDeleteInvenTransRequest>
|
||||
{
|
||||
public StockCountDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class StockCountDeleteInvenTransHandler : IRequestHandler<StockCountDeleteInvenTransRequest, StockCountDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public StockCountDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<StockCountDeleteInvenTransResult> Handle(StockCountDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.StockCountDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new StockCountDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class StockCountUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class StockCountUpdateInvenTransRequest : IRequest<StockCountUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? QtySCCount { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class StockCountUpdateInvenTransValidator : AbstractValidator<StockCountUpdateInvenTransRequest>
|
||||
{
|
||||
public StockCountUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.QtySCCount).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class StockCountUpdateInvenTransHandler : IRequestHandler<StockCountUpdateInvenTransRequest, StockCountUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public StockCountUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<StockCountUpdateInvenTransResult> Handle(StockCountUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.StockCountUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.ProductId,
|
||||
request.QtySCCount,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new StockCountUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class TransferInCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class TransferInCreateInvenTransRequest : IRequest<TransferInCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class TransferInCreateInvenTransValidator : AbstractValidator<TransferInCreateInvenTransRequest>
|
||||
{
|
||||
public TransferInCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class TransferInCreateInvenTransHandler : IRequestHandler<TransferInCreateInvenTransRequest, TransferInCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public TransferInCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<TransferInCreateInvenTransResult> Handle(TransferInCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.TransferInCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new TransferInCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class TransferInDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class TransferInDeleteInvenTransRequest : IRequest<TransferInDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class TransferInDeleteInvenTransValidator : AbstractValidator<TransferInDeleteInvenTransRequest>
|
||||
{
|
||||
public TransferInDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class TransferInDeleteInvenTransHandler : IRequestHandler<TransferInDeleteInvenTransRequest, TransferInDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public TransferInDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<TransferInDeleteInvenTransResult> Handle(TransferInDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.TransferInDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new TransferInDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class TransferInUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class TransferInUpdateInvenTransRequest : IRequest<TransferInUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class TransferInUpdateInvenTransValidator : AbstractValidator<TransferInUpdateInvenTransRequest>
|
||||
{
|
||||
public TransferInUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class TransferInUpdateInvenTransHandler : IRequestHandler<TransferInUpdateInvenTransRequest, TransferInUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public TransferInUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<TransferInUpdateInvenTransResult> Handle(TransferInUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.TransferInUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new TransferInUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class TransferOutCreateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class TransferOutCreateInvenTransRequest : IRequest<TransferOutCreateInvenTransResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? CreatedById { get; init; }
|
||||
}
|
||||
|
||||
public class TransferOutCreateInvenTransValidator : AbstractValidator<TransferOutCreateInvenTransRequest>
|
||||
{
|
||||
public TransferOutCreateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.CreatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class TransferOutCreateInvenTransHandler : IRequestHandler<TransferOutCreateInvenTransRequest, TransferOutCreateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public TransferOutCreateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<TransferOutCreateInvenTransResult> Handle(TransferOutCreateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.TransferOutCreateInvenTrans(
|
||||
request.ModuleId,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.CreatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new TransferOutCreateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class TransferOutDeleteInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class TransferOutDeleteInvenTransRequest : IRequest<TransferOutDeleteInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? DeletedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class TransferOutDeleteInvenTransValidator : AbstractValidator<TransferOutDeleteInvenTransRequest>
|
||||
{
|
||||
public TransferOutDeleteInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.DeletedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class TransferOutDeleteInvenTransHandler : IRequestHandler<TransferOutDeleteInvenTransRequest, TransferOutDeleteInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public TransferOutDeleteInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<TransferOutDeleteInvenTransResult> Handle(TransferOutDeleteInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.TransferOutDeleteInvenTrans(
|
||||
request.Id,
|
||||
request.DeletedById,
|
||||
cancellationToken);
|
||||
|
||||
return new TransferOutDeleteInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Commands;
|
||||
|
||||
public class TransferOutUpdateInvenTransResult
|
||||
{
|
||||
public InventoryTransaction? Data { get; set; }
|
||||
}
|
||||
|
||||
public class TransferOutUpdateInvenTransRequest : IRequest<TransferOutUpdateInvenTransResult>
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? ProductId { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? UpdatedById { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class TransferOutUpdateInvenTransValidator : AbstractValidator<TransferOutUpdateInvenTransRequest>
|
||||
{
|
||||
public TransferOutUpdateInvenTransValidator()
|
||||
{
|
||||
RuleFor(x => x.Id).NotEmpty();
|
||||
RuleFor(x => x.ProductId).NotEmpty();
|
||||
RuleFor(x => x.Movement).NotEmpty();
|
||||
RuleFor(x => x.UpdatedById).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class TransferOutUpdateInvenTransHandler : IRequestHandler<TransferOutUpdateInvenTransRequest, TransferOutUpdateInvenTransResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public TransferOutUpdateInvenTransHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<TransferOutUpdateInvenTransResult> Handle(TransferOutUpdateInvenTransRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.TransferOutUpdateInvenTrans(
|
||||
request.Id,
|
||||
request.ProductId,
|
||||
request.Movement,
|
||||
request.UpdatedById,
|
||||
cancellationToken);
|
||||
|
||||
return new TransferOutUpdateInvenTransResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> DeliveryOrderCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.DeliveryOrder
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(DeliveryOrder);
|
||||
child.ModuleCode = "DO";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.DeliveryDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> DeliveryOrderUpdateInvenTrans(
|
||||
string? id,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> DeliveryOrderDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> DeliveryOrderGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> GoodsReceiveCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.GoodsReceive
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(GoodsReceive);
|
||||
child.ModuleCode = "GR";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.ReceiveDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> GoodsReceiveUpdateInvenTrans(
|
||||
string? id,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> GoodsReceiveDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> GoodsReceiveGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> NegativeAdjustmentCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.NegativeAdjustment
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(NegativeAdjustment);
|
||||
child.ModuleCode = "ADJ-";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.AdjustmentDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> NegativeAdjustmentUpdateInvenTrans(
|
||||
string? id,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> NegativeAdjustmentDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> NegativeAdjustmentGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> PositiveAdjustmentCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.PositiveAdjustment
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(PositiveAdjustment);
|
||||
child.ModuleCode = "ADJ+";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.AdjustmentDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> PositiveAdjustmentUpdateInvenTrans(
|
||||
string? id,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> PositiveAdjustmentDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> PositiveAdjustmentGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> PurchaseReturnCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.PurchaseReturn
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(PurchaseReturn);
|
||||
child.ModuleCode = "PRN";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.ReturnDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> PurchaseReturnUpdateInvenTrans(
|
||||
string? id,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> PurchaseReturnDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> PurchaseReturnGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> SalesReturnCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.SalesReturn
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(SalesReturn);
|
||||
child.ModuleCode = "SRN";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.ReturnDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> SalesReturnUpdateInvenTrans(
|
||||
string? id,
|
||||
string? warehouseId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.WarehouseId = warehouseId;
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> SalesReturnDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> SalesReturnGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> ScrappingCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.Scrapping
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(Scrapping);
|
||||
child.ModuleCode = "SCRP";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.ScrappingDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
child.WarehouseId = parent.WarehouseId;
|
||||
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> ScrappingUpdateInvenTrans(
|
||||
string? id,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> ScrappingDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> ScrappingGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> StockCountCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? productId,
|
||||
double? qtySCCount,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.StockCount
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(StockCount);
|
||||
child.ModuleCode = "COUNT";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.CountDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
|
||||
child.WarehouseId = parent.WarehouseId;
|
||||
child.ProductId = productId;
|
||||
child.QtySCCount = qtySCCount;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> StockCountUpdateInvenTrans(
|
||||
string? id,
|
||||
string? productId,
|
||||
double? qtySCCount,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.ProductId = productId;
|
||||
child.QtySCCount = qtySCCount;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> StockCountDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> StockCountGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> TransferInCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.TransferIn
|
||||
.Include(x => x.TransferOut)
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(TransferIn);
|
||||
child.ModuleCode = "TO-IN";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.TransferReceiveDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
child.WarehouseId = parent.TransferOut!.WarehouseToId;
|
||||
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> TransferInUpdateInvenTrans(
|
||||
string? id,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> TransferInDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> TransferInGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
using Application.Common.Extensions;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
public async Task<InventoryTransaction> TransferOutCreateInvenTrans(
|
||||
string? moduleId,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? createdById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var parent = await _queryContext
|
||||
.TransferOut
|
||||
.AsNoTracking()
|
||||
.SingleOrDefaultAsync(x => x.Id == moduleId, cancellationToken);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
throw new Exception($"Parent entity not found: {moduleId}");
|
||||
}
|
||||
|
||||
var child = new InventoryTransaction();
|
||||
child.CreatedById = createdById;
|
||||
|
||||
child.Number = _numberSequenceService.GenerateNumber(nameof(InventoryTransaction), "", "IVT");
|
||||
child.ModuleId = parent.Id;
|
||||
child.ModuleName = nameof(TransferOut);
|
||||
child.ModuleCode = "TO-OUT";
|
||||
child.ModuleNumber = parent.Number;
|
||||
child.MovementDate = parent.TransferReleaseDate;
|
||||
child.Status = (InventoryTransactionStatus?)parent.Status;
|
||||
child.WarehouseId = parent.WarehouseFromId;
|
||||
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
await _inventoryTransactionRepository.CreateAsync(child, cancellationToken);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> TransferOutUpdateInvenTrans(
|
||||
string? id,
|
||||
string? productId,
|
||||
double? movement,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
child.ProductId = productId;
|
||||
child.Movement = movement;
|
||||
|
||||
CalculateInvenTrans(child);
|
||||
|
||||
_inventoryTransactionRepository.Update(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
public async Task<InventoryTransaction> TransferOutDeleteInvenTrans(
|
||||
string? id,
|
||||
string? updatedById,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var child = await _inventoryTransactionRepository.GetAsync(id ?? string.Empty, cancellationToken);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
throw new Exception($"Child entity not found: {id}");
|
||||
}
|
||||
|
||||
child.UpdatedById = updatedById;
|
||||
|
||||
_inventoryTransactionRepository.Delete(child);
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
|
||||
return child;
|
||||
}
|
||||
public async Task<List<InventoryTransaction>> TransferOutGetInvenTransList(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _queryContext
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return childs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
using Application.Common.CQS.Queries;
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Repositories;
|
||||
using Application.Features.NumberSequenceManager;
|
||||
using Application.Features.WarehouseManager;
|
||||
using Domain.Entities;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager;
|
||||
|
||||
public partial class InventoryTransactionService
|
||||
{
|
||||
private readonly NumberSequenceService _numberSequenceService;
|
||||
private readonly WarehouseService _warehouseService;
|
||||
private readonly IQueryContext _queryContext;
|
||||
private readonly ICommandRepository<InventoryTransaction> _inventoryTransactionRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public InventoryTransactionService(
|
||||
NumberSequenceService numberSequenceService,
|
||||
WarehouseService warehouseService,
|
||||
IQueryContext queryContext,
|
||||
ICommandRepository<InventoryTransaction> inventoryTransactionRepository,
|
||||
IUnitOfWork unitOfWork
|
||||
)
|
||||
{
|
||||
_numberSequenceService = numberSequenceService;
|
||||
_warehouseService = warehouseService;
|
||||
_queryContext = queryContext;
|
||||
_inventoryTransactionRepository = inventoryTransactionRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
public double GetStock(string? warehouseId, string? productId, string? currentId = null)
|
||||
{
|
||||
var result = 0.0;
|
||||
if (currentId == null)
|
||||
{
|
||||
result = _queryContext.InventoryTransaction
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Include(x => x.Product)
|
||||
.Where(x =>
|
||||
x.Status == InventoryTransactionStatus.Confirmed &&
|
||||
x.WarehouseId == warehouseId &&
|
||||
x.ProductId == productId &&
|
||||
x.Product!.Physical == true)
|
||||
.Sum(x => x.Stock ?? 0.0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
result = _queryContext.InventoryTransaction
|
||||
.ApplyIsDeletedFilter(false)
|
||||
.Include(x => x.Product)
|
||||
.Where(x =>
|
||||
x.Status == InventoryTransactionStatus.Confirmed &&
|
||||
x.WarehouseId == warehouseId &&
|
||||
x.ProductId == productId &&
|
||||
x.Product!.Physical == true &&
|
||||
x.Id != currentId)
|
||||
.Sum(x => x.Stock ?? 0.0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task PropagateParentUpdate(
|
||||
string? moduleId,
|
||||
string? moduleName,
|
||||
DateTime? movementDate,
|
||||
InventoryTransactionStatus? status,
|
||||
bool? isDeleted,
|
||||
string? updatedId,
|
||||
string? warehouseId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var childs = await _inventoryTransactionRepository
|
||||
.GetQuery()
|
||||
.Where(x => x.ModuleId == moduleId && x.ModuleName == moduleName)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
foreach (var item in childs)
|
||||
{
|
||||
item.MovementDate = movementDate;
|
||||
item.Status = status;
|
||||
item.IsDeleted = isDeleted ?? false;
|
||||
item.UpdatedById = updatedId;
|
||||
item.UpdatedAtUtc = DateTime.UtcNow;
|
||||
if (warehouseId != null)
|
||||
{
|
||||
item.WarehouseId = warehouseId;
|
||||
}
|
||||
}
|
||||
|
||||
await _unitOfWork.SaveAsync(cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
public InventoryTransaction CalculateInvenTrans(InventoryTransaction? transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
var moduleName = transaction.ModuleName;
|
||||
|
||||
if (moduleName != nameof(StockCount) && transaction.Movement <= 0.0)
|
||||
{
|
||||
throw new Exception("Quantity must not zero and should be positive.");
|
||||
}
|
||||
|
||||
if (moduleName == nameof(StockCount) && transaction.QtySCCount <= 0.0)
|
||||
{
|
||||
throw new Exception("Quantity must not zero and should be positive.");
|
||||
}
|
||||
|
||||
switch (moduleName)
|
||||
{
|
||||
case nameof(DeliveryOrder):
|
||||
DeliveryOrderProcessing(transaction);
|
||||
break;
|
||||
case nameof(GoodsReceive):
|
||||
GoodsReceiveProcessing(transaction);
|
||||
break;
|
||||
case nameof(SalesReturn):
|
||||
SalesReturnProcessing(transaction);
|
||||
break;
|
||||
case nameof(PurchaseReturn):
|
||||
PurchaseReturnProcessing(transaction);
|
||||
break;
|
||||
case nameof(TransferIn):
|
||||
TransferInProcessing(transaction);
|
||||
break;
|
||||
case nameof(TransferOut):
|
||||
TransferOutProcessing(transaction);
|
||||
break;
|
||||
case nameof(StockCount):
|
||||
StockCountProcessing(transaction);
|
||||
break;
|
||||
case nameof(NegativeAdjustment):
|
||||
AdjustmentMinusProcessing(transaction);
|
||||
break;
|
||||
case nameof(PositiveAdjustment):
|
||||
AdjustmentPlusProcessing(transaction);
|
||||
break;
|
||||
case nameof(Scrapping):
|
||||
ScrappingProcessing(transaction);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private void CalculateStock(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.Stock = transaction.Movement * (int)(transaction.TransType ?? 0.0);
|
||||
}
|
||||
|
||||
private InventoryTransaction DeliveryOrderProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.TransType = InventoryTransType.Out;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = transaction.WarehouseId;
|
||||
transaction.WarehouseToId = _warehouseService.GetCustomerWarehouse()!.Id;
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private InventoryTransaction GoodsReceiveProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.TransType = InventoryTransType.In;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = _warehouseService.GetVendorWarehouse()!.Id;
|
||||
transaction.WarehouseToId = transaction.WarehouseId;
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private InventoryTransaction SalesReturnProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.TransType = InventoryTransType.In;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = _warehouseService.GetVendorWarehouse()!.Id;
|
||||
transaction.WarehouseToId = transaction.WarehouseId;
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private InventoryTransaction PurchaseReturnProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.TransType = InventoryTransType.Out;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = transaction.WarehouseId;
|
||||
transaction.WarehouseToId = _warehouseService.GetCustomerWarehouse()!.Id;
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private InventoryTransaction TransferInProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.TransType = InventoryTransType.In;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = _warehouseService.GetTransferWarehouse()!.Id;
|
||||
transaction.WarehouseToId = transaction.WarehouseId;
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private InventoryTransaction TransferOutProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.TransType = InventoryTransType.Out;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = transaction.WarehouseId;
|
||||
transaction.WarehouseToId = _warehouseService.GetTransferWarehouse()!.Id;
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private InventoryTransaction StockCountProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.QtySCSys = GetStock(transaction.WarehouseId, transaction.ProductId, transaction.Id);
|
||||
transaction.QtySCDelta = transaction.QtySCSys - transaction.QtySCCount;
|
||||
transaction.Movement = Math.Abs(transaction.QtySCDelta ?? 0.0);
|
||||
|
||||
if (transaction.QtySCDelta < 0.0)
|
||||
{
|
||||
|
||||
transaction.TransType = InventoryTransType.In;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = _warehouseService.GetStockCountWarehouse()!.Id;
|
||||
transaction.WarehouseToId = transaction.WarehouseId;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
transaction.TransType = InventoryTransType.Out;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = transaction.WarehouseId;
|
||||
transaction.WarehouseToId = _warehouseService.GetStockCountWarehouse()!.Id;
|
||||
|
||||
}
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private InventoryTransaction AdjustmentMinusProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.TransType = InventoryTransType.Out;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = transaction.WarehouseId;
|
||||
transaction.WarehouseToId = _warehouseService.GetAdjustmentWarehouse()!.Id;
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private InventoryTransaction AdjustmentPlusProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.TransType = InventoryTransType.In;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = _warehouseService.GetAdjustmentWarehouse()!.Id;
|
||||
transaction.WarehouseToId = transaction.WarehouseId;
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private InventoryTransaction ScrappingProcessing(InventoryTransaction transaction)
|
||||
{
|
||||
if (transaction == null)
|
||||
{
|
||||
throw new Exception("Inventory transaction is null");
|
||||
}
|
||||
|
||||
transaction.TransType = InventoryTransType.Out;
|
||||
CalculateStock(transaction);
|
||||
transaction.WarehouseFromId = transaction.WarehouseId;
|
||||
transaction.WarehouseToId = _warehouseService.GetScrappingWarehouse()!.Id;
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class DeliveryOrderGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class DeliveryOrderGetInvenTransListRequest : IRequest<DeliveryOrderGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class DeliveryOrderGetInvenTransListValidator : AbstractValidator<DeliveryOrderGetInvenTransListRequest>
|
||||
{
|
||||
public DeliveryOrderGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeliveryOrderGetInvenTransListHandler : IRequestHandler<DeliveryOrderGetInvenTransListRequest, DeliveryOrderGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public DeliveryOrderGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<DeliveryOrderGetInvenTransListResult> Handle(DeliveryOrderGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.DeliveryOrderGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(DeliveryOrder),
|
||||
cancellationToken);
|
||||
|
||||
return new DeliveryOrderGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
using Application.Common.CQS.Queries;
|
||||
using Application.Common.Extensions;
|
||||
using AutoMapper;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
|
||||
public record GetInventoryStockListDto
|
||||
{
|
||||
public string? StatusName { get; init; }
|
||||
public string? WarehouseId { get; set; }
|
||||
public string? WarehouseName { get; init; }
|
||||
public string? ProductId { get; set; }
|
||||
public string? ProductName { get; init; }
|
||||
public string? ProductNumber { get; init; }
|
||||
public double? Stock { get; init; }
|
||||
public DateTime? CreatedAtUtc { get; init; }
|
||||
}
|
||||
|
||||
|
||||
public class GetInventoryStockListProfile : Profile
|
||||
{
|
||||
public GetInventoryStockListProfile()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class GetInventoryStockListResult
|
||||
{
|
||||
public List<GetInventoryStockListDto>? Data { get; init; }
|
||||
}
|
||||
|
||||
public class GetInventoryStockListRequest : IRequest<GetInventoryStockListResult>
|
||||
{
|
||||
public bool IsDeleted { get; init; } = false;
|
||||
}
|
||||
|
||||
|
||||
public class GetInventoryStockListHandler : IRequestHandler<GetInventoryStockListRequest, GetInventoryStockListResult>
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IQueryContext _context;
|
||||
|
||||
public GetInventoryStockListHandler(IMapper mapper, IQueryContext context)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetInventoryStockListResult> Handle(GetInventoryStockListRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = _context
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(request.IsDeleted)
|
||||
.Include(x => x.Warehouse)
|
||||
.Include(x => x.Product)
|
||||
.Where(x =>
|
||||
x.Product!.Physical == true &&
|
||||
x.Warehouse!.SystemWarehouse == false &&
|
||||
x.Status == Domain.Enums.InventoryTransactionStatus.Confirmed
|
||||
)
|
||||
.GroupBy(x => new { x.WarehouseId, x.ProductId })
|
||||
.Select(group => new GetInventoryStockListDto
|
||||
{
|
||||
WarehouseId = group.Key.WarehouseId,
|
||||
ProductId = group.Key.ProductId,
|
||||
WarehouseName = group.Max(x => x.Warehouse!.Name),
|
||||
ProductName = group.Max(x => x.Product!.Name),
|
||||
ProductNumber = group.Max(x => x.Product!.Number),
|
||||
Stock = group.Sum(x => x.Stock),
|
||||
StatusName = group.Max(x => x.Status.ToString()),
|
||||
CreatedAtUtc = group.Max(x => x.CreatedAtUtc)
|
||||
})
|
||||
.AsQueryable();
|
||||
|
||||
var entities = await query.ToListAsync(cancellationToken);
|
||||
|
||||
return new GetInventoryStockListResult
|
||||
{
|
||||
Data = entities
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
using Application.Common.CQS.Queries;
|
||||
using Application.Common.Extensions;
|
||||
using AutoMapper;
|
||||
using Domain.Entities;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
|
||||
public record GetInventoryTransactionListDto
|
||||
{
|
||||
public string? Id { get; init; }
|
||||
public string? ModuleId { get; init; }
|
||||
public string? ModuleName { get; init; }
|
||||
public string? ModuleCode { get; init; }
|
||||
public string? ModuleNumber { get; init; }
|
||||
public DateTime? MovementDate { get; init; }
|
||||
public string? StatusName { get; init; }
|
||||
public string? Number { get; init; }
|
||||
public string? WarehouseName { get; init; }
|
||||
public string? ProductName { get; init; }
|
||||
public double? Movement { get; init; }
|
||||
public string? TransTypeName { get; init; }
|
||||
public double? Stock { get; init; }
|
||||
public string? WarehouseFromName { get; init; }
|
||||
public string? WarehouseToName { get; init; }
|
||||
public DateTime? CreatedAtUtc { get; init; }
|
||||
}
|
||||
|
||||
|
||||
public class GetInventoryTransactionListProfile : Profile
|
||||
{
|
||||
public GetInventoryTransactionListProfile()
|
||||
{
|
||||
CreateMap<InventoryTransaction, GetInventoryTransactionListDto>()
|
||||
.ForMember(
|
||||
dest => dest.StatusName,
|
||||
opt => opt.MapFrom(src => src.Status.HasValue ? src.Status.Value.ToFriendlyName() : string.Empty)
|
||||
)
|
||||
.ForMember(
|
||||
dest => dest.TransTypeName,
|
||||
opt => opt.MapFrom(src => src.TransType.HasValue ? src.TransType.Value.ToFriendlyName() : string.Empty)
|
||||
)
|
||||
.ForMember(
|
||||
dest => dest.WarehouseName,
|
||||
opt => opt.MapFrom(src => src.Warehouse != null ? src.Warehouse.Name : string.Empty)
|
||||
)
|
||||
.ForMember(
|
||||
dest => dest.WarehouseToName,
|
||||
opt => opt.MapFrom(src => src.WarehouseTo != null ? src.WarehouseTo.Name : string.Empty)
|
||||
)
|
||||
.ForMember(
|
||||
dest => dest.WarehouseFromName,
|
||||
opt => opt.MapFrom(src => src.WarehouseFrom != null ? src.WarehouseFrom.Name : string.Empty)
|
||||
)
|
||||
.ForMember(
|
||||
dest => dest.ProductName,
|
||||
opt => opt.MapFrom(src => src.Product != null ? src.Product.Number + ' ' + src.Product.Name : string.Empty)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public class GetInventoryTransactionListResult
|
||||
{
|
||||
public List<GetInventoryTransactionListDto>? Data { get; init; }
|
||||
}
|
||||
|
||||
public class GetInventoryTransactionListRequest : IRequest<GetInventoryTransactionListResult>
|
||||
{
|
||||
public bool IsDeleted { get; init; } = false;
|
||||
}
|
||||
|
||||
|
||||
public class GetInventoryTransactionListHandler : IRequestHandler<GetInventoryTransactionListRequest, GetInventoryTransactionListResult>
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IQueryContext _context;
|
||||
|
||||
public GetInventoryTransactionListHandler(IMapper mapper, IQueryContext context)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetInventoryTransactionListResult> Handle(GetInventoryTransactionListRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = _context
|
||||
.InventoryTransaction
|
||||
.AsNoTracking()
|
||||
.ApplyIsDeletedFilter(request.IsDeleted)
|
||||
.Include(x => x.Warehouse)
|
||||
.Include(x => x.Product)
|
||||
.Include(x => x.WarehouseFrom)
|
||||
.Include(x => x.WarehouseTo)
|
||||
.Where(x =>
|
||||
x.Product!.Physical == true &&
|
||||
x.Warehouse!.SystemWarehouse == false &&
|
||||
x.Status == Domain.Enums.InventoryTransactionStatus.Confirmed
|
||||
)
|
||||
.OrderByDescending(x => x.CreatedAtUtc)
|
||||
.AsQueryable();
|
||||
|
||||
var entities = await query.ToListAsync(cancellationToken);
|
||||
|
||||
var dtos = _mapper.Map<List<GetInventoryTransactionListDto>>(entities);
|
||||
|
||||
return new GetInventoryTransactionListResult
|
||||
{
|
||||
Data = dtos
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class GoodsReceiveGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class GoodsReceiveGetInvenTransListRequest : IRequest<GoodsReceiveGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class GoodsReceiveGetInvenTransListValidator : AbstractValidator<GoodsReceiveGetInvenTransListRequest>
|
||||
{
|
||||
public GoodsReceiveGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class GoodsReceiveGetInvenTransListHandler : IRequestHandler<GoodsReceiveGetInvenTransListRequest, GoodsReceiveGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public GoodsReceiveGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<GoodsReceiveGetInvenTransListResult> Handle(GoodsReceiveGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.GoodsReceiveGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(GoodsReceive),
|
||||
cancellationToken);
|
||||
|
||||
return new GoodsReceiveGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class NegativeAdjustmentGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentGetInvenTransListRequest : IRequest<NegativeAdjustmentGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentGetInvenTransListValidator : AbstractValidator<NegativeAdjustmentGetInvenTransListRequest>
|
||||
{
|
||||
public NegativeAdjustmentGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class NegativeAdjustmentGetInvenTransListHandler : IRequestHandler<NegativeAdjustmentGetInvenTransListRequest, NegativeAdjustmentGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public NegativeAdjustmentGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<NegativeAdjustmentGetInvenTransListResult> Handle(NegativeAdjustmentGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.NegativeAdjustmentGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(NegativeAdjustment),
|
||||
cancellationToken);
|
||||
|
||||
return new NegativeAdjustmentGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class PositiveAdjustmentGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentGetInvenTransListRequest : IRequest<PositiveAdjustmentGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentGetInvenTransListValidator : AbstractValidator<PositiveAdjustmentGetInvenTransListRequest>
|
||||
{
|
||||
public PositiveAdjustmentGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class PositiveAdjustmentGetInvenTransListHandler : IRequestHandler<PositiveAdjustmentGetInvenTransListRequest, PositiveAdjustmentGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public PositiveAdjustmentGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<PositiveAdjustmentGetInvenTransListResult> Handle(PositiveAdjustmentGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.PositiveAdjustmentGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(PositiveAdjustment),
|
||||
cancellationToken);
|
||||
|
||||
return new PositiveAdjustmentGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class PurchaseReturnGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class PurchaseReturnGetInvenTransListRequest : IRequest<PurchaseReturnGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class PurchaseReturnGetInvenTransListValidator : AbstractValidator<PurchaseReturnGetInvenTransListRequest>
|
||||
{
|
||||
public PurchaseReturnGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class PurchaseReturnGetInvenTransListHandler : IRequestHandler<PurchaseReturnGetInvenTransListRequest, PurchaseReturnGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public PurchaseReturnGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<PurchaseReturnGetInvenTransListResult> Handle(PurchaseReturnGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.PurchaseReturnGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(PurchaseReturn),
|
||||
cancellationToken);
|
||||
|
||||
return new PurchaseReturnGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class SalesReturnGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class SalesReturnGetInvenTransListRequest : IRequest<SalesReturnGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class SalesReturnGetInvenTransListValidator : AbstractValidator<SalesReturnGetInvenTransListRequest>
|
||||
{
|
||||
public SalesReturnGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class SalesReturnGetInvenTransListHandler : IRequestHandler<SalesReturnGetInvenTransListRequest, SalesReturnGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public SalesReturnGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<SalesReturnGetInvenTransListResult> Handle(SalesReturnGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.SalesReturnGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(SalesReturn),
|
||||
cancellationToken);
|
||||
|
||||
return new SalesReturnGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class ScrappingGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class ScrappingGetInvenTransListRequest : IRequest<ScrappingGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class ScrappingGetInvenTransListValidator : AbstractValidator<ScrappingGetInvenTransListRequest>
|
||||
{
|
||||
public ScrappingGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class ScrappingGetInvenTransListHandler : IRequestHandler<ScrappingGetInvenTransListRequest, ScrappingGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public ScrappingGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<ScrappingGetInvenTransListResult> Handle(ScrappingGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.ScrappingGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(Scrapping),
|
||||
cancellationToken);
|
||||
|
||||
return new ScrappingGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class StockCountGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class StockCountGetInvenTransListRequest : IRequest<StockCountGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class StockCountGetInvenTransListValidator : AbstractValidator<StockCountGetInvenTransListRequest>
|
||||
{
|
||||
public StockCountGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class StockCountGetInvenTransListHandler : IRequestHandler<StockCountGetInvenTransListRequest, StockCountGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public StockCountGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<StockCountGetInvenTransListResult> Handle(StockCountGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.StockCountGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(StockCount),
|
||||
cancellationToken);
|
||||
|
||||
return new StockCountGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class TransferInGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class TransferInGetInvenTransListRequest : IRequest<TransferInGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class TransferInGetInvenTransListValidator : AbstractValidator<TransferInGetInvenTransListRequest>
|
||||
{
|
||||
public TransferInGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class TransferInGetInvenTransListHandler : IRequestHandler<TransferInGetInvenTransListRequest, TransferInGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public TransferInGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<TransferInGetInvenTransListResult> Handle(TransferInGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.TransferInGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(TransferIn),
|
||||
cancellationToken);
|
||||
|
||||
return new TransferInGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using Domain.Entities;
|
||||
using FluentValidation;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Features.InventoryTransactionManager.Queries;
|
||||
|
||||
public class TransferOutGetInvenTransListResult
|
||||
{
|
||||
public List<InventoryTransaction>? Data { get; set; }
|
||||
}
|
||||
|
||||
public class TransferOutGetInvenTransListRequest : IRequest<TransferOutGetInvenTransListResult>
|
||||
{
|
||||
public string? ModuleId { get; init; }
|
||||
|
||||
}
|
||||
|
||||
public class TransferOutGetInvenTransListValidator : AbstractValidator<TransferOutGetInvenTransListRequest>
|
||||
{
|
||||
public TransferOutGetInvenTransListValidator()
|
||||
{
|
||||
RuleFor(x => x.ModuleId).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class TransferOutGetInvenTransListHandler : IRequestHandler<TransferOutGetInvenTransListRequest, TransferOutGetInvenTransListResult>
|
||||
{
|
||||
private readonly InventoryTransactionService _inventoryTransactionService;
|
||||
|
||||
public TransferOutGetInvenTransListHandler(
|
||||
InventoryTransactionService inventoryTransactionService
|
||||
)
|
||||
{
|
||||
_inventoryTransactionService = inventoryTransactionService;
|
||||
}
|
||||
|
||||
public async Task<TransferOutGetInvenTransListResult> Handle(TransferOutGetInvenTransListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _inventoryTransactionService.TransferOutGetInvenTransList(
|
||||
request.ModuleId,
|
||||
nameof(TransferOut),
|
||||
cancellationToken);
|
||||
|
||||
return new TransferOutGetInvenTransListResult
|
||||
{
|
||||
Data = entity
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user