Silverlight Open-Source Workflow designer and silverlight Workflow

Source: Internet
Author: User

[Switch] Silverlight Open-Source Workflow designer and silverlight Workflow

Statement

This workflow is a self-designed passive data trigger mode workflow. There are no existing workflow design standards (such as WFMC or WSFL) or interface specifications that are universal with other workflows. Here, more is the author's idea of using workflows and the practicality of workflows in daily office work. Therefore, if you are a person who follows various standards and specifications, please refer to the following content as appropriate. If you pay more attention to reality and practicality, follow the steps of the author to understand the implementation of this workflow.

 

Introduction

The SV workflow consists of a workflow designer and a workflow engine. All are developed based on Visual Studio 2012 + FramWork4.5. The workflow designer is a fully visualized operation mode developed based on silverlight5. The workflow engine is an independent engine class library developed based on the C # language. Combined with the asp.net MVC4 framework, the entire workflow is better designed and used. The following describes in detail the working principle and usage of the workflow designer and engine.

 

Overview

There are already many workflow designers with powerful functions on the market, many of which are based on scripts or plug-ins to complete the corresponding design operations. I have also tried some workflow designers and almost all of them have strict requirements on the running environment. This is a nightmare for users, because different browsers or PCs, the environment will be different. to display the complete designer page, you need to do a lot of settings or install some unauthenticated plug-ins. So I chose Microsoft's Silverlight. Similar to flash, you only need to install Silverlight once. In addition, almost all browsers can run, greatly simplifying user requirements.

 

Principle

The entire workflow is composed of active nodes and route settings. The flow between nodes is implemented based on the route settings. The data between nodes and routes is defined by the workflow variables.

It can also be understood here, that is, first create a workflow, then define the variables used in the workflow, and control the available variables of each node through the settings of the active node. When the engine is pushing nodes, select the next active node to be promoted based on the variable value of the route settings. This will be demonstrated in an example later. Here we will first describe how it works.

The activity node of a workflow is based on the system role. The author has abandoned his previous point of view of binding to people, because the basic positions of various enterprises or organizations are basically fixed, and only people are changed. The system roles we talk about, it can also contain multiple positions, so that no matter how the personnel's positions change, it will not affect the logic of the transfer. This greatly reduces the maintenance of workflows. What we need to do here is to do a good job of the relationship between the system role and the role. Of course, this requires us to pay attention and work. For our workflow, this must be done, but we will not talk about this here, because it involves the basis of the entire system, and there are many implementation methods, and they are different, the following provides only a diagram of the roles, positions, personnel, and permissions implemented by the author.

 

 

 

Use

 

Open the workflow designer and you will see the following interface:

 

Includes six function buttons and an empty design interface. You can click "create workflow" or "open workflow" to load the workflow content. Here, we assume that we want to establish a leave process, which involves two activity nodes, one is the data node of the Application Form filled by the person who asks for leave, and the other is the node that reviews the application form. Click "create workflow". The following page is displayed:

A green and red node appears on the settings page. We call a green node as the Start Node and a red node as the end node. All workflows contain the two nodes, all work starts from the Start Node and ends from the end node. The gray dot in the Start Node is the drag and drop point, and the route settings are created by dragging.

A workflow without any active nodes has been created. Next, we need to define the variables involved in the workflow. What we need to create is a leave process, the involved data should include: persons on leave, reason for leave, start date of leave, end date of leave, and review. Move the mouse to the blank area in the designer, right-click, and the workflow settings page is displayed as follows:

 

 

Here, we can set the workflow Name and description, and define the variables involved in the workflow. The types of variables include: single-line character type, multi-line character type, Html format character type, integer type, numeric type, date type, date and time type, choice type.

