The example demonstrates the definition of business process using the workflow component of the RDIFramework.NET framework - leave application process - Web

Examples demonstrate workflow components using the RDIFramework.NET  framework

Carry out the definition of business process - leave application process - Web

 

  Reference article:

RDIFramework.NET — Rapid Information System Development Framework Based on .NET — Series Catalog

RDIFramework.NET ━ .NET Rapid Information System Development Framework ━ Introduction of Workflow Components

RDIFramework.NET ━ .NET Rapid Information System Development Framework ━ Workflow Component Web Business Platform

RDIFramework.NET ━ .NET rapid information system development framework ━ workflow component WinForm business platform

The example demonstrates the definition of business process using the workflow component of the RDIFramework.NET framework-leave application process-WinForm 

  The RDIFramework.NET workflow component is supported by the RDIFramework.NET framework, a set of process management components developed based on our years of project experience and project practice, combined with the characteristics of major domestic workflow products. This component not only considers building a business system from scratch, but also considers integration with existing business systems. To build a system from scratch, we can use the RDIFramework.NET framework to quickly build a business system. To integrate with the existing system, our process engine provides rich functional interfaces for three-party business system calls, and provides all the source code of the components to facilitate users to integrate. The RDIFramework.NET workflow component adopts the SOA architecture mode, and the process engine supports WCF access. Support B/S, C/S systems, and support mainstream databases such as SQLServer and ORACLE.

  RDIFramework.NET-workflow components mainly cover the design and definition of workflow, the initiation and operation of process instances, the monitoring and management of business processes, the integration and collaboration of workflow components and business systems, etc.

  1. Business description of the leave process

    The employee leave process is basically involved in the major information systems of the enterprise. In this article, I will show you how to use the RDIFramework.NET workflow component to customize the employee leave process. The current leave business process requirements are as follows:

    The employee's request for leave must first be submitted to the "partial manager" of the department where the requester belongs for approval. If the number of days of leave is less than or equal to 3 days, the "department manager" has the right to directly approve it, otherwise it needs to be submitted to the "branch general manager" for approval.

  2. Definition of leave application process

  We have clear the business process of applying for leave, and now we use the RDIFramework.NET framework to define the application for leave. The final leave application process is shown in the following figure:

  3. Development of business form for leave application

  Now that the definition of the entire process of applying for leave is complete, we will start developing the leave form. The form development is very simple. We can develop it in the usual way of developing a form, and then load it into the framework. Before developing the form, we need to create the data table of leave request form in the database. At the same time, the table needs to contain the following four fields: WorkFlowId (workflow primary key), WorkFlowInsId (workflow instance primary key), WorkTaskId (work task primary key), and WorkTaskInsId (work task instance primary key). As shown below:

  

  The table is defined, and now we are going to develop the business form. The business form refers to the form used in the process. The interface of the form file is generally divided into two types: the editing interface and the query interface, and the editing interface refers to the creation and modification. Information interface; query interface refers to the interface for querying form data. The difference between the two is that the former has an input area and the latter has no input area. Both can also be implemented in the same form, by setting the state of the form (view, modify, new) to control the editability of the page. The style and design of the form can be set according to your own preferences, and there are no special requirements. Just coordinate with other modules.

  Open VS and develop a leave application form (explain, there are many ways to develop, here is just for the convenience of explanation, make it simpler, you can expand it yourself), as shown in the following figure:

  Then write the form code, and you can freely implement the business logic of the form in the code, which is very flexible. At the same time, the business form of the process only needs to inherit from the base class (BaseUserControl) that we have implemented, and then overload the corresponding method. The business form implementation code of the entire leave application is given below for reference, as shown below:

using System;
using System.Data;

namespace RDIFramework.WebApp.BizModules
{
    using RDIFramework.BizLogic;
    using RDIFramework.Utilities;

