往来单位银行信息详情返回增加发票抬头

usertest
嵇文龙 3 months ago
parent b15888f55b
commit 385fbdd1b9

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.WMS.Core.Info.Entity;
namespace DS.WMS.Core.Info.Dtos;
@ -103,4 +104,9 @@ public class ClientBankRes
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 发票抬头
/// </summary>
public List<InvoiceHeader> InvoiceHeaders { get; set; } = [];
}

@ -111,4 +111,10 @@ public class InfoClientBank : BaseModelV2<long>
/// </summary>
[SugarColumn(ColumnDescription = "机构Id")]
public long OrgId { get; set; }
/// <summary>
/// 发票抬头
/// </summary>
[Navigate(NavigateType.OneToMany, nameof(InvoiceHeader.RelativeId))]
public List<InvoiceHeader>? InvoiceHeaders { get; set; }
}

@ -25,7 +25,7 @@ public interface IClientBankService
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<ClientBankRes> GetClientBankInfo(string id);
Task<DataResult<ClientBankRes>> GetClientBankInfoAsync(long id);
/// <summary>
/// 删除

@ -49,11 +49,7 @@ public class ClientBankService : ServiceBase, IClientBankService
return DataResult.Failed("客户银行信息已存在!", MultiLanguageConst.ClientBankExist);
var data = req.Adapt<InfoClientBank>();
var entity = await TenantDb.Insertable(data).ExecuteReturnEntityAsync();
if (req.InvoiceHeaders?.Count > 0)
{
await TenantDb.Insertable(req.InvoiceHeaders).ExecuteCommandAsync();
}
var entity = await TenantDb.InsertNav(data).Include(x => x.InvoiceHeaders).ExecuteReturnEntityAsync();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
@ -80,12 +76,16 @@ public class ClientBankService : ServiceBase, IClientBankService
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<ClientBankRes> GetClientBankInfo(string id)
public async Task<DataResult<ClientBankRes>> GetClientBankInfoAsync(long id)
{
var data = TenantDb.Queryable<InfoClientBank>()
.Where(a => a.Id == long.Parse(id))
var data = await TenantDb.Queryable<InfoClientBank>()
.Where(a => a.Id == id)
.Select<ClientBankRes>()
.First();
.FirstAsync();
if (data != null)
data.InvoiceHeaders = await TenantDb.Queryable<InvoiceHeader>().Where(x => x.RelativeId == id).ToListAsync();
return DataResult<ClientBankRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.MainApi.Controllers;
/// <summary>
/// 客户银行信息-模块
/// 往来单位银行信息-模块
/// </summary>
public class ClientBankController : ApiController
{
@ -54,10 +54,9 @@ public class ClientBankController : ApiController
/// <returns></returns>
[HttpGet]
[Route("GetClientBankInfo")]
public DataResult<ClientBankRes> GetClientBankInfo([FromQuery] string id)
public async Task<DataResult<ClientBankRes>> GetClientBankInfoAsync([FromQuery] long id)
{
var res = _invokeService.GetClientBankInfo(id);
return res;
return await _invokeService.GetClientBankInfoAsync(id);
}
/// <summary>

Loading…
Cancel
Save