工作流之公文流转篇

出处:http://www.cnblogs.com/flyskyer/archive/2009/03/11/1408578.html

 最近因为接手离职同事的公文审批(没有使用工作流)维护,感觉很麻烦,于是在我开发的工作流平台上重新写了相关的功能,扩展同事的功能,同时可以支持固定流和任意流功能。希望大哥们给予指点。

固定流就是由发起人定义审批的步骤,流程按照既定步骤执行。

任意流就是由发起人发起,选择下一步审批人审批,然后审批再选择下一步审批人。

当然公文审批支持的电子签名的功能也有,但是不作为本篇讨论内容,还有界面美观。

1.服务代码。


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.ComponentModel;

namespace StateMachineService
{
    [Serializable] 
    
public class DocFlowEventArgs:ExternalDataEventArgs 
    
{
       
public DocFlowEventArgs(string userID,Guid uninstand): base(uninstand)
       
{
           
           
this.uninstand = uninstand;
           
this.userID = userID;
       }

     
        
private Guid uninstand = Guid.Empty;
        
public Guid Uninstand
        
{
            
get return this.uninstand; }
            
set this.uninstand = value; }
        }

        
private string userID = string.Empty;
        
public string UserID
        
{
            
get return this.userID; }
            
set this.userID = value; }
        }

    }

    [ExternalDataExchange] 
    
public interface IDocFlowService
    
{
        
event EventHandler<DocFlowEventArgs> Next;
        
event EventHandler<DocFlowEventArgs> Jump;
        
event EventHandler<DocFlowEventArgs> Stop;

        
void SetFixNextApprover(int NextStpeID, string uninstand);
        
void SetFixEnableApprover(int CurrentStpeID, string uninstand);
        
void SetAutoNextApprover();
        
void SetAutoEnableApprover(string uninstand);
        
void ChangeStatus();
    }

    [Serializable] 
   
public  class DocFlowService:IDocFlowService 
    
{
        IDAL.IWFreeNode iwfreenode;
        Guid T;
        
string UserID;
        Dictionary
<string, EventHandler<DocFlowEventArgs>> list = new Dictionary<string, EventHandler<DocFlowEventArgs>>(); 
        
public void RaiseEventer(string eventName,Guid uninstand,string userID)
        
{
            
if(list[eventName]!=null)
            
{
                
try
                
{
                    EventHandler
<DocFlowEventArgs> eventHandler=list[eventName];
                    DocFlowEventArgs args
= new DocFlowEventArgs(userID ,uninstand);
                    args.WaitForIdle 
= true;
                    eventHandler.Invoke(
null, args );
                    
this.T = uninstand;
                    
this.UserID = userID;
                }

                
catch
                
{
                }

            }

        }

        
#region IDocFlowService 成员

        
public event EventHandler<DocFlowEventArgs> Next
        
{
 add
            
{
                
this.list.Add("Next", value);
            }

            remove
            
{
                
this.list.Remove("Next");
            }

        }


        
public event EventHandler<DocFlowEventArgs> Jump
        
{ add
            
{
                
this.list.Add("Jump", value);
            }

            remove
            
{
                
this.list.Remove("Jump");
            }

        }


        
public event EventHandler<DocFlowEventArgs> Stop
        
{
 add
            
{
                
this.list.Add("Stop", value);
            }

            remove
            
{
                
this.list.Remove("Stop");
            }

        }


        
public void ChangeStatus()
        
{
            
throw new NotImplementedException();
        }


        
#endregion


      
        
IDocFlowService 成员



        
IDocFlowService 成员



        
IDocFlowService 成员
    }

}

现在支持前进,抄送(平台功能)和终止,还不支持会退和跳批。

2.数据库结构


CREATE TABLE [dbo].[DocFlow](
    [Uninstand] [uniqueidentifier] NOT NULL,
    [UserID] [varchar](
50) NOT NULL,
    [Date] [datetime] NULL,
    [Title] [varchar](
400) NULL,
    [Remark] [varchar](
500) NULL,
    [DocLevel] [varchar](
50) NULL,
    [FlowType] [varchar](
10) NULL,
    [Depart] [varchar](
50) NULL
)

3.流程图

  a.

b.

2.

3.

4.

流程代码

 

Code

 

主要是StepIDList用于记录固定工作流的步骤序号,DocFlow用于记录工作流类型 CurrentIndex 记录当前步骤号

其它的就是分析最小和最大号,找寻下部号,已经相关的流转控制。还有一些是访问后台数据库的服务。

用户操作界面

审批界面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值