diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs index 16fc0eacd..2cf35fe22 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs @@ -35,13 +35,8 @@ public class TransferLibJobAppService /// public override async Task CompleteAsync(Guid id, TransferLibJobDTO dto) { - var str = "Win_in.Sfs.Wms.Store.Application.InjectionJobAppService"; - var implementation=_serviceProvider.GetService(Type.GetType("Win_in.Sfs.Wms.Store.Application.InjectionJobAppService")); - MethodInfo methodInfo=implementation.GetType().GetMethod("Test"); - methodInfo.Invoke(implementation, null); - + //var str = "Win_in.Sfs.Wms.Store.Application.InjectionJobAppService"; string methodPrefix = "TransferLibJobAppService.CompleteAsync - "; - if (dto.CallServerName.IsNullOrEmpty()) { throw new UserFriendlyException($"{methodPrefix}CallServerName 不能为空"); @@ -62,18 +57,17 @@ public class TransferLibJobAppService var ret = await base.CompleteAsync(id, dto).ConfigureAwait(false); if (ret != null) { - var assembly = Assembly.GetExecutingAssembly(); - var ty = assembly.GetType(dto.CallServerName); + Type ty = Type.GetType(dto.CallServerName); if (ty == null) { throw new UserFriendlyException($"{methodPrefix}没有找到类型为{dto.CallServerName}的对象"); } - var instance = Activator.CreateInstance(ty); + var instance = _serviceProvider.GetService(ty); if (instance == null) { throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象创建失败"); } - ITransferLibCallback transferLibCallback = (ITransferLibCallback)instance; + ITransferLibCallback transferLibCallback = (Win_in.Sfs.Wms.Store.Notes.ITransferLibCallback)instance; if (transferLibCallback == null) { throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象没有实现ITransferLibCallback接口"); @@ -83,6 +77,27 @@ public class TransferLibJobAppService { throw new UserFriendlyException($"{methodPrefix}执行回调服务{dto.CallServerName}出错,返回错误信息:{callbackRet.Item2}"); } + //var assembly = Assembly.GetExecutingAssembly(); + //var ty = assembly.GetType(dto.CallServerName); + //if (ty == null) + //{ + // throw new UserFriendlyException($"{methodPrefix}没有找到类型为{dto.CallServerName}的对象"); + //} + //var instance = Activator.CreateInstance(ty); + //if (instance == null) + //{ + // throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象创建失败"); + //} + //ITransferLibCallback transferLibCallback = (ITransferLibCallback)instance; + //if (transferLibCallback == null) + //{ + // throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象没有实现ITransferLibCallback接口"); + //} + //Tuple callbackRet = transferLibCallback.DoTransferLibCallback(dto.CallServerName, dto.CallRequestNumber, dto.CallJobNumber); + //if (callbackRet != null && callbackRet.Item1 == false) + //{ + // throw new UserFriendlyException($"{methodPrefix}执行回调服务{dto.CallServerName}出错,返回错误信息:{callbackRet.Item2}"); + //} } return ret; }