修改工作流的最后一步不再更新内容

usertest
嵇文龙 2 months ago
parent f5b553b0df
commit 2f72e70aee

@ -196,7 +196,7 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
public DataResult CancelFlowInstance(CancelFlowInstanceReq req)
{
var instance = Db.Queryable<FlowInstance>().First(x => x.Id == req.Id);
if (instance.IsNull())
if (instance == null)
{
return DataResult.Failed("该工作流不存在!", MultiLanguageConst.FlowInstanceNotExist);
}
@ -266,7 +266,7 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
public DataResult StartFlowInstance(string id)
{
var instance = Db.Queryable<FlowInstance>().First(x => x.Id == long.Parse(id));
if (instance.IsNull())
if (instance == null)
{
return DataResult.Failed("该工作流不存在!", MultiLanguageConst.FlowInstanceNotExist);
}
@ -321,7 +321,7 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
{
var instance = GetFlowInstance(req.Id);
if (instance.IsNull())
if (instance == null)
{
return DataResult.Failed("该工作流不存在!", MultiLanguageConst.FlowInstanceNotExist);
}
@ -416,7 +416,7 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
instance.ActivityType = runtime.NextNodeType;
instance.ActivityName = runtime.NextNode.Name;
instance.MakerList = runtime.NextNodeType == 4 ? "1" : GetNextMakers(runtime);
instance.FlowStatus = (runtime.NextNodeType == 4 ? FlowStatusEnum.Approve : FlowStatusEnum.Running);
instance.FlowStatus = runtime.NextNodeType == 4 ? FlowStatusEnum.Approve : FlowStatusEnum.Running;
}
else
{
@ -428,12 +428,16 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
#endregion 一般审核
var serializerSettings = new JsonSerializerSettings
if (!string.IsNullOrEmpty(instance.MakerList) && instance.MakerList != "1")
{
// 设置为驼峰命名
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
};
instance.Content = JsonConvert.SerializeObject(runtime.ToFlowRoot(), Formatting.None, serializerSettings);
var serializerSettings = new JsonSerializerSettings
{
// 设置为驼峰命名
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
};
instance.Content = JsonConvert.SerializeObject(runtime.ToFlowRoot(), Formatting.None, serializerSettings);
}
instance.Note = auditNote;
Db.Updateable(instance).ExecuteCommand();

@ -442,12 +442,18 @@ public class FlowRuntime
public FlowRoot ToFlowRoot()
{
var root = ChildNodes.First(x => x.Id == "root");
var list = ChildNodes.Where(x => x.Id != "root").ToList();
var info = root.Adapt<FlowRoot>();
info.Child = list.First(x => x.Pid == "root");
UpdateChild(info.Child);
try
{
UpdateChild(info.Child);
}
catch
{
}
return info;
}

@ -4,13 +4,13 @@ using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity.TaskInteraction;
using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Op.Interface.TaskInteraction;
using DS.WMS.Core.Sys.Entity;
using HtmlAgilityPack;
using Mapster;
using Masuit.Tools;
using Masuit.Tools.Systems;
using Microsoft.Extensions.Configuration;
@ -19,7 +19,7 @@ using Newtonsoft.Json;
using RazorEngineCore;
using SqlSugar;
namespace DS.WMS.Core.Op.Method.TaskInteraction
namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
{
/// <summary>
/// 用于邮件发送的执行器
@ -87,17 +87,17 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
}
string title, content = string.Empty;
var templateModel = new MailTemplateModel<SeaExportRes> { Primary = result.Data };
var templateModel = new MailTemplateModel<SeaExportOrder> { Primary = result.Data.Adapt<SeaExportOrder>() };
IRazorEngine razorEngine = new RazorEngine();
try
{
var titleTemplate = razorEngine.Compile<RazorEngineTemplateBase<MailTemplateModel<SeaExportRes>>>(mailConfig.Title);
var titleTemplate = razorEngine.Compile<RazorEngineTemplateBase<MailTemplateModel<SeaExportOrder>>>(mailConfig.Title);
title = await titleTemplate.RunAsync(x =>
{
x.Model = templateModel;
});
var contentTemplate = razorEngine.Compile<RazorEngineTemplateBase<MailTemplateModel<SeaExportRes>>>(mailConfig.Content);
var contentTemplate = razorEngine.Compile<RazorEngineTemplateBase<MailTemplateModel<SeaExportOrder>>>(mailConfig.Content);
content = await contentTemplate.RunAsync(x =>
{
x.Model = templateModel;
@ -145,6 +145,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
StringWriter writer = new();
htmlDoc.Save(writer);
content = writer.ToString();
writer.Close();
//设置收件人
List<long> receiverIds = [];
@ -152,7 +153,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
receiverIds.Add(templateModel.Primary.CarrierId);
if (mailConfig.Receiver.IsBooking)
receiverIds.Add(templateModel.Primary.CarrierId);
receiverIds.Add(templateModel.Primary.ForwarderId);
if (mailConfig.Receiver.IsYard)
receiverIds.Add(templateModel.Primary.YardId);

@ -1,9 +1,9 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Entity.TaskInteraction;
using DS.WMS.Core.Op.Interface.TaskInteraction;
using DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor;
using DS.WMS.Core.TaskPlat;
using SqlSugar;

@ -0,0 +1,9 @@
using RazorEngineCore;
namespace DS.WMS.Core.Op.Method.TaskInteraction
{
internal class TemplateTranslator
{
}
}

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NameOfLastUsedPublishProfile>D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>D:\Source\Repos\DS8\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup>

Loading…
Cancel
Save