For our leave form, we create the following variables: Leave person (single-line character type), leave reason (multi-line character type), leave start date (date type), leave end date (date type), whether to allow (select type), audit description (multi-line character type ). In addition to the review instructions, other variables are not allowed to be blank. When the variable type is select type, we also need to click "…" Button to set the selected content and whether to allow variables. We have set two options: Allow and not allow. The variable order in the Variable list can be adjusted at will. The order of the variables will affect the sorting of fields when you fill out the form. For example:

 

 

Click OK. A workflow framework with the workflow name and variables is complete. The next step is to create related nodes and configure routes between nodes.

Click the "add activity" button. At this time, there will be an extra rectangular node in the setting interface. This rectangular node is our active node. You can move the node with the mouse, move the cursor to the blank area between the border of the rectangle and the drag point, and hold down the left mouse button to move the active node. The start and end nodes can also be moved. We add two active nodes and move them, such:

 

 

According to our process design, the first activity node should be the data of the requester to fill out the application form. The second node is the manager's review action on the application form. We start from the Start Node and drag and drop the node, create the relationship between these nodes, drag and drop the nodes, drag them to the next node, and release them to establish the routing relationship between nodes. The routing relationship we need to establish is as follows, from the Start Node to fill in the leave form to the Review Form to the end of the process. For example:

 

 

 

At this point, the general flow of our workflow has been set. Next, we need to set the active nodes and routes to implement our flow logic. Let's first set the active node, move the mouse to the first node, right-click the first node, and the pop-up setting box is as follows:

Activity node settings have four main items: attributes, execution roles, variables, and reminders.

Attribute: Set the name of the active node and the submission method of the node. The submission method can be set to "Submit after any one of the roles ", the other is "the owner of the role submits after processing ".

Submit after any one of the roles is processed: if any one of the roles specified in the role item is executed, the submit operation is performed.

Submit after all roles in the role are processed: in all roles specified in the role execution, all roles must be processed before submission.

In this option, the name of the active node is set to: Enter the ticket form; the method of submitting the node is: Any one of the roles can process and then submit.

 

Select the role to execute. The settings page is as follows:

On the specified role execution page, we can set the role type to operate on this active node.

The initiator processes the activity. Once this option is selected, the following role list cannot be selected again, meaning that this node can only be operated by the workflow initiator.

The personnel dynamically specified in the previous activity processes the activity. Once this item is selected, the role list is not allowed to be selected, which means that in the process of the workflow, the handler of this node is dynamically specified by the operator of the previous node. After this option is selected, you can also set whether to specify it at one time. This means that if the node has multiple execution opportunities in the entire workflow, it is required to dynamically specify the executor of the previous Node during each execution, then, all subsequent tasks will be executed by the person specified for the first time.

System role selection list: select the role that can execute the node, and click ">" to add the role to the current node on the right. In the list of roles executed on the current node, you can also set the relationship between the current role and the initiator's organization or department. There are three items: no designation, the same organization, or the same department. If this parameter is not specified, no judgment is required, as long as it is in the role list, it can be processed; the same organization means that the handler in the role list must be in the same organization as the initiator to process the role; the same Department means that the handler in the role list must be in the same organization and department as the initiator. This relationship can greatly improve the applicability of our workflows.

In this option, we choose to process the activity by the initiator.

The settings page for selecting a variable appears as follows:

 

 

Here, we can see all the variables set in the workflow, and add the variables to be processed by this activity node to the current activity Variable list on the right. When a variable is added to the current Active Variable list, you can also set whether the variable is read-only. If the variable is checked on the read-only check box, the attribute of this active node is read-only, only read is allowed, and modification is not allowed.

In this option, you can add the requester, reason, start date, and end date to the current activity variable and edit the variable.

 

Select the reminder option. The following page is displayed:

This tab is used to indicate whether the worker of this node needs to set information reminders when the workflow is transferred to this active node.

Reminder type: Includes never-reminder, instant reminder, and delayed reminder. No reminder is not required to remind the handler of the node. A reminder immediately means that the handler of the node immediately performs a reminder once the process is executed on the node. A delayed reminder, when this option is selected, the following latency value is required. This means that when the node is executed, if it has not been processed within the specified latency, start to remind the worker of the node.

