Browse Source

新移库-修改回调方法

dev_DY_CC
刘云峰 1 year ago
parent
commit
82c930b8d9
  1. 26
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/DTOs/TransferNoteDTO.cs
  2. 27
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteEditInput.cs
  3. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionJobs/InjectionJobAppService.cs
  4. 68
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs
  5. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferLibNotes/ITransferLibCallback.cs

26
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/DTOs/TransferNoteDTO.cs

@ -44,4 +44,30 @@ public class TransferNoteDTO : SfsStoreDTOBase<TransferNoteDetailDTO>, IHasNumbe
[Display(Name = "确认时间")] [Display(Name = "确认时间")]
public DateTime? ConfirmTime { get; set; } public DateTime? ConfirmTime { get; set; }
#region 回调服务相关
/// <summary>
/// 回调服务名称
/// </summary>
[Display(Name = "回调服务名称")]
public string CallServerName { get; set; }
/// <summary>
/// 回调业务类型
/// </summary>
[Display(Name = "回调业务类型")]
public string CallBusinessType { get; set; }
/// <summary>
/// 调用者传入申请单号
/// </summary>
[Display(Name = "传入申请单号")]
public string CallRequestNumber { get; set; }
/// <summary>
/// 调用者传入任务单号
/// </summary>
[Display(Name = "传入任务单号")]
public string CallJobNumber { get; set; }
#endregion
} }

27
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteEditInput.cs

@ -51,4 +51,31 @@ public class TransferNoteEditInput : SfsStoreCreateOrUpdateInputBase
[Display(Name = "详情")] [Display(Name = "详情")]
public List<TransferNoteDetailInput> Details { get; set; } = new List<TransferNoteDetailInput>(); public List<TransferNoteDetailInput> Details { get; set; } = new List<TransferNoteDetailInput>();
#region 回调服务相关
/// <summary>
/// 回调服务名称
/// </summary>
[Display(Name = "回调服务名称")]
public string CallServerName { get; set; }
/// <summary>
/// 回调业务类型
/// </summary>
[Display(Name = "回调业务类型")]
public string CallBusinessType { get; set; }
/// <summary>
/// 调用者传入申请单号
/// </summary>
[Display(Name = "传入申请单号")]
public string CallRequestNumber { get; set; }
/// <summary>
/// 调用者传入任务单号
/// </summary>
[Display(Name = "传入任务单号")]
public string CallJobNumber { get; set; }
#endregion
} }

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionJobs/InjectionJobAppService.cs

@ -138,9 +138,9 @@ public class InjectionJobAppService
} }
[HttpPost("Do-Call-Back")] [HttpPost("Do-Call-Back")]
public async Task<TransferLibJobDTO> DoTransferLibCallbackAsync(string businessType, string requestNum, string jobNum) public async Task DoTransferLibCallbackAsync(TransferLibJobDTO dto)
{ {
var job = await _repository.FindAsync(p => p.Number == jobNum).ConfigureAwait(false); var job = await _repository.FindAsync(p => p.Number == dto.JobNumber).ConfigureAwait(false);
//todo 等云峰写好换成真实的 //todo 等云峰写好换成真实的
var transferLibJobDto= await _transferLibJobAppService.GetByNumberAsync("AAA").ConfigureAwait(false); var transferLibJobDto= await _transferLibJobAppService.GetByNumberAsync("AAA").ConfigureAwait(false);
@ -181,8 +181,7 @@ public class InjectionJobAppService
await _repository.UpdateAsync(job).ConfigureAwait(false); await _repository.UpdateAsync(job).ConfigureAwait(false);
//return new Tuple<bool?, string>(true,"s"); return;
return new TransferLibJobDTO();
} }
[HttpPost("test")] [HttpPost("test")]

68
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs

@ -38,8 +38,25 @@ public class TransferLibJobAppService
[UnitOfWork] [UnitOfWork]
public override async Task<TransferLibJobDTO> CompleteAsync(Guid id, TransferLibJobDTO dto) public override async Task<TransferLibJobDTO> CompleteAsync(Guid id, TransferLibJobDTO dto)
{ {
string methodPrefix = "TransferLibJobAppService.CompleteAsync - ";
if (dto.CallServerName.IsNullOrEmpty())
{
throw new UserFriendlyException($"{methodPrefix}CallServerName 不能为空");
}
if (dto.CallBusinessType.IsNullOrEmpty())
{
throw new UserFriendlyException($"{methodPrefix}CallBusinessType 不能为空");
}
if (dto.CallRequestNumber.IsNullOrEmpty())
{
throw new UserFriendlyException($"{methodPrefix}CallRequestNumber 不能为空");
}
if (dto.CallJobNumber.IsNullOrEmpty())
{
throw new UserFriendlyException($"{methodPrefix}CallJobNumber 不能为空");
}
//校验 #region 校验
foreach (var detailObj in dto.Details) foreach (var detailObj in dto.Details)
{ {
if (detailObj.IsPackingCodeFrom) if (detailObj.IsPackingCodeFrom)
@ -153,25 +170,7 @@ public class TransferLibJobAppService
} }
} }
} }
#endregion
//var str = "Win_in.Sfs.Wms.Store.Application.InjectionJobAppService";
string methodPrefix = "TransferLibJobAppService.CompleteAsync - ";
if (dto.CallServerName.IsNullOrEmpty())
{
throw new UserFriendlyException($"{methodPrefix}CallServerName 不能为空");
}
if (dto.CallBusinessType.IsNullOrEmpty())
{
throw new UserFriendlyException($"{methodPrefix}CallBusinessType 不能为空");
}
if (dto.CallRequestNumber.IsNullOrEmpty())
{
throw new UserFriendlyException($"{methodPrefix}CallRequestNumber 不能为空");
}
if (dto.CallJobNumber.IsNullOrEmpty())
{
throw new UserFriendlyException($"{methodPrefix}CallJobNumber 不能为空");
}
var ret = await base.CompleteAsync(id, dto).ConfigureAwait(false); var ret = await base.CompleteAsync(id, dto).ConfigureAwait(false);
if (ret != null) if (ret != null)
@ -186,37 +185,12 @@ public class TransferLibJobAppService
{ {
throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象创建失败"); throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象创建失败");
} }
ITransferLibCallback transferLibCallback = (Win_in.Sfs.Wms.Store.Notes.ITransferLibCallback)instance; ITransferLibCallback transferLibCallback = (ITransferLibCallback)instance;
if (transferLibCallback == null) if (transferLibCallback == null)
{ {
throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象没有实现ITransferLibCallback接口"); throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象没有实现ITransferLibCallback接口");
} }
TransferLibJobDTO callbackRet = await transferLibCallback.DoTransferLibCallbackAsync(dto.CallServerName, dto.CallRequestNumber, dto.CallJobNumber).ConfigureAwait(false); await transferLibCallback.DoTransferLibCallbackAsync(dto).ConfigureAwait(false);
if (callbackRet == null || callbackRet.Number == null)
{
throw new UserFriendlyException($"{methodPrefix}执行回调服务{dto.CallServerName}出错,返回实体为空!");
}
//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;
} }

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferLibNotes/ITransferLibCallback.cs

@ -9,7 +9,7 @@ using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Store.Notes; namespace Win_in.Sfs.Wms.Store.Notes;
public interface ITransferLibCallback public interface ITransferLibCallback
{ {
Task<TransferLibJobDTO> DoTransferLibCallbackAsync(string businessType, string requestNum, string jobNum); Task DoTransferLibCallbackAsync(TransferLibJobDTO dto);
} }
public class TestTransferLibCallback : ITransferLibCallback public class TestTransferLibCallback : ITransferLibCallback
@ -18,9 +18,8 @@ public class TestTransferLibCallback : ITransferLibCallback
{ {
} }
public async Task<TransferLibJobDTO> DoTransferLibCallbackAsync(string businessType, string requestNum, public async Task DoTransferLibCallbackAsync(TransferLibJobDTO dto)
string jobNum)
{ {
return new TransferLibJobDTO(); await Task.Run(() => { }).ConfigureAwait(false);
} }
} }

Loading…
Cancel
Save