    public partial class UCQingJia : BaseUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load();
            if (!IsPostBack)
            {
                InitData ();
            }
        }

        /// <summary>
        /// Form data display, consider the case of returning the form to reprocessing and saving the draft
        ///
        /// </summary>
        private void InitData()
        {
            string sql = "select * from testQingjia where workflowinsId=@workflowinsId";
            var sqlBuilder = new SQLBuilder(this.WorkFlowDbProvider);
            sqlBuilder.BeginSelect("testQingjia");
            sqlBuilder.SetWhere("workflowinsId", WorkFlowInsId);
            DataTable dt = sqlBuilder.EndSelect();
            if (dt != null && dt.Rows.Count > 0)//Determine whether there is data, there is data to read the value in the database
            {
                lbUserId.Text = dt.Rows[0]["userid"].ToString();
                lbUserName.Text = dt.Rows[0]["userName"].ToString();
                lbDutyCaption.Text = dt.Rows[0]["dutyCaption"].ToString();
                lbArchCaption.Text = dt.Rows[0]["archCaption"].ToString();
                tbxStartTime.Value = dt.Rows[0]["beginTime"].ToString();
                tbxEndTime.Value = dt.Rows[0]["endTime"].ToString();
                tbxDays.Text = dt.Rows[0]["Days"].ToString();
                tbxQingjia.Text = dt.Rows[0]["QingJia"].ToString();
                dplType.Text = dt.Rows[0]["QingJiaType"].ToString();
            }
            else//If there is no data, initialize the default value
            {
                lbUserId.Text = UserId;
                lbUserName.Text = UserName;
                lbDutyCaption.Text = DutyCaption;
                lbArchCaption.Text = ArchCaption;
                tbxStartTime.Value = DateTime.Now.ToShortDateString();
                tbxEndTime.Value = DateTime.Now.ToShortDateString();
            }
        }

        /// <summary>
        /// Form data submission, avoid repeated submission
        /// </summary>
        public override void SaveUserControl(bool IsDraft)
        {
            base.SaveUserControl(IsDraft);

            var sqlBuilder = new SQLBuilder(this.WorkFlowDbProvider);
            string sql = "DELETE TESTQINGJIA WHERE WORKFLOWINSID=@WORKFLOWINSID";//Delete the original data first
            sqlBuilder.BeginDelete("testQingjia");
            sqlBuilder.SetWhere("WORKFLOWINSID", WorkFlowInsId);
            sqlBuilder.EndDelete();

            sqlBuilder.BeginInsert("testQingjia");
            sqlBuilder.SetValue("WorkFlowId", WorkFlowId);
            sqlBuilder.SetValue("WorkTaskId", WorkTaskId);
            sqlBuilder.SetValue("WorkFlowInsId", WorkFlowInsId);
            sqlBuilder.SetValue("WorkTaskInsId", WorkTaskInsId);
            sqlBuilder.SetValue("ID", BusinessLogic.NewGuid());
            sqlBuilder.SetValue("userId", lbUserId.Text);
            sqlBuilder.SetValue("userName", lbUserName.Text);
            sqlBuilder.SetValue("dutyCaption", lbDutyCaption.Text);
            sqlBuilder.SetValue("archCaption", lbArchCaption.Text);
            if (this.WorkFlowDbProvider.CurrentDbType == CurrentDbType.Oracle)
            {
                sqlBuilder.SetValue("BeginTime", !string.IsNullOrEmpty(tbxStartTime.Value) ? BusinessLogic.GetOracleDateFormat(DateTimeHelper.ToDate(tbxStartTime.Value)) : BusinessLogic.ConvertToDateToString(tbxStartTime.Value));
                sqlBuilder.SetValue("EndTime", !string.IsNullOrEmpty(tbxEndTime.Value) ? BusinessLogic.GetOracleDateFormat(DateTimeHelper.ToDate(tbxEndTime.Value)) : BusinessLogic.ConvertToDateToString(tbxEndTime.Value));
            }
            else
            {
                sqlBuilder.SetValue("BeginTime", BusinessLogic.ConvertToDateToString(tbxStartTime.Value));
                sqlBuilder.SetValue("EndTime", BusinessLogic.ConvertToDateToString(tbxEndTime.Value));
            }
            sqlBuilder.SetValue("Days", tbxDays.Text);
            sqlBuilder.SetValue("QingJiaType", BusinessLogic.ConvertToString(dplType.SelectedItem.Text));
            sqlBuilder.SetValue("QingJia", tbxQingjia.Text);
            sqlBuilder.EndInsert ();
        }
    }
}

  Fourth, the binding of forms and business processes

  After the form development is completed, we need to bind the form in the RDIFramework.NET framework, as shown in the following figure:

 

  For the description of specific items, please refer to the introduction document of the RDIFramework.NET workflow section.

  It can also be set in the "User Form Management" module of the Web business platform, as shown in the following figure:

  In the picture above, I have defined the "Form False Form" subform, we click "Modify Subform" and see the settings, as shown in the following figure:

  在“修改子表单”界面的“位置:”设置,就是我们开发的业务表单发布到IIS下的相对地址,按这样设置后,框架就可以自动加载进来了。

  有时我们的业务可能会比较复杂,会涉及不至一个业务表单,我们的工作流组件充分的考虑到了这种情况。因此我们是以主表单(可包含多个子表单)来与各任务节点进行关联的。比如:我们在发起请假申请时,会需要填写请假单表单,还会上传一些附件(附件表单我们可以做成公用表单),这时配置如下所示:

 

  表单在框架中定义好后,我们再在请假申请各任务节点对表单进行绑定,需要说明的是,我们是以主表单以基础进行绑定的,这就代表一个任务节点可以拥有多个表单,这对复杂的业务非常有用。下面看下请假流程中部门经理对表单的绑定如下图所示,在“表单名”后面的按钮“...”就可以打开选择我们已经定义的主表单,来作为当前任务节点的表单列表。

   五、请假申请演示

  请假申请是每个登录系统的人都应该可以使用的业务流程,因此我们把“请假申请”的启动节点的处理人指定为“所有人”,这就代表只要能登录系统,就可以使用“请假申请”流程。如下图所示:

 

  打开“日常业务”功能模块,可以看到当前用户可以使用的业务流程,如下图所示:

  在“可用业务”中选择“行政部”,右侧列出所选节点当前用户有权限启动的所有业务流程,我们选择“员工请假流程”,单击“开始任务”,打开启动任务主界面,如下图所示。假设请假5天,则应由当前用户所在部门经理审批的同时还需要分公司总经理审批。

  单击提交后,流程提交到部门经理“wikstone”处,以wikstone用户登录,在未认领任务界面,可以看到请假申请已经提交给“部门经理处了,如下图所示:

  RDIFramework.NET工作流组件约定所有任务提交后都会进入对方未认领任务列表,这样做的好处是:如果当前提交后想反悔,只要对方没有认领,就可以撤回任务。选择“认领任务”后,进行待办任务窗体,如下图所示:

  选择一条待办任务后,我们可以“处理任务”,放弃对当前任务的认领、查看当前任务的执行流程图,当前任务的“处理记录”等。我们选择“处理任务”按钮,对当前任务进行处理,如下图所示:

  在“处理任务”主界面,我们可以做很多的操作,具体可以参考RDIFramework.NET工作流组件的相关说明,这儿就不一一阐述了。

  填写好审批意见后,单击“提交”按钮,即可根据流程定义(当前请假天数大于3天)提交到“分公司总经理”处审批。下面我们以分公司总经理“chenp”的用户登录系统,可以看到请假申请已经提交到了分公司总经理处。如下图所示:

 

  按同样方式进行任务处理,再提交,流程就可以回到流程启动用户了。我们以流程启动者登录进来看下,查看下审批列表,如下图所示:

  同时我们可以查看流程执行情况,如下图所示:

  同样,我们可以查看流程的处理记录,如下图所示。

  在我参与的任务界面可以查看我所参与的所有任务的情况,如下图所示:

 

  至此,整个请假申请业务流程完成,当前在流程流转的过程中还有很多操作,比如:任务的回退、授权、指派、召回等都可以轻易实现。

 

作者: EricHu 
出处:http://www.cnblogs.com/huyong/ 
Email:[email protected] 
QQ交流:406590790 
框架博客:http://chinahuyong.iteye.com/
                http://www.cnblogs.com/huyong 
RDIFramework.NET,基于.NET的快速信息化系统开发、整合框架,给用户和开发者最佳的.Net框架部署方案。 
关于作者:高级工程师、信息系统项目管理师、DBA。专注于微软平台项目架构、管理和企业解决方案,多年项目开发与管理经验,曾多次组织并开发多个大型项目,在面向对象、面向服务以及数据库领域有一定的造诣。现主要从事基于 RDIFramework.NET 框架的技术开发、咨询工作,主要服务于金融、医疗卫生、铁路、电信、物流、物联网、制造、零售等行业。 
如有问题或建议,请多多赐教! 
本文版权归作者和iteye博客共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,如有问题,可以通过邮箱或QQ 联系我,非常感谢。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326452424&siteId=291194637