工作流回调功能

usertest
嵇文龙 6 months ago
parent 534067cc5c
commit 9c5e451235

@ -7,36 +7,65 @@ namespace DS.Module.Core
/// </summary>
public enum FeeStatus
{
/// <summary>
/// 审核通过
/// </summary>
[Description("审核通过")]
AuditPassed = 0,
/// <summary>
/// 录入状态
/// </summary>
[Description("录入状态")]
Entering = 1,
/// <summary>
/// 提交审核
/// </summary>
[Description("提交审核")]
AuditSubmitted = 2,
/// <summary>
/// 申请修改
/// </summary>
[Description("申请修改")]
ApplyModification = 3,
/// <summary>
/// 申请删除
/// </summary>
[Description("申请删除")]
ApplyDeletion = 4,
/// <summary>
/// 撤销申请
/// </summary>
[Description("撤销申请")]
Withdraw = 5,
/// <summary>
/// 驳回提交
/// </summary>
[Description("驳回提交")]
RejectSubmission = 6,
/// <summary>
/// 驳回申请
/// </summary>
[Description("驳回申请")]
RejectApplication = 7,
/// <summary>
/// 部分结算
/// </summary>
[Description("部分结算")]
PartialSettlement = 8,
/// <summary>
/// 结算完毕
/// </summary>
[Description("结算完毕")]
SettlementCompleted = 9
}
/// <summary>
@ -60,12 +89,6 @@ namespace DS.Module.Core
/// 申请删除
/// </summary>
[Description("申请删除")]
ApplyDeletion,
/// <summary>
/// 撤销申请
/// </summary>
[Description("撤销申请")]
Withdraw,
ApplyDeletion
}
}

@ -635,3 +635,80 @@
2024-03-08 17:28:31.4061 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-03-08 17:28:31.4276 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-03-08 17:28:31.4898 Info Configuration initialized.
2024-05-24 13:34:15.9918 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 13:34:16.0274 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 13:34:16.0274 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 13:34:16.0419 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-24 13:34:16.0419 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 13:34:16.0419 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 13:34:16.0532 Info Configuration initialized.
2024-05-24 14:16:23.3825 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:16:23.3825 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:16:23.4001 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:16:23.4155 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-24 14:16:23.4155 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 14:16:23.4155 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:16:23.4285 Info Configuration initialized.
2024-05-24 14:31:20.9578 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:31:20.9784 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:31:20.9784 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:31:20.9984 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-24 14:31:21.0062 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 14:31:21.0062 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:31:21.0209 Info Configuration initialized.
2024-05-24 14:36:46.4277 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:36:46.4467 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:36:46.4467 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:36:46.4675 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-24 14:36:46.4750 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 14:36:46.4750 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:36:46.4750 Info Configuration initialized.
2024-05-24 14:47:52.3513 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:47:52.3725 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:47:52.3725 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:47:52.3920 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-24 14:47:52.3995 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 14:47:52.3995 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:47:52.4127 Info Configuration initialized.
2024-05-24 14:50:18.0841 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:50:18.1368 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:50:18.1368 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:50:18.1537 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-24 14:50:18.1537 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 14:50:18.1615 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:50:18.1615 Info Configuration initialized.
2024-05-24 14:54:57.5539 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:54:57.5539 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:54:57.5748 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:54:57.5893 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-24 14:54:57.5893 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 14:54:57.5893 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:54:57.6071 Info Configuration initialized.
2024-05-24 15:04:34.2580 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 15:04:34.2702 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 15:04:34.2731 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 15:04:34.2731 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-24 15:04:34.2892 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 15:04:34.2892 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 15:04:34.2892 Info Configuration initialized.
2024-05-24 15:21:56.1372 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 15:21:56.1509 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 15:21:56.1509 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 15:21:56.1663 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-24 15:21:56.1663 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 15:21:56.1663 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 15:21:56.1793 Info Configuration initialized.
2024-05-24 15:28:55.6623 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 15:28:55.6623 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 15:28:55.6791 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 15:28:55.6933 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-24 15:28:55.6933 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 15:28:55.6933 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 15:28:55.7096 Info Configuration initialized.
2024-05-24 15:37:13.1370 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 15:37:13.1516 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 15:37:13.1516 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 15:37:13.1685 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-24 15:37:13.1685 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-05-24 15:37:13.1790 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 15:37:13.1790 Info Configuration initialized.

@ -58,5 +58,20 @@ public interface IFeeRecordService
/// <returns></returns>
DataResult SubmitForApproval(FeeAuditType auditType, params long[] idArray);
/// <summary>
/// 撤销审批
/// </summary>
/// <param name="idArray">费用记录ID</param>
/// <returns></returns>
DataResult Withdraw(params long[] idArray);
/// <summary>
/// 根据审批结果更新审批状态
/// </summary>
/// <param name="id">费用ID</param>
/// <param name="flowStatus">审批结果</param>
/// <returns></returns>
DataResult UpdateAuditStatus(long id, FlowStatusEnum flowStatus);
}

