From 2b32afc508b563bf9f5573ca494bc0d776037254 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:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=A2=9E=E5=8A=A0BusinessTyp?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.Module.Core/Enums/FeeStatus.cs | 56 ++++++- .../DS.WMS.Core/Fee/Dtos/FeeRecordSubmit.cs | 8 +- .../DS.WMS.Core/Fee/Entity/FeeModification.cs | 16 +- .../DS.WMS.Core/Fee/Entity/FeeRecord.cs | 8 + .../Fee/Interface/IFeeRecordService.cs | 11 +- .../Fee/Method/FeeRecordService.cs | 156 +++++++++++++++--- .../Flow/Dtos/CreateFlowInstanceReq.cs | 6 + .../DS.WMS.Core/Flow/Dtos/FlowCallback.cs | 3 + .../DS.WMS.Core/Flow/Entity/FlowInstance.cs | 5 + .../Interface/IClientFlowInstanceService.cs | 3 +- .../Flow/Method/ClientFlowInstanceService.cs | 6 +- .../Flow/Method/FlowInstanceService.cs | 2 +- .../Op/Entity/BusinessFeeStatus.cs | 35 +--- .../DS.WMS.Core/Op/Method/SeaExportService.cs | 4 +- .../Controllers/FeeRecordController.cs | 11 +- .../DS.WMS.FeeApi/Logs/internal-nlog.txt | 14 ++ .../ClientFlowInstanceController.cs | 6 +- .../DS.WMS.MainApi/Logs/internal-nlog.txt | 14 ++ 18 files changed, 282 insertions(+), 82 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs b/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs index b0694487..957cf1e0 100644 --- a/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs +++ b/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs @@ -91,29 +91,77 @@ namespace DS.Module.Core [Description("部分录入")] PartialEntering = 2, + /// + /// 提交审核 + /// + [Description("提交审核")] + AuditSubmitted = 3, + + /// + /// 部分提交 + /// + [Description("部分提交")] + PartialSubmitted = 4, + /// /// 审核通过 /// [Description("审核通过")] - AuditPassed = 3, + AuditPassed = 5, /// /// 驳回提交 /// [Description("驳回提交")] - RejectSubmission = 4, + RejectSubmission = 6, + + /// + /// 部分审核 + /// + [Description("部分审核")] + PartialAudited = 7, /// /// 部分结算 /// [Description("部分结算")] - PartialSettlement = 5, + PartialSettlement = 8, /// /// 结算完毕 /// [Description("结算完毕")] - SettlementCompleted = 6 + SettlementCompleted = 9 + } + + /// + /// 整单审核状态 + /// + public enum BillAuditStatus + { + /// + /// 待提交 + /// + [Description("待提交")] + Pending = 0, + + /// + /// 提交审核 + /// + [Description("提交审核")] + AuditSubmitted = 1, + + /// + /// 审核通过 + /// + [Description("审核通过")] + AuditPassed = 2, + + /// + /// 驳回提交 + /// + [Description("驳回提交")] + Rejected = 3 } /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeRecordSubmit.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeRecordSubmit.cs index 52dd4f96..27ca166d 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeRecordSubmit.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeRecordSubmit.cs @@ -1,4 +1,6 @@ -namespace DS.WMS.Core.Fee.Dtos +using DS.WMS.Core.Op.Entity; + +namespace DS.WMS.Core.Fee.Dtos { public class FeeRecordSubmit { @@ -7,6 +9,8 @@ /// public long BusinessId { get; set; } + public BusinessType BusinessType { get; set; } + /// /// 要提交的费用项 /// @@ -20,6 +24,8 @@ /// public long BusinessId { get; set; } + public BusinessType BusinessType { get; set; } + /// /// 要引入费用模板的ID /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeModification.cs b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeModification.cs index aed3caaf..66d89f43 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeModification.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeModification.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using DS.Module.Core.Data; +using DS.WMS.Core.Op.Entity; using SqlSugar; namespace DS.WMS.Core.Fee.Entity @@ -18,6 +19,13 @@ namespace DS.WMS.Core.Fee.Entity /// [SugarColumn(ColumnDescription = "业务Id")] public long BusinessId { get; set; } + + /// + /// 业务类型 + /// + [SugarColumn(ColumnDescription = "业务类型")] + public BusinessType BusinessType { get; set; } + /// /// 收付类型(收、付) 1应收 2 应付 /// @@ -308,15 +316,9 @@ namespace DS.WMS.Core.Fee.Entity [SugarColumn(ColumnDescription = "是否财务费用", IsNullable = true, DefaultValue = "0")] public bool IsAcc { get; set; } - /// - /// - /// [SugarColumn(ColumnDescription = "PaymentId", IsNullable = true, Length = 50)] public string PaymentId { get; set; } - /// - /// - /// [SugarColumn(ColumnDescription = "StatementNo", IsNullable = true, Length = 50)] public string StatementNo { get; set; } @@ -337,7 +339,5 @@ namespace DS.WMS.Core.Fee.Entity /// [SugarColumn(ColumnDescription = "发票自助连接", IsNullable = true, Length = 50)] public string InvLinkId { get; set; } - - } } diff --git a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs index edfa2518..86a35fbd 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs @@ -1,6 +1,7 @@ using System.ComponentModel; using DS.Module.Core; using DS.Module.Core.Data; +using DS.WMS.Core.Op.Entity; using SqlSugar; namespace DS.WMS.Core.Fee.Entity @@ -16,6 +17,13 @@ namespace DS.WMS.Core.Fee.Entity /// [SugarColumn(ColumnDescription = "业务Id")] public long BusinessId { get; set; } + + /// + /// 业务类型 + /// + [SugarColumn(ColumnDescription = "业务类型")] + public BusinessType BusinessType { get; set; } + /// /// 收付类型(收、付) 1应收 2 应付 /// 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 8a541dc0..3b6f8a3f 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs @@ -2,6 +2,7 @@ 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; namespace DS.WMS.Core.Fee.Interface; @@ -24,18 +25,18 @@ public interface IFeeRecordService /// /// 提交 /// - /// 业务ID /// 要提交的费用记录 /// - DataResult InsertOrUpdate(long bid, IEnumerable items); + DataResult InsertOrUpdate(IEnumerable items); /// /// 根据费用模板引入 /// - /// - /// + /// 业务ID + /// 业务类型 + /// 模板ID /// - DataResult CreateByTemplate(long bid, params long[] tidArray); + DataResult CreateByTemplate(long bid, BusinessType type, params long[] tidArray); /// /// 删除 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 46e82bff..a35d2991 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs @@ -1,4 +1,5 @@ -using System.Text; +using System.Collections.Generic; +using System.Text; using AngleSharp.Dom; using DS.Module.Core; using DS.Module.Core.Extensions; @@ -107,9 +108,10 @@ namespace DS.WMS.Core.Fee.Method /// 检查业务是否已费用锁定 /// /// 业务ID + /// 业务类型 /// 锁定范围 /// - bool IsFeeLocked(long bid, FeeType type = FeeType.All) + bool IsFeeLocked(long bid, BusinessType businessType, FeeType type = FeeType.All) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); bool? isFeeLocking = null; @@ -120,23 +122,24 @@ namespace DS.WMS.Core.Fee.Method case FeeType.Payable: break; case FeeType.All: - isFeeLocking = tenantDb.Queryable().Where(x => x.BusinessId == bid).Select(x => x.IsFeeLocking).First(); + isFeeLocking = tenantDb.Queryable().Where( + x => x.BusinessId == bid && x.BusinessType == businessType).Select(x => x.IsFeeLocking).First(); break; } return isFeeLocking.GetValueOrDefault(); } /// - /// 提交 + /// 费用提交 /// - /// 业务ID /// 要提交的费用记录 /// - public DataResult InsertOrUpdate(long bid, IEnumerable items) + public DataResult InsertOrUpdate(IEnumerable items) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - if (IsFeeLocked(bid)) + var first = items.Select(x => new { x.BusinessType, x.BusinessId }).FirstOrDefault(); + if (IsFeeLocked(first.BusinessId, first.BusinessType)) return DataResult.Failed("当前业务已费用锁定,禁止提交", MultiLanguageConst.Operation_Failed); try @@ -178,7 +181,8 @@ namespace DS.WMS.Core.Fee.Method if (item.Id == 0) { - item.BusinessId = bid; + item.BusinessId = first.BusinessId; + item.BusinessType = first.BusinessType; tenantDb.Insertable(item).ExecuteCommand(); } else @@ -211,7 +215,10 @@ namespace DS.WMS.Core.Fee.Method ex.Log(db); return DataResult.Failed("保存失败", MultiLanguageConst.DataUpdateFailed); } - + finally + { + WriteBackStatus(tenantDb, first.BusinessId, first.BusinessType); + } } //获取汇率 @@ -247,9 +254,10 @@ namespace DS.WMS.Core.Fee.Method /// 根据模板ID创建 /// /// 业务ID + /// 业务类型 /// 模板ID /// - public DataResult CreateByTemplate(long bid, params long[] tidArray) + public DataResult CreateByTemplate(long bid, BusinessType type, params long[] tidArray) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); @@ -297,6 +305,9 @@ namespace DS.WMS.Core.Fee.Method FetchExchangeRate(tenantDb, records); int result = tenantDb.Insertable(records).ExecuteCommand(); + + WriteBackStatus(tenantDb, bid, type); + return result > 0 ? DataResult.Successed("保存成功", records, MultiLanguageConst.DataCreateSuccess) : DataResult.Successed("操作失败!", MultiLanguageConst.Operation_Failed); } @@ -321,14 +332,17 @@ namespace DS.WMS.Core.Fee.Method { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var bid = tenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select(x => x.BusinessId).First(); - if (IsFeeLocked(bid)) + var model = tenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select(x => new { x.BusinessId, x.BusinessType }).First(); + if (IsFeeLocked(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))) return DataResult.Failed("只能删除状态为‘录入’或‘驳回提交’的费用", MultiLanguageConst.FeeRecordDelete); int result = tenantDb.Deleteable(x => ids.Contains(x.Id)).ExecuteCommand(); + + WriteBackStatus(tenantDb, model.BusinessId, model.BusinessType); + return result > 0 ? DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess) : DataResult.Failed("删除失败!", MultiLanguageConst.Operation_Failed); } @@ -352,8 +366,10 @@ namespace DS.WMS.Core.Fee.Method if (fees.IsNullOrEmpty()) return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed); + var bid = fees[0].BusinessId; + var bType = fees[0].BusinessType; //业务状态检测 - if (IsFeeLocked(fees[0].BusinessId)) + if (IsFeeLocked(bid, bType)) return DataResult.Failed("当前业务已费用锁定,禁止修改", MultiLanguageConst.Operation_Failed); if (fees.Any(x => x.FlowId.HasValue)) @@ -389,7 +405,6 @@ namespace DS.WMS.Core.Fee.Method x.SubmitDate, x.FlowId }).ExecuteCommand(); - tenantDb.Ado.CommitTran(); return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess); } @@ -423,7 +438,12 @@ namespace DS.WMS.Core.Fee.Method DateTime dtNow = DateTime.Now; foreach (var item in fees) { - var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq { BusinessId = item.Id, TemplateId = template.Id }); + var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq + { + BusinessId = item.Id, + BusinessType = item.BusinessType, + TemplateId = template.Id + }); if (result.Succeeded) { var instance = result.Data as FlowInstance; @@ -462,7 +482,12 @@ namespace DS.WMS.Core.Fee.Method DateTime dtNow = DateTime.Now; foreach (var item in fees) { - var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq { BusinessId = item.Id, TemplateId = template.Id }); + var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq + { + BusinessId = item.Id, + BusinessType = item.BusinessType, + TemplateId = template.Id + }); if (result.Succeeded) { var instance = result.Data as FlowInstance; @@ -488,7 +513,7 @@ namespace DS.WMS.Core.Fee.Method { var idList = items.Select(x => x.FeeRecordId).Distinct().ToList(); var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var fees = tenantDb.Queryable().Select(x => new FeeRecord + var fees = tenantDb.Queryable().Where(x => idList.Contains(x.Id)).Select(x => new FeeRecord { Id = x.Id, FeeName = x.FeeName, @@ -517,7 +542,12 @@ namespace DS.WMS.Core.Fee.Method { foreach (var fee in fees) { - var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq { BusinessId = fee.Id, TemplateId = template.Id }); + var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq + { + BusinessId = fee.Id, + BusinessType = fee.BusinessType, + TemplateId = template.Id + }); if (result.Succeeded) { var instance = result.Data as FlowInstance; @@ -678,8 +708,8 @@ namespace DS.WMS.Core.Fee.Method tenantDb.Updateable(). SetColumns(x => x.FeeStatus == status). - SetColumns(x=>x.FlowId == null). - Where(x => x.BusinessId == businessFee.BusinessId && + SetColumns(x => x.FlowId == null). + Where(x => x.BusinessId == businessFee.BusinessId && (x.FeeStatus == FeeStatus.Entering || x.FeeStatus == FeeStatus.RejectSubmission)).ExecuteCommand(); break; @@ -708,6 +738,10 @@ namespace DS.WMS.Core.Fee.Method ex.Log(db); return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed); } + finally + { + WriteBackStatus(tenantDb, callback.BusinessId, callback.BusinessType); + } } /// @@ -809,7 +843,12 @@ namespace DS.WMS.Core.Fee.Method if (template == null) return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed); - var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq { BusinessId = entity.Id, TemplateId = template.Id }); + var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq + { + BusinessId = entity.Id, + BusinessType = entity.BusinessType, + TemplateId = template.Id + }); if (result.Succeeded) { var instance = result.Data as FlowInstance; @@ -836,9 +875,82 @@ namespace DS.WMS.Core.Fee.Method //回写业务主表的费用状态 - void WriteBackStatus(SqlSugarScopeProvider tenantDb, List fees) + void WriteBackStatus(SqlSugarScopeProvider tenantDb, long businessId, BusinessType businessType) { + var fees = 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(); + var arFeeStatus = DetermineStatus(fees.FindAll(x => x.FeeType == FeeType.Receivable)); + var apFeeStatus = DetermineStatus(fees.FindAll(x => x.FeeType == FeeType.Payable)); + + if (arFeeStatus != null || apFeeStatus != null) + { + var upt = tenantDb.Updateable(); + if (arFeeStatus != null) + { + upt = upt.SetColumns(x => x.ARFeeStatus == arFeeStatus); + } + if (apFeeStatus != null) + { + upt = upt.SetColumns(x => x.APFeeStatus == apFeeStatus); + } + + upt.Where(x => x.BusinessType == businessType && x.BusinessId == businessId) + .ExecuteCommand(); + } + } + + //业务表费用状态判定 + static BillFeeStatus? DetermineStatus(List fees) + { + BillFeeStatus? billFeeStatus = null; + if (fees.Count == 0) + { + billFeeStatus = BillFeeStatus.NotEntered; + } + else if (fees.All(x => x.FeeStatus == FeeStatus.Entering)) + { + billFeeStatus = BillFeeStatus.Entering; + } + else if (fees.All(x => x.FeeStatus == FeeStatus.AuditSubmitted)) + { + billFeeStatus = BillFeeStatus.AuditSubmitted; + } + else if (fees.All(x => x.FeeStatus == FeeStatus.AuditPassed)) + { + billFeeStatus = BillFeeStatus.AuditPassed; + } + else if (fees.All(x => x.FeeStatus == FeeStatus.RejectSubmission)) + { + billFeeStatus = BillFeeStatus.RejectSubmission; + } + else if (fees.All(x => x.FeeStatus == FeeStatus.PartialSettlement)) + { + billFeeStatus = BillFeeStatus.PartialSettlement; + } + else if (fees.All(x => x.FeeStatus == FeeStatus.SettlementCompleted)) + { + billFeeStatus = BillFeeStatus.SettlementCompleted; + } + else if (fees.Any(x => x.FeeStatus == FeeStatus.Entering)) + { + billFeeStatus = BillFeeStatus.PartialEntering; + } + else if (fees.Any(x => x.FeeStatus == FeeStatus.AuditSubmitted)) + { + billFeeStatus = BillFeeStatus.PartialSubmitted; + } + else if (fees.Any(x => x.FeeStatus == FeeStatus.AuditPassed)) + { + billFeeStatus = BillFeeStatus.PartialAudited; + } + return billFeeStatus; } /// diff --git a/ds-wms-service/DS.WMS.Core/Flow/Dtos/CreateFlowInstanceReq.cs b/ds-wms-service/DS.WMS.Core/Flow/Dtos/CreateFlowInstanceReq.cs index dc95891e..e3732414 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Dtos/CreateFlowInstanceReq.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Dtos/CreateFlowInstanceReq.cs @@ -1,3 +1,5 @@ +using DS.WMS.Core.Op.Entity; + namespace DS.WMS.Core.Flow.Dtos; /// @@ -10,6 +12,10 @@ public class CreateFlowInstanceReq /// public long BusinessId { get; set; } /// + /// 业务类型 + /// + public BusinessType BusinessType { get; set; } + /// /// 模板Id /// public long? TemplateId { get; set; } diff --git a/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowCallback.cs b/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowCallback.cs index 3df39d5b..177e8ab8 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowCallback.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowCallback.cs @@ -1,4 +1,5 @@ using DS.Module.Core; +using DS.WMS.Core.Op.Entity; namespace DS.WMS.Core.Flow.Dtos { @@ -8,6 +9,8 @@ namespace DS.WMS.Core.Flow.Dtos public long BusinessId { get; set; } + public BusinessType BusinessType { get; set; } + public string AuditType { get; set; } public FlowStatusEnum FlowStatus { get; set; } diff --git a/ds-wms-service/DS.WMS.Core/Flow/Entity/FlowInstance.cs b/ds-wms-service/DS.WMS.Core/Flow/Entity/FlowInstance.cs index 8fe5e4ba..8e43333e 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Entity/FlowInstance.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Entity/FlowInstance.cs @@ -1,6 +1,7 @@ using System.ComponentModel; using DS.Module.Core; using DS.Module.Core.Data; +using DS.WMS.Core.Op.Entity; using SqlSugar; namespace DS.WMS.Core.Flow.Entity; @@ -15,6 +16,10 @@ public class FlowInstance : BaseTenantModel /// [Description("业务Id")] public long BusinessId { get; set; } + + [Description("业务类型")] + public BusinessType BusinessType { get; set; } + /// /// 模板Id /// diff --git a/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs b/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs index 56ed6530..2259ec37 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs @@ -1,5 +1,6 @@ using DS.Module.Core; using DS.WMS.Core.Flow.Dtos; +using DS.WMS.Core.Op.Entity; namespace DS.WMS.Core.Flow.Interface; @@ -60,5 +61,5 @@ public interface IClientFlowInstanceService /// DataResult> GetFlowInstanceHistoryList(string id); - DataResult GetFlowInstance(long businessId, string type); + DataResult GetFlowInstance(long businessId, BusinessType businessType, string type); } \ No newline at end of file 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 a8a575df..0df49756 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs @@ -3,6 +3,7 @@ using DS.Module.SqlSugar; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Entity; using DS.WMS.Core.Flow.Interface; +using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Sys.Entity; using Mapster; using Microsoft.Extensions.DependencyInjection; @@ -13,7 +14,6 @@ public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanc { readonly ISaasDbService saasService; - public ClientFlowInstanceService(IServiceProvider serviceProvider) : base(serviceProvider) { saasService = serviceProvider.GetRequiredService(); @@ -67,9 +67,9 @@ public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanc return new FlowRuntime(instance, db, saasService, user); } - public DataResult GetFlowInstance(long businessId, string type) + public DataResult GetFlowInstance(long businessId, BusinessType businessType, string type) { - var entity = db.Queryable().Where(x => x.BusinessId == businessId && x.AuditType == type) + var entity = db.Queryable().Where(x => x.BusinessId == businessId && x.BusinessType == businessType && x.AuditType == type) .OrderByDescending(x => x.CreateTime).First(); var result = entity == null ? null : entity.Adapt(); return DataResult.Success(result); 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 5769153d..e326723b 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs @@ -1,4 +1,3 @@ -using System.Net; using System.Text; using DS.Module.Core; using DS.Module.Core.Extensions; @@ -427,6 +426,7 @@ public class FlowInstanceService : IFlowInstanceService { InstanceId = instance.Id, BusinessId = instance.BusinessId, + BusinessType = instance.BusinessType, AuditType = instance.AuditType, FlowStatus = (FlowStatusEnum)instance.FlowStatus, RejectReason = instance.Note diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs index 065eabf9..f9f7bfe1 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs @@ -109,6 +109,11 @@ namespace DS.WMS.Core.Op.Entity /// public enum BusinessType { + /// + /// 费用更改单 + /// + ChangeOrder = 0, + /// /// 海运出口 /// @@ -119,34 +124,4 @@ namespace DS.WMS.Core.Op.Entity /// OceanShippingImport = 2 } - - /// - /// 整单审核状态 - /// - public enum BillAuditStatus - { - /// - /// 待提交 - /// - [Description("待提交")] - Pending = 0, - - /// - /// 提交审核 - /// - [Description("提交审核")] - AuditSubmitted = 1, - - /// - /// 审核通过 - /// - [Description("审核通过")] - AuditPassed = 2, - - /// - /// 驳回提交 - /// - [Description("驳回提交")] - Rejected = 3 - } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index 4db57b01..002f583c 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -233,8 +233,8 @@ public class SeaExportService : ISeaExportService { it.SourceDetailName = tenantDb.Queryable().Where(x => x.Id == it.SourceDetailId).Select(n => n.DetailName).First(); var feeStatus = tenantDb.Queryable().First(x => x.BusinessId == it.Id); - it.ARFeeStatus = feeStatus.IsNull() ? 0 : feeStatus.ARFeeStatus; - it.APFeeStatus = feeStatus.IsNull() ? 0 : feeStatus.APFeeStatus; + it.ARFeeStatus = feeStatus.IsNull() ? 0 : (int)feeStatus.ARFeeStatus; + it.APFeeStatus = feeStatus.IsNull() ? 0 : (int)feeStatus.APFeeStatus; it.ARInvoiceStatus = feeStatus.IsNull() ? 0 : feeStatus.ARInvoiceStatus; it.APInvoiceStatus = feeStatus.IsNull() ? 0 : feeStatus.APInvoiceStatus; it.ARCheckStatus = feeStatus.IsNull() ? 0 : feeStatus.ARCheckStatus; diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs index b58a2a52..50157a00 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs @@ -70,14 +70,19 @@ namespace DS.WMS.FeeApi.Controllers [HttpPost, Route("Submit")] public DataResult Submit([FromBody] FeeRecordSubmit recordSubmit) { - if (recordSubmit == null) + if (recordSubmit == null || recordSubmit.Items.IsNullOrEmpty()) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); if (recordSubmit.Items.Any(x => x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission)) return DataResult.Failed("只能提交状态为‘录入’或‘驳回提交’的费用", MultiLanguageConst.IllegalRequest); var list = recordSubmit.Items.Select(x => x.Adapt()); - return _feeService.InsertOrUpdate(recordSubmit.BusinessId, list); + foreach (var item in list) + { + item.BusinessId = recordSubmit.BusinessId; + item.BusinessType = recordSubmit.BusinessType; + } + return _feeService.InsertOrUpdate(list); } /// @@ -91,7 +96,7 @@ namespace DS.WMS.FeeApi.Controllers if (request == null || request.TemplateIdList.Length == 0) return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); - var res = _feeService.CreateByTemplate(request.BusinessId, request.TemplateIdList); + var res = _feeService.CreateByTemplate(request.BusinessId, request.BusinessType, request.TemplateIdList); return res; } 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 e370d15e..4bb6626b 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -803,3 +803,17 @@ 2024-05-29 17:54:33.7416 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-05-29 17:54:33.7416 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-05-29 17:54:33.7527 Info Configuration initialized. +2024-05-30 16:12:43.6522 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-30 16:12:43.6669 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-30 16:12:43.6669 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-30 16:12:43.6850 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-05-30 16:12:43.6915 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-05-30 16:12:43.6915 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-30 16:12:43.6915 Info Configuration initialized. +2024-05-30 16:14:34.5160 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-30 16:14:34.5306 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-30 16:14:34.5353 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-30 16:14:34.5353 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-05-30 16:14:34.5552 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-05-30 16:14:34.5552 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-30 16:14:34.5552 Info Configuration initialized. diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs index da3b1c87..ddd94e0d 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs @@ -1,6 +1,7 @@ using DS.Module.Core; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Interface; +using DS.WMS.Core.Op.Entity; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; @@ -117,12 +118,13 @@ public class ClientFlowInstanceController : ApiController /// 获取流程运行实例的内容 /// /// 业务ID + /// 业务类型 /// 流程类型 /// [HttpGet, Route("GetFlowContent")] - public IActionResult GetFlowContent([FromQuery] long businessId, [FromQuery] FeeAuditType type) + public IActionResult GetFlowContent([FromQuery] long businessId, [FromQuery] BusinessType businessType, [FromQuery] FeeAuditType type) { - var res = _invokeService.GetFlowInstance(businessId, type.ToString()); + var res = _invokeService.GetFlowInstance(businessId, businessType, type.ToString()); string? content = res.Data?.Content; string json = JsonConvert.SerializeObject(DataResult.Success(content ?? string.Empty)); return new ContentResult { Content = json, ContentType = "application/json" }; diff --git a/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt index ff7700ae..041d4996 100644 --- a/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt @@ -1639,3 +1639,17 @@ 2024-05-29 17:54:34.1263 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config 2024-05-29 17:54:34.1263 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-05-29 17:54:34.1263 Info Configuration initialized. +2024-05-30 16:12:43.6519 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-30 16:12:43.6677 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-30 16:12:43.6677 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-30 16:12:43.6852 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-05-30 16:12:43.6917 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-05-30 16:12:43.6917 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-30 16:12:43.6917 Info Configuration initialized. +2024-05-30 16:14:35.3817 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-30 16:14:35.3974 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-30 16:14:35.3974 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-30 16:14:35.4162 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-05-30 16:14:35.4162 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-05-30 16:14:35.4162 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-30 16:14:35.4302 Info Configuration initialized.