Repeat reminder type: This option can be set when the reminder type is not a reminder, but can be set to do not repeat or repeat. When the repeat reminder is selected, you need to set the repetition interval.

We choose not to remind you.

After setting related items for the active node, click OK to complete the setting of the node.

 

At this point, the first active node in the designer has a subscript "fill in the Application Form ".

Next, we will set the second activity node in the same way. We will set its name as "review request form" and the submission method of the activity node, we also select "any one of the roles will be processed and then submitted ".

 

When selecting the execution role, we select the manager role and set the relationship between the current role and the initiator's organization or department to "same Department", for example:

This means that only those who are in the same department as the sponsor of the application form and are in the Manager role can process the node.

On the variables tab, we add all the variables to the list of current active variables.

The four variables are set to read-only, such:

That is to say, when the manager reviews the four read-only variables, he has only the right to view and not to modify them. He can only set whether to allow and audit the two variables.

 

In the reminder tab, we still choose not to remind you. Click OK to complete the setting of the second active node, for example:

So far, we have made corresponding settings for the workflow and workflow activity nodes. At this time, it is already an executable workflow, but such a workflow, there is no logic analysis capability. We also need to set the route so that the flow can flow according to our intention.

Let's look at the current workflow. There are three routes in total. One arrow represents a route. Let's take a rough look at it. The first route is very clear, starting from the process, directly go to the first node, that is, the initiator needs to fill in the application form data. after entering the application form data, the initiator will directly submit the node to review the application form. The process is no problem until now, let's take a look at the last route. After the review request form is completed, it will go directly to the process completion node. There seems to be something missing in the whole process. Yes, there is no interaction between the initiator and reviewer. If the reviewer passes the review directly, the process is completed directly without any objection. But what if the review fails? What should I do if I need to feedback my review opinion to the person on leave?

Well, we need to add another route to the process at this time, that is, the route from the review of the requester node to the entry of the requester node. Hold down the drag-and-drop point of the review ticket and drag it to the left-side Navigation Pane. Our flow chart is changed to the following,

There are two routes between the two active nodes. It can be seen that the information exchange between the two nodes is basically realized.

Here, we need to note that the routing can be set or not set. If the logic flow between nodes is involved, you need to set the routing. If it is a simple linear process, you do not need to set the route, and the process will be executed by step, one node and one node.

For our process, we only need to set the route for the two nodes from the review request node. We first set the route from the review request node to the End Node of the process. Move the mouse over the route and right-click it. The routing Settings dialog box is displayed as follows:

 

 

Route name: Enter "approved and completed ".

Routing rules are formed by comparing the variable values of the workflow. Here, you can add multiple variable comparison rules to form a routing rule. The relationship between multiple variable rules is & (and), meaning that the route is executed only when all the variable comparison rules are met. When setting a route, we need to have a thorough understanding of this workflow to accurately set routing rules.

 

For our leave process, we only set whether the allowed variable is equal to the allowed variable here, this rule. This means that the workflow will directly end if the variable is allowed during review. For example:

Click "OK" to view the flow diagram. The route name is displayed.

 

Similarly, we set the route from the review request form to the request form entry as follows:

This means that when the review is not allowed, the data will be returned to the node where the application form is filled, so that the person who entered the application form can see the review result. If the review result still needs to be submitted, continue to submit. If you do not need to submit again, you can end the process yourself.

After setting, click OK to see the final flowchart:

 

 

Let's follow this flowchart to understand the entire process.

The process sponsor should fill out the leave form and submit it to the Manager for review. If the manager permits leave, the process will be completed directly. If the manager does not allow leave, the review information will be fed back to the person who asks for leave, the requester can modify the leave information before submitting for review, and then go through the manager's review. Or, the process is completed.

 

In this way, we have completed the preparation of a leave process. Click "save workflow" to save the workflow. You can call up the workflow to modify or delete it at any time.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.