往来单位银行与发票抬头合并提交

usertest
嵇文龙 3 months ago
parent fbb501e8ac
commit b15888f55b

@ -13,7 +13,6 @@ using DS.WMS.Core.Sys.Entity;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using static AnyDiff.DifferenceLines;
namespace DS.WMS.Core.Fee.Method
{
@ -436,10 +435,8 @@ namespace DS.WMS.Core.Fee.Method
};
pendingAudit.ItemGroups.Add(group);
continue;
}
if (group.Items.Exists(x => x.FeeType == item.FeeType))
else if (group.Items.Exists(x => x.FeeType == item.FeeType))
{
group = new AuditItemGroup
{

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.WMS.Core.Info.Entity;
using FluentValidation;
namespace DS.WMS.Core.Info.Dtos;
@ -99,6 +100,10 @@ public class ClientBankReq
/// </summary>
public string? Note { get; set; }
/// <summary>
/// 发票抬头
/// </summary>
public List<InvoiceHeader> InvoiceHeaders { get; set; } = [];
}
/// <summary>

@ -460,11 +460,6 @@ public class ClientInfoReq
/// </summary>
public bool IsMortgageLastOrder { get; set; }
/// <summary>
/// 发票抬头
/// </summary>
public List<InvoiceHeader> InvoiceHeaders { get; set; } = [];
/// <summary>
/// Desc:业务来源明细Id
/// </summary>

@ -382,12 +382,6 @@ public class InfoClient : SharedOrgModel<long>
[SugarColumn(ColumnDescription = "是否押最后一单", DefaultValue = "1")]
public bool IsMortgageLastOrder { get; set; }
/// <summary>
/// 发票抬头
/// </summary>
[Navigate(NavigateType.OneToMany, nameof(InvoiceHeader.RelativeId))]
public List<InvoiceHeader>? InvoiceHeaders { get; set; }
/// <summary>
/// Desc:业务来源明细Id
/// </summary>

@ -13,13 +13,12 @@ public interface IClientBankService
/// <returns></returns>
DataResult<List<ClientBankRes>> GetListByPage(PageRequest request);
/// <summary>
/// 编辑
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditClientBank(ClientBankReq model);
Task<DataResult> EditClientBankAsync(ClientBankReq model);
/// <summary>
/// 获取详情

@ -1,36 +1,24 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Info.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.Info.Method;
/// <summary>
/// 客服银行服务
/// 往来单位银行
/// </summary>
public class ClientBankService : IClientBankService
public class ClientBankService : ServiceBase, IClientBankService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public ClientBankService(IServiceProvider serviceProvider)
public ClientBankService(IServiceProvider serviceProvider) : base(serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/// <summary>
@ -40,46 +28,53 @@ public class ClientBankService : IClientBankService
/// <returns></returns>
public DataResult<List<ClientBankRes>> GetListByPage(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = request.GetConditionalModels(db);
var data = tenantDb.Queryable<InfoClientBank>()
var whereList = request.GetConditionalModels(Db);
var data = TenantDb.Queryable<InfoClientBank>()
.Where(whereList)
.Select<ClientBankRes>().ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult EditClientBank(ClientBankReq req)
public async Task<DataResult> EditClientBankAsync(ClientBankReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (req.Id == 0)
{
if (await TenantDb.Queryable<InfoClientBank>().Where(x => x.CodeName == req.CodeName).AnyAsync())
return DataResult.Failed("客户银行信息已存在!", MultiLanguageConst.ClientBankExist);
if (tenantDb.Queryable<InfoClientBank>().Where(x=>x.CodeName == req.CodeName).Any())
var data = req.Adapt<InfoClientBank>();
var entity = await TenantDb.Insertable(data).ExecuteReturnEntityAsync();
if (req.InvoiceHeaders?.Count > 0)
{
return DataResult.Failed("客户银行信息已存在!",MultiLanguageConst.ClientBankExist);
await TenantDb.Insertable(req.InvoiceHeaders).ExecuteCommandAsync();
}
var data = req.Adapt<InfoClientBank>();
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = tenantDb.Queryable<InfoClientBank>().Where(x => x.Id == req.Id).First();
var info = await TenantDb.Queryable<InfoClientBank>().Where(x => x.Id == req.Id).FirstAsync();
if (info == null)
{
return DataResult.FailedWithDesc(MultiLanguageConst.EmptyData);
}
info = req.Adapt(info);
await TenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
//创建或更新发票抬头
if (req.InvoiceHeaders?.Count > 0)
await TenantDb.Storageable(req.InvoiceHeaders).DefaultAddElseUpdate().ExecuteCommandAsync();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
/// <summary>
/// 详情
/// </summary>
@ -87,12 +82,11 @@ public class ClientBankService : IClientBankService
/// <returns></returns>
public DataResult<ClientBankRes> GetClientBankInfo(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClientBank>()
var data = TenantDb.Queryable<InfoClientBank>()
.Where(a => a.Id == long.Parse(id))
.Select<ClientBankRes>()
.First();
return DataResult<ClientBankRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
return DataResult<ClientBankRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
@ -102,9 +96,8 @@ public class ClientBankService : IClientBankService
/// <returns></returns>
public async Task<DataResult> DeleteAsync(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//删除客户信息
int rows = await tenantDb.Deleteable<InfoClientBank>().Where(x => req.Ids.Contains(x.Id)).ExecuteCommandAsync();
int rows = await TenantDb.Deleteable<InfoClientBank>().Where(x => req.Ids.Contains(x.Id)).ExecuteCommandAsync();
return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
}

@ -298,9 +298,9 @@ public class ClientInfoService : ServiceBase, IClientInfoService
var tag = req.ClientTag.Adapt<InfoClientTag>();
//助记码
data.CodeName = PinYinUtil.GetFristLetter(req.ShortName);
var entity = TenantDb.InsertNav(data).Include(x => x.InvoiceHeaders).ExecuteReturnEntity();
var entity = await TenantDb.Insertable(data).ExecuteReturnEntityAsync();
tag.ClientId = entity.Id;
TenantDb.Insertable(tag).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").ExecuteCommand();
await TenantDb.Insertable(tag).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").ExecuteCommandAsync();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
@ -328,10 +328,6 @@ public class ClientInfoService : ServiceBase, IClientInfoService
.EnableDiffLogEvent().ExecuteCommand();
TenantDb.Updateable(tag).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand();
//创建或更新发票抬头
if (req.InvoiceHeaders?.Count > 0)
TenantDb.Storageable(req.InvoiceHeaders).DefaultAddElseUpdate().ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}

@ -105,6 +105,5 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <param name="taskTypes">任务类型,不指定任务类型则删除全部任务</param>
/// <returns></returns>
Task<DataResult> Delete(long id, BusinessType? businessType, string? remark = null, params TaskBaseTypeEnum[] taskTypes);
Task SetTaskBaseDescription(object wAIT_CHECKOUT_BILL);
}
}

@ -42,10 +42,9 @@ public class ClientBankController : ApiController
/// <returns></returns>
[HttpPost]
[Route("EditClientBank")]
public DataResult EditClientBank([FromBody] ClientBankReq req)
public async Task<DataResult> EditClientBankAsync([FromBody] ClientBankReq req)
{
var res = _invokeService.EditClientBank(req);
return res;
return await _invokeService.EditClientBankAsync(req);
}
/// <summary>

Loading…
Cancel
Save