@ -1,4 +1,5 @@
using AngleSharp.Dom;
using System.Text;
using AngleSharp.Dom;
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
@ -10,6 +11,7 @@ using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity;
using DS.WMS.Core.Flow.Interface;
using DS.WMS.Core.Sys.Entity;
using LogicExtensions;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
@ -100,21 +102,46 @@ namespace DS.WMS.Core.Fee.Method
{
tenantDb.Ado.BeginTran();
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<FeeRecord>().Where(x => feeIds.Contains(x.Id)).Select(x => new FeeRecord
{
Id = x.Id,
FeeName = x.FeeName,
FeeStatus = x.FeeStatus
}).ToList();
StringBuilder sb = new StringBuilder();
foreach (var fe in fees)
{
if (fe.FeeStatus != FeeStatus.Entering || fe.FeeStatus != FeeStatus.AuditPassed)
{
sb.Append($"费用【{fe.FeeName}】状态不正确,无法修改;");
continue;
}
}
if (sb.Length > 0)
return DataResult.Failed(sb.ToString(), MultiLanguageConst.Operation_Failed);
}
foreach (var item in items)
{
item.SubmitDate = dtNow;
item.FeeStatus = FeeStatus.Entering;
if (item.Id == 0)
{
item.BusinessId = bid;
item.FeeStatus = FeeStatus.Entering;
tenantDb.Insertable(item).ExecuteCommand();
}
else
{
tenantDb.Updateable(item).IgnoreColumns(x => new
{
x.FeeStatus,
//x.FeeStatus,
x.CreateBy,
x.CreateTime,
x.BusinessId,
@ -138,7 +165,7 @@ namespace DS.WMS.Core.Fee.Method
}
/// <rsummary>
/// <summary>
/// 根据模板ID创建
/// </summary>
/// <param name="bid">业务ID</param>
@ -231,7 +258,7 @@ namespace DS.WMS.Core.Fee.Method
}
/// <summary>
/// 删除(录入状态)
/// 删除
/// </summary>
/// <param name="ids">费用记录ID</param>
/// <returns></returns>
@ -239,8 +266,8 @@ namespace DS.WMS.Core.Fee.Method
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (tenantDb.Queryable<FeeRecord>().Any(x => ids.Contains(x.Id) && x.FeeStatus != FeeStatus.Entering))
return DataResult.Failed("只能删除状态为‘录入’的费用", MultiLanguageConst.FeeRecordDelete);
if (tenantDb.Queryable<FeeRecord>().Any(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering || x.FeeStatus != FeeStatus.AuditPassed)))
return DataResult.Failed("只能删除状态为‘录入’或‘审核通过’的费用", MultiLanguageConst.FeeRecordDelete);
int result = tenantDb.Deleteable<FeeRecord>(x => ids.Contains(x.Id)).ExecuteCommand();
return result > 0 ? DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess) : DataResult.Failed("删除失败!", MultiLanguageConst.Operation_Failed);
@ -254,26 +281,210 @@ namespace DS.WMS.Core.Fee.Method
/// <returns></returns>
public DataResult SubmitForApproval(FeeAuditType auditType, params long[] idArray)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var fees = tenantDb.Queryable<FeeRecord>().Where(x => idArray.Contains(x.Id)).Select(x => new FeeRecord
{
Id = x.Id,
FeeName = x.FeeName,
FeeStatus = x.FeeStatus
}).ToList();
if (fees.IsNullOrEmpty())
return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed);
if (fees.Any(x => x.FeeStatus == FeeStatus.PartialSettlement || x.FeeStatus == FeeStatus.SettlementCompleted))
return DataResult.Failed($"当前审批费用包含已结算/部分结算的费用,无法提交", MultiLanguageConst.Operation_Failed);
DataResult result;
if (auditType == FeeAuditType.ApplyAudit)
{
result = ApplyAudit(auditType, fees);
}
else
{
result = ApplyModification(auditType, fees);
}
if (!result.Succeeded)
return result;
int rows = tenantDb.Updateable(fees).UpdateColumns(x => new { x.Id, x.FeeStatus, x.UpdateBy, x.UpdateTime }).ExecuteCommand();
return rows > 0 ? DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess) : DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed);
}
//录入->提交审核
DataResult ApplyAudit(FeeAuditType auditType, List<FeeRecord> fees)
{
StringBuilder sb = new StringBuilder();
foreach (var fe in fees)
{
if (fe.FeeStatus != FeeStatus.Entering && fe.FeeStatus != FeeStatus.RejectSubmission)
{
sb.Append($"费用【{fe.FeeName}】状态不正确,无法提交审批;");
continue;
}
}
if (sb.Length > 0)
return DataResult.Failed(sb.ToString(), MultiLanguageConst.Operation_Failed);
var template = FindTemplate(auditType.ToString());
if (template == null)
return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed);
DateTime dtNow = DateTime.Now;
foreach (var item in fees)
{
var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq { BusinessId = item.Id, TemplateId = template.Id });
if (result.Succeeded)
{
var instance = result.Data as FlowInstance;
flowService.StartFlowInstance(instance.Id.ToString());
//变更状态为提交审核
item.FeeStatus = FeeStatus.AuditSubmitted;
item.UpdateBy = long.Parse(user.UserId);
item.UpdateTime = dtNow;
}
}
return DataResult.Success;
}
//审核通过->申请修改/删除
DataResult ApplyModification(FeeAuditType auditType, List<FeeRecord> fees)
{
StringBuilder sb = new StringBuilder();
foreach (var fe in fees)
{
if (fe.FeeStatus != FeeStatus.AuditPassed && fe.FeeStatus != FeeStatus.RejectApplication)
{
sb.Append($"费用【{fe.FeeName}】状态不正确,无法提交审批;");
continue;
}
}
if (sb.Length > 0)
return DataResult.Failed(sb.ToString(), MultiLanguageConst.Operation_Failed);
var template = FindTemplate(auditType.ToString());
if (template == null)
return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed);
var list = new List<FlowInstance>(idArray.Length);
foreach (var id in idArray)
DateTime dtNow = DateTime.Now;
foreach (var item in fees)
{
var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq { BusinessId = id, TemplateId = template.Id });
var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq { BusinessId = item.Id, TemplateId = template.Id });
if (result.Succeeded)
{
var instance = result.Data as FlowInstance;
list.Add(instance);
flowService.StartFlowInstance(instance.Id.ToString());
//变更状态为申请删除/修改
item.FeeStatus = auditType == FeeAuditType.ApplyDeletion ? FeeStatus.ApplyDeletion : FeeStatus.ApplyModification;
item.UpdateBy = long.Parse(user.UserId);
item.UpdateTime = dtNow;
}
}
var status = auditType.ToString().ToEnum<FeeStatus>();
return DataResult.Success;
}
/// <summary>
/// 根据审批结果更新审批状态
/// </summary>
/// <param name="id">费用ID</param>
/// <param name="flowStatus">审批结果</param>
/// <returns></returns>
public DataResult UpdateAuditStatus(long id, FlowStatusEnum flowStatus)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
int rows = tenantDb.Updateable<FeeRecord>(list.Select(x => new FeeRecord { Id = x.BusinessId, FeeStatus = status }))
.UpdateColumns(x => new { x.Id, x.FeeStatus }).ExecuteCommand();
var fee = tenantDb.Queryable<FeeRecord>().Where(x => x.Id == id).Select(x => new { x.Id, x.FeeStatus }).First();
if (fee == null)
return DataResult.Failed("未能找到费用记录,更新状态失败", MultiLanguageConst.Operation_Failed);
FeeStatus? targetStatus = null;
switch (fee.FeeStatus)
{
case FeeStatus.AuditSubmitted:
if (flowStatus == FlowStatusEnum.Approve)
targetStatus = FeeStatus.AuditPassed;
else if (flowStatus == FlowStatusEnum.Reject)
targetStatus = FeeStatus.RejectSubmission;
break;
case FeeStatus.ApplyModification:
if (flowStatus == FlowStatusEnum.Approve)
targetStatus = FeeStatus.AuditPassed;
else if (flowStatus == FlowStatusEnum.Reject)
targetStatus = FeeStatus.RejectApplication;
break;
case FeeStatus.ApplyDeletion:
if (flowStatus == FlowStatusEnum.Approve)
targetStatus = FeeStatus.AuditPassed;
else if (flowStatus == FlowStatusEnum.Reject)
targetStatus = FeeStatus.RejectApplication;
break;
default:
return DataResult.Failed("费用未处于审批状态,更新状态失败", MultiLanguageConst.Operation_Failed);
}
//状态无变化
if (targetStatus == null)
return DataResult.NoChanged;
var entity = new FeeRecord
{
Id = fee.Id,
FeeStatus = targetStatus.Value,
UpdateBy = user.UserId.ToInt64(),
UpdateTime = DateTime.Now
};
int rows = tenantDb.Updateable(entity).UpdateColumns(x => new { x.Id, x.FeeStatus, x.UpdateBy, x.UpdateTime }).ExecuteCommand();
return rows > 0 ? DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess) : DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed);
}
/// <summary>
/// 撤销审批
/// </summary>
/// <param name="idArray">费用记录ID</param>
/// <returns></returns>
public DataResult Withdraw(params long[] idArray)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var fees = tenantDb.Queryable<FeeRecord>().Where(x => idArray.Contains(x.Id)).Select(x => new FeeRecord
{
Id = x.Id,
FeeName = x.FeeName,
FeeStatus = x.FeeStatus
}).ToList();
//未在审批状态中
var fees2 = fees.FindAll(x => x.FeeStatus != FeeStatus.AuditSubmitted ||
x.FeeStatus != FeeStatus.ApplyModification || x.FeeStatus != FeeStatus.ApplyDeletion).ToList();
if (fees2.Count > 0)
{
string msg = string.Join("; ", fees2.Select(x => $"{x.FeeName}"));
return DataResult.Failed($"以下费用项:{msg} 未在审批状态中,无需撤销", MultiLanguageConst.Operation_Failed);
}
DateTime dtNow = DateTime.Now;
foreach (var item in fees)
{
switch (item.FeeStatus)
{
case FeeStatus.AuditSubmitted:
item.FeeStatus = FeeStatus.Entering;
break;
case FeeStatus.ApplyModification:
item.FeeStatus = FeeStatus.AuditSubmitted;
break;
case FeeStatus.ApplyDeletion:
item.FeeStatus = FeeStatus.AuditSubmitted;
break;
}
item.UpdateBy = long.Parse(user.UserId);
item.UpdateTime = dtNow;
}
int rows = tenantDb.Updateable(fees).UpdateColumns(x => new { x.Id, x.FeeStatus, x.UpdateBy, x.UpdateTime }).ExecuteCommand();
return rows > 0 ? DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess) : DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed);
}
@ -284,7 +495,12 @@ namespace DS.WMS.Core.Fee.Method
/// <returns></returns>
public FlowTemplateTenant FindTemplate(string auditType)
{
return db.Queryable<FlowTemplateTenant>().Where(x => x.PermissionId == PERMISSION_ID && x.AuditType == auditType).First();
return db.Queryable<FlowTemplateTenant>().Where(x =>
x.Status == StatusEnum.Enable &&
x.PermissionId == PERMISSION_ID &&
x.AuditType == auditType).First();
}
}
}

