调整,wms通用逻辑代码
This commit is contained in:
40
WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs
Normal file
40
WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF;
|
||||
using JNPF.Common.Extension;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
[Caller("app")]
|
||||
public class PdaStroageService : IWHStorageService
|
||||
{
|
||||
private static Dictionary<string, BaseWareHouseService> _serviceMap = new Dictionary<string, BaseWareHouseService>(StringComparer.OrdinalIgnoreCase);
|
||||
static PdaStroageService()
|
||||
{
|
||||
var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IPdaStroage).IsAssignableFrom(u) && u.IsSubclassOf(typeof(BaseWareHouseService))).ToList();
|
||||
foreach (var serviceType in serviceTypes)
|
||||
{
|
||||
var bizTypeId = serviceType.GetCustomAttribute<ServiceModuleAttribute>()?.BizTypeId;
|
||||
if (!bizTypeId.IsNullOrEmpty())
|
||||
{
|
||||
_serviceMap[bizTypeId!] = (BaseWareHouseService)App.GetService(serviceType)!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Do(WareHouseUpInput input)
|
||||
{
|
||||
if (_serviceMap.ContainsKey(input.bizTypeId))
|
||||
{
|
||||
await _serviceMap[input.bizTypeId].ModifyAsync(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user