|
@ -35,13 +35,8 @@ public class TransferLibJobAppService |
|
|
/// <returns></returns>
|
|
|
/// <returns></returns>
|
|
|
public override async Task<TransferLibJobDTO> CompleteAsync(Guid id, TransferLibJobDTO dto) |
|
|
public override async Task<TransferLibJobDTO> CompleteAsync(Guid id, TransferLibJobDTO dto) |
|
|
{ |
|
|
{ |
|
|
var str = "Win_in.Sfs.Wms.Store.Application.InjectionJobAppService"; |
|
|
//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); |
|
|
|
|
|
|
|
|
|
|
|
string methodPrefix = "TransferLibJobAppService.CompleteAsync - "; |
|
|
string methodPrefix = "TransferLibJobAppService.CompleteAsync - "; |
|
|
|
|
|
|
|
|
if (dto.CallServerName.IsNullOrEmpty()) |
|
|
if (dto.CallServerName.IsNullOrEmpty()) |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException($"{methodPrefix}CallServerName 不能为空"); |
|
|
throw new UserFriendlyException($"{methodPrefix}CallServerName 不能为空"); |
|
@ -62,18 +57,17 @@ public class TransferLibJobAppService |
|
|
var ret = await base.CompleteAsync(id, dto).ConfigureAwait(false); |
|
|
var ret = await base.CompleteAsync(id, dto).ConfigureAwait(false); |
|
|
if (ret != null) |
|
|
if (ret != null) |
|
|
{ |
|
|
{ |
|
|
var assembly = Assembly.GetExecutingAssembly(); |
|
|
Type ty = Type.GetType(dto.CallServerName); |
|
|
var ty = assembly.GetType(dto.CallServerName); |
|
|
|
|
|
if (ty == null) |
|
|
if (ty == null) |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException($"{methodPrefix}没有找到类型为{dto.CallServerName}的对象"); |
|
|
throw new UserFriendlyException($"{methodPrefix}没有找到类型为{dto.CallServerName}的对象"); |
|
|
} |
|
|
} |
|
|
var instance = Activator.CreateInstance(ty); |
|
|
var instance = _serviceProvider.GetService(ty); |
|
|
if (instance == null) |
|
|
if (instance == null) |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象创建失败"); |
|
|
throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象创建失败"); |
|
|
} |
|
|
} |
|
|
ITransferLibCallback transferLibCallback = (ITransferLibCallback)instance; |
|
|
ITransferLibCallback transferLibCallback = (Win_in.Sfs.Wms.Store.Notes.ITransferLibCallback)instance; |
|
|
if (transferLibCallback == null) |
|
|
if (transferLibCallback == null) |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象没有实现ITransferLibCallback接口"); |
|
|
throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象没有实现ITransferLibCallback接口"); |
|
@ -83,6 +77,27 @@ public class TransferLibJobAppService |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException($"{methodPrefix}执行回调服务{dto.CallServerName}出错,返回错误信息:{callbackRet.Item2}"); |
|
|
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<bool?, string> 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; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|