@ -1,6 +1,4 @@

using DS.Module.Core;
using DS.Module.Core;
namespace DS.WMS.Core.Flow.Dtos
{
@ -10,10 +8,6 @@ namespace DS.WMS.Core.Flow.Dtos
public long? TemplateId { get; set; }
public int? ActivityType { get; set; }
public string ActivityName { get; set; }
public FlowStatusEnum FlowStatus { get; set; }
}
}

@ -1,97 +1,31 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity;
using DS.WMS.Core.Flow.Interface;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System.Net;
using System.Net.Http;
using System.Text;
namespace DS.WMS.Core.Flow.Method;
/// <summary>
///
/// </summary>
public class ClientFlowInstanceService : IClientFlowInstanceService
public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanceService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ICommonService _commonService;
private readonly ISaasDbService saasService;
readonly ISaasDbService saasService;
public ClientFlowInstanceService(IServiceProvider serviceProvider)
public ClientFlowInstanceService(IServiceProvider serviceProvider) : base(serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
_commonService = _serviceProvider.GetRequiredService<ICommonService>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
saasService = serviceProvider.GetRequiredService<ISaasDbService>();
}
public DataResult<List<FlowInstanceRes>> GetListByPage(PageRequest request)
protected override FlowInstance BuildInstance(CreateFlowInstanceReq req)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<FlowInstance>().Where(a => (a.MakerList == "1" || a.MakerList.Contains(user.UserId)))
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Select<FlowInstanceRes>()
.Where(whereList).ToQueryPage(request.PageCondition);
return data;
}
public DataResult EditFlowInstance(FlowInstanceReq req)
{
if (req.Id == 0)
{
return DataResult.Failed("非法请求!", MultiLanguageConst.IllegalRequest);
}
else
{
var info = db.Queryable<FlowInstance>().Where(x => x.Id == req.Id).First();
if (!(info.FlowStatus == FlowStatusEnum.Draft.ToEnumInt() || info.FlowStatus == FlowStatusEnum.Ready.ToEnumInt()))
{
return DataResult.Failed("只能修改【就绪】和【撤销】状态的流程", MultiLanguageConst.FlowEditOnlyReadyAndCancel);
}
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
/// <summary>
/// 创建工作流实例
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult CreateFlowInstance(CreateFlowInstanceReq req)
{
FlowTemplate template = null;
if(string.IsNullOrEmpty(req.TemplateId.ToString()))
return null;
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
if (!string.IsNullOrEmpty(req.TemplateId.ToString()))
{
template = db.Queryable<FlowTemplate>().First(x => x.Id == req.TemplateId);
}
FlowTemplateTenant template = db.Queryable<FlowTemplateTenant>().First(x => x.Id == req.TemplateId);
if (template == null)
{
return DataResult.Failed("该流程模板已不存在,请重新设计流程!", MultiLanguageConst.FlowTemplateNotExist);
}
var flowInstance = new FlowInstance
return template == null ? null : new FlowInstance
{
CustomName = template.Name,
TemplateId = template.Id,
@ -99,437 +33,11 @@ public class ClientFlowInstanceService : IClientFlowInstanceService
PermissionId = template.PermissionId,
ColumnView = template.ColumnView,
Content = template.Content,
CallbackURL = template.CallbackURL
};
//创建运行实例
var wfruntime = new FlowRuntimeService(flowInstance, db, saasService, user);
if (wfruntime.CurrentNode is { AssigneeType: "user", Users.Count: > 0 })
{
if (!wfruntime.CurrentNode.Users.Contains(user.UserId))
{
return DataResult.Failed("该工作流指定用户非本人!", MultiLanguageConst.FlowInstanceAssignUser);
}
}
if (wfruntime.CurrentNode is { AssigneeType: "role", Roles.Count: > 0 })
{
var userRoles = db.Queryable<SysRoleUser>().Where(x => x.UserId == long.Parse(user.UserId))
.Select(n => n.RoleId.ToString()).ToList();
var intersectRoles = wfruntime.CurrentNode.Roles.Intersect(userRoles).ToList();
if (intersectRoles.Count == 0)
{
return DataResult.Failed("该工作流指定角色非本人!", MultiLanguageConst.FlowInstanceAssignRole);
}
}
#region 根据运行实例改变当前节点状态
flowInstance.ActivityId = wfruntime.CurrentNodeId;
flowInstance.ActivityType = wfruntime.GetNodeType(wfruntime.StartNodeId);
flowInstance.ActivityName = wfruntime.CurrentNode.Name;
flowInstance.PreviousId = "";
flowInstance.MakerList = GetCurrentMakers(wfruntime);
flowInstance.FlowStatus = FlowStatusEnum.Ready.ToEnumInt();
wfruntime.FlowInstanceId = flowInstance.Id;
#endregion 根据运行实例改变当前节点状态
db.Insertable(flowInstance).ExecuteCommand();
var history = new FlowInstanceHistory
{
InstanceId = flowInstance.Id,
Content = "【创建】"
+ userInfo.UserName
+ "创建了一个流程进程【"
+ flowInstance.CustomName + "】"
};
db.Insertable(history).ExecuteCommand();
// var info = db.Queryable<FlowInstance>().Where(x => x.Id == req.Id).First();
//
// info = req.Adapt(info);
//
// db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("创建工作流实例成功!", flowInstance, MultiLanguageConst.FlowInstanceCreateSuccess);
}
/// <summary>
/// 撤销
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult CancelFlowInstance(CancelFlowInstanceReq req)
{
var instance = db.Queryable<FlowInstance>().First(x => x.Id == req.Id);
if (instance.IsNull())
{
return DataResult.Failed("该工作流不存在!", MultiLanguageConst.FlowInstanceNotExist);
}
if (instance.FlowStatus == FlowStatusEnum.Approve.ToEnumInt())
{
return DataResult.Failed("该工作流已完成!", MultiLanguageConst.FlowInstanceFinished);
}
instance.ActivityId = "";
//创建运行实例
var wfruntime = new FlowRuntimeService(instance, db, saasService, user);
wfruntime.Cancel();
#region 根据运行实例改变当前节点状态
string startNodeId = wfruntime.StartNodeId; //起始节点
instance.PreviousId = instance.ActivityId;
instance.ActivityId = startNodeId;
instance.ActivityType = wfruntime.GetNodeType(startNodeId);
instance.ActivityName = wfruntime.ChildNodes.First(x => x.Id == startNodeId).Name;
instance.MakerList =
(wfruntime.GetNextNodeType() != 4 ? GetCurrentMakers(wfruntime) : "1");
instance.FlowStatus = FlowStatusEnum.Draft.ToEnumInt();
wfruntime.FlowInstanceId = instance.Id;
#endregion 根据运行实例改变当前节点状态
var serializerSettings = new JsonSerializerSettings
{
// 设置为驼峰命名
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
};
instance.Content = JsonConvert.SerializeObject(wfruntime.ToFlowRoot(), Formatting.None, serializerSettings);
db.Updateable(instance).ExecuteCommand();
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
var history = new FlowInstanceHistory
{
InstanceId = instance.Id,
Content = $"【撤销】由{userInfo.UserName}撤销,备注:{req.Note}"
};
db.Insertable(history).ExecuteCommand();
return DataResult.Successed("撤销成功!", MultiLanguageConst.FlowInstanceCancelSuccess);
}
/// <summary>
/// 获取流程操作历史
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<List<FlowInstanceHistoryRes>> GetFlowInstanceHistoryList(string id)
{
var data = db.Queryable<FlowInstanceHistory>()
.Where(a => a.InstanceId == long.Parse(id))
.Select<FlowInstanceHistoryRes>()
.ToList();
return DataResult<List<FlowInstanceHistoryRes>>.Success(data);
}
public DataResult StartFlowInstance(string id)
{
var instance = db.Queryable<FlowInstance>().First(x => x.Id == long.Parse(id));
if (instance.IsNull())
{
return DataResult.Failed("该工作流不存在!", MultiLanguageConst.FlowInstanceNotExist);
}
if (instance.FlowStatus == FlowStatusEnum.Approve.ToEnumInt())
{
return DataResult.Failed("该工作流已完成!", MultiLanguageConst.FlowInstanceFinished);
}
//创建运行实例
var wfruntime = new FlowRuntimeService(instance, db, saasService, user);
#region 根据运行实例改变当前节点状态
instance.ActivityId = wfruntime.NextNodeId;
instance.ActivityType = wfruntime.GetNextNodeType();
instance.ActivityName = wfruntime.NextNode.Name;
instance.PreviousId = wfruntime.CurrentNodeId;
instance.MakerList =
(wfruntime.GetNextNodeType() != 4 ? GetNextMakers(wfruntime) : "1");
instance.FlowStatus = (wfruntime.GetNextNodeType() == 4
? FlowStatusEnum.Approve.ToEnumInt()
: FlowStatusEnum.Running.ToEnumInt());
wfruntime.FlowInstanceId = instance.Id;
#endregion 根据运行实例改变当前节点状态
db.Updateable(instance).ExecuteCommand();
//流程==4为结束执行回调URL
if (wfruntime.GetNextNodeType() == 4 && !instance.CallbackURL.IsNullOrEmpty() && Uri.TryCreate(instance.CallbackURL, UriKind.RelativeOrAbsolute, out Uri? uri))
{
RunCallback(instance, uri);
}
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
var history = new FlowInstanceHistory
{
InstanceId = instance.Id,
Content = $"【启动】由{userInfo.UserName}启动该流程。"
};
db.Insertable(history).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.FlowInstanceUpdateSuccess);
}
public DataResult AuditFlowInstance(FlowInstanceAuditReq req)
{
var userId = user.UserId;
var userName = db.Queryable<SysUser>().First(x => x.Id == long.Parse(userId)).UserName;
var instance = db.Queryable<FlowInstance>().First(x => x.Id == req.Id);
if (instance.IsNull())
{
return DataResult.Failed("该工作流不存在!", MultiLanguageConst.FlowInstanceNotExist);
}
if (instance.FlowStatus == FlowStatusEnum.Approve.ToEnumInt())
{
return DataResult.Failed("该工作流已完成!", MultiLanguageConst.FlowInstanceFinished);
}
var tag = new FlowTag
{
UserName = userName,
UserId = user.UserId,
Description = req.AuditNote,
Taged = req.Status
};
var wfruntime = new FlowRuntimeService(instance, db, saasService, user);
if (wfruntime.CurrentNodeId != req.NodeId)
{
return DataResult.Failed("该工作流审批节点与当前节点不一致!", MultiLanguageConst.FlowInstanceNodeIdConflict);
}
#region 会签
if (instance.ActivityType == 0) //当前节点是会签节点
{
//会签时的【当前节点】一直是会签开始节点
wfruntime.MakeTagNode(wfruntime.CurrentNodeId, tag); //标记审核节点状态
string res = wfruntime.NodeConfluence(wfruntime.CurrentNodeId, tag);
if (res == TagState.No.ToString("D"))
{
instance.FlowStatus = FlowStatusEnum.Reject.ToEnumInt();
}
else if (!string.IsNullOrEmpty(res))
{
instance.PreviousId = instance.ActivityId;
instance.ActivityId = wfruntime.NextNodeId;
instance.ActivityType = wfruntime.NextNodeType;
instance.ActivityName = wfruntime.NextNode.Name;
instance.FlowStatus = (wfruntime.NextNodeType == 4
? FlowStatusEnum.Approve.ToEnumInt()
: FlowStatusEnum.Running.ToEnumInt());
instance.MakerList =
(wfruntime.NextNodeType == 4 ? "1" : GetNextMakers(wfruntime));
// AddTransHistory(wfruntime);
}
else
{
//会签过程中,需要更新用户
instance.MakerList = GetForkNodeMakers(wfruntime, wfruntime.CurrentNodeId);
// AddTransHistory(wfruntime);
}
}
#endregion 会签
#region 一般审核
else
{
wfruntime.MakeTagNode(wfruntime.CurrentNodeId, tag);
if (tag.Taged == (int)TagState.Ok)
{
instance.PreviousId = instance.ActivityId;
instance.ActivityId = wfruntime.NextNodeId;
instance.ActivityType = wfruntime.NextNodeType;
instance.ActivityName = wfruntime.NextNode.Name;
instance.MakerList = wfruntime.NextNodeType == 4 ? "1" : GetNextMakers(wfruntime);
instance.FlowStatus = (wfruntime.NextNodeType == 4
? FlowStatusEnum.Approve.ToEnumInt()
: FlowStatusEnum.Running.ToEnumInt());
}
else
{
instance.FlowStatus = FlowStatusEnum.Reject.ToEnumInt(); //表示该节点不同意
wfruntime.NextNodeId = "-1";
wfruntime.NextNodeType = 4;
}
}
#endregion 一般审核
var serializerSettings = new JsonSerializerSettings
{
// 设置为驼峰命名
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
};
instance.Content = JsonConvert.SerializeObject(wfruntime.ToFlowRoot(), Formatting.None, serializerSettings);
db.Updateable(instance).ExecuteCommand();
//流程==4为结束执行回调URL
if (wfruntime.GetNextNodeType() == 4 && !instance.CallbackURL.IsNullOrEmpty() && Uri.TryCreate(instance.CallbackURL, UriKind.RelativeOrAbsolute, out Uri? uri))
{
RunCallback(instance, uri);
}
var history = new FlowInstanceHistory
{
InstanceId = instance.Id,
Content = "【" + wfruntime.CurrentNode.Name
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm")
+ "】" + (tag.Taged == 1 ? "同意" : "不同意") + ",备注:"
+ tag.Description
};
db.Insertable(history).ExecuteCommand();
return DataResult.Successed("审批成功!", MultiLanguageConst.FlowInstanceAuditSuccess);
}
public DataResult<FlowInstanceRes> GetFlowInstanceInfo(string id)
{
var data = db.Queryable<FlowInstance>()
// .LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Where(a => a.Id == long.Parse(id))
.Select<FlowInstanceRes>()
.First();
return DataResult<FlowInstanceRes>.Success(data);
}
static void RunCallback(FlowInstance instance, Uri uri)
{
HttpClient http = new HttpClient();
http.DefaultRequestHeaders.Add("User-Agent", "X-HttpClient");
//请求参数设置
FlowCallback callback = new FlowCallback
{
ActivityName = instance.ActivityName,
ActivityType = instance.ActivityType,
BusinessId = instance.BusinessId,
FlowStatus = (FlowStatusEnum)instance.FlowStatus,
TemplateId = instance.TemplateId
};
var jsonRequest = new StringContent(JsonConvert.SerializeObject(callback), Encoding.UTF8, "application/json");
try
{
http.PostAsync(uri, jsonRequest).ContinueWith(t =>
{
var response = t.Result;
if (!response.IsSuccessStatusCode)
{
//todo:记录错误日志
}
//获取响应内容
var responseContent = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
});
}
catch (Exception ex)
{
//todo:记录错误日志
}
finally
{
http?.Dispose();
}
}
/// <summary>
/// 寻找下一步的执行人
/// 一般用于本节点审核完成后,修改流程实例的当前执行人,可以做到通知等功能
/// </summary>
/// <returns></returns>
private string GetCurrentMakers(FlowRuntimeService wfruntime, CreateFlowInstanceReq request = null)
{
string makerList = "";
if (wfruntime.NextNodeId == "-1")
{
throw (new Exception("无法寻找到下一个节点"));
}
if (wfruntime.CurrentNodeType == 0) //如果是会签节点
{
makerList = GetForkNodeMakers(wfruntime, wfruntime.NextNodeId);
}
else if (wfruntime.CurrentNode.AssigneeType == "role")
{
var users = db.Queryable<SysRoleUser>().Where(x =>
wfruntime.CurrentNode.Roles.Contains(x.RoleId.ToString()))
.Select(x => x.UserId).Distinct().ToList();
makerList = GenericHelper.ArrayToString(users, makerList);
}
else if (wfruntime.CurrentNode.AssigneeType == "user")
{
makerList = string.Join(",", wfruntime.CurrentNode.Users);
}
else
{
makerList = GetNodeMarkers(wfruntime.CurrentNode);
if (string.IsNullOrEmpty(makerList))
{
throw (new Exception("无法寻找到节点的审核者,请查看流程设计是否有问题!"));
}
}
return makerList;
}
/// <summary>
/// 寻找下一步的执行人
/// 一般用于本节点审核完成后,修改流程实例的当前执行人,可以做到通知等功能
/// </summary>
/// <returns></returns>
private string GetNextMakers(FlowRuntimeService wfruntime, CreateFlowInstanceReq request = null)
{
string makerList = "";
if (wfruntime.NextNodeId == "-1")
{
throw (new Exception("无法寻找到下一个节点"));
}
// if (wfruntime.NextNodeType == 0) //如果是会签节点
// {
// makerList = GetForkNodeMakers(wfruntime, wfruntime.NextNodeId);
// } else
if (wfruntime.NextNode.AssigneeType == "role")
{
var users = db.Queryable<SysRoleUser>().Where(x =>
wfruntime.NextNode.Roles.Contains(x.RoleId.ToString()))
.Select(x => x.UserId).Distinct().ToList();
makerList = GenericHelper.ArrayToString(users, makerList);
}
else if (wfruntime.NextNode.AssigneeType == "user")
{
makerList = string.Join(",", wfruntime.NextNode.Users);
}
else
{
makerList = GetNodeMarkers(wfruntime.NextNode);
if (string.IsNullOrEmpty(makerList))
{
throw (new Exception("无法寻找到节点的审核者,请查看流程设计是否有问题!"));
}
}
return makerList;
}
/// <summary>
/// 获取会签开始节点的所有可执行者
/// </summary>
/// <param name="forkNodeId">会签开始节点</param>
/// <returns></returns>
private string GetForkNodeMakers(FlowRuntimeService wfruntime, string forkNodeId)
protected override string GetForkNodeMakers(FlowRuntimeService wfruntime, string forkNodeId)
{
string makerList = "";
@ -552,37 +60,8 @@ public class ClientFlowInstanceService : IClientFlowInstanceService
return makerList;
}
/// <summary>
/// 寻找该节点执行人
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
private string GetNodeMarkers(FlowChild node, string flowinstanceCreateUserId = "")
protected override FlowRuntimeService CreateRuntimeService(FlowInstance instance)
{
string makerList = "";
if (node.Type == FlowChild.START && (!string.IsNullOrEmpty(flowinstanceCreateUserId))) //如果是开始节点,通常情况下是驳回到开始了
{
makerList = flowinstanceCreateUserId;
}
else if (node.AssigneeType != null)
{
if (node.AssigneeType == "role")
{
var users = db.Queryable<SysRoleUser>().Where(x =>
node.Roles.Contains(x.RoleId.ToString()))
.Select(x => x.UserId).Distinct().ToList();
makerList = GenericHelper.ArrayToString(users, makerList);
}
else if (node.AssigneeType == "user")
{
makerList = node.Users.ToString();
}
}
else //如果没有设置节点信息,默认所有人都可以审核
{
makerList = "1";
}
return makerList;
return new FlowRuntimeService(instance, db, saasService, user);
}
}

