using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Dynamic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using JNPF; using JNPF.Common.Extension; using Microsoft.Extensions.DependencyInjection; 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 Dictionary _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() != null) .ToDictionary(x => x.GetCustomAttribute().BizTypeId, x => (BaseWareHouseService)App.GetService(x)); } public async Task Do(WareHouseUpInput input) { if (_serviceMap.ContainsKey(input.bizTypeId)) await _serviceMap[input.bizTypeId].ModifyAsync(input); } } }