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