From 800cb94f8f2d01824f74b9eb4c226c8edb4133c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Thu, 27 Jun 2024 16:04:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=B9=E7=94=A8=E8=AE=B0=E5=BD=95=EF=BC=8C?= =?UTF-8?q?=E5=B0=86=E8=BF=94=E5=9B=9E=E7=9A=84=E6=B6=88=E6=81=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=A4=9A=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/MultiLanguageConst.cs | 31 ++++- .../Method/InvoiceApplicationService.cs | 2 +- .../Method/PaymentApplicationService.cs | 4 +- .../DS.WMS.Core/Fee/Dtos/FeeAudit.cs | 73 ------------ .../Fee/Dtos/FeeAuditQueryModel.cs | 77 +++++++++++++ .../DS.WMS.Core/Fee/Method/FeeAuditService.cs | 9 +- .../Fee/Method/FeeRecordService.cs | 108 +++++++++--------- .../DS.WMS.FeeApi/Logs/internal-nlog.txt | 7 ++ 8 files changed, 175 insertions(+), 136 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAuditQueryModel.cs diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index b879ba35..d7aa514f 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -7,7 +7,11 @@ namespace DS.Module.Core; /// public static class MultiLanguageConst { - + /// + /// 未能获取指定的数据 + /// + [Description("未能获取指定的数据")] + public const string ItemNotFound = "Item_NotFound"; /// /// 查询成功 /// @@ -36,7 +40,7 @@ public static class MultiLanguageConst public const string DataDelSuccess = "Data_Del_Success"; /// - /// 删除成功 + /// 操作失败 /// [Description("操作失败")] public const string Operation_Failed = "Operation_Failed"; @@ -507,11 +511,30 @@ public static class MultiLanguageConst public const string FeeCodeExist = "Fee_Code_Exist"; [Description("费用记录已存在")] public const string FeeRecordExist = "Fee_Record_Exist"; - + [Description("费用记录不存在")] + public const string FeeRecordNotExist = "Fee_Record_NotExist"; [Description("没有找到费用记录")] public const string FeeRecordNone = "Fee_Record_None"; - [Description("只能删除状态为‘录入’的费用")] + [Description("只能删除状态为‘录入’或‘驳回提交’的费用")] public const string FeeRecordDelete = "Fee_Record_Delete"; + [Description("费用已锁定,禁止提交")] + public const string FeeLocked = "Fee_Record_Locked"; + [Description("费用【{0}】状态不正确")] + public const string FeeRecordStatus = "Fee_Record_Status"; + [Description("所选项包含正在审批中的费用,无法提交")] + public const string FeeRecordIsAuditing = "Fee_Record_IsAuditing"; + [Description("当前审批费用包含已结算/部分结算的费用,无法提交")] + public const string FeeRecordIsSettled = "Fee_Record_IsSettled"; + [Description("未能找到审批模板")] + public const string TemplateNotFound = "Template_NotFound"; + [Description("以下项:{0} 未在审批状态中,无需撤销")] + public const string NoNeedWithdraw = "NoNeed_Withdraw"; + [Description("未能获取业务信息")] + public const string BusinessNotFound = "Business_NotFound"; + [Description("当前业务的费用状态为:{0},无法提交")] + public const string BusinessStatusError = "Business_Status_Error"; + [Description("不支持的业务类型:{0}")] + public const string BusinessNotSupported = "Business_NotSupported"; #endregion } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs index 0725bbca..f1e873a4 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs @@ -529,7 +529,7 @@ namespace DS.WMS.Core.Application.Method protected override DataResult PreDelete(List applications) { if (applications.Any(x => x.Status != InvoiceApplicationStatus.Pending && x.Status != InvoiceApplicationStatus.AuditRejected)) - return DataResult.Failed("只能删除状态为‘未提交’或‘审核驳回’的申请单", MultiLanguageConst.FeeRecordDelete); + return DataResult.Failed("只能删除状态为‘未提交’或‘审核驳回’的申请单"); return DataResult.Success; } diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs index d1ea7ec1..ec406e0d 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs @@ -5,7 +5,6 @@ using DS.Module.Core.Extensions; using DS.WMS.Core.Application.Dtos; using DS.WMS.Core.Application.Entity; using DS.WMS.Core.Application.Interface; -using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Info.Entity; @@ -123,6 +122,7 @@ namespace DS.WMS.Core.Application.Method } var result = await queryList.ToQueryPageAsync(request.PageCondition); + if (result.Data.Count > 0) { //关联用户名称 @@ -472,7 +472,7 @@ namespace DS.WMS.Core.Application.Method protected override DataResult PreDelete(List applications) { if (applications.Any(x => x.Status != PaymentApplicationStatus.Pending && x.Status != PaymentApplicationStatus.AuditRejected)) - return DataResult.Failed("只能删除状态为‘未提交’或‘驳回’的申请单", MultiLanguageConst.FeeRecordDelete); + return DataResult.Failed("只能删除状态为‘未提交’或‘驳回’的申请单"); return DataResult.Success; } diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs index e4861998..52dc4e8c 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs @@ -565,77 +565,4 @@ namespace DS.WMS.Core.Fee.Dtos public DateTime CreateTime { get; set; } } - public class FeeAuditItemQuery : FeeAuditItem - { - /// - /// 业务类型 - /// - public BusinessType BusinessType { get; set; } - - /// - /// 委托编号 - /// - public string CustomerNo { get; set; } - - /// - /// 船名 - /// - public string Vessel { get; set; } - - /// - /// 航次 - /// - public string Voyage { get; set; } - - /// - /// 国外代理ID - /// - public long? AgencyId { get; set; } - - /// - /// 结算对象 - /// - public long? FeeCustomerId { get; set; } - - /// - /// 运输类型 - /// - public string ShipmentType { get; set; } - - /// - /// 揽货人 - /// - public long? SaleId { get; set; } - - /// - /// 委托单位 - /// - public long? CustomerId { get; set; } - - /// - /// 业务日期 - /// - public DateTime? BusinessDate { get; set; } - - /// - /// 费用名称ID - /// - public long? FeeId { get; set; } - - /// - /// 业务来源 - /// - public long? SourceId { get; set; } - - /// - /// 会计期间 - /// - public string? AccountDate { get; set; } - - /// - /// 操作员 - /// - public long? OperatorId { get; set; } - } - } diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAuditQueryModel.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAuditQueryModel.cs new file mode 100644 index 00000000..5f60f8ac --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAuditQueryModel.cs @@ -0,0 +1,77 @@ +using DS.WMS.Core.Op.Entity; + +namespace DS.WMS.Core.Fee.Dtos +{ + public class FeeAuditItemQuery : FeeAuditItem + { + /// + /// 业务类型 + /// + public BusinessType BusinessType { get; set; } + + /// + /// 委托编号 + /// + public string CustomerNo { get; set; } + + /// + /// 船名 + /// + public string Vessel { get; set; } + + /// + /// 航次 + /// + public string Voyage { get; set; } + + /// + /// 国外代理ID + /// + public long? AgencyId { get; set; } + + /// + /// 结算对象 + /// + public long? FeeCustomerId { get; set; } + + /// + /// 运输类型 + /// + public string ShipmentType { get; set; } + + /// + /// 揽货人 + /// + public long? SaleId { get; set; } + + /// + /// 委托单位 + /// + public long? CustomerId { get; set; } + + /// + /// 业务日期 + /// + public DateTime? BusinessDate { get; set; } + + /// + /// 费用名称ID + /// + public long? FeeId { get; set; } + + /// + /// 业务来源 + /// + public long? SourceId { get; set; } + + /// + /// 会计期间 + /// + public string? AccountDate { get; set; } + + /// + /// 操作员 + /// + public long? OperatorId { get; set; } + } +} 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 792344f6..d1e08f50 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs @@ -54,7 +54,8 @@ namespace DS.WMS.Core.Fee.Method List flowList = null; if (string.Equals(request.OtherQueryCondition, Audit_Only)) { - flowList = await GetCurrentFlowsQuery(AuditTypes).ToListAsync(); + flowList = await GetCurrentFlowsQuery(AuditTypes) + .Select(x=>new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType } ).ToListAsync(); //没有待审批的列表直接返回不再执行后续查询 if (flowList.Count == 0) @@ -190,7 +191,8 @@ namespace DS.WMS.Core.Fee.Method List flowList = null; if (string.Equals(request.OtherQueryCondition, Audit_Only)) { - flowList = await GetCurrentFlowsQuery([AuditType.FeeBusiness.ToString()]).ToListAsync(); + flowList = await GetCurrentFlowsQuery([AuditType.FeeBusiness.ToString()]) + .Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToListAsync(); //没有待审批的列表直接返回不再执行后续查询 if (flowList.Count == 0) @@ -206,6 +208,7 @@ namespace DS.WMS.Core.Fee.Method } var result = await queryList.Select().ToQueryPageAsync(request.PageCondition); + if (result.Data.Count > 0) { //关联用户名称 @@ -317,7 +320,7 @@ namespace DS.WMS.Core.Fee.Method } /// - /// 根据查询条件获取费用明细 + /// 根据业务和查询条件获取费用明细 /// /// 业务ID /// 业务类型 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 1a07c88c..9d4d39a1 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Text; +using System.Text; using DS.Module.Core; using DS.Module.Core.Extensions; using DS.WMS.Core.Fee.Dtos; @@ -90,7 +89,7 @@ namespace DS.WMS.Core.Fee.Method } var data = await src.ToListAsync(); - return new DataResult>(ResultCode.Success) { Data = data }; + return DataResult>.Success(data); } /// @@ -139,7 +138,7 @@ namespace DS.WMS.Core.Fee.Method { var first = items.Select(x => new { x.BusinessType, x.BusinessId }).FirstOrDefault(); if (await IsFeeLockedAsync(first.BusinessId, first.BusinessType)) - return DataResult.Failed("当前业务已费用锁定,禁止提交", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.FeeLocked); DateTime dtNow = DateTime.Now; await TenantDb.Ado.BeginTranAsync(); @@ -162,7 +161,7 @@ namespace DS.WMS.Core.Fee.Method { if (fe.FeeStatus != FeeStatus.Entering && fe.FeeStatus != FeeStatus.RejectSubmission) { - sb.Append($"费用【{fe.FeeName}】状态不正确,无法修改;"); + sb.AppendFormat(MultiLanguageConst.FeeRecordStatus, fe.FeeName); continue; } } @@ -212,13 +211,13 @@ namespace DS.WMS.Core.Fee.Method await TenantDb.Ado.CommitTranAsync(); var list = createList.Union(updateList).Select(x => x.Adapt()); - return DataResult.Successed("保存成功", list, MultiLanguageConst.DataUpdateSuccess); + return DataResult.Success; } catch (Exception ex) { await TenantDb.Ado.RollbackTranAsync(); await ex.LogAsync(Db); - return DataResult.Failed("保存失败", MultiLanguageConst.DataUpdateFailed); + return DataResult.Failed(MultiLanguageConst.Operation_Failed); } finally { @@ -239,7 +238,7 @@ namespace DS.WMS.Core.Fee.Method 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); + return DataResult.Failed(MultiLanguageConst.FeeRecordExist); var details = await TenantDb.Queryable().Where(x => tidArray.Contains(x.TemplateId) && !x.Deleted).Select(x => new { @@ -281,7 +280,7 @@ namespace DS.WMS.Core.Fee.Method await WriteBackStatusAsync(bid, businessType); - return result > 0 ? DataResult.Successed("保存成功", records, MultiLanguageConst.DataCreateSuccess) : DataResult.Successed("操作失败!", MultiLanguageConst.Operation_Failed); + return result > 0 ? DataResult.Success : DataResult.Successed(MultiLanguageConst.Operation_Failed); } /// @@ -293,16 +292,16 @@ namespace DS.WMS.Core.Fee.Method { 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); + return DataResult.Failed(MultiLanguageConst.FeeLocked); if (await TenantDb.Queryable().AnyAsync(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission))) - return DataResult.Failed("只能删除状态为‘录入’或‘驳回提交’的费用", MultiLanguageConst.FeeRecordDelete); + return DataResult.Failed(MultiLanguageConst.FeeRecordDelete); int result = await TenantDb.Deleteable(x => ids.Contains(x.Id)).ExecuteCommandAsync(); await WriteBackStatusAsync(model.BusinessId, model.BusinessType); - return result > 0 ? DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess) : DataResult.Failed("删除失败!", MultiLanguageConst.Operation_Failed); + return result > 0 ? DataResult.Success : DataResult.Failed(MultiLanguageConst.Operation_Failed); } /// @@ -325,21 +324,21 @@ namespace DS.WMS.Core.Fee.Method BusinessType = x.BusinessType }).ToListAsync(); if (fees.IsNullOrEmpty()) - return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.FeeRecordNotExist); var bid = fees[0].BusinessId; var bType = fees[0].BusinessType; //业务状态检测 if (await IsFeeLockedAsync(bid, bType)) - return DataResult.Failed("当前业务已费用锁定,禁止提交", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.FeeLocked); if (fees.Any(x => x.FlowId.HasValue)) - return DataResult.Failed("当前费用包含正在审批中的费用,无法提交", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.FeeRecordIsAuditing); if (fees.Any(x => x.FeeStatus == FeeStatus.PartialSettlement || x.FeeStatus == FeeStatus.SettlementCompleted)) - return DataResult.Failed("当前审批费用包含已结算/部分结算的费用,无法提交", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.FeeRecordIsSettled); - DataResult result = DataResult.Failed(string.Empty, MultiLanguageConst.Operation_Failed); + DataResult result = DataResult.Failed(MultiLanguageConst.Operation_Failed); await TenantDb.Ado.BeginTranAsync(); try { @@ -367,13 +366,13 @@ namespace DS.WMS.Core.Fee.Method x.FlowId }).ExecuteCommandAsync(); await TenantDb.Ado.CommitTranAsync(); - return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); + return DataResult.Success; } catch (Exception ex) { await TenantDb.Ado.RollbackTranAsync(); await ex.LogAsync(Db); - return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.Operation_Failed); } } @@ -385,7 +384,7 @@ namespace DS.WMS.Core.Fee.Method { if (fe.FeeStatus != FeeStatus.Entering && fe.FeeStatus != FeeStatus.RejectSubmission) { - sb.Append($"费用【{fe.FeeName}】状态不正确,无法提交审批;"); + sb.AppendFormat(MultiLanguageConst.FeeRecordStatus, fe.FeeName); continue; } } @@ -394,7 +393,7 @@ namespace DS.WMS.Core.Fee.Method var template = await FindTemplateAsync(AuditType.FeeAudit); if (template == null) - return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.TemplateNotFound); DateTime dtNow = DateTime.Now; foreach (var item in fees) @@ -429,7 +428,7 @@ namespace DS.WMS.Core.Fee.Method { if (fe.FeeStatus != FeeStatus.AuditPassed && fe.FeeStatus != FeeStatus.RejectApplication) { - sb.Append($"费用【{fe.FeeName}】状态不正确,无法提交审批;"); + sb.AppendFormat(MultiLanguageConst.FeeRecordStatus, fe.FeeName); continue; } } @@ -438,7 +437,7 @@ namespace DS.WMS.Core.Fee.Method var template = await FindTemplateAsync(AuditType.FeeDelete); if (template == null) - return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.TemplateNotFound); DateTime dtNow = DateTime.Now; foreach (var item in fees) @@ -481,14 +480,14 @@ namespace DS.WMS.Core.Fee.Method FeeStatus = x.FeeStatus }).ToListAsync(); if (fees.Count == 0) - return DataResult.Failed("未能获取费用信息", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.FeeRecordNotExist); StringBuilder sb = new StringBuilder(); foreach (var fe in fees) { if (fe.FeeStatus != FeeStatus.AuditPassed && fe.FeeStatus != FeeStatus.RejectApplication) { - sb.Append($"费用【{fe.FeeName}】状态不正确,无法提交审批;"); + sb.AppendFormat(MultiLanguageConst.FeeRecordStatus, fe.FeeName); continue; } } @@ -497,7 +496,7 @@ namespace DS.WMS.Core.Fee.Method var template = await FindTemplateAsync(AuditType.FeeModify); if (template == null) - return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.TemplateNotFound); DateTime dtNow = DateTime.Now; await TenantDb.Ado.BeginTranAsync(); @@ -530,13 +529,13 @@ namespace DS.WMS.Core.Fee.Method await TenantDb.Updateable(fees).UpdateColumns(x => new { x.FeeStatus, x.FlowId }).ExecuteCommandAsync(); await TenantDb.Ado.CommitTranAsync(); - return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); + return DataResult.Success; } catch (Exception ex) { await TenantDb.Ado.RollbackTranAsync(); await ex.LogAsync(Db); - return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.Operation_Failed); } } @@ -557,14 +556,14 @@ namespace DS.WMS.Core.Fee.Method }).ToListAsync(); if (fees.Count == 0) - return DataResult.Failed("未能找到费用记录", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.TemplateNotFound); //未在审批状态中 var fees2 = fees.FindAll(x => x.FlowId == null).ToList(); if (fees2.Count > 0) { string msg = string.Join("; ", fees2.Select(x => $"{x.FeeName}")); - return DataResult.Failed($"以下费用项:{msg} 未在审批状态中,无需撤销", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(string.Format(MultiLanguageConst.NoNeedWithdraw, msg)); } var flows = fees.Select(x => new FlowInstance { Id = x.FlowId.Value, FlowStatus = (int)FlowStatusEnum.Draft, MakerList = string.Empty }).ToList(); @@ -605,13 +604,13 @@ namespace DS.WMS.Core.Fee.Method await TenantDb.Updateable(fees).UpdateColumns(x => new { x.Id, x.FeeStatus, x.SubmitBy, x.SubmitDate, x.FlowId }).ExecuteCommandAsync(); await TenantDb.Ado.CommitTranAsync(); - return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); + return DataResult.Success; } catch (Exception ex) { await TenantDb.Ado.RollbackTranAsync(); await ex.LogAsync(Db); - return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.Operation_Failed); } } @@ -628,23 +627,25 @@ namespace DS.WMS.Core.Fee.Method x.BusinessType == BusinessType.OceanShippingExport).Select(x => new BusinessFeeStatus { Id = x.Id, + BusinessId = x.BusinessId, + BusinessType = x.BusinessType, IsFeeLocking = x.IsFeeLocking, BillAuditStatus = x.BillAuditStatus, FlowId = x.FlowId }).FirstAsync(); if (entity == null) - return DataResult.Failed("未能找到业务信息", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.BusinessNotFound); if (entity.IsFeeLocking.GetValueOrDefault()) - return DataResult.Failed("当前业务已费用锁定,禁止提交", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.FeeLocked); if (entity.FlowId.HasValue) - return DataResult.Failed($"当前业务正在审批中,无法提交", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.FeeRecordIsAuditing); if (entity.BillAuditStatus == BillAuditStatus.AuditPassed) - return DataResult.Failed($"当前业务的费用状态为:{entity.BillAuditStatus.GetDescription()},无法提交", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription())); var template = await FindTemplateAsync(AuditType.FeeBusiness); if (template == null) - return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.TemplateNotFound); var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq { @@ -670,12 +671,13 @@ namespace DS.WMS.Core.Fee.Method }).ExecuteCommandAsync(); //修改关联费用状态为提交审核 + await TenantDb.Updateable().Where(x => x.BusinessId == entity.BusinessId && x.BusinessType == entity.BusinessType) + .SetColumns(x => x.FeeStatus, FeeStatus.AuditSubmitted).ExecuteCommandAsync(); - - return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); + return DataResult.Success; } - return DataResult.Failed("创建工作流失败", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.Operation_Failed); } /// @@ -688,7 +690,7 @@ namespace DS.WMS.Core.Fee.Method { var list = idArray.Select(x => new FeeRecord { Id = x, IsInvoice = enabled }).ToList(); int rows = await TenantDb.Updateable(list).UpdateColumns(x => new { x.IsInvoice }).ExecuteCommandAsync(); - return rows > 0 ? DataResult.Successed("设置成功!", MultiLanguageConst.DataUpdateSuccess) : DataResult.Failed("设置失败!", MultiLanguageConst.Operation_Failed); + return rows > 0 ? DataResult.Success : DataResult.Failed(MultiLanguageConst.Operation_Failed); } /// @@ -707,7 +709,7 @@ namespace DS.WMS.Core.Fee.Method x.Name }).FirstAsync(); if (model == null) - return DataResult.Failed("未能找到费用对象信息,设置失败!", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(MultiLanguageConst.ItemNotFound); var list = idArray.Select(x => new FeeRecord { @@ -718,7 +720,7 @@ namespace DS.WMS.Core.Fee.Method CustomerType = customerType }).ToList(); 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); + return rows > 0 ? DataResult.Success : DataResult.Failed(MultiLanguageConst.Operation_Failed); } /// @@ -739,8 +741,8 @@ namespace DS.WMS.Core.Fee.Method break; default: - return DataResult.Failed( - $"不支持业务类型为【{businessType.GetDescription()}】的费用打印", MultiLanguageConst.Operation_Failed); + return DataResult.Failed(string.Format( + MultiLanguageConst.BusinessNotSupported, businessType.GetDescription())); } if (form != null) @@ -748,17 +750,17 @@ namespace DS.WMS.Core.Fee.Method long UserId = long.Parse(User.UserId); form.Creator = Db.Queryable().Where(x => x.Id == UserId).Select(x => x.NickName).First(); - form.ReceivableRMB = form.Details.FindAll(x => x.Type == FeeType.Receivable && x.Currency == "CNY").Sum(x => x.Amount); - form.PayableRMB = form.Details.FindAll(x => x.Type == FeeType.Payable && x.Currency == "CNY").Sum(x => x.Amount); - form.ReceivableUSD = form.Details.FindAll(x => x.Type == FeeType.Receivable && x.Currency == "USD").Sum(x => x.Amount); - form.PayableUSD = form.Details.FindAll(x => x.Type == FeeType.Payable && x.Currency == "USD").Sum(x => x.Amount); - form.ReceivableOther = form.Details.FindAll(x => x.Type == FeeType.Receivable && (x.Currency != "CNY" && x.Currency != "USD")).Sum(x => x.Amount); - form.PayableOther = form.Details.FindAll(x => x.Type == FeeType.Payable && (x.Currency == "CNY" && x.Currency != "USD")).Sum(x => x.Amount); + form.ReceivableRMB = form.Details.FindAll(x => x.Type == FeeType.Receivable && x.Currency == RMB_CODE).Sum(x => x.Amount); + form.PayableRMB = form.Details.FindAll(x => x.Type == FeeType.Payable && x.Currency == RMB_CODE).Sum(x => x.Amount); + form.ReceivableUSD = form.Details.FindAll(x => x.Type == FeeType.Receivable && x.Currency == USD_CODE).Sum(x => x.Amount); + form.PayableUSD = form.Details.FindAll(x => x.Type == FeeType.Payable && x.Currency == USD_CODE).Sum(x => x.Amount); + form.ReceivableOther = form.Details.FindAll(x => x.Type == FeeType.Receivable && (x.Currency != RMB_CODE && x.Currency != USD_CODE)).Sum(x => x.Amount); + form.PayableOther = form.Details.FindAll(x => x.Type == FeeType.Payable && (x.Currency == RMB_CODE && x.Currency != USD_CODE)).Sum(x => x.Amount); //获取美元汇率 var fees = new List { - new FeeRecord { Currency = "USD", FeeType = FeeType.Receivable }, - new FeeRecord { Currency = "USD", FeeType = FeeType.Payable } + new FeeRecord { Currency = USD_CODE, FeeType = FeeType.Receivable }, + new FeeRecord { Currency = USD_CODE, FeeType = FeeType.Payable } }; await FetchExchangeRateAsync(fees); form.ExchangeRate = fees[0].ExchangeRate.HasValue ? fees[0].ExchangeRate.Value : 1; diff --git a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt index 1357667f..6c0d440a 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -1615,3 +1615,10 @@ 2024-06-26 15:35:24.8370 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config 2024-06-26 15:35:24.8453 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-06-26 15:35:24.8453 Info Configuration initialized. +2024-06-27 13:58:07.6301 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-06-27 13:58:07.6596 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-06-27 13:58:07.6624 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-06-27 13:58:07.6624 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-06-27 13:58:07.6624 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-06-27 13:58:07.6624 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-06-27 13:58:07.6624 Info Configuration initialized.