|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
|
using DS.WMS.Core.Op.Entity.TaskInteraction;
|
|
|
|
|
using DS.WMS.Core.Op.Interface.TaskInteraction;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.OpApi.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 邮件模板API
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class TaskMailController : ApiController
|
|
|
|
|
{
|
|
|
|
|
readonly ITaskMailService service;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 构造函数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="service"></param>
|
|
|
|
|
public TaskMailController(ITaskMailService service)
|
|
|
|
|
{
|
|
|
|
|
this.service = service;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 渲染模板
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="docType">单据类型</param>
|
|
|
|
|
/// <param name="bsId">业务ID</param>
|
|
|
|
|
/// <param name="businessType">业务类型</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet, Route("RenderTemplate")]
|
|
|
|
|
public async Task<DataResult<string>> RenderTemplateAsync(DocumentType docType, long bsId, BusinessType businessType)
|
|
|
|
|
{
|
|
|
|
|
return await service.RenderTemplateAsync(docType, bsId, businessType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取分页列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("GetList")]
|
|
|
|
|
public async Task<DataResult<List<BusinessTaskMail>>> GetListAsync(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
return await service.GetListAsync(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet, Route("Edit")]
|
|
|
|
|
public async Task<DataResult<BusinessTaskMail>> GetAsync(long id)
|
|
|
|
|
{
|
|
|
|
|
return await service.GetAsync(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 编辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskMail">邮件配置</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("Edit")]
|
|
|
|
|
public async Task<DataResult> EditAsync(BusinessTaskMail taskMail)
|
|
|
|
|
{
|
|
|
|
|
if (taskMail.Receiver == null)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskMailReceiverNotNull));
|
|
|
|
|
|
|
|
|
|
if (taskMail.Sender == null)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskMailSenderNotNull));
|
|
|
|
|
|
|
|
|
|
return await service.EditAsync(taskMail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idModel"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("Delete")]
|
|
|
|
|
public async Task<DataResult> DeleteAsync(IdModel idModel)
|
|
|
|
|
{
|
|
|
|
|
return await service.DeleteAsync(idModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|