@ -1,3 +1,4 @@
using System.Text;
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.UserModule;
@ -19,8 +20,8 @@ namespace DS.WMS.Core.Flow.Method;
public class FlowInstanceService : IFlowInstanceService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
protected readonly ISqlSugarClient db;
protected readonly IUser user;
private readonly ICommonService _commonService;
/// <summary>
@ -67,28 +68,14 @@ public class FlowInstanceService : IFlowInstanceService
}
}
/// <summary>
/// 创建工作流实例
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult CreateFlowInstance(CreateFlowInstanceReq req)
protected virtual FlowInstance BuildInstance(CreateFlowInstanceReq req)
{
FlowTemplate template = null;
if (string.IsNullOrEmpty(req.TemplateId.ToString()))
return null;
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
if (!string.IsNullOrEmpty(req.TemplateId.ToString()))
{
template = db.Queryable<FlowTemplate>().First(x => x.Id == req.TemplateId);
}
FlowTemplate template = db.Queryable<FlowTemplate>().First(x => x.Id == req.TemplateId);
if (template == null)
{
return DataResult.Failed("该流程模板已不存在,请重新设计流程!", MultiLanguageConst.FlowTemplateNotExist);
}
var flowInstance = new FlowInstance
return template == null ? null : new FlowInstance
{
CustomName = template.Name,
TemplateId = template.Id,
@ -98,8 +85,21 @@ public class FlowInstanceService : IFlowInstanceService
Content = template.Content,
CallbackURL = template.CallbackURL
};
}
/// <summary>
/// 创建工作流实例
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult CreateFlowInstance(CreateFlowInstanceReq req)
{
var instance = BuildInstance(req);
if (instance == null)
return DataResult.Failed("该流程模板已不存在,请重新设计流程!", MultiLanguageConst.FlowTemplateNotExist);
//创建运行实例
var wfruntime = new FlowRuntimeService(flowInstance, db);
var wfruntime = CreateRuntimeService(instance);
if (wfruntime.CurrentNode is { AssigneeType: "user", Users.Count: > 0 })
{
@ -122,26 +122,33 @@ public class FlowInstanceService : IFlowInstanceService
#region 根据运行实例改变当前节点状态
flowInstance.ActivityId = wfruntime.CurrentNodeId;
flowInstance.ActivityType = wfruntime.GetNodeType(wfruntime.StartNodeId);
flowInstance.ActivityName = wfruntime.CurrentNode.Name;
flowInstance.PreviousId = "";
flowInstance.MakerList = GetCurrentMakers(wfruntime);
flowInstance.FlowStatus = FlowStatusEnum.Ready.ToEnumInt();
instance.ActivityId = wfruntime.CurrentNodeId;
instance.ActivityType = wfruntime.GetNodeType(wfruntime.StartNodeId);
instance.ActivityName = wfruntime.CurrentNode.Name;
instance.PreviousId = "";
instance.MakerList = GetCurrentMakers(wfruntime);
instance.FlowStatus = FlowStatusEnum.Ready.ToEnumInt();
wfruntime.FlowInstanceId = flowInstance.Id;
wfruntime.FlowInstanceId = instance.Id;
#endregion 根据运行实例改变当前节点状态
db.Insertable(flowInstance).ExecuteCommand();
db.Insertable(instance).ExecuteCommand();
//流程==4为结束执行回调URL
if (wfruntime.GetNextNodeType() == 4 && !instance.CallbackURL.IsNullOrEmpty() && Uri.TryCreate(instance.CallbackURL, UriKind.RelativeOrAbsolute, out Uri? uri))
{
RunCallback(instance, uri);
}
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
var history = new FlowInstanceHistory
{
InstanceId = flowInstance.Id,
InstanceId = instance.Id,
Content = "【创建】"
+ userInfo.UserName
+ "创建了一个流程进程【"
+ flowInstance.CustomName + "】"
+ instance.CustomName + "】"
};
db.Insertable(history).ExecuteCommand();
// var info = db.Queryable<FlowInstance>().Where(x => x.Id == req.Id).First();
@ -149,7 +156,7 @@ public class FlowInstanceService : IFlowInstanceService
// info = req.Adapt(info);
//
// db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("创建工作流实例成功!", MultiLanguageConst.FlowInstanceCreateSuccess);
return DataResult.Successed("创建工作流实例成功!", instance, MultiLanguageConst.FlowInstanceCreateSuccess);
}
/// <summary>
@ -172,7 +179,7 @@ public class FlowInstanceService : IFlowInstanceService
instance.ActivityId = "";
//创建运行实例
var wfruntime = new FlowRuntimeService(instance, db);
var wfruntime = CreateRuntimeService(instance);
wfruntime.Cancel();
#region 根据运行实例改变当前节点状态
@ -197,6 +204,8 @@ public class FlowInstanceService : IFlowInstanceService
instance.Content = JsonConvert.SerializeObject(wfruntime.ToFlowRoot(), Formatting.None, serializerSettings);
db.Updateable(instance).ExecuteCommand();
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
var history = new FlowInstanceHistory
{
@ -235,7 +244,7 @@ public class FlowInstanceService : IFlowInstanceService
}
//创建运行实例
var wfruntime = new FlowRuntimeService(instance, db);
var wfruntime = CreateRuntimeService(instance);
#region 根据运行实例改变当前节点状态
@ -255,6 +264,12 @@ public class FlowInstanceService : IFlowInstanceService
db.Updateable(instance).ExecuteCommand();
//流程==4为结束执行回调URL
if (wfruntime.GetNextNodeType() == 4 && !instance.CallbackURL.IsNullOrEmpty() && Uri.TryCreate(instance.CallbackURL, UriKind.RelativeOrAbsolute, out Uri? uri))
{
RunCallback(instance, uri);
}
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
var history = new FlowInstanceHistory
{
@ -265,7 +280,6 @@ public class FlowInstanceService : IFlowInstanceService
return DataResult.Successed("更新成功!", MultiLanguageConst.FlowInstanceUpdateSuccess);
}
public DataResult AuditFlowInstance(FlowInstanceAuditReq req)
{
var userId = user.UserId;
@ -289,7 +303,7 @@ public class FlowInstanceService : IFlowInstanceService
Taged = req.Status
};
var wfruntime = new FlowRuntimeService(instance, db);
var wfruntime = CreateRuntimeService(instance);
if (wfruntime.CurrentNodeId != req.NodeId)
@ -366,6 +380,12 @@ public class FlowInstanceService : IFlowInstanceService
instance.Content = JsonConvert.SerializeObject(wfruntime.ToFlowRoot(), Formatting.None, serializerSettings);
db.Updateable(instance).ExecuteCommand();
//流程==4为结束执行回调URL
if (wfruntime.GetNextNodeType() == 4 && !instance.CallbackURL.IsNullOrEmpty() && Uri.TryCreate(instance.CallbackURL, UriKind.RelativeOrAbsolute, out Uri? uri))
{
RunCallback(instance, uri);
}
var history = new FlowInstanceHistory
{
InstanceId = instance.Id,
@ -379,6 +399,46 @@ public class FlowInstanceService : IFlowInstanceService
return DataResult.Successed("审批成功!", MultiLanguageConst.FlowInstanceAuditSuccess);
}
protected virtual void RunCallback(FlowInstance instance, Uri uri)
{
HttpClient http = new HttpClient();
http.DefaultRequestHeaders.Add("User-Agent", "X-HttpClient");
//请求参数设置
FlowCallback callback = new FlowCallback
{
BusinessId = instance.BusinessId,
FlowStatus = (FlowStatusEnum)instance.FlowStatus,
TemplateId = instance.TemplateId
};
var jsonRequest = new StringContent(JsonConvert.SerializeObject(callback), Encoding.UTF8, "application/json");
try
{
var response = http.PostAsync(uri, jsonRequest).GetAwaiter().GetResult();
if (!response.IsSuccessStatusCode)
{
//todo:记录错误日志
}
//获取响应内容
//var responseContent = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
}
catch (Exception ex)
{
//todo:记录错误日志
}
finally
{
http?.Dispose();
}
}
protected virtual FlowRuntimeService CreateRuntimeService(FlowInstance instance)
{
return new FlowRuntimeService(instance, db, null, user);
}
public DataResult<FlowInstanceRes> GetFlowInstanceInfo(string id)
{
var data = db.Queryable<FlowInstance>()
@ -394,7 +454,7 @@ public class FlowInstanceService : IFlowInstanceService
/// 一般用于本节点审核完成后,修改流程实例的当前执行人,可以做到通知等功能
/// </summary>
/// <returns></returns>
private string GetCurrentMakers(FlowRuntimeService wfruntime, CreateFlowInstanceReq request = null)
protected string GetCurrentMakers(FlowRuntimeService wfruntime, CreateFlowInstanceReq request = null)
{
string makerList = "";
if (wfruntime.NextNodeId == "-1")
@ -434,7 +494,7 @@ public class FlowInstanceService : IFlowInstanceService
/// 一般用于本节点审核完成后,修改流程实例的当前执行人,可以做到通知等功能
/// </summary>
/// <returns></returns>
private string GetNextMakers(FlowRuntimeService wfruntime, CreateFlowInstanceReq request = null)
protected string GetNextMakers(FlowRuntimeService wfruntime, CreateFlowInstanceReq request = null)
{
string makerList = "";
if (wfruntime.NextNodeId == "-1")
@ -474,7 +534,7 @@ public class FlowInstanceService : IFlowInstanceService
/// </summary>
/// <param name="forkNodeId">会签开始节点</param>
/// <returns></returns>
private string GetForkNodeMakers(FlowRuntimeService wfruntime, string forkNodeId)
protected virtual string GetForkNodeMakers(FlowRuntimeService wfruntime, string forkNodeId)
{
string makerList = "";
@ -512,7 +572,7 @@ public class FlowInstanceService : IFlowInstanceService
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
private string GetNodeMarkers(FlowChild node, string flowinstanceCreateUserId = "")
protected string GetNodeMarkers(FlowChild node, string flowinstanceCreateUserId = "")
{
string makerList = "";
if (node.Type == FlowChild.START && (!string.IsNullOrEmpty(flowinstanceCreateUserId))) //如果是开始节点,通常情况下是驳回到开始了

@ -56,17 +56,17 @@ public class SysRoleService : ISysRoleService
{
if (model.Id == 0)
{
var isExist = db.Queryable<SysRole>().Filter(null,true).Where(x => x.RoleCode == model.RoleCode).First();
var isExist = db.Queryable<SysRole>().Filter(null, true).Where(x => x.RoleCode == model.RoleCode).First();
if (isExist != null)
{
return DataResult.Failed("角色唯一编码已存在!",MultiLanguageConst.UserCodeExist);
return DataResult.Failed("角色唯一编码已存在!", MultiLanguageConst.UserCodeExist);
}
var data = model.Adapt<SysRole>();
var role = db.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", role.Id,MultiLanguageConst.DataCreateSuccess);
return DataResult.Successed("添加成功!", role.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
@ -75,7 +75,7 @@ public class SysRoleService : ISysRoleService
info = model.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
@ -89,7 +89,7 @@ public class SysRoleService : ISysRoleService
var data = db.Queryable<SysRole>()
.Where(a => a.Id == long.Parse(id))
.First();
return DataResult<SysRole>.Success(data,MultiLanguageConst.DataQuerySuccess);
return DataResult<SysRole>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
@ -142,7 +142,7 @@ public class SysRoleService : ISysRoleService
data.TreeData = info;
data.Ids = db.Queryable<SysPermission>().Select(x => x.Id.ToString()).ToArray();
return DataResult<RolePermissionTreeViewModel>.Success("获取数据成功!", data,MultiLanguageConst.DataQuerySuccess);
return DataResult<RolePermissionTreeViewModel>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取角色权限树-客户端
@ -194,7 +194,7 @@ public class SysRoleService : ISysRoleService
data.TreeData = info;
data.Ids = db.Queryable<SysPermission>().Select(x => x.Id.ToString()).ToArray();
return DataResult<RolePermissionTreeViewModel>.Success("获取数据成功!", data,MultiLanguageConst.DataQuerySuccess);
return DataResult<RolePermissionTreeViewModel>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取角色权限
@ -204,9 +204,9 @@ public class SysRoleService : ISysRoleService
public DataResult<long?[]> GetRolePermission(string id)
{
var data = db.Queryable<SysRolePermission>().Where(x => x.RoleId == long.Parse(id) && x.IsPermission == 1).Select(x => x.PermissionId).ToArray();
return DataResult<long?[]>.Success("获取数据成功!", data,MultiLanguageConst.DataQuerySuccess);
return DataResult<long?[]>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
public DataResult UpdateRolePermission(RolePermissionInput model)
{
@ -244,10 +244,10 @@ public class SysRoleService : ISysRoleService
db.Insertable(permission).ExecuteCommand();
}
}
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
public DataResult UpdateClientRolePermission(RolePermissionInput model)
{
var existPermissions = db.Queryable<SysRolePermission>().Where(x => x.RoleId == model.RoleId && x.IsPermission == 1).Select(n => n.PermissionId).ToArray();
@ -276,21 +276,21 @@ public class SysRoleService : ISysRoleService
#region 租户模块权限检测
var tenant = db.Queryable<SysTenant>().Where(x=>x.Id ==long.Parse(user.TenantId)).First();
var tenant = db.Queryable<SysTenant>().Where(x => x.Id == long.Parse(user.TenantId)).First();
foreach (var item in addRolePermissions)
{
var per = db.Queryable<SysPermission>().Where(x => x.Id == item)
.First();
if (per.MenuType == 2)
if (per != null && per.MenuType == 2)
{
var perAuth = db.Queryable<SysTenantPermissionAuth>().Where(x=>x.PermissionId == item).First();
var perAuth = db.Queryable<SysTenantPermissionAuth>().Where(x => x.PermissionId == item).First();
if (perAuth.IsNotNull())
{
var authNum = EncrypteHelper.DecryptData(perAuth.AuthNum, tenant.AppSecret);
var roleList = db.Queryable<SysRolePermission>()
.Where(x => x.PermissionId == item && x.IsPermission == 1).Select(n => n.RoleId).ToList();
roleList.Add(model.RoleId);
roleList.Distinct();
var userList = new List<long?>();
@ -301,21 +301,21 @@ public class SysRoleService : ISysRoleService
userList.AddRange(userArr);
}
userList.Distinct();
userList.Distinct();
var userCount = userList.Count();
if (userCount>= int.Parse(authNum))
if (userCount >= int.Parse(authNum))
{
return DataResult.Failed(string.Format("{0}模块数量超出授权数量{1}",per.PermissionName, int.Parse(authNum)),MultiLanguageConst.PerAuthNumLimit);
return DataResult.Failed(string.Format("{0}模块数量超出授权数量{1}", per.PermissionName, int.Parse(authNum)), MultiLanguageConst.PerAuthNumLimit);
}
}
}
}
}
#endregion
foreach (var item in addRolePermissions)
{
var permission = new SysRolePermission
@ -327,6 +327,6 @@ public class SysRoleService : ISysRoleService
db.Insertable(permission).ExecuteCommand();
}
}
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}

@ -6,6 +6,7 @@ using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Interface;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
@ -97,7 +98,7 @@ namespace DS.WMS.FeeApi.Controllers
/// </summary>
/// <param name="request">请求参数</param>
/// <returns></returns>
[HttpPost, Route("CreateByTemplate")]
[HttpPost, Route("CreateByTemplate"), NonAction]
public DataResult CreateByTemplate([FromBody] FeeRecordByTemplate request)
{
if (request == null || request.TemplateIdList.Length == 0)
@ -123,7 +124,7 @@ namespace DS.WMS.FeeApi.Controllers
}
/// <summary>
/// 提交审
/// 提交审
/// </summary>
/// <param name="model">费用记录ID</param>
/// <returns></returns>
@ -133,22 +134,63 @@ namespace DS.WMS.FeeApi.Controllers
if (model == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
var res = _feeService.SubmitForApproval(FeeAuditType.ApplyAudit, model.Ids);
return res;
return _feeService.SubmitForApproval(FeeAuditType.ApplyAudit, model.Ids);
}
/// <summary>
/// 申请修改
/// </summary>
/// <param name="model">费用记录ID</param>
/// <returns></returns>
[HttpPost, Route("ApplyModification")]
public DataResult ApplyModification([FromBody] IdModel model)
{
if (model == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return _feeService.SubmitForApproval(FeeAuditType.ApplyModification, model.Ids);
}
/// <summary>
/// 申请删除
/// </summary>
/// <param name="model">费用记录ID</param>
/// <returns></returns>
[HttpPost, Route("ApplyDeletion")]
public DataResult ApplyDeletion([FromBody] IdModel model)
{
if (model == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return _feeService.SubmitForApproval(FeeAuditType.ApplyDeletion, model.Ids);
}
/// <summary>
/// 撤销审批申请
/// </summary>
/// <param name="model">费用记录ID</param>
/// <returns></returns>
[HttpPost, Route("Withdraw")]
public DataResult Withdraw([FromBody] IdModel model)
{
if (model == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return _feeService.Withdraw(model.Ids);
}
/// <summary>
/// 变更费用审批状态
/// 变更费用审批状态回调
/// </summary>
/// <param name="model">费用ID</param>
/// <param name="callback">回调信息</param>
/// <returns></returns>
[HttpPost, Route("ChangeStatus")]
[HttpPost, Route("ChangeStatus"), AllowAnonymous]
public DataResult ChangeStatus([FromBody] FlowCallback callback)
{
if (callback == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return DataResult.Successed("");
return _feeService.UpdateAuditStatus(callback.BusinessId, callback.FlowStatus);
}
}
}

@ -1,12 +1,8 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Ocsp;
namespace DS.WMS.FeeApi.Controllers
{
@ -39,6 +35,19 @@ namespace DS.WMS.FeeApi.Controllers
return res;
}
/// <summary>
/// 根据模板ID获取模板明细
/// </summary>
/// <param name="tid">模板ID</param>
/// <returns></returns>
[HttpGet]
[Route("GetListByTemplateId")]
public DataResult<List<FeeTemplateDetailRes>> GetListByTemplateId([FromQuery] long tid)
{
var res = _invokeService.GetListByTemplateId(tid);
return res;
}
/// <summary>
/// 编辑
/// </summary>
@ -86,7 +95,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <returns></returns>
[HttpPost]
[Route("BatchDelFeeTemplateDetail")]
public DataResult BatchDelFeeTemplateDetail([FromBody]IdModel req)
public DataResult BatchDelFeeTemplateDetail([FromBody] IdModel req)
{
var res = _invokeService.BatchDelFeeTemplateDetail(req);
return res;

@ -250,3 +250,157 @@
2024-05-23 17:42:47.9282 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-23 17:42:47.9282 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-23 17:42:47.9433 Info Configuration initialized.
2024-05-23 17:52:43.4013 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-23 17:52:43.4163 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-23 17:52:43.4163 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-23 17:52:43.4369 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-23 17:52:43.4433 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-23 17:52:43.4433 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-23 17:52:43.4433 Info Configuration initialized.
2024-05-23 17:52:52.8887 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-23 17:52:52.9027 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-23 17:52:52.9027 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-23 17:52:52.9185 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-23 17:52:52.9185 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-23 17:52:52.9284 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-23 17:52:52.9284 Info Configuration initialized.
2024-05-23 17:57:14.1454 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-23 17:57:14.1454 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-23 17:57:14.1619 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-23 17:57:14.1619 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-23 17:57:14.1788 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-23 17:57:14.1788 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-23 17:57:14.1788 Info Configuration initialized.
2024-05-24 09:24:54.1348 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 09:24:54.1459 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 09:24:54.1459 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 09:24:54.1459 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-24 09:24:54.1651 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-24 09:24:54.1651 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 09:24:54.1651 Info Configuration initialized.
2024-05-24 09:27:24.5568 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 09:27:24.5697 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 09:27:24.5697 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 09:27:24.5877 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-24 09:27:24.5877 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-24 09:27:24.5978 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 09:27:24.5978 Info Configuration initialized.
2024-05-24 09:29:23.6483 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 09:29:23.6642 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 09:29:23.6642 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 09:29:23.6836 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-24 09:29:23.6836 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-24 09:29:23.6940 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 09:29:23.6940 Info Configuration initialized.
2024-05-24 09:33:06.1297 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 09:33:06.1297 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 09:33:06.1474 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 09:33:06.1474 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-24 09:33:06.1669 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-24 09:33:06.1669 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 09:33:06.1669 Info Configuration initialized.
2024-05-24 09:33:43.5094 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 09:33:43.5219 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 09:33:43.5219 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 09:33:43.5384 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-24 09:33:43.5384 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-24 09:33:43.5384 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 09:33:43.5528 Info Configuration initialized.
2024-05-24 09:39:24.2402 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 09:39:24.2402 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 09:39:24.2546 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 09:39:24.2546 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-24 09:39:24.2745 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-24 09:39:24.2745 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 09:39:24.2745 Info Configuration initialized.
2024-05-24 09:44:59.7011 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 09:44:59.7155 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 09:44:59.7155 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 09:44:59.7297 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-24 09:44:59.7297 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-24 09:44:59.7297 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 09:44:59.7431 Info Configuration initialized.
2024-05-24 09:47:09.2332 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 09:47:09.2505 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 09:47:09.2546 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 09:47:09.2546 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-24 09:47:09.2736 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-24 09:47:09.2736 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 09:47:09.2862 Info Configuration initialized.
2024-05-24 13:34:15.9613 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 13:34:15.9613 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 13:34:15.9752 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 13:34:15.9752 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-24 13:34:15.9920 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-24 13:34:15.9920 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 13:34:15.9920 Info Configuration initialized.
2024-05-24 14:16:23.9588 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:16:23.9760 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:16:23.9760 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:16:24.0077 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-24 14:16:24.0077 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-24 14:16:24.0205 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:16:24.0205 Info Configuration initialized.
2024-05-24 14:31:21.2452 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:31:21.2585 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:31:21.2585 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:31:21.2753 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-24 14:31:21.2753 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-24 14:31:21.2867 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:31:21.2867 Info Configuration initialized.
2024-05-24 14:36:46.9575 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:36:46.9575 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:36:46.9575 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:36:46.9879 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-24 14:36:46.9937 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-24 14:36:46.9937 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:36:46.9937 Info Configuration initialized.
2024-05-24 14:47:52.6322 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:47:52.6480 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:47:52.6480 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:47:52.6664 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-24 14:47:52.6770 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-24 14:47:52.6770 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:47:52.6770 Info Configuration initialized.
2024-05-24 14:50:18.3195 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:50:18.3346 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:50:18.3346 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:50:18.3578 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-24 14:50:18.3637 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-24 14:50:18.3637 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:50:18.3637 Info Configuration initialized.
2024-05-24 14:54:56.8915 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 14:54:56.9070 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 14:54:56.9070 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 14:54:56.9245 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-24 14:54:56.9315 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-24 14:54:56.9315 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 14:54:56.9315 Info Configuration initialized.
2024-05-24 15:04:34.4371 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 15:04:34.4522 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 15:04:34.4522 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 15:04:34.4683 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-24 15:04:34.4683 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-24 15:04:34.4683 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 15:04:34.4845 Info Configuration initialized.
2024-05-24 15:21:56.8583 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 15:21:56.8707 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 15:21:56.8707 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 15:21:56.8841 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-24 15:21:56.8841 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-24 15:21:56.8841 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 15:21:56.8981 Info Configuration initialized.
2024-05-24 15:28:55.9297 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 15:28:55.9445 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 15:28:55.9445 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 15:28:55.9655 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-24 15:28:55.9655 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-24 15:28:55.9754 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 15:28:55.9754 Info Configuration initialized.
2024-05-24 15:37:13.5233 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 15:37:13.5407 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 15:37:13.5407 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 15:37:13.5601 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-24 15:37:13.5670 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-24 15:37:13.5670 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 15:37:13.5670 Info Configuration initialized.

@ -1356,3 +1356,17 @@
2024-05-22 18:00:17.2391 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-05-22 18:00:17.2391 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-22 18:00:17.2682 Info Configuration initialized.
2024-05-24 10:13:06.3348 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 10:13:06.3479 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 10:13:06.3479 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 10:13:06.3479 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-24 10:13:06.3658 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-24 10:13:06.3658 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 10:13:06.3658 Info Configuration initialized.
2024-05-24 10:16:32.2869 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-24 10:16:32.2869 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-24 10:16:32.3036 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-24 10:16:32.3036 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-24 10:16:32.3192 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-24 10:16:32.3192 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-24 10:16:32.3192 Info Configuration initialized.

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\Main</_PublishTargetUrl>
<History>True|2024-05-21T09:32:52.9294009Z;</History>
<History>True|2024-05-23T09:51:45.6784172Z||;True|2024-05-21T17:32:52.9294009+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
Loading…
Cancel
Save