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 934d60c7..44c7324d 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs @@ -104,7 +104,7 @@ namespace DS.WMS.Core.Fee.Dtos [IgnoreDataMember] public long? SourceId { get; set; } - public string Source { get; set; } + public string SourceName { get; set; } /// /// 来源明细 @@ -112,7 +112,7 @@ namespace DS.WMS.Core.Fee.Dtos [IgnoreDataMember] public long? SourceDetailId { get; set; } - public string SourceDetail { get; set; } + public string DetailName { get; set; } /// /// 经营单位 @@ -259,7 +259,7 @@ namespace DS.WMS.Core.Fee.Dtos /// /// 订舱公司 /// - public string BookingCompany { get; set; } + public string Forwarder { 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 b051a372..030ad73f 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs @@ -32,7 +32,7 @@ namespace DS.WMS.Core.Fee.Interface /// 审批结果:1=通过,2=驳回 /// 备注 /// - DataResult AuditBusiness(int yesOrNo, string remark); + DataResult Audit(int yesOrNo, string remark); /// /// 整单费用状态审核 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 98001da7..a5a10fc8 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs @@ -2,6 +2,7 @@ using DS.Module.Core.Extensions; using DS.Module.SqlSugar; using DS.Module.UserModule; +using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Fee.Interface; @@ -26,6 +27,11 @@ namespace DS.WMS.Core.Fee.Method /// public static readonly FeeStatus[] AuditStatusArray = [FeeStatus.AuditSubmitted, FeeStatus.ApplyDeletion, FeeStatus.ApplyModification]; + /// + /// 一键审核支持的类型 + /// + public static readonly string[] AuditTypes = [FeeAuditType.ApplyAudit.ToString(), FeeAuditType.ApplyModification.ToString(), FeeAuditType.ApplyDeletion.ToString()]; + /// /// 工作流运行状态值 /// @@ -53,26 +59,25 @@ namespace DS.WMS.Core.Fee.Method /// public DataResult> GetListByPage(PageRequest request) { - var flowList = db.Queryable().Where(x => x.FlowStatus == RunningStatus && x.MakerList.Contains(user.UserId)) - .Select(x => new { x.BusinessId, x.BusinessType }).ToList(); + var flowList = 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(); //没有待审批的列表直接返回不再执行后续查询 if (flowList.Count == 0) DataResult>.PageList(0, null, MultiLanguageConst.DataQuerySuccess); var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var queryList = GetDataQuery(tenantDb); - var bidList = flowList.Select(x => x.BusinessId); - queryList = queryList.Where(x => bidList.Contains(x.Id)); + var queryList = CreateQuery(tenantDb, flowList); + //queryList = queryList.Where(x => SqlFunc.Subqueryable().Where( + // y => y.BusinessId == x.Id && y.BusinessType == x.BusinessType && SqlFunc.SplitIn(y.MakerList, user.UserId)).Any()); - List whereList = null; if (!request.QueryCondition.IsNullOrEmpty()) - whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - - if (whereList != null) + { + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); queryList = queryList.Where(whereList); + } var result = queryList.ToQueryPage(request.PageCondition); - if (result.Data.Count > 0) { //关联用户名称 @@ -94,16 +99,20 @@ namespace DS.WMS.Core.Fee.Method return result; } - //获取各项业务数据的查询并集 - internal static ISugarQueryable GetDataQuery(SqlSugarScopeProvider tenantDb) + //创建各项业务数据的查询并集 + internal static ISugarQueryable CreateQuery(SqlSugarScopeProvider tenantDb, IEnumerable additions) { //海运出口 - var query1 = tenantDb.Queryable((s, b, f) => new JoinQueryInfos( + var ids1 = additions?.Where(x => x.BusinessType == BusinessType.OceanShippingExport).Select(x => x.BusinessId).ToArray(); + 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.Inner, s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport && AuditStatusArray.Contains(f.FeeStatus), + 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)) .GroupBy(s => s.Id) - .Select((s, b, f) => new FeeAuditBusiness + .Select((s, b, f, cs, csd) => new FeeAuditBusiness { Id = s.Id, AccountDate = SqlFunc.ToDate(s.AccountDate), @@ -113,8 +122,6 @@ namespace DS.WMS.Core.Fee.Method BusinessStatus = s.BusinessStatusName, BusinessDate = s.BusinessDate,//业务日期 BLType = s.BLType, - //BookingCompany = //订舱公司 - //BusinessUnit = //经营单位 CargoId = s.CargoId, Carrier = s.Carrier, AgencyId = s.AgentId, @@ -133,6 +140,7 @@ namespace DS.WMS.Core.Fee.Method DischargePort = s.DischargePort, Doc = s.Doc, ETD = s.ETD, + Forwarder = s.Forwarder, GoodsName = s.GoodsName, HBLNO = s.HBLNO, InvoiceNo = s.InvoiceNo, @@ -150,17 +158,29 @@ namespace DS.WMS.Core.Fee.Method ReceiptPlace = s.ReceiptPlace, Remark = s.Remark, SaleDeptId = s.SaleDeptId, - SaleId = s.SaleId,//揽货人 - SaleName = s.Sale, + //SaleDeptName //所属部门 + SaleId = s.SaleId, + SaleName = s.Sale,//揽货人 SourceId = s.SourceId, + SourceName = cs.SourceName, SourceDetailId = s.SourceDetailId, + DetailName = csd.DetailName, TradeTerm = s.TradeTerm, + TransitTerms = s.Service,//运输条款 Vessel = s.Vessel,//船名 Voyage = s.Voyno,//航次 Yard = s.Yard + //BusinessUnit = //经营单位 + //ChangeOrder //更改单 + //ChangeReason //更改单更改原因 + //FreightRatio //运杂费比例 + //查询:运输类型 (枚举值,暂未建立) + //查询:是否费用提交 + //查询:利润减少 }); //海运进口 + //var ids2 = additions?.Where(x => x.BusinessType == BusinessType.OceanShippingImport).Select(x => x.BusinessId).ToArray(); return tenantDb.UnionAll(new List> { query1 }); } @@ -234,22 +254,16 @@ namespace DS.WMS.Core.Fee.Method /// 审批结果:1=通过,2=驳回 /// 备注 /// - public DataResult AuditBusiness(int yesOrNo, string remark) + public DataResult Audit(int yesOrNo, string remark) { - var flowList = db.Queryable().Where(x => x.FlowStatus == RunningStatus && x.MakerList.Contains(user.UserId)) - .Select(x => new { x.BusinessId, x.BusinessType }).ToList(); + var recordIds = db.Queryable().Where(x => x.FlowStatus == RunningStatus && + SqlFunc.SplitIn(x.MakerList, user.UserId) && AuditTypes.Contains(x.AuditType)) + .Select(x => x.BusinessId).ToArray(); //没有待审批的列表直接返回不再执行后续查询 - if (flowList.Count == 0) + if (recordIds.Length == 0) return DataResult.Failed("当前暂无待审批的费用"); - var request = new FeeBizAuditRequest - { - Items = flowList.Select(x => new BizAudit { Id = x.BusinessId, BusinessType = x.BusinessType }).ToList(), - Remark = remark, - Result = yesOrNo - }; - - return AuditBusiness(request); + return Audit(yesOrNo, remark, recordIds); } /// @@ -282,7 +296,8 @@ namespace DS.WMS.Core.Fee.Method return DataResult.Failed("业务的审批状态不正确"); var fIdArr = bizList.Select(x => x.FlowId).ToArray(); - var flows = db.Queryable().Where(x => fIdArr.Contains(x.Id)).ToList(); + string auditType = FeeAuditType.Business.ToString(); + var flows = db.Queryable().Where(x => fIdArr.Contains(x.Id) && x.AuditType == auditType).ToList(); if (flows.Count == 0) return DataResult.Failed("未能获取审批工作流"); diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs index 131bbc28..22d2c663 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs @@ -60,7 +60,7 @@ namespace DS.WMS.FeeApi.Controllers if (status != 1 && status != 2) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - return _auditService.AuditBusiness(status, remark); + return _auditService.Audit(status, remark); } /// 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 4acddc16..5dc02d29 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -1020,3 +1020,38 @@ 2024-06-04 17:02:33.6570 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-04 17:02:33.6570 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-06-04 17:02:33.6570 Info Configuration initialized. +2024-06-05 11:35:20.3506 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-06-05 11:35:20.3770 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-06-05 11:35:20.3770 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-06-05 11:35:20.3897 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-05 11:35:20.3897 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-05 11:35:20.3897 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-06-05 11:35:20.3897 Info Configuration initialized. +2024-06-05 11:45:01.6040 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-06-05 11:45:01.6245 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-06-05 11:45:01.6439 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-06-05 11:45:01.6608 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-05 11:45:01.6608 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-05 11:45:01.6748 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-06-05 11:45:01.6748 Info Configuration initialized. +2024-06-05 11:52:49.4697 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-06-05 11:52:49.5104 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-06-05 11:52:49.5169 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-06-05 11:52:49.5385 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-05 11:52:49.5652 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-05 11:52:49.5652 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-06-05 11:52:49.5975 Info Configuration initialized. +2024-06-05 11:54:40.1696 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-06-05 11:54:40.2250 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-06-05 11:54:40.2250 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-06-05 11:54:40.2625 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-05 11:54:40.2625 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-05 11:54:40.2625 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-06-05 11:54:40.2806 Info Configuration initialized. +2024-06-05 13:49:01.3062 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-06-05 13:49:01.3282 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-06-05 13:49:01.3282 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-06-05 13:49:01.3461 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-05 13:49:01.3461 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-05 13:49:01.3530 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-06-05 13:49:01.3530 Info Configuration initialized.