31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using System.Reflection;
|
|
using JNPF;
|
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
|
using Tnb.WarehouseMgr.Entities.Dto;
|
|
using Tnb.WarehouseMgr.Interfaces;
|
|
|
|
namespace Tnb.WarehouseMgr
|
|
{
|
|
[Caller("web")]
|
|
public class PcStroageService : IWHStorageService
|
|
{
|
|
private static readonly Dictionary<string, BaseWareHouseService> _serviceMap = new(StringComparer.OrdinalIgnoreCase);
|
|
static PcStroageService()
|
|
{
|
|
|
|
_serviceMap = App.EffectiveTypes.AsParallel().Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && !typeof(IPdaStroage).IsAssignableFrom(u)
|
|
&& u.IsSubclassOf(typeof(BaseWareHouseService)) && u.GetCustomAttribute<ServiceModuleAttribute>() != null)
|
|
.ToDictionary(x => x.GetCustomAttribute<ServiceModuleAttribute>().BizTypeId, x => (BaseWareHouseService)App.GetService(x));
|
|
}
|
|
|
|
public async Task Do(WareHouseUpInput input)
|
|
{
|
|
if (_serviceMap.ContainsKey(input.bizTypeId))
|
|
{
|
|
await _serviceMap[input.bizTypeId].ModifyAsync(input);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|