diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs index 46577e31..59b54a07 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs @@ -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 { diff --git a/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientBankReq.cs b/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientBankReq.cs index 74109c37..466e8d90 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientBankReq.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientBankReq.cs @@ -1,4 +1,5 @@ using DS.Module.Core; +using DS.WMS.Core.Info.Entity; using FluentValidation; namespace DS.WMS.Core.Info.Dtos; @@ -98,7 +99,11 @@ public class ClientBankReq /// 备注 /// public string? Note { get; set; } - + + /// + /// 发票抬头 + /// + public List InvoiceHeaders { get; set; } = []; } /// diff --git a/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientInfoReq.cs b/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientInfoReq.cs index 2d288335..6337e2a6 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientInfoReq.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientInfoReq.cs @@ -460,11 +460,6 @@ public class ClientInfoReq /// public bool IsMortgageLastOrder { get; set; } - /// - /// 发票抬头 - /// - public List InvoiceHeaders { get; set; } = []; - /// /// Desc:业务来源明细Id /// diff --git a/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClient.cs b/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClient.cs index 60625ff2..c6c1a390 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClient.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClient.cs @@ -382,12 +382,6 @@ public class InfoClient : SharedOrgModel [SugarColumn(ColumnDescription = "是否押最后一单", DefaultValue = "1")] public bool IsMortgageLastOrder { get; set; } - /// - /// 发票抬头 - /// - [Navigate(NavigateType.OneToMany, nameof(InvoiceHeader.RelativeId))] - public List? InvoiceHeaders { get; set; } - /// /// Desc:业务来源明细Id /// diff --git a/ds-wms-service/DS.WMS.Core/Info/Interface/IClientBankService.cs b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientBankService.cs index d465797c..ff2ae31a 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Interface/IClientBankService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientBankService.cs @@ -13,13 +13,12 @@ public interface IClientBankService /// DataResult> GetListByPage(PageRequest request); - /// /// 编辑 /// /// /// - DataResult EditClientBank(ClientBankReq model); + Task EditClientBankAsync(ClientBankReq model); /// /// 获取详情 diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs index 975449cf..27a5afe9 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs @@ -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; /// -/// 客服银行服务 +/// 往来单位银行 /// -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; /// /// /// /// - public ClientBankService(IServiceProvider serviceProvider) + public ClientBankService(IServiceProvider serviceProvider) : base(serviceProvider) { - _serviceProvider = serviceProvider; - db = _serviceProvider.GetRequiredService(); - user = _serviceProvider.GetRequiredService(); - saasService = _serviceProvider.GetRequiredService(); } /// @@ -40,46 +28,53 @@ public class ClientBankService : IClientBankService /// public DataResult> GetListByPage(PageRequest request) { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); //序列化查询条件 - var whereList = request.GetConditionalModels(db); - var data = tenantDb.Queryable() + var whereList = request.GetConditionalModels(Db); + var data = TenantDb.Queryable() .Where(whereList) .Select().ToQueryPage(request.PageCondition); return data; } + /// /// 编辑 /// /// /// - public DataResult EditClientBank(ClientBankReq req) + public async Task EditClientBankAsync(ClientBankReq req) { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); if (req.Id == 0) { + if (await TenantDb.Queryable().Where(x => x.CodeName == req.CodeName).AnyAsync()) + return DataResult.Failed("客户银行信息已存在!", MultiLanguageConst.ClientBankExist); - if (tenantDb.Queryable().Where(x=>x.CodeName == req.CodeName).Any()) + var data = req.Adapt(); + 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(); - - 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().Where(x => x.Id == req.Id).First(); + var info = await TenantDb.Queryable().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); } } + /// /// 详情 /// @@ -87,12 +82,11 @@ public class ClientBankService : IClientBankService /// public DataResult GetClientBankInfo(string id) { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var data = tenantDb.Queryable() + var data = TenantDb.Queryable() .Where(a => a.Id == long.Parse(id)) .Select() .First(); - return DataResult.Success(data,MultiLanguageConst.DataQuerySuccess); + return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); } /// @@ -100,11 +94,10 @@ public class ClientBankService : IClientBankService /// /// /// - public async Task DeleteAsync(IdModel req) + public async Task DeleteAsync(IdModel req) { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); //删除客户信息 - int rows = await tenantDb.Deleteable().Where(x => req.Ids.Contains(x.Id)).ExecuteCommandAsync(); + int rows = await TenantDb.Deleteable().Where(x => req.Ids.Contains(x.Id)).ExecuteCommandAsync(); return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs index 5db36cba..1b0e29d2 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs @@ -298,9 +298,9 @@ public class ClientInfoService : ServiceBase, IClientInfoService var tag = req.ClientTag.Adapt(); //助记码 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); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/ITaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/ITaskService.cs index d851738b..e0ec002c 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/ITaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/ITaskService.cs @@ -105,6 +105,5 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction /// 任务类型,不指定任务类型则删除全部任务 /// Task Delete(long id, BusinessType? businessType, string? remark = null, params TaskBaseTypeEnum[] taskTypes); - Task SetTaskBaseDescription(object wAIT_CHECKOUT_BILL); } } diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientBankController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientBankController.cs index f95dc4ef..3784fa16 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientBankController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientBankController.cs @@ -42,10 +42,9 @@ public class ClientBankController : ApiController /// [HttpPost] [Route("EditClientBank")] - public DataResult EditClientBank([FromBody] ClientBankReq req) + public async Task EditClientBankAsync([FromBody] ClientBankReq req) { - var res = _invokeService.EditClientBank(req); - return res; + return await _invokeService.EditClientBankAsync(req); } ///