You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
using Furion.DependencyInjection;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Myshipping.Application
|
|
{
|
|
public class TaskManageExternalService : ITaskManageExternalService, ITransient
|
|
{
|
|
private readonly INamedServiceProvider<ITaskManageService> _namedServiceProvider;
|
|
|
|
public TaskManageExternalService(INamedServiceProvider<ITaskManageService> namedServiceProvider)
|
|
{
|
|
_namedServiceProvider = namedServiceProvider;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 提交派车
|
|
/// </summary>
|
|
/// <param name="info">请求派车报文</param>
|
|
/// <returns>返回回执</returns>
|
|
public async Task<TaskManageOrderResultDto> SubmitTruckDispatchAsync(TaskManageOrderMessageInfo info)
|
|
{
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
try
|
|
{
|
|
var service = _namedServiceProvider.GetService(nameof(TaskManageService));
|
|
|
|
var rlt = await service.CreateTaskJob(info);
|
|
|
|
if(!rlt.succ)
|
|
{
|
|
result.succ = false;
|
|
result.msg = $"提交派车失败,原因:{rlt.msg}";
|
|
}
|
|
else
|
|
{
|
|
result.succ = true;
|
|
result.msg = "提交成功";
|
|
//提取任务流水号
|
|
result.ext = rlt.ext;
|
|
}
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
result.succ = false;
|
|
result.msg = $"保存派车异常,原因:{ex.Message}";
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 撤销派车
|
|
/// </summary>
|
|
/// <param name="info">请求派车报文</param>
|
|
/// <returns>返回回执</returns>
|
|
public async Task<TaskManageOrderResultDto> CancelTruckDispatchAsync(TaskManageOrderMessageInfo info)
|
|
{
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
try
|
|
{
|
|
var service = _namedServiceProvider.GetService(nameof(TaskManageService));
|
|
|
|
var rlt = await service.CancelTaskJob(info);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.succ = false;
|
|
result.msg = $"保存派车异常,原因:{ex.Message}";
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|