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

usertest
嵇文龙 3 months ago
parent fbb501e8ac
commit b15888f55b

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

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

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

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

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

@ -1,36 +1,24 @@
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Data; using DS.Module.Core.Data;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Info.Dtos; using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity; using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Info.Interface; using DS.WMS.Core.Info.Interface;
using Mapster; using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.Info.Method; namespace DS.WMS.Core.Info.Method;
/// <summary> /// <summary>
/// 客服银行服务 /// 往来单位银行
/// </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>
/// ///
/// </summary> /// </summary>
/// <param name="serviceProvider"></param> /// <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> /// <summary>
@ -40,46 +28,53 @@ public class ClientBankService : IClientBankService
/// <returns></returns> /// <returns></returns>
public DataResult<List<ClientBankRes>> GetListByPage(PageRequest request) public DataResult<List<ClientBankRes>> GetListByPage(PageRequest request)
{ {
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件 //序列化查询条件
var whereList = request.GetConditionalModels(db); var whereList = request.GetConditionalModels(Db);
var data = tenantDb.Queryable<InfoClientBank>() var data = TenantDb.Queryable<InfoClientBank>()
.Where(whereList) .Where(whereList)
.Select<ClientBankRes>().ToQueryPage(request.PageCondition); .Select<ClientBankRes>().ToQueryPage(request.PageCondition);
return data; return data;
} }
/// <summary> /// <summary>
/// 编辑 /// 编辑
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <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 (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();
} }
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
var data = req.Adapt<InfoClientBank>();
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
} }
else 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); 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>
/// 详情 /// 详情
/// </summary> /// </summary>
@ -87,12 +82,11 @@ public class ClientBankService : IClientBankService
/// <returns></returns> /// <returns></returns>
public DataResult<ClientBankRes> GetClientBankInfo(string id) 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)) .Where(a => a.Id == long.Parse(id))
.Select<ClientBankRes>() .Select<ClientBankRes>()
.First(); .First();
return DataResult<ClientBankRes>.Success(data,MultiLanguageConst.DataQuerySuccess); return DataResult<ClientBankRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
} }
/// <summary> /// <summary>
@ -102,9 +96,8 @@ public class ClientBankService : IClientBankService
/// <returns></returns> /// <returns></returns>
public async Task<DataResult> DeleteAsync(IdModel req) 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)); 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>(); var tag = req.ClientTag.Adapt<InfoClientTag>();
//助记码 //助记码
data.CodeName = PinYinUtil.GetFristLetter(req.ShortName); 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; 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); return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
} }
else else
@ -328,10 +328,6 @@ public class ClientInfoService : ServiceBase, IClientInfoService
.EnableDiffLogEvent().ExecuteCommand(); .EnableDiffLogEvent().ExecuteCommand();
TenantDb.Updateable(tag).IgnoreColumns(ignoreAllNullColumns: true).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); return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
} }
} }

@ -105,6 +105,5 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <param name="taskTypes">任务类型,不指定任务类型则删除全部任务</param> /// <param name="taskTypes">任务类型,不指定任务类型则删除全部任务</param>
/// <returns></returns> /// <returns></returns>
Task<DataResult> Delete(long id, BusinessType? businessType, string? remark = null, params TaskBaseTypeEnum[] taskTypes); 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> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("EditClientBank")] [Route("EditClientBank")]
public DataResult EditClientBank([FromBody] ClientBankReq req) public async Task<DataResult> EditClientBankAsync([FromBody] ClientBankReq req)
{ {
var res = _invokeService.EditClientBank(req); return await _invokeService.EditClientBankAsync(req);
return res;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save