8 changed files with 64 additions and 7 deletions
@ -0,0 +1,36 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Caching; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Application; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Inventory.Domain.Acl.ErpLocationItem; |
||||
|
public class ErpLocationItemAclService |
||||
|
: AclServiceBase, IErpLocationItemAclService |
||||
|
{ |
||||
|
private readonly IErpLocationItemAppService _appService; |
||||
|
private readonly IDistributedCache<ErpLocationItemDTO> _cache; |
||||
|
|
||||
|
public ErpLocationItemAclService( |
||||
|
IErpLocationItemAppService appService |
||||
|
, IDistributedCache<ErpLocationItemDTO> cache |
||||
|
) |
||||
|
{ |
||||
|
_appService = appService; |
||||
|
_cache = cache; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<ErpLocationItemDTO> GetFirstAsync(string itemCode, string locationCode) |
||||
|
{ |
||||
|
var dto = await _cache.GetOrAddItemAsync( |
||||
|
$"{itemCode}:{locationCode}", |
||||
|
async () => await GetFromAppServiceAsync(itemCode, locationCode).ConfigureAwait(false), |
||||
|
CacheMinutes).ConfigureAwait(false); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
private async Task<ErpLocationItemDTO> GetFromAppServiceAsync(string itemCode, string locationCode) |
||||
|
{ |
||||
|
return await _appService.CheckItemErpLocationIsAvailable(itemCode, locationCode).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Inventory.Domain.Acl.ErpLocationItem; |
||||
|
public interface IErpLocationItemAclService |
||||
|
{ |
||||
|
Task<ErpLocationItemDTO> GetFirstAsync(string itemCode, string locationCode); |
||||
|
} |
Loading…
Reference in new issue