-
Notifications
You must be signed in to change notification settings - Fork 246
Slickflow Quick Start Tutorial
Slickflow.NET Tutorial
Foreword: For developers eager to understand the engine function, after downloading the version, they want to try to write code to complete the development and testing of a process.This article attempts to illustrate how to quickly understand engine code writing from a simple process.
Version:.NETCore 2.1
Sequence is used to create sequential processes, and nodes are generated sequentially.
var pmb = ProcessModelBuilder.CreateProcess("BookSeller Process", "BookSeller Process Code", "1");
var process = pmb.Start("Start")
.Task("Package Books", "PB001")
.Task("Deliver Books", "DB001")
.End("End")
.Store();
The above code creates a simple serial process with four nodes, the start node, two task nodes and the Store () method is used for database storage process. Examples of flow charts are as follows:
Starting and running processes are the two most commonly used API interfaces.
Starting needs to deal with the creation of process instances, as well as the creation of task nodes after the start node. The sample code is as follows:
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("10", "jack")
.UseApp("BS-100", "Delivery-Books", "BS-100-LX")
.UseProcess(" BookSellerProcessCode ")
.Start();
Process Record List:
Process running is a process that starts with the current to-do task and runs to the next step. When parsing a process, there may be multiple processing steps in the next step, requiring the user to explicitly select a list of steps (usually specified by the front-end user when the next step list pops up). Here, an example can be used to run as a simple one-step instance.
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("10", "jack")
.UseApp("BS-100", "Delivery-Books", "BS-100-LX")
.UseProcess("BookSellerProcessCode")
.OnTask(8027) // TaskID
.NextStepInt("20", "Alice")
.Run();
Process Record List:
If the user finds an error message when he completes his to-do task and sends it to the next dealer, he can initiate the revocation by himself and revoke the current process back.Revoking internal processing logic is equivalent to returning processing, except that the sponsors are in different positions.The code example is as follows:
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("20", "Alice")
.UseApp("BS-100", "Delivery-Books", "BS-100-LX")
.UseProcess("BookSellerProcessCode ")
.OnTask(8027) // TaskID
.Withdraw( );
Process Record List:
The process return is initiated by the current to-do task handler and returns to the previous step of the process.When parsing a process, the previous step may have multiple processing steps, requiring the user to explicitly select a list of steps (usually specified by the front-end user when the previous step list pops up), and the PrevStepInt () method is used to simplify processing for only one of the processing steps that are returned.
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("20", "Alice")
.UseApp("BS-100", "Delivery-Books", "BS-100-LX")
.UseProcess("BookSellerProcessCode")
.PrevStepInt()
.OnTask(8030) // TaskID
.SendBack();
Process Record List:
Foreword: For developers eager to understand the engine function, after downloading the version, they want to try to write code to complete the development and testing of a process.This article attempts to illustrate how to quickly understand engine code writing from a simplest parallel branching process.
Version:.NET Core 2.1
Branch process is a common decision-making process. In this paper, a car order process is taken as an example to demonstrate the process of parallel branch process.Parallel branches are usually used in scenarios where multiple departments can perform tasks at the same time, and each individual branch can also be considered as a serial sequence fragment.Finally, multiple branches are merged through the sink node.
var pmb = ProcessModelBuilder.CreateProcess(" LargeOrderProcess ", " LargeOrderProcessCode ");
var process = pmb.Start("Start")
.Task("Large Order Received", "LOR001")
.AndSplit("AndSplit")
.Parallels(
() => pmb.Branch (
() => pmb.Task ("Engineering Review", "ER001")
)
, ( ) => pmb.Branch (
() => pmb.Task ("Design Review", "DR001")
)
)
.AndJoin("AndJoin")
.Task("Management Approve", "MA001")
.End("End")
.Store();
The above code creates a parallel branching process with two branches, and the branch is AndSplit-AndJoin. The attribute types of the nodes in the graph are set by direct assignment of the code. Examples of flow charts are as follows:
Starting and running processes are the two most commonly used API interfaces.
Starting needs to deal with the creation of process instances, as well as the creation of task nodes after the start node and the start node. The sample code is as follows:
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("10", "jack")
.UseApp("PS-100", "Large-Car-Order", "PS-100-LX")
.UseProcess("LargeOrderProcessCode")
.Start();
The activity instance record table is as follows:
Process running is a process that starts with the current to-do task and runs to the next step.Parallel branches indicate that multiple branches are triggered simultaneously, as illustrated in the flow chart above: Design Review and Engineering Review are triggered simultaneously by parallel gateway nodes (AndSplit), so two new activity records are generated at one time in the activity instance table.
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("10", "jack")
.UseApp("PS-100", "Large-Car-Order", "PS-100-LX")
.UseProcess("LargeOrderProcessCode ")
.OnTask(8033)
.NextStepInt("20", "Alice")
.Run();
The activity instance record table is as follows:
If the user finds an error message when he completes his to-do task and sends it to the next dealer, he can initiate the revocation by himself and revoke the current process back. When the parallel branch is withdrawn, the two parallel branches are also set back and revoked at the same time, indicating that the branch is two activities of strong correlation type.
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("10", "Jack")
.UseApp("PS-100", "Large-Car-Order", "PS-100-LX")
.UseProcess("LargeOrderProcessCode ")
.OnTask(8033) // TaskID
.Withdraw();
The activity instance record table is as follows:
The process return is initiated by the current to-do task handler and returns to the previous step of the process. If one branch of a parallel branch is returned, then the default is to return only the task node before the current branch to the gateway, without affecting the other branch.
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("20", "Alice")
.UseApp("PS-100", "Large-Car-Order", "PS-100-LX")
.UseProcess("LargeOrderProcessCode ")
.PrevStepInt()
.OnTask(8038) // TaskID
.SendBack();
The activity instance record table is as follows: Revocation and fallback of parallel branches are special in the engine because of the processing of adjacent branches. Here, only the result records after the return are described, and the internal processing logic of the return will be arranged for another article to be introduced specifically in the future.
Foreword: For developers eager to understand the engine function, after downloading the version, they want to try to write code to complete the development and testing of a process.This paper attempts to quickly understand the engine code writing from the leave process or branch mode.
Version:.NET CORE 2.1
Or branching process is a common decision-making process, which is used to deal with business processing in different decision scenarios, in which each branch can be regarded as a fragment of a serial process.The following is the creation code of the leave process:
var pmb = ProcessModelBuilder.CreateProcess("LeaveRequest", "LeaveRequestCode", "1");
var process = pmb.Start("Start")
.Task("Fill Leave Days", "FLD001")
.OrSplit("OrSplit")
.Parallels(
() => pmb.Branch (
() => pmb.Task (
VertexBuilder.CreateTask("CEO Evaluate", "CEOE001"),
LinkBuilder.CreateTransition("days>=3")
.AddCondition(ConditionTypeEnum.Expression, "Days>=3")
)
)
, () => pmb.Branch (
() => pmb.Task(
VertexBuilder.CreateTask ("Manager Evaluate", "ME001"),
LinkBuilder.CreateTransition ("days<3")
.AddCondition(ConditionTypeEnum.Expression , "Days<3")
)
)
)
.OrJoin("OrJoin")
.Task("the Notify HR", "HRN001")
.End("End")
.Store();
The above code creates an OrSplit-OrJoin process with two branches representing the leave process in the actual business process. An example of the completed flow chart is as follows: Or the branch is a transition of two conditional expressions. In the case of a branch gateway node, the process will decide which branch to take according to the value of the incoming conditional variable days. This process can be regarded as the branch selection of the number of days off in the leave process.For example, if the number of days off is less than 3 days, the Department Manager will approve it. If the number of days off exceeds (including) 3 days, the general manager will be required to approve it.Approval decision-making can be realized by means of branch mode or branch mode.
Starting and running processes are the two most commonly used API interfaces.
Starting needs to deal with the creation of process instances, as well as the creation of task nodes after the start node and the start node. The sample code is as follows:
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("10", "jack")
.UseApp("DS-100", "Leave-Request", "DS-100-LX")
.UseProcess("LeaveRequestCode")
.Start();
The activity instance record table is as follows:
Similarly, according to the leave process as an example, the first task node can be regarded as "submitting leave form", and when the employee completes the leave form, it can be regarded as starting the process.
Process running is a process that starts with the current to-do task and runs to the next step.Because it's a branch gateway or a branch gateway, it's necessary to specify the name and value of the condition variable to determine the next branch path.Here, the days of leave as a conditional variable need to be passed in. When the days of leave are 3 days, the gateway decides to the CEO approval node, so only one of the branches will be selected for routing.The code example is as follows:
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("10", "jack")
.UseApp("DS-100", "Leave-Request", "DS-100-LX")
.UseProcess("LeaveRequestCode")
.OnTask(8017)
.IfCondition("Days", "3")
.NextStepInt("20", "Alice")
.Run();
The activity instance record table is as follows:
If the user finds an error message when he completes his to-do task and sends it to the next dealer, he can initiate the revocation by himself and revoke the current process back.
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("10", "Jack")
.UseApp("DS-100", "Leave-Request", "DS-100-LX")
.UseProcess("LeaveRequestCode ")
.OnTask(8017) // TaskID
.Withdraw();
The activity instance record table is as follows:
The process return is initiated by the current to-do task handler and returns to the previous step of the process.If one branch of a parallel branch is returned, then the default is to return only the task node before the current branch to the gateway, without affecting the other branch.
IWorkflowService wfService = new WorkflowService( );
var wfResult = wfService.CreateRunner("20", "Alice")
.UseApp("DS-100", "Leave-Request", "DS-100-LX")
.UseProcess("LeaveRequestCode ")
.PrevStepInt()
.OnTask(8020) // TaskID
.SendBack();
The activity instance record table is as follows:
- Slickflow Process Designer Http://demo.slickflow.com/sfd/
- Slickflow WebTest Tools Http://demo.slickflow.com/sfw2/
Https://github.com/besley/Slickflow
- The above code can help developers quickly familiarize themselves with the interface of engine components and the practical functions of simple or branch. The complete functions need to be acquired in the enterprise version or above.
- Process Designer and Web Testing Tool in the Assistant Development Tool, which can give users intuitive experience operation, but also suitable for different types of business users;
- Code creation process and test process are convenient for developers to learn and start quickly, which is an efficient way to improve work efficiency.