From f09b649d371923b007a6f4048a93fa29b7e80d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Thu, 30 May 2024 16:51:13 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Fee/Interface/IFeeRecordService.cs | 4 +- .../Fee/Method/FeeRecordService.cs | 89 +++++++++---------- .../FolderProfile1.pubxml.user | 2 +- .../FolderProfile1.pubxml.user | 2 +- 4 files changed, 48 insertions(+), 49 deletions(-) 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 3b6f8a3f..e0f6be61 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs @@ -63,9 +63,9 @@ public interface IFeeRecordService /// /// 撤销审批 /// - /// 费用记录ID + /// 费用记录ID /// - DataResult Withdraw(params long[] idArray); + DataResult Withdraw(params long[] ids); /// /// 根据审批结果更新审批状态 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 a35d2991..1a1f480d 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs @@ -254,16 +254,16 @@ namespace DS.WMS.Core.Fee.Method /// 根据模板ID创建 /// /// 业务ID - /// 业务类型 + /// 业务类型 /// 模板ID /// - public DataResult CreateByTemplate(long bid, BusinessType type, params long[] tidArray) + public DataResult CreateByTemplate(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 && tidArray.Contains(y.TemplateId) && !y.Deleted); + x.BusinessId == bid && x.BusinessType == businessType && tidArray.Contains(y.TemplateId) && !y.Deleted); if (hasExists) return DataResult.Failed("费用记录已存在", MultiLanguageConst.FeeRecordExist); @@ -306,23 +306,11 @@ namespace DS.WMS.Core.Fee.Method int result = tenantDb.Insertable(records).ExecuteCommand(); - WriteBackStatus(tenantDb, bid, type); + WriteBackStatus(tenantDb, bid, businessType); return result > 0 ? DataResult.Successed("保存成功", records, MultiLanguageConst.DataCreateSuccess) : DataResult.Successed("操作失败!", MultiLanguageConst.Operation_Failed); } - /// - /// 根据费用明细转换为模板明细 - /// - /// 费用明细ID - /// - public DataResult> ReadAsTemplate(params long[] idArray) - { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var list = tenantDb.Queryable().Where(x => idArray.Contains(x.Id)).Select().ToList(); - return new DataResult>(ResultCode.Success) { Data = list }; - } - /// /// 删除 /// @@ -355,14 +343,15 @@ namespace DS.WMS.Core.Fee.Method public DataResult SubmitForApproval(FeeAuditType auditType, params long[] idArray) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var fees = tenantDb.Queryable().Where(x => idArray.Contains(x.Id)).Select(x => new FeeRecord - { - Id = x.Id, - FeeName = x.FeeName, - FeeStatus = x.FeeStatus, - FlowId = x.FlowId, - BusinessId = x.BusinessId - }).ToList(); + var fees = tenantDb.Queryable().Where(x => idArray.Contains(x.Id)).Select( + x => new FeeRecord + { + Id = x.Id, + FeeName = x.FeeName, + FeeStatus = x.FeeStatus, + FlowId = x.FlowId, + BusinessId = x.BusinessId + }).ToList(); if (fees.IsNullOrEmpty()) return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed); @@ -511,9 +500,10 @@ namespace DS.WMS.Core.Fee.Method /// public DataResult SubmitForModification(IEnumerable items) { + var bizType = items.FirstOrDefault()?.BusinessType; 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 = tenantDb.Queryable().Where(x => idList.Contains(x.Id) && x.BusinessType == bizType).Select(x => new FeeRecord { Id = x.Id, FeeName = x.FeeName, @@ -589,14 +579,19 @@ namespace DS.WMS.Core.Fee.Method BusinessFeeStatus businessFee = null; if (auditType == FeeAuditType.Business) { - businessFee = tenantDb.Queryable().Where(x => x.Id == callback.BusinessId).Select( - x => new BusinessFeeStatus { Id = x.Id, BusinessId = x.BusinessId, BillAuditStatus = x.BillAuditStatus }).First(); + businessFee = 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(); if (businessFee == null) return DataResult.Failed("未能找到业务信息,更新状态失败", MultiLanguageConst.Operation_Failed); } else { - fee = tenantDb.Queryable().Where(x => x.Id == callback.BusinessId).Select( + fee = tenantDb.Queryable().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType).Select( x => new FeeRecord { Id = x.Id, FeeStatus = x.FeeStatus }).First(); if (fee == null) return DataResult.Failed("未能找到费用记录,更新状态失败", MultiLanguageConst.Operation_Failed); @@ -636,9 +631,6 @@ namespace DS.WMS.Core.Fee.Method //申请修改审核成功需要回填费用信息 if (callback.FlowStatus == FlowStatusEnum.Approve) { - fee.FeeStatus = FeeStatus.AuditPassed; - fee.Reason = string.Empty; - var fm = tenantDb.Queryable().Where(x => x.FeeRecordId == fee.Id).OrderByDescending(x => x.CreateTime).First(); if (fm == null) return DataResult.Failed("未找到费用修改信息,更新失败", MultiLanguageConst.Operation_Failed); @@ -648,6 +640,10 @@ namespace DS.WMS.Core.Fee.Method entity.Reason = callback.RejectReason; fee = entity; + //全表更新 + tenantDb.Updateable(fee).ExecuteCommand(); + + //逻辑删除暂存数据 fm.Deleted = true; fm.DeleteTime = DateTime.Now; fm.DeleteBy = long.Parse(user.UserId); @@ -660,15 +656,17 @@ namespace DS.WMS.Core.Fee.Method }).ExecuteCommand(); } else if (callback.FlowStatus == FlowStatusEnum.Reject) + { fee.FeeStatus = FeeStatus.RejectApplication; + tenantDb.Updateable(fee).UpdateColumns(x => new + { + x.Id, + x.FeeStatus, + x.Reason, + x.FlowId + }).ExecuteCommand(); + } - tenantDb.Updateable(fee).UpdateColumns(x => new - { - x.Id, - x.FeeStatus, - x.Reason, - x.FlowId - }).ExecuteCommand(); break; case FeeAuditType.ApplyDeletion: if (callback.FlowStatus == FlowStatusEnum.Approve) @@ -752,13 +750,14 @@ namespace DS.WMS.Core.Fee.Method public DataResult Withdraw(params long[] idArray) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var fees = 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(); + var fees = 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(); if (fees.IsNullOrEmpty()) return DataResult.Failed("未能找到费用记录", MultiLanguageConst.Operation_Failed); 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 5cbc5177..93bee96a 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-05-29T07:44:18.4051203Z||;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-05-30T08:18:06.9957657Z||;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 diff --git a/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile1.pubxml.user b/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile1.pubxml.user index 8e847f75..fe883010 100644 --- a/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile1.pubxml.user +++ b/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile1.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>D:\Publish\DS8\Main - True|2024-05-30T01:30:24.9756841Z||;True|2024-05-29T17:46:22.9869679+08:00||;True|2024-05-29T17:20:28.9621862+08:00||;True|2024-05-29T17:18:16.4688274+08:00||;True|2024-05-29T16:33:42.5152962+08:00||;False|2024-05-29T16:33:09.8393409+08:00||;False|2024-05-29T16:31:07.7569208+08:00||;True|2024-05-28T18:00:39.2399003+08:00||;True|2024-05-28T08:47:53.8630073+08:00||;True|2024-05-23T17:51:45.6784172+08:00||;True|2024-05-21T17:32:52.9294009+08:00||; + True|2024-05-30T08:18:14.8047074Z||;True|2024-05-30T09:30:24.9756841+08:00||;True|2024-05-29T17:46:22.9869679+08:00||;True|2024-05-29T17:20:28.9621862+08:00||;True|2024-05-29T17:18:16.4688274+08:00||;True|2024-05-29T16:33:42.5152962+08:00||;False|2024-05-29T16:33:09.8393409+08:00||;False|2024-05-29T16:31:07.7569208+08:00||;True|2024-05-28T18:00:39.2399003+08:00||;True|2024-05-28T08:47:53.8630073+08:00||;True|2024-05-23T17:51:45.6784172+08:00||;True|2024-05-21T17:32:52.9294009+08:00||; \ No newline at end of file