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.

118 lines
3.4 KiB
C#

using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Enums;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Interface;
using Microsoft.AspNetCore.Mvc;
using Masuit.Tools.Systems;
namespace DS.WMS.MainApi.Controllers;
/// <summary>
/// 客户基本信息-模块
/// </summary>
public class ClientInfoController : ApiController
{
private readonly IClientInfoService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public ClientInfoController(IClientInfoService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetClientInfoList")]
public DataResult<List<ClientInfoRes>> GetClientInfoList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("EditClientInfo")]
public DataResult EditClientInfo([FromBody] ClientInfoReq req)
{
var res = _invokeService.EditClientInfo(req);
return res;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetClientInfo")]
public DataResult<ClientInfoRes> GetClientInfo([FromQuery] string id)
{
var res = _invokeService.GetClientInfo(id);
return res;
}
/// <summary>
/// 根据ID删除发票明细
/// </summary>
/// <param name="idModel"></param>
/// <returns></returns>
[HttpPost, Route("DeleteInvoiceHeader")]
public async Task<DataResult> DeleteInvoiceHeaderAsync(IdModel idModel)
{
if (!ModelState.IsValid)
return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
return await _invokeService.DeleteInvoiceHeaderAsync(idModel);
}
/// <summary>
/// 根据ID删除往来单位
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost, Route("Delete")]
public async Task<DataResult> DeleteAsync([FromBody] IdModel model)
{
if (!ModelState.IsValid)
return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
return await _invokeService.DeleteAsync(model);
}
/// <summary>
/// 获取往来单位详情(含有联系人列表)
/// </summary>
/// <param name="query">查询往来单位</param>
/// <returns>返回往来单位详情</returns>
[HttpPost]
[Route("GetClientInfoWithContact")]
public async Task<DataResult<ClientInfoRes>> GetClientInfoWithContact([FromBody] QueryClientInfo query)
{
return await _invokeService.GetClientInfoWithContact(query);
}
/// <summary>
/// 获取推送通知可选项列表
/// </summary>
/// <returns></returns>
[HttpGet, Route("GetNotifications")]
public DataResult<List<NotificationItem>> GetNotifications()
{
var list = typeof(PushNotification).GetDescriptionAndValue().Where(x => x.Value > 0)
.Select(x => new NotificationItem { Value = x.Value, Name = x.Key }).ToList();
return DataResult<List<NotificationItem>>.Success(list);
}
}