From e60a6966f10f1d262b9e9bf0e561658f2e6cde45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Thu, 6 Jun 2024 11:08:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8Ebug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/QueryableExtensions.cs | 101 ++++++--- ds-wms-service/DS.WMS.Core/Extensions.cs | 12 +- .../DS.WMS.Core/Fee/Dtos/FeeAuditRequest.cs | 25 +- .../Fee/Interface/IFeeAuditService.cs | 14 +- .../Fee/Interface/IFeeRecordService.cs | 33 ++- .../DS.WMS.Core/Fee/Method/FeeAuditService.cs | 129 +++++------ .../Fee/Method/FeeRecordService.cs | 214 +++++++++--------- .../Flow/Method/ClientFlowInstanceService.cs | 3 + .../Flow/Method/FlowInstanceService.cs | 4 +- .../Controllers/FeeAuditController.cs | 31 ++- .../Controllers/FeeRecordController.cs | 56 ++--- .../FolderProfile1.pubxml.user | 2 +- 12 files changed, 344 insertions(+), 280 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Extensions/QueryableExtensions.cs b/ds-wms-service/DS.Module.Core/Extensions/QueryableExtensions.cs index 4052b366..88402e26 100644 --- a/ds-wms-service/DS.Module.Core/Extensions/QueryableExtensions.cs +++ b/ds-wms-service/DS.Module.Core/Extensions/QueryableExtensions.cs @@ -1,7 +1,7 @@ -using SqlSugar; -using System.ComponentModel; +using System.ComponentModel; using DS.Module.Core.Data; using Newtonsoft.Json; +using SqlSugar; namespace DS.Module.Core.Extensions; @@ -42,12 +42,29 @@ public static partial class Extensions { page.NotNull(nameof(page)); - var result = source.WhereAsync(page.PageIndex, page.PageSize, page.SortConditions); + var result = source.Where(page.PageIndex, page.PageSize, page.SortConditions); var list = result.data; var total = result.totalNumber; return DataResult>.PageList(total, list, MultiLanguageConst.DataQuerySuccess); } + /// + /// 将查询转换为分页结果 + /// + /// + /// 数据源 + /// 分页设置 + /// + public static async Task>> ToQueryPageAsync(this ISugarQueryable source, + PageCondition page) + { + page.NotNull(nameof(page)); + var result = await source.WhereAsync(page.PageIndex, page.PageSize, page.SortConditions); + var list = result.Item1; + var total = result.Item2; + return DataResult>.PageList(total, list, MultiLanguageConst.DataQuerySuccess); + } + /// /// /// @@ -57,7 +74,7 @@ public static partial class Extensions /// /// /// - private static (List data, int totalNumber) WhereAsync(this ISugarQueryable source, + private static (List data, int totalNumber) Where(this ISugarQueryable source, int pageIndex, int pageSize, SortCondition[] orderConditions) { @@ -82,6 +99,28 @@ public static partial class Extensions ? source.ToPageList(pageIndex, pageSize, ref total) : Enumerable.Empty().ToList(), total); } + + private static async Task, int>> WhereAsync(this ISugarQueryable source, + int pageIndex, int pageSize, SortCondition[] orderConditions) + { + ISugarQueryable orderSource; + if (orderConditions == null || orderConditions.Length == 0) + { + orderSource = source.OrderBy("Id"); + } + else + { + orderSource = source.OrderBy(orderConditions); + } + + source = orderSource; + + var total = new RefAsync(); + var list = await source.ToPageListAsync(pageIndex, pageSize, total); + + return new Tuple, int>(list, total.Value); + } + /// /// 转换SqlSugar条件查询表达式 /// @@ -100,7 +139,8 @@ public static partial class Extensions (WhereType.And, new ConditionalModel { - FieldName = item.Field, ConditionalType = GetConditionalType(item.Operator), + FieldName = item.Field, + ConditionalType = GetConditionalType(item.Operator), FieldValue = item.Value }) ); @@ -109,9 +149,9 @@ public static partial class Extensions if (conditionList.Count > 0) { conditionalCollections.Add(new ConditionalCollections - { - ConditionalList = conditionList - } + { + ConditionalList = conditionList + } ) ; } @@ -127,7 +167,8 @@ public static partial class Extensions (WhereType.And, new ConditionalModel { - FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator), + FieldName = item1.Field, + ConditionalType = GetConditionalType(item1.Operator), FieldValue = item1.Value }) ); @@ -141,7 +182,8 @@ public static partial class Extensions (WhereType.Or, new ConditionalModel { - FieldName = item1.Field, ConditionalType =GetConditionalType(item1.Operator), + FieldName = item1.Field, + ConditionalType = GetConditionalType(item1.Operator), FieldValue = item1.Value }) ); @@ -152,9 +194,9 @@ public static partial class Extensions if (groupList.Count > 0) { conditionalCollections.Add(new ConditionalCollections - { - ConditionalList = groupList - } + { + ConditionalList = groupList + } ) ; } @@ -168,7 +210,8 @@ public static partial class Extensions (WhereType.Or, new ConditionalModel { - FieldName = item.Field, ConditionalType = GetConditionalType(item.Operator), + FieldName = item.Field, + ConditionalType = GetConditionalType(item.Operator), FieldValue = item.Value }) ); @@ -177,9 +220,9 @@ public static partial class Extensions if (conditionList.Count > 0) { conditionalCollections.Add(new ConditionalCollections - { - ConditionalList = conditionList - } + { + ConditionalList = conditionList + } ) ; } @@ -195,7 +238,8 @@ public static partial class Extensions (WhereType.And, new ConditionalModel { - FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator), + FieldName = item1.Field, + ConditionalType = GetConditionalType(item1.Operator), FieldValue = item1.Value }) ); @@ -209,7 +253,8 @@ public static partial class Extensions (WhereType.Or, new ConditionalModel { - FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator), + FieldName = item1.Field, + ConditionalType = GetConditionalType(item1.Operator), FieldValue = item1.Value }) ); @@ -220,9 +265,9 @@ public static partial class Extensions if (groupList.Count > 0) { conditionalCollections.Add(new ConditionalCollections - { - ConditionalList = groupList - } + { + ConditionalList = groupList + } ) ; } @@ -230,12 +275,12 @@ public static partial class Extensions return conditionalCollections; } - - /// - /// 转换SqlSugar 条件操作符 - /// - /// - /// + + /// + /// 转换SqlSugar 条件操作符 + /// + /// + /// private static ConditionalType GetConditionalType(string conditionalType) { switch (conditionalType) diff --git a/ds-wms-service/DS.WMS.Core/Extensions.cs b/ds-wms-service/DS.WMS.Core/Extensions.cs index 0e80708a..1331192a 100644 --- a/ds-wms-service/DS.WMS.Core/Extensions.cs +++ b/ds-wms-service/DS.WMS.Core/Extensions.cs @@ -6,7 +6,15 @@ namespace DS.WMS.Core { public static class LogExtensions { - public static void Log(this Exception ex, ISqlSugarClient db) + const long CONFIG_ID = 1288018625843826680; + + /// + /// 将异常信息记录到数据库 + /// + /// + /// + /// + public static async Task LogAsync(this Exception ex, ISqlSugarClient db) { string className = string.Empty; var stacktrace = new StackTrace(); @@ -24,7 +32,7 @@ namespace DS.WMS.Core }; var scope = (SqlSugarScope)db; - scope.GetConnection(1288018625843826680).Insertable(exLog).ExecuteCommand(); + await scope.GetConnection(CONFIG_ID).Insertable(exLog).ExecuteCommandAsync(); } } } diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAuditRequest.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAuditRequest.cs index 996bc102..33a1ce57 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAuditRequest.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAuditRequest.cs @@ -2,7 +2,10 @@ namespace DS.WMS.Core.Fee.Dtos { - public class FeeAuditRequest + /// + /// 审批请求 + /// + public class AuditRequest { /// /// 审核结果:1=通过,2=驳回 @@ -12,28 +15,24 @@ namespace DS.WMS.Core.Fee.Dtos /// /// 审批备注 /// - public string Remark { get; set; } + public string? Remark { get; set; } + } + public class FeeAuditRequest : AuditRequest + { /// /// 审批的费用ID /// public long[] Ids { get; set; } + /// + /// 业务类型 + /// public BusinessType BusinessType { get; set; } } - public class FeeBizAuditRequest + public class FeeBizAuditRequest: AuditRequest { - /// - /// 审核结果:1=通过,2=驳回 - /// - public int Result { get; set; } - - /// - /// 审批备注 - /// - public string Remark { get; set; } - public List Items { get; set; } } diff --git a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs index 973e2593..8f6f1a43 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs @@ -15,14 +15,14 @@ namespace DS.WMS.Core.Fee.Interface /// /// /// - DataResult> GetList(PageRequest request); + Task>> GetListAsync(PageRequest request); /// /// 获取整票审核列表 /// /// /// - DataResult> GetBizList(PageRequest request); + Task>> GetBizListAsync(PageRequest request); /// /// 批量审批 @@ -31,7 +31,7 @@ namespace DS.WMS.Core.Fee.Interface /// 备注 /// 待审批的费用ID /// - DataResult Audit(int yesOrNo, string remark, params long[] idArray); + Task AuditAsync(int yesOrNo, string remark, params long[] idArray); /// /// 本票审核(一键审核当前登录用户的所有待审核项) @@ -39,26 +39,26 @@ namespace DS.WMS.Core.Fee.Interface /// 审批结果:1=通过,2=驳回 /// 备注 /// - DataResult Audit(int yesOrNo, string remark); + Task AuditAsync(int yesOrNo, string remark); /// /// 整单费用状态审核 /// /// - DataResult AuditBusiness(FeeBizAuditRequest request); + Task AuditBusinessAsync(FeeBizAuditRequest request); /// /// 设置业务费用锁定状态 /// /// 业务信息 /// - DataResult SetFeeLocking(IEnumerable items); + Task SetFeeLockingAsync(IEnumerable items); /// /// 根据审批结果更新审批状态 /// ///回调信息 /// - DataResult UpdateAuditStatus(FlowCallback callback); + Task UpdateStatusAsync(FlowCallback callback); } } diff --git a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs index 90021ee3..7d6de840 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs @@ -1,8 +1,8 @@ using DS.Module.Core; using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Entity; -using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Op.Entity; +using SqlSugar; namespace DS.WMS.Core.Fee.Interface; @@ -13,21 +13,21 @@ public interface IFeeRecordService /// /// /// - DataResult> GetListByPage(PageRequest request); + Task>> GetListByPageAsync(PageRequest request); /// /// 列表 /// /// 查询条件 /// - DataResult> GetList(string query); + Task>> GetListAsync(string query); /// /// 提交 /// /// 要提交的费用记录 /// - DataResult InsertOrUpdate(IEnumerable items); + Task SaveAsync(IEnumerable items); /// /// 根据费用模板引入 @@ -36,14 +36,14 @@ public interface IFeeRecordService /// 业务类型 /// 模板ID /// - DataResult CreateByTemplate(long bid, BusinessType type, params long[] tidArray); + Task CreateByTemplateAsync(long bid, BusinessType type, params long[] tidArray); /// /// 删除 /// /// /// - DataResult Delete(params long[] ids); + Task DeleteAsync(params long[] ids); /// /// 发起审批工作流 @@ -52,21 +52,21 @@ public interface IFeeRecordService /// 备注 /// 费用记录ID /// - DataResult SubmitForApproval(FeeAuditType auditType, string remark, params long[] idArray); + Task SubmitForApprovalAsync(FeeAuditType auditType, string remark, params long[] idArray); /// /// 发起费用修改申请 /// /// 费用修改信息 /// - DataResult SubmitForModification(IEnumerable items); + Task SubmitForModificationAsync(IEnumerable items); /// /// 撤销审批 /// /// 费用记录ID /// - DataResult Withdraw(params long[] ids); + Task WithdrawAsync(params long[] ids); /// /// 发起整单审核 @@ -74,7 +74,16 @@ public interface IFeeRecordService /// 业务ID /// 业务类型 /// - DataResult SubmitBusinessAudit(long bid, BusinessType type); + Task SubmitBusinessAuditAsync(long bid, BusinessType type); + + /// + /// 回写业务表费用状态 + /// + /// + /// 业务ID + /// 业务类型 + /// + Task WriteBackStatusAsync(SqlSugarScopeProvider tenantDb, long businessId, BusinessType businessType); /// /// 获取费用核算单打印信息 @@ -82,7 +91,7 @@ public interface IFeeRecordService /// 业务类型 /// 费用记录ID /// - DataResult GetPrintInfo(BusinessType businessType, params long[] idArray); + Task> GetPrintInfoAsync(BusinessType businessType, params long[] idArray); /// /// 设置发票启用状态 @@ -90,5 +99,5 @@ public interface IFeeRecordService /// 是否启用 /// 费用记录ID /// - DataResult SetInvoiceEnabled(bool enabled, params long[] idArray); + Task SetInvoiceEnabledAsync(bool enabled, params long[] idArray); } \ No newline at end of file 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 810166e4..ba9bb691 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs @@ -42,14 +42,16 @@ namespace DS.WMS.Core.Fee.Method readonly IUser user; readonly ISaasDbService saasService; readonly IClientFlowInstanceService flowService; + readonly IFeeRecordService feeService; public FeeAuditService(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; - db = _serviceProvider.GetRequiredService(); - user = _serviceProvider.GetRequiredService(); - saasService = _serviceProvider.GetRequiredService(); - flowService = _serviceProvider.GetRequiredService(); + db = serviceProvider.GetRequiredService(); + user = serviceProvider.GetRequiredService(); + saasService = serviceProvider.GetRequiredService(); + flowService = serviceProvider.GetRequiredService(); + feeService = serviceProvider.GetRequiredService(); } /// @@ -57,11 +59,11 @@ namespace DS.WMS.Core.Fee.Method /// /// /// - public DataResult> GetList(PageRequest request) + public async Task>> GetListAsync(PageRequest request) { - var flowList = db.Queryable().Where(x => x.FlowStatus == RunningStatus + var flowList = await db.Queryable().Where(x => x.FlowStatus == RunningStatus && SqlFunc.SplitIn(x.MakerList, user.UserId) && AuditTypes.Contains(x.AuditType)) - .Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToList(); + .Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToListAsync(); //没有待审批的列表直接返回不再执行后续查询 if (flowList.Count == 0) DataResult>.PageList(0, null, MultiLanguageConst.DataQuerySuccess); @@ -77,14 +79,14 @@ namespace DS.WMS.Core.Fee.Method queryList = queryList.Where(whereList); } - var result = queryList.ToQueryPage(request.PageCondition); + var result = await queryList.ToQueryPageAsync(request.PageCondition); if (result.Data.Count > 0) { //关联用户名称 var userIds = result.Data.Where(x => x.OperatorId.HasValue).Select(x => x.OperatorId.Value) .Union(result.Data.Select(x => x.CreateBy)) .Distinct(); - var users = db.Queryable().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToList(); + var users = await db.Queryable().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync(); foreach (var item in result.Data) { item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName; @@ -104,12 +106,12 @@ namespace DS.WMS.Core.Fee.Method /// /// /// - public DataResult> GetBizList(PageRequest request) + public async Task>> GetBizListAsync(PageRequest request) { string auditType = FeeAuditType.Business.ToString(); - var flowList = db.Queryable().Where(x => x.FlowStatus == RunningStatus + var flowList = await db.Queryable().Where(x => x.FlowStatus == RunningStatus && SqlFunc.SplitIn(x.MakerList, user.UserId) && x.AuditType == auditType) - .Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToList(); + .Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToListAsync(); //没有待审批的列表直接返回不再执行后续查询 if (flowList.Count == 0) DataResult>.PageList(0, null, MultiLanguageConst.DataQuerySuccess); @@ -123,14 +125,14 @@ namespace DS.WMS.Core.Fee.Method queryList = queryList.Where(whereList); } - var result = queryList.ToQueryPage(request.PageCondition); + var result = await queryList.ToQueryPageAsync(request.PageCondition); if (result.Data.Count > 0) { //关联用户名称 var userIds = result.Data.Where(x => x.OperatorId.HasValue).Select(x => x.OperatorId.Value) .Union(result.Data.Select(x => x.CreateBy)) .Distinct(); - var users = db.Queryable().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToList(); + var users = await db.Queryable().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync(); foreach (var item in result.Data) { item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName; @@ -145,7 +147,7 @@ namespace DS.WMS.Core.Fee.Method return result; } - //创建各项业务数据的查询并集 + //创建各项费用数据的查询并集 internal static ISugarQueryable CreateQuery(SqlSugarScopeProvider tenantDb, IEnumerable additions) { //海运出口 @@ -153,7 +155,7 @@ namespace DS.WMS.Core.Fee.Method var query1 = tenantDb.Queryable((s, b, f, cs, csd) => new JoinQueryInfos( JoinType.Left, s.Id == b.BusinessId && b.BusinessType == BusinessType.OceanShippingExport, JoinType.Inner, s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport && AuditStatusArray.Contains(f.FeeStatus), - JoinType.Left,s.SourceId == cs.Id, + JoinType.Left, s.SourceId == cs.Id, JoinType.Left, s.SourceDetailId == csd.Id )) .WhereIF(ids1 != null && ids1.Length > 0, (s, b, f) => ids1.Contains(f.Id)) @@ -311,7 +313,7 @@ namespace DS.WMS.Core.Fee.Method }); //海运进口 - + return tenantDb.UnionAll(new List> { query1 }); } @@ -323,16 +325,16 @@ namespace DS.WMS.Core.Fee.Method /// 备注 /// 待审批的费用ID /// - public DataResult Audit(int yesOrNo, string remark, params long[] idArray) + public async Task AuditAsync(int yesOrNo, string remark, params long[] idArray) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var fees = tenantDb.Queryable().Where(x => idArray.Contains(x.Id)).Select(x => new + var fees = await tenantDb.Queryable().Where(x => idArray.Contains(x.Id)).Select(x => new { x.Id, x.FeeName, x.FeeStatus, x.FlowId - }).ToList(); + }).ToListAsync(); if (fees.Count == 0) return DataResult.Failed("未能获取费用信息"); @@ -344,7 +346,7 @@ namespace DS.WMS.Core.Fee.Method return DataResult.Failed("提交数据中包含不在待审批状态的费用"); var flowIds = fees.Select(x => x.FlowId.GetValueOrDefault()); - var flows = db.Queryable().Where(x => flowIds.Contains(x.Id)).ToList(); + var flows = await db.Queryable().Where(x => flowIds.Contains(x.Id)).ToListAsync(); if (flows.Count == 0) return DataResult.Failed("未能获取审批工作流"); @@ -385,16 +387,16 @@ namespace DS.WMS.Core.Fee.Method /// 审批结果:1=通过,2=驳回 /// 备注 /// - public DataResult Audit(int yesOrNo, string remark) + public async Task AuditAsync(int yesOrNo, string remark) { - var recordIds = db.Queryable().Where(x => x.FlowStatus == RunningStatus && + var recordIds = await db.Queryable().Where(x => x.FlowStatus == RunningStatus && SqlFunc.SplitIn(x.MakerList, user.UserId) && AuditTypes.Contains(x.AuditType)) - .Select(x => x.BusinessId).ToArray(); + .Select(x => x.BusinessId).ToArrayAsync(); //没有待审批的列表直接返回不再执行后续查询 if (recordIds.Length == 0) return DataResult.Failed("当前暂无待审批的费用"); - return Audit(yesOrNo, remark, recordIds); + return await AuditAsync(yesOrNo, remark, recordIds); } /// @@ -402,20 +404,20 @@ namespace DS.WMS.Core.Fee.Method /// /// 审批请求 /// - public DataResult AuditBusiness(FeeBizAuditRequest request) + public async Task AuditBusinessAsync(FeeBizAuditRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var gpList = request.Items.GroupBy(x => x.BusinessType).ToList(); foreach (var gp in gpList) { var bIdArr = gp.Select(x => x.Id).ToArray(); - var bizList = tenantDb.Queryable().Where(x => bIdArr.Contains(x.BusinessId) && x.BusinessType == gp.Key) + var bizList = await tenantDb.Queryable().Where(x => bIdArr.Contains(x.BusinessId) && x.BusinessType == gp.Key) .Select(x => new { x.Id, x.BillAuditStatus, x.FlowId - }).ToList(); + }).ToListAsync(); if (bizList.Count == 0) return DataResult.Failed("未能获取业务信息"); @@ -428,13 +430,13 @@ namespace DS.WMS.Core.Fee.Method var fIdArr = bizList.Select(x => x.FlowId).ToArray(); string auditType = FeeAuditType.Business.ToString(); - var flows = db.Queryable().Where(x => fIdArr.Contains(x.Id) && x.AuditType == auditType).ToList(); + var flows = await db.Queryable().Where(x => fIdArr.Contains(x.Id) && x.AuditType == auditType).ToListAsync(); if (flows.Count == 0) return DataResult.Failed("未能获取审批工作流"); if (flows.Any(x => !x.MakerList.Contains(user.UserId))) - return DataResult.Failed("所选项包含不属于当前用户权限范围内的审批,禁止提交"); + continue; foreach (var flow in flows) { @@ -461,13 +463,13 @@ namespace DS.WMS.Core.Fee.Method /// /// 业务信息 /// - public DataResult SetFeeLocking(IEnumerable items) + public async Task SetFeeLockingAsync(IEnumerable items) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - int rows = tenantDb.Updateable(items) + int rows = await tenantDb.Updateable(items) .WhereColumns(x => new { x.BusinessId, x.BusinessType }) .UpdateColumns(x => new { x.IsFeeLocking }) - .ExecuteCommand(); + .ExecuteCommandAsync(); return rows > 0 ? DataResult.Success : DataResult.Failed("更新失败"); } @@ -477,7 +479,7 @@ namespace DS.WMS.Core.Fee.Method /// /// 回调信息 /// - public DataResult UpdateAuditStatus(FlowCallback callback) + public async Task UpdateStatusAsync(FlowCallback callback) { var auditType = callback.AuditType.ToEnum(); var tenantDb = saasService.GetBizDbScopeById(user.TenantId); @@ -485,20 +487,20 @@ namespace DS.WMS.Core.Fee.Method BusinessFeeStatus biz = null; if (auditType == FeeAuditType.Business) { - biz = tenantDb.Queryable().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType) + biz = await tenantDb.Queryable().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType) .Select(x => new BusinessFeeStatus { Id = x.Id, BusinessId = x.BusinessId, BillAuditStatus = x.BillAuditStatus - }).First(); + }).FirstAsync(); if (biz == null) return DataResult.Failed("未能找到业务信息,更新状态失败", MultiLanguageConst.Operation_Failed); } else { - fee = tenantDb.Queryable().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType).Select( - x => new FeeRecord { Id = x.Id, FeeStatus = x.FeeStatus }).First(); + fee = await tenantDb.Queryable().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType).Select( + x => new FeeRecord { Id = x.Id, FeeStatus = x.FeeStatus }).FirstAsync(); if (fee == null) return DataResult.Failed("未能找到费用记录,更新状态失败", MultiLanguageConst.Operation_Failed); @@ -507,7 +509,7 @@ namespace DS.WMS.Core.Fee.Method long userId = long.Parse(user.UserId); DateTime dtNow = DateTime.Now; - tenantDb.Ado.BeginTran(); + await tenantDb.Ado.BeginTranAsync(); try { switch (auditType) @@ -525,7 +527,7 @@ namespace DS.WMS.Core.Fee.Method else if (callback.FlowStatus == FlowStatusEnum.Reject) fee.FeeStatus = FeeStatus.RejectSubmission; - tenantDb.Updateable(fee).UpdateColumns(x => new + await tenantDb.Updateable(fee).UpdateColumns(x => new { x.FeeStatus, x.AuditBy, @@ -533,14 +535,14 @@ namespace DS.WMS.Core.Fee.Method x.AuditDate, x.Reason, x.FlowId - }).ExecuteCommand(); + }).ExecuteCommandAsync(); break; case FeeAuditType.ApplyModification: //申请修改审核成功需要回填费用信息 if (callback.FlowStatus == FlowStatusEnum.Approve) { - var fm = tenantDb.Queryable().Where(x => x.FeeRecordId == fee.Id).OrderByDescending(x => x.CreateTime).First(); + var fm = await tenantDb.Queryable().Where(x => x.FeeRecordId == fee.Id).OrderByDescending(x => x.CreateTime).FirstAsync(); if (fm == null) return DataResult.Failed("未找到费用修改信息,更新失败", MultiLanguageConst.Operation_Failed); @@ -551,29 +553,29 @@ namespace DS.WMS.Core.Fee.Method entity.UpdateBy = userId; entity.UpdateTime = dtNow; //全表更新 - tenantDb.Updateable(entity).IgnoreColumns( - x => new { x.AuditBy, x.AuditDate, x.AuditOperator, x.SubmitBy, x.SubmitDate }).ExecuteCommand(); + await tenantDb.Updateable(entity).IgnoreColumns( + x => new { x.AuditBy, x.AuditDate, x.AuditOperator, x.SubmitBy, x.SubmitDate }).ExecuteCommandAsync(); //逻辑删除暂存数据 fm.Deleted = true; fm.DeleteTime = dtNow; fm.DeleteBy = userId; - tenantDb.Updateable(fm).UpdateColumns(x => new + await tenantDb.Updateable(fm).UpdateColumns(x => new { x.DeleteBy, x.Deleted, x.DeleteTime - }).ExecuteCommand(); + }).ExecuteCommandAsync(); } else if (callback.FlowStatus == FlowStatusEnum.Reject) { fee.FeeStatus = FeeStatus.RejectApplication; - tenantDb.Updateable(fee).UpdateColumns(x => new + await tenantDb.Updateable(fee).UpdateColumns(x => new { x.FeeStatus, x.Reason, x.FlowId - }).ExecuteCommand(); + }).ExecuteCommandAsync(); } break; @@ -585,27 +587,27 @@ namespace DS.WMS.Core.Fee.Method fee.DeleteBy = userId; fee.DeleteTime = dtNow; - tenantDb.Updateable(fee).UpdateColumns(x => new + await tenantDb.Updateable(fee).UpdateColumns(x => new { x.DeleteBy, x.Deleted, x.DeleteTime, x.Reason, x.FlowId - }).ExecuteCommand(); + }).ExecuteCommandAsync(); - //tenantDb.Deleteable(fee).ExecuteCommand(); + //tenantDb.Deleteable(fee).ExecuteCommandAsync(); } else { fee.FeeStatus = FeeStatus.RejectApplication; - tenantDb.Updateable(fee).UpdateColumns(x => new + await tenantDb.Updateable(fee).UpdateColumns(x => new { x.FeeStatus, x.Reason, x.FlowId - }).ExecuteCommand(); + }).ExecuteCommandAsync(); } break; @@ -621,21 +623,20 @@ namespace DS.WMS.Core.Fee.Method biz.BillAuditStatus = BillAuditStatus.Rejected; } - tenantDb.Updateable(biz).UpdateColumns(x => new + await tenantDb.Updateable(biz).UpdateColumns(x => new { x.BillAuditStatus, x.FlowId - }).ExecuteCommand(); - + }).ExecuteCommandAsync(); - tenantDb.Updateable() + await tenantDb.Updateable() .SetColumns(x => x.FeeStatus == status) .SetColumns(x => x.FlowId == null) .SetColumns(x => x.AuditBy == userId) .SetColumns(x => x.AuditOperator == user.UserName) .SetColumns(x => x.AuditDate == dtNow) .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == callback.BusinessType && - (x.FeeStatus == FeeStatus.Entering || x.FeeStatus == FeeStatus.RejectSubmission)).ExecuteCommand(); + (x.FeeStatus == FeeStatus.Entering || x.FeeStatus == FeeStatus.RejectSubmission)).ExecuteCommandAsync(); break; default: @@ -645,27 +646,27 @@ namespace DS.WMS.Core.Fee.Method //驳回申请则逻辑删除关联工作流 if (callback.FlowStatus == FlowStatusEnum.Reject) { - db.Updateable(new FlowInstance + await db.Updateable(new FlowInstance { Id = callback.InstanceId, Deleted = true, DeleteBy = 0, DeleteTime = DateTime.Now - }).UpdateColumns(x => new { x.Deleted, x.DeleteBy, x.DeleteTime }).ExecuteCommand(); + }).UpdateColumns(x => new { x.Deleted, x.DeleteBy, x.DeleteTime }).ExecuteCommandAsync(); } - tenantDb.Ado.CommitTran(); + await tenantDb.Ado.CommitTranAsync(); return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); } catch (Exception ex) { - tenantDb.Ado.RollbackTran(); - ex.Log(db); + await tenantDb.Ado.RollbackTranAsync(); + await ex.LogAsync(db); return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed); } finally { - FeeRecordService.WriteBackStatus(tenantDb, callback.BusinessId, callback.BusinessType); + await feeService.WriteBackStatusAsync(tenantDb, callback.BusinessId, callback.BusinessType); } } diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs index 028e0ea4..539dbd33 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs @@ -49,23 +49,23 @@ namespace DS.WMS.Core.Fee.Method /// /// /// - public DataResult> GetListByPage(PageRequest request) + public async Task>> GetListByPageAsync(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); long userId = long.Parse(user.UserId); //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - var data = tenantDb.Queryable() + var data = await tenantDb.Queryable() .Where(x => x.IsOpen || (!x.IsOpen && x.CreateBy == userId)) .Where(whereList) .Select() - .ToQueryPage(request.PageCondition); + .ToQueryPageAsync(request.PageCondition); //关联用户名称 var userIds = data.Data.Where(x => x.UpdateBy.HasValue).Select(x => x.UpdateBy.Value) //.Union(data.Data.Where(x => x.SubmitBy.HasValue).Select(x => x.SubmitBy.Value)) .Union(data.Data.Select(x => x.CreateBy)).Distinct(); - var users = db.Queryable().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToList(); + var users = await db.Queryable().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync(); foreach (var item in data.Data) { item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName; @@ -89,7 +89,7 @@ namespace DS.WMS.Core.Fee.Method /// /// /// - public DataResult> GetList(string query) + public async Task>> GetListAsync(string query) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); long userId = long.Parse(user.UserId); @@ -101,7 +101,7 @@ namespace DS.WMS.Core.Fee.Method src = src.Where(whereList); } - var data = src.ToList(); + var data = await src.ToListAsync(); return new DataResult>(ResultCode.Success) { Data = data }; } @@ -112,7 +112,7 @@ namespace DS.WMS.Core.Fee.Method /// 业务类型 /// 锁定范围 /// - bool IsFeeLocked(long bid, BusinessType businessType, FeeType type = FeeType.All) + internal async Task IsFeeLockedAsync(long bid, BusinessType businessType, FeeType type = FeeType.All) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); bool? isFeeLocking = null; @@ -123,8 +123,8 @@ namespace DS.WMS.Core.Fee.Method case FeeType.Payable: break; case FeeType.All: - isFeeLocking = tenantDb.Queryable().Where( - x => x.BusinessId == bid && x.BusinessType == businessType).Select(x => x.IsFeeLocking).First(); + isFeeLocking = await tenantDb.Queryable().Where( + x => x.BusinessId == bid && x.BusinessType == businessType).Select(x => x.IsFeeLocking).FirstAsync(); break; } return isFeeLocking.GetValueOrDefault(); @@ -135,29 +135,29 @@ namespace DS.WMS.Core.Fee.Method /// /// 要提交的费用记录 /// - public DataResult InsertOrUpdate(IEnumerable items) + public async Task SaveAsync(IEnumerable items) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var first = items.Select(x => new { x.BusinessType, x.BusinessId }).FirstOrDefault(); - if (IsFeeLocked(first.BusinessId, first.BusinessType)) + if (await IsFeeLockedAsync(first.BusinessId, first.BusinessType)) return DataResult.Failed("当前业务已费用锁定,禁止提交", MultiLanguageConst.Operation_Failed); try { - tenantDb.Ado.BeginTran(); + await tenantDb.Ado.BeginTranAsync(); DateTime dtNow = DateTime.Now; var feeIds = items.Where(x => x.Id > 0).Select(x => x.Id).ToArray(); //包含修改的项,需要检测费用状态再修改 if (feeIds.Length > 0) { - var fees = tenantDb.Queryable().Where(x => feeIds.Contains(x.Id)).Select(x => new FeeRecord + var fees = await tenantDb.Queryable().Where(x => feeIds.Contains(x.Id)).Select(x => new FeeRecord { Id = x.Id, FeeName = x.FeeName, FeeStatus = x.FeeStatus - }).ToList(); + }).ToListAsync(); StringBuilder sb = new StringBuilder(); foreach (var fe in fees) @@ -173,7 +173,7 @@ namespace DS.WMS.Core.Fee.Method } //若计价货币单位不等于默认货币则尝试获取最新汇率 - FetchExchangeRate(tenantDb, items); + await FetchExchangeRateAsync(tenantDb, items); List list = new List(items.Count()); foreach (var item in items) @@ -184,41 +184,42 @@ namespace DS.WMS.Core.Fee.Method { item.BusinessId = first.BusinessId; item.BusinessType = first.BusinessType; - tenantDb.Insertable(item).ExecuteCommand(); + await tenantDb.Insertable(item).ExecuteCommandAsync(); } else { - tenantDb.Updateable(item).IgnoreColumns(x => new + await tenantDb.Updateable(item).IgnoreColumns(x => new { x.FeeStatus, x.CreateBy, x.CreateTime, x.BusinessId, + x.BusinessType, x.DeleteBy, x.Deleted, x.DeleteTime, x.SubmitDate, x.SubmitBy - }).ExecuteCommand(); + }).ExecuteCommandAsync(); } list.Add(item); } - tenantDb.Ado.CommitTran(); + await tenantDb.Ado.CommitTranAsync(); var list2 = list.Select(x => x.Adapt()).ToList(); return DataResult.Successed("保存成功", list2, MultiLanguageConst.DataUpdateSuccess); } catch (Exception ex) { - tenantDb.Ado.RollbackTran(); - ex.Log(db); + await tenantDb.Ado.RollbackTranAsync(); + await ex.LogAsync(db); return DataResult.Failed("保存失败", MultiLanguageConst.DataUpdateFailed); } finally { - WriteBackStatus(tenantDb, first.BusinessId, first.BusinessType); + await WriteBackStatusAsync(tenantDb, first.BusinessId, first.BusinessType); } } @@ -229,17 +230,17 @@ namespace DS.WMS.Core.Fee.Method /// 业务类型 /// 模板ID /// - public DataResult CreateByTemplate(long bid, BusinessType businessType, params long[] tidArray) + public async Task CreateByTemplateAsync(long bid, BusinessType businessType, params long[] tidArray) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); bool hasExists = tenantDb.Queryable().LeftJoin((x, y) => - x.FeeId == y.FeeId && x.FeeType == y.FeeType).Any((x, y) => - x.BusinessId == bid && x.BusinessType == businessType && tidArray.Contains(y.TemplateId) && !y.Deleted); + x.FeeId == y.FeeId && x.FeeType == y.FeeType).Any( + (x, y) => x.BusinessId == bid && x.BusinessType == businessType && tidArray.Contains(y.TemplateId)); if (hasExists) return DataResult.Failed("费用记录已存在", MultiLanguageConst.FeeRecordExist); - var details = tenantDb.Queryable().Where(x => tidArray.Contains(x.TemplateId) && !x.Deleted).Select(x => new + var details = await tenantDb.Queryable().Where(x => tidArray.Contains(x.TemplateId) && !x.Deleted).Select(x => new { x.FeeType, x.FeeId, @@ -261,7 +262,7 @@ namespace DS.WMS.Core.Fee.Method x.IsInvoice, x.SaleOrgId, x.Note - }).ToList(); + }).ToListAsync(); List records = new List(details.Count); foreach (var item in details) @@ -274,11 +275,10 @@ namespace DS.WMS.Core.Fee.Method } //若计价货币单位不等于默认货币则尝试获取最新汇率 - FetchExchangeRate(tenantDb, records); - - int result = tenantDb.Insertable(records).ExecuteCommand(); + await FetchExchangeRateAsync(tenantDb, records); + int result = await tenantDb.Insertable(records).ExecuteCommandAsync(); - WriteBackStatus(tenantDb, bid, businessType); + await WriteBackStatusAsync(tenantDb, bid, businessType); return result > 0 ? DataResult.Successed("保存成功", records, MultiLanguageConst.DataCreateSuccess) : DataResult.Successed("操作失败!", MultiLanguageConst.Operation_Failed); } @@ -288,20 +288,20 @@ namespace DS.WMS.Core.Fee.Method /// /// 费用记录ID /// - public DataResult Delete(params long[] ids) + public async Task DeleteAsync(params long[] ids) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var model = tenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select(x => new { x.BusinessId, x.BusinessType }).First(); - if (IsFeeLocked(model.BusinessId, model.BusinessType)) + var model = await tenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select(x => new { x.BusinessId, x.BusinessType }).FirstAsync(); + if (await IsFeeLockedAsync(model.BusinessId, model.BusinessType)) return DataResult.Failed("当前业务已费用锁定,禁止修改", MultiLanguageConst.Operation_Failed); - if (tenantDb.Queryable().Any(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission))) + if (await tenantDb.Queryable().AnyAsync(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission))) return DataResult.Failed("只能删除状态为‘录入’或‘驳回提交’的费用", MultiLanguageConst.FeeRecordDelete); - int result = tenantDb.Deleteable(x => ids.Contains(x.Id)).ExecuteCommand(); + int result = await tenantDb.Deleteable(x => ids.Contains(x.Id)).ExecuteCommandAsync(); - WriteBackStatus(tenantDb, model.BusinessId, model.BusinessType); + await WriteBackStatusAsync(tenantDb, model.BusinessId, model.BusinessType); return result > 0 ? DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess) : DataResult.Failed("删除失败!", MultiLanguageConst.Operation_Failed); } @@ -313,10 +313,10 @@ namespace DS.WMS.Core.Fee.Method /// 备注 /// 费用记录ID /// - public DataResult SubmitForApproval(FeeAuditType auditType, string remark, params long[] idArray) + public async Task SubmitForApprovalAsync(FeeAuditType auditType, string remark, params long[] idArray) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var fees = tenantDb.Queryable().Where(x => idArray.Contains(x.Id)).Select( + var fees = await tenantDb.Queryable().Where(x => idArray.Contains(x.Id)).Select( x => new FeeRecord { Id = x.Id, @@ -324,14 +324,14 @@ namespace DS.WMS.Core.Fee.Method FeeStatus = x.FeeStatus, FlowId = x.FlowId, BusinessId = x.BusinessId - }).ToList(); + }).ToListAsync(); if (fees.IsNullOrEmpty()) return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed); var bid = fees[0].BusinessId; var bType = fees[0].BusinessType; //业务状态检测 - if (IsFeeLocked(bid, bType)) + if (await IsFeeLockedAsync(bid, bType)) return DataResult.Failed("当前业务已费用锁定,禁止提交", MultiLanguageConst.Operation_Failed); if (fees.Any(x => x.FlowId.HasValue)) @@ -341,7 +341,7 @@ namespace DS.WMS.Core.Fee.Method return DataResult.Failed($"当前审批费用包含已结算/部分结算的费用,无法提交", MultiLanguageConst.Operation_Failed); DataResult result = DataResult.Failed(string.Empty, MultiLanguageConst.Operation_Failed); - tenantDb.Ado.BeginTran(); + await tenantDb.Ado.BeginTranAsync(); try { if (auditType == FeeAuditType.ApplyAudit) @@ -355,25 +355,25 @@ namespace DS.WMS.Core.Fee.Method if (!result.Succeeded) { - tenantDb.Ado.RollbackTran(); + await tenantDb.Ado.RollbackTranAsync(); return result; } - tenantDb.Updateable(fees).UpdateColumns(x => new + await tenantDb.Updateable(fees).UpdateColumns(x => new { x.Id, x.FeeStatus, x.SubmitBy, x.SubmitDate, x.FlowId - }).ExecuteCommand(); - tenantDb.Ado.CommitTran(); + }).ExecuteCommandAsync(); + await tenantDb.Ado.CommitTranAsync(); return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); } catch (Exception ex) { - tenantDb.Ado.RollbackTran(); - ex.Log(db); + await tenantDb.Ado.RollbackTranAsync(); + await ex.LogAsync(db); return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed); } } @@ -472,16 +472,16 @@ namespace DS.WMS.Core.Fee.Method /// /// 费用修改信息 /// - public DataResult SubmitForModification(IEnumerable items) + public async Task SubmitForModificationAsync(IEnumerable items) { var idList = items.Select(x => x.FeeRecordId).Distinct().ToList(); var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var fees = tenantDb.Queryable().Where(x => idList.Contains(x.Id)).Select(x => new FeeRecord + var fees = await tenantDb.Queryable().Where(x => idList.Contains(x.Id)).Select(x => new FeeRecord { Id = x.Id, FeeName = x.FeeName, FeeStatus = x.FeeStatus - }).ToList(); + }).ToListAsync(); if (fees.Count == 0) return DataResult.Failed("未能获取费用信息", MultiLanguageConst.Operation_Failed); @@ -502,7 +502,7 @@ namespace DS.WMS.Core.Fee.Method return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed); DateTime dtNow = DateTime.Now; - tenantDb.Ado.BeginTran(); + await tenantDb.Ado.BeginTranAsync(); try { foreach (var fee in fees) @@ -528,16 +528,16 @@ namespace DS.WMS.Core.Fee.Method } var list = items.ToList(); - tenantDb.Insertable(list).ExecuteCommand(); - tenantDb.Updateable(fees).UpdateColumns(x => new { x.FeeStatus, x.FlowId }).ExecuteCommand(); + await tenantDb.Insertable(list).ExecuteCommandAsync(); + await tenantDb.Updateable(fees).UpdateColumns(x => new { x.FeeStatus, x.FlowId }).ExecuteCommandAsync(); - tenantDb.Ado.CommitTran(); + await tenantDb.Ado.CommitTranAsync(); return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); } catch (Exception ex) { - tenantDb.Ado.RollbackTran(); - ex.Log(db); + await tenantDb.Ado.RollbackTranAsync(); + await ex.LogAsync(db); return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed); } } @@ -547,17 +547,17 @@ namespace DS.WMS.Core.Fee.Method /// /// 费用记录ID /// - public DataResult Withdraw(params long[] idArray) + public async Task WithdrawAsync(params long[] idArray) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var fees = tenantDb.Queryable().Where(x => idArray.Contains(x.Id)).Select( + var fees = await tenantDb.Queryable().Where(x => idArray.Contains(x.Id)).Select( x => new FeeRecord { Id = x.Id, FeeName = x.FeeName, FeeStatus = x.FeeStatus, FlowId = x.FlowId - }).ToList(); + }).ToListAsync(); if (fees.IsNullOrEmpty()) return DataResult.Failed("未能找到费用记录", MultiLanguageConst.Operation_Failed); @@ -574,8 +574,8 @@ namespace DS.WMS.Core.Fee.Method DateTime dtNow = DateTime.Now; try { - tenantDb.Ado.BeginTran(); - db.Updateable(flows).UpdateColumns(x => new { x.FlowStatus, x.MakerList }).ExecuteCommand(); + await tenantDb.Ado.BeginTranAsync(); + await db.Updateable(flows).UpdateColumns(x => new { x.FlowStatus, x.MakerList }).ExecuteCommandAsync(); foreach (var item in fees) { @@ -588,11 +588,11 @@ namespace DS.WMS.Core.Fee.Method item.FeeStatus = FeeStatus.AuditPassed; //删除暂存数据 - var entity = tenantDb.Queryable().OrderByDescending( - x => x.CreateTime).Select(x => new { x.Id, x.FeeRecordId }).First(x => x.FeeRecordId == item.Id); + var entity = await tenantDb.Queryable().OrderByDescending( + x => x.CreateTime).Select(x => new { x.Id, x.FeeRecordId }).FirstAsync(x => x.FeeRecordId == item.Id); if (entity != null) { - tenantDb.Deleteable().Where(x => x.Id == entity.Id).ExecuteCommand(); + await tenantDb.Deleteable().Where(x => x.Id == entity.Id).ExecuteCommandAsync(); } break; case FeeStatus.ApplyDeletion: @@ -605,15 +605,15 @@ namespace DS.WMS.Core.Fee.Method item.FlowId = null; } - tenantDb.Updateable(fees).UpdateColumns(x => new { x.Id, x.FeeStatus, x.SubmitBy, x.SubmitDate, x.FlowId }).ExecuteCommand(); + await tenantDb.Updateable(fees).UpdateColumns(x => new { x.Id, x.FeeStatus, x.SubmitBy, x.SubmitDate, x.FlowId }).ExecuteCommandAsync(); - tenantDb.Ado.CommitTran(); + await tenantDb.Ado.CommitTranAsync(); return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); } catch (Exception ex) { - tenantDb.Ado.RollbackTran(); - ex.Log(db); + await tenantDb.Ado.RollbackTranAsync(); + await ex.LogAsync(db); return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed); } @@ -625,17 +625,17 @@ namespace DS.WMS.Core.Fee.Method /// 业务ID /// 业务类型 /// - public DataResult SubmitBusinessAudit(long bid, BusinessType type) + public async Task SubmitBusinessAuditAsync(long bid, BusinessType type) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var entity = tenantDb.Queryable().Where(x => x.BusinessId == bid && + var entity = await tenantDb.Queryable().Where(x => x.BusinessId == bid && x.BusinessType == BusinessType.OceanShippingExport).Select(x => new BusinessFeeStatus { Id = x.Id, IsFeeLocking = x.IsFeeLocking, BillAuditStatus = x.BillAuditStatus, FlowId = x.FlowId - }).First(); + }).FirstAsync(); if (entity == null) return DataResult.Failed("未能找到业务信息", MultiLanguageConst.Operation_Failed); @@ -666,14 +666,16 @@ namespace DS.WMS.Core.Fee.Method entity.BillFeeStatusTime = DateTime.Now; entity.FlowId = instance.Id; - tenantDb.Updateable(entity).UpdateColumns(x => new + await tenantDb.Updateable(entity).UpdateColumns(x => new { x.BillAuditStatus, x.BillFeeStatusTime, x.FlowId - }).ExecuteCommand(); + }).ExecuteCommandAsync(); + + //修改关联费用状态为提交审核 + - tenantDb.Ado.CommitTran(); return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); } @@ -686,11 +688,11 @@ namespace DS.WMS.Core.Fee.Method /// 是否启用 /// 费用记录ID /// - public DataResult SetInvoiceEnabled(bool enabled, params long[] idArray) + public async Task SetInvoiceEnabledAsync(bool enabled, params long[] idArray) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var list = idArray.Select(x => new FeeRecord { Id = x, IsInvoice = enabled }).ToList(); - int rows = tenantDb.Updateable(list).UpdateColumns(x => new { x.IsInvoice }).ExecuteCommand(); + int rows = await tenantDb.Updateable(list).UpdateColumns(x => new { x.IsInvoice }).ExecuteCommandAsync(); return rows > 0 ? DataResult.Successed("设置成功!", MultiLanguageConst.DataUpdateSuccess) : DataResult.Failed("设置失败!", MultiLanguageConst.Operation_Failed); } @@ -701,15 +703,15 @@ namespace DS.WMS.Core.Fee.Method /// 客户类别 /// 费用记录ID /// - public DataResult SetCustomer(long customerId, string customerType, params long[] idArray) + public async Task SetCustomerAsync(long customerId, string customerType, params long[] idArray) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var model = tenantDb.Queryable().Where(x => x.Id == customerId).Select(x => new + var model = await tenantDb.Queryable().Where(x => x.Id == customerId).Select(x => new { Id = customerId, x.CodeName, x.Name - }).First(); + }).FirstAsync(); if (model == null) return DataResult.Failed("未能找到费用对象信息,设置失败!", MultiLanguageConst.Operation_Failed); @@ -721,7 +723,7 @@ namespace DS.WMS.Core.Fee.Method CustomerName = model.Name, CustomerType = customerType }).ToList(); - int rows = tenantDb.Updateable(list).UpdateColumns(x => new { x.CustomerId, x.CustomerCode, x.CustomerName, x.CustomerType }).ExecuteCommand(); + int rows = await tenantDb.Updateable(list).UpdateColumns(x => new { x.CustomerId, x.CustomerCode, x.CustomerName, x.CustomerType }).ExecuteCommandAsync(); return rows > 0 ? DataResult.Successed("设置成功!", MultiLanguageConst.DataUpdateSuccess) : DataResult.Failed("设置失败!", MultiLanguageConst.Operation_Failed); } @@ -731,16 +733,14 @@ namespace DS.WMS.Core.Fee.Method /// 业务类型 /// 费用记录ID /// - public DataResult GetPrintInfo(BusinessType businessType, params long[] idArray) + public async Task> GetPrintInfoAsync(BusinessType businessType, params long[] idArray) { CostAccountingForm form = null; var tenantDb = saasService.GetBizDbScopeById(user.TenantId); switch (businessType) { - //case BusinessType.ChangeOrder: - // break; case BusinessType.OceanShippingExport: - form = GetOceanShippingExportForm(tenantDb, idArray); + form = await GetOceanShippingExportAsync(tenantDb, idArray); break; case BusinessType.OceanShippingImport: @@ -767,7 +767,7 @@ namespace DS.WMS.Core.Fee.Method new FeeRecord { Currency = "USD", FeeType = FeeType.Receivable }, new FeeRecord { Currency = "USD", FeeType = FeeType.Payable } }; - FetchExchangeRate(tenantDb, fees); + await FetchExchangeRateAsync(tenantDb, fees); form.ExchangeRate = fees[0].ExchangeRate.HasValue ? fees[0].ExchangeRate.Value : 1; form.TotalReceivable = Math.Round(form.ReceivableUSD * form.ExchangeRate, 4, MidpointRounding.ToEven) + form.ReceivableRMB + form.ReceivableOther; form.TotalPayable = Math.Round(form.PayableUSD * form.ExchangeRate, 4, MidpointRounding.ToEven) + form.PayableRMB + form.PayableOther; @@ -776,11 +776,11 @@ namespace DS.WMS.Core.Fee.Method return DataResult.Success(form); } - - CostAccountingForm GetOceanShippingExportForm(SqlSugarScopeProvider tenantDb, params long[] idArray) + //获取海运出口打印数据 + async Task GetOceanShippingExportAsync(SqlSugarScopeProvider tenantDb, params long[] idArray) { CostAccountingForm form = null; - var list = tenantDb.Queryable().InnerJoin((x, y) => x.BusinessId == y.Id) + var list = await tenantDb.Queryable().InnerJoin((x, y) => x.BusinessId == y.Id) .Where((x, y) => idArray.Contains(x.Id) //&& x.FeeStatus == FeeStatus.SettlementCompleted ).Select((x, y) => new @@ -802,7 +802,7 @@ namespace DS.WMS.Core.Fee.Method y.DischargePort, y.CntrTotal, //Volume y.IssueType //放单方式 - }).ToList(); + }).ToListAsync(); if (list.Count == 0) return form; @@ -835,21 +835,23 @@ namespace DS.WMS.Core.Fee.Method return form; } - //回写业务主表的费用状态 - internal static void WriteBackStatus(SqlSugarScopeProvider tenantDb, long businessId, BusinessType businessType) + /// + /// 回写业务表费用状态 + /// + /// + /// 业务ID + /// 业务类型 + /// + public async Task WriteBackStatusAsync(SqlSugarScopeProvider tenantDb, long businessId, BusinessType businessType) { - var fees = tenantDb.Queryable().Where(x => x.BusinessId == businessId && x.BusinessType == businessType) + var fees = await tenantDb.Queryable().Where(x => x.BusinessId == businessId && x.BusinessType == businessType) .Select(x => new FeeRecord { - //BusinessId = businessId, - //BusinessType = businessType, FeeType = x.FeeType, FeeStatus = x.FeeStatus - }).ToList(); + }).ToListAsync(); if (fees.IsNullOrEmpty()) - { return; - } var arFeeStatus = DetermineStatus(fees.FindAll(x => x.FeeType == FeeType.Receivable)); var apFeeStatus = DetermineStatus(fees.FindAll(x => x.FeeType == FeeType.Payable)); @@ -866,8 +868,14 @@ namespace DS.WMS.Core.Fee.Method upt = upt.SetColumns(x => x.APFeeStatus == apFeeStatus); } - upt.Where(x => x.BusinessType == businessType && x.BusinessId == businessId) - .ExecuteCommand(); + try + { + await upt.Where(x => x.BusinessType == businessType && x.BusinessId == businessId).ExecuteCommandAsync(); + } + catch (Exception ex) + { + await ex.LogAsync(db); + } } } @@ -879,6 +887,7 @@ namespace DS.WMS.Core.Fee.Method { billFeeStatus = BillFeeStatus.NotEntered; } + //全状态 else if (fees.All(x => x.FeeStatus == FeeStatus.Entering)) { billFeeStatus = BillFeeStatus.Entering; @@ -903,6 +912,7 @@ namespace DS.WMS.Core.Fee.Method { billFeeStatus = BillFeeStatus.SettlementCompleted; } + //部分状态 else if (fees.Any(x => x.FeeStatus == FeeStatus.Entering)) { billFeeStatus = BillFeeStatus.PartialEntering; @@ -933,13 +943,13 @@ namespace DS.WMS.Core.Fee.Method } //获取汇率 - void FetchExchangeRate(SqlSugarScopeProvider tenantDb, IEnumerable items) + async Task FetchExchangeRateAsync(SqlSugarScopeProvider tenantDb, IEnumerable items) { var exRecords = items.Where(x => !x.ExchangeRate.HasValue && x.Currency != DefaultCurrency).ToList(); if (exRecords.Count > 0) { var codes = exRecords.Select(x => x.Currency).Distinct().ToList(); - var currencies = tenantDb.Queryable().Where(x => codes.Contains(x.CodeName)).Includes(x => x.Exchanges).ToList(); + var currencies = await tenantDb.Queryable().Where(x => codes.Contains(x.CodeName)).Includes(x => x.Exchanges).ToListAsync(); DateTime dtNow = DateTime.Now; foreach (var item in exRecords) { diff --git a/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs b/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs index 89f6b34d..1359e01b 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs @@ -10,6 +10,9 @@ using Microsoft.Extensions.DependencyInjection; namespace DS.WMS.Core.Flow.Method; +/// +/// ⻧˹ʵ +/// public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanceService { readonly ISaasDbService saasService; diff --git a/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs b/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs index 1d451608..49e1be43 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs @@ -441,7 +441,7 @@ public class FlowInstanceService : IFlowInstanceService var response = await http.PostAsync(uri, jsonRequest); if (!response.IsSuccessStatusCode) { - new HttpRequestException("回调请求失败", null, response.StatusCode).Log(db); + new HttpRequestException("回调请求失败", null, response.StatusCode).LogAsync(db); } //更新回调执行标识 @@ -450,7 +450,7 @@ public class FlowInstanceService : IFlowInstanceService } catch (Exception ex) { - ex.Log(db); + ex.LogAsync(db); } finally { diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs index c6d6eb5c..f1fc418f 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs @@ -2,7 +2,6 @@ using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Interface; using DS.WMS.Core.Flow.Dtos; -using DS.WMS.Core.Flow.Interface; using Microsoft.AspNetCore.Mvc; namespace DS.WMS.FeeApi.Controllers @@ -13,14 +12,10 @@ namespace DS.WMS.FeeApi.Controllers public class FeeAuditController : ApiController { readonly IFeeAuditService _auditService; - readonly IFeeRecordService _feeService; - readonly IClientFlowInstanceService _flowService; - public FeeAuditController(IFeeAuditService auditService, IFeeRecordService feeService, IClientFlowInstanceService flowService) + public FeeAuditController(IFeeAuditService auditService) { _auditService = auditService; - _feeService = feeService; - _flowService = flowService; } /// @@ -29,9 +24,9 @@ namespace DS.WMS.FeeApi.Controllers /// /// [HttpPost, Route("GetList")] - public DataResult> List([FromBody] PageRequest request) + public async Task>> ListAsync([FromBody] PageRequest request) { - return _auditService.GetList(request); + return await _auditService.GetListAsync(request); } /// @@ -40,9 +35,9 @@ namespace DS.WMS.FeeApi.Controllers /// /// [HttpPost, Route("GetBizList")] - public DataResult> BizList([FromBody] PageRequest request) + public async Task>> BizListAsync([FromBody] PageRequest request) { - return _auditService.GetBizList(request); + return await _auditService.GetBizListAsync(request); } /// @@ -51,12 +46,12 @@ namespace DS.WMS.FeeApi.Controllers /// /// [HttpPost, Route("Audit")] - public DataResult Audit(FeeAuditRequest request) + public async Task AuditAsync(FeeAuditRequest request) { if (request == null || request.Ids.Length == 0 || (request.Result != 1 && request.Result != 2)) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _auditService.Audit(request.Result, request.Remark, request.Ids); + return await _auditService.AuditAsync(request.Result, request.Remark, request.Ids); } /// @@ -66,12 +61,12 @@ namespace DS.WMS.FeeApi.Controllers /// 审批备注 /// [HttpPost, Route("OneClickAudit")] - public DataResult OneClickAudit(int status, string remark) + public async Task OneClickAuditAsync(int status, string remark) { if (status != 1 && status != 2) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _auditService.Audit(status, remark); + return await _auditService.AuditAsync(status, remark); } /// @@ -80,12 +75,12 @@ namespace DS.WMS.FeeApi.Controllers /// /// [HttpPost, Route("AuditBusiness")] - public DataResult AuditBusiness(FeeBizAuditRequest request) + public async Task AuditBusinessAsync(FeeBizAuditRequest request) { if (request == null || (request.Result != 1 && request.Result != 2) || request.Items == null || !request.Items.Any()) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _auditService.AuditBusiness(request); + return await _auditService.AuditBusinessAsync(request); } /// @@ -94,12 +89,12 @@ namespace DS.WMS.FeeApi.Controllers /// 回调信息 /// [HttpPost, Route("ChangeStatus")] - public DataResult ChangeStatus([FromBody] FlowCallback callback) + public async Task ChangeStatusAsync([FromBody] FlowCallback callback) { if (callback == null) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _auditService.UpdateAuditStatus(callback); + return await _auditService.UpdateStatusAsync(callback); } } } diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs index 87f99650..af0c019c 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs @@ -4,7 +4,6 @@ using DS.Module.Core.Extensions; using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Fee.Interface; -using DS.WMS.Core.Flow.Interface; using DS.WMS.Core.Op.Entity; using Mapster; using Microsoft.AspNetCore.Mvc; @@ -17,17 +16,15 @@ namespace DS.WMS.FeeApi.Controllers public class FeeRecordController : ApiController { readonly IFeeRecordService _feeService; - readonly IClientFlowInstanceService _flowService; /// /// 构造函数 /// /// /// - public FeeRecordController(IFeeRecordService feeService, IClientFlowInstanceService flowService) + public FeeRecordController(IFeeRecordService feeService) { _feeService = feeService; - _flowService = flowService; } /// @@ -37,10 +34,9 @@ namespace DS.WMS.FeeApi.Controllers /// [HttpPost] [Route("GetList")] - public DataResult> GetList([FromBody] PageRequest request) + public async Task>> GetListAsync([FromBody] PageRequest request) { - var res = _feeService.GetListByPage(request); - return res; + return await _feeService.GetListByPageAsync(request); } /// @@ -49,12 +45,12 @@ namespace DS.WMS.FeeApi.Controllers /// 查询条件 /// [HttpPost, Route("FeeStatistics")] - public DataResult FeeStatistics([FromBody] FeeStatisticsRequest request) + public async Task> StatisticsAsync([FromBody] FeeStatisticsRequest request) { if (request == null) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - var res = _feeService.GetList(request.QueryCondition); + var res = await _feeService.GetListAsync(request.QueryCondition); if (!res.Succeeded) return DataResult.Error(res.Message); @@ -68,7 +64,7 @@ namespace DS.WMS.FeeApi.Controllers /// 费用提交参数 /// [HttpPost, Route("Submit")] - public DataResult Submit([FromBody] FeeRecordSubmit recordSubmit) + public async Task SubmitAsync([FromBody] FeeRecordSubmit recordSubmit) { if (recordSubmit == null || recordSubmit.Items.IsNullOrEmpty()) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); @@ -82,7 +78,7 @@ namespace DS.WMS.FeeApi.Controllers item.BusinessId = recordSubmit.BusinessId; item.BusinessType = recordSubmit.BusinessType; } - return _feeService.InsertOrUpdate(list); + return await _feeService.SaveAsync(list); } /// @@ -91,13 +87,12 @@ namespace DS.WMS.FeeApi.Controllers /// 请求参数 /// [HttpPost, Route("CreateByTemplate")] - public DataResult CreateByTemplate([FromBody] FeeRecordByTemplate request) + public async Task CreateByTemplateAsync([FromBody] FeeRecordByTemplate request) { if (request == null || request.TemplateIdList.Length == 0) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - var res = _feeService.CreateByTemplate(request.BusinessId, request.BusinessType, request.TemplateIdList); - return res; + return await _feeService.CreateByTemplateAsync(request.BusinessId, request.BusinessType, request.TemplateIdList); } /// @@ -106,13 +101,12 @@ namespace DS.WMS.FeeApi.Controllers /// 费用记录ID /// [HttpPost, Route("Delete")] - public DataResult Delete([FromBody] IdModel model) + public async Task DeleteAsync([FromBody] IdModel model) { if (model == null || model.Ids.Length == 0) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - var res = _feeService.Delete(model.Ids); - return res; + return await _feeService.DeleteAsync(model.Ids); } /// @@ -121,12 +115,12 @@ namespace DS.WMS.FeeApi.Controllers /// 费用记录ID /// [HttpPost, Route("ApplyAudit")] - public DataResult ApplyAudit([FromBody] IdModel model) + public async Task ApplyAuditAsync([FromBody] IdModel model) { if (model == null || model.Ids.Length == 0) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _feeService.SubmitForApproval(FeeAuditType.ApplyAudit, model.Remark, model.Ids); + return await _feeService.SubmitForApprovalAsync(FeeAuditType.ApplyAudit, model.Remark, model.Ids); } /// @@ -135,12 +129,12 @@ namespace DS.WMS.FeeApi.Controllers /// 费用记录ID /// [HttpPost, Route("ApplyDeletion")] - public DataResult ApplyDeletion([FromBody] IdModel model) + public async Task ApplyDeletionAsync([FromBody] IdModel model) { if (model == null || model.Ids.Length == 0) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _feeService.SubmitForApproval(FeeAuditType.ApplyDeletion, model.Remark, model.Ids); + return await _feeService.SubmitForApprovalAsync(FeeAuditType.ApplyDeletion, model.Remark, model.Ids); } /// @@ -149,12 +143,12 @@ namespace DS.WMS.FeeApi.Controllers /// 费用修改信息 /// [HttpPost, Route("ApplyModification")] - public DataResult ApplyModification([FromBody] IEnumerable items) + public async Task ApplyModificationAsync([FromBody] IEnumerable items) { if (items.IsNullOrEmpty()) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _feeService.SubmitForModification(items); + return await _feeService.SubmitForModificationAsync(items); } /// @@ -163,12 +157,12 @@ namespace DS.WMS.FeeApi.Controllers /// 费用记录ID /// [HttpPost, Route("Withdraw")] - public DataResult Withdraw([FromBody] IdModel model) + public async Task WithdrawAsync([FromBody] IdModel model) { if (model == null || model.Ids.Length == 0) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _feeService.Withdraw(model.Ids); + return await _feeService.WithdrawAsync(model.Ids); } /// @@ -177,12 +171,12 @@ namespace DS.WMS.FeeApi.Controllers /// 业务ID和类型 /// [HttpPost, Route("ApplyBusinessAudit")] - public DataResult ApplyBusinessAudit(IdModel model) + public async Task ApplyBusinessAuditAsync(IdModel model) { if (model == null || !long.TryParse(model.Id, out long bid)) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _feeService.SubmitBusinessAudit(bid, (BusinessType)model.BusinessType); + return await _feeService.SubmitBusinessAuditAsync(bid, (BusinessType)model.BusinessType); } /// @@ -191,12 +185,12 @@ namespace DS.WMS.FeeApi.Controllers /// 费用记录ID /// [HttpPost, Route("GetPrintInfo")] - public DataResult GetPrintInfo(IdModel model) + public async Task> GetPrintInfoAsync(IdModel model) { if (model == null || model.Ids.Length == 0) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _feeService.GetPrintInfo((BusinessType)model.BusinessType, model.Ids); + return await _feeService.GetPrintInfoAsync((BusinessType)model.BusinessType, model.Ids); } /// @@ -205,13 +199,13 @@ namespace DS.WMS.FeeApi.Controllers /// 费用记录ID /// [HttpPost, Route("SetInvoiceEnabled")] - public DataResult SetInvoiceEnabled(IdModel model) + public async Task SetInvoiceEnabledAsync(IdModel model) { if (model == null || model.Ids.Length == 0) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); bool enabled = Convert.ToBoolean(model.Value); - return _feeService.SetInvoiceEnabled(enabled, model.Ids); + return await _feeService.SetInvoiceEnabledAsync(enabled, model.Ids); } } } diff --git a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user index e8d9c70f..08a8ed7d 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user +++ b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>D:\Publish\DS8\FeeApi - True|2024-06-04T06:23:21.3742450Z||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; + True|2024-06-06T02:57:27.8273617Z||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; \ No newline at end of file