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
{
///
/// 邮件模板API
///
public class TaskMailController : ApiController
{
readonly ITaskMailService service;
///
/// 构造函数
///
///
public TaskMailController(ITaskMailService service)
{
this.service = service;
}
///
/// 渲染模板
///
/// 单据类型
/// 业务ID
/// 业务类型
///
[HttpGet, Route("RenderTemplate")]
public async Task> RenderTemplateAsync(DocumentType docType, long bsId, BusinessType businessType)
{
return await service.RenderTemplateAsync(docType, bsId, businessType);
}
///
/// 获取分页列表
///
///
///
[HttpPost, Route("GetList")]
public async Task>> GetListAsync(PageRequest request)
{
return await service.GetListAsync(request);
}
///
/// 详情
///
/// ID
///
[HttpGet, Route("Edit")]
public async Task> GetAsync(long id)
{
return await service.GetAsync(id);
}
///
/// 编辑
///
/// 邮件配置
///
[HttpPost, Route("Edit")]
public async Task 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);
}
///
/// 删除
///
///
///
[HttpPost, Route("Delete")]
public async Task DeleteAsync(IdModel idModel)
{
return await service.DeleteAsync(idModel);
}
}
}