WMSlite/WmsLite.Api/Services/InventoryTransactionService.cs
zhougf fa1b286463 Add WmsLite monorepo with JWT auth, tenant context, and project READMEs.
Implement API security baseline (sys_user, JWT, audit fields, transactions,
unique constraints) and Web real login with 401 handling. Document setup
and development workflows in root, WmsLite.Api, and WmsLite.Web README files.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 14:17:47 +08:00

61 lines
2.2 KiB
C#

using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Inventory;
using WmsLite.Api.Models;
using WmsLite.Api.Repositories.Interfaces;
using WmsLite.Api.Services.Interfaces;
namespace WmsLite.Api.Services;
public class InventoryTransactionService : IInventoryTransactionService
{
private readonly IInventoryTransactionRepository _repository;
public InventoryTransactionService(IInventoryTransactionRepository repository)
{
_repository = repository;
}
public async Task<PagedResult<InventoryTransactionViewDto>> GetPagedListAsync(InventoryTransactionPagedQuery query)
{
var page = await _repository.GetPagedListAsync(query);
return new PagedResult<InventoryTransactionViewDto>
{
PageIndex = page.PageIndex,
PageSize = page.PageSize,
TotalCount = page.TotalCount,
Items = page.Items.ConvertAll(Map)
};
}
private static InventoryTransactionViewDto Map(InventoryTransaction entity)
{
return new InventoryTransactionViewDto
{
Id = entity.Id,
TenantId = entity.TenantId,
OwnerCode = entity.OwnerCode,
InventoryId = entity.InventoryId,
MovementType = entity.MovementType,
InventoryStatus = entity.InventoryStatus,
BizNo = entity.BizNo,
BeforeQty = entity.BeforeQty,
AfterQty = entity.AfterQty,
BeforePendingInboundQty = entity.BeforePendingInboundQty,
AfterPendingInboundQty = entity.AfterPendingInboundQty,
BeforePendingOutboundQty = entity.BeforePendingOutboundQty,
AfterPendingOutboundQty = entity.AfterPendingOutboundQty,
BeforeFrozenQty = entity.BeforeFrozenQty,
AfterFrozenQty = entity.AfterFrozenQty,
ChangeQty = entity.ChangeQty,
MaterialCode = entity.MaterialCode,
ContainerCode = entity.ContainerCode,
WarehouseCode = entity.WarehouseCode,
AreaCode = entity.AreaCode,
ZoneCode = entity.ZoneCode,
LocationCode = entity.LocationCode,
Attrs = entity.Attrs,
CreateTime = entity.CreateTime
};
}
}