一: 开发配置说明:

1. 复制SQLScripts目录里有数据库生成SQL,并执行;
2. Wf5.WebApi为工作流WebApi项目,可以用FireFox插件RestClient进行接口测试;
3. Wf5.UnitTest为工作流单元测试项目;
4. 查看以上项目的Web.Config文件或App.config文件数据库链接配置,修改步骤1创建的数据库名称和登录信息;
5. Xml目录有流程定义文件,price.xml为顺序流转示例,officeIn.xml为分支流转示例;
6. 查看以上项目的Web.config文件或App.congig文件的<appSettings>节点配置<WorkflowFileServer>目录指向xml文件路径的主目录。
示例说明:
比如应用程序中嵌入Price Process流程:ProcessGUID为:072af8c3-482a-4b1c-890b-685ce2fcc75d,工作流引擎根据ProcessGUID值查找流程定义表WfProcess, 然后根据appSetting配置的WorkflowFileServer值和表中字段XmlFilePath和XmlFileName 组合生成xml文件路径。


完整路径为:

<WorkflowFileServer> WfProcess表中的XmlFilePath字段 WfProcess表中的XmlFileName


一个实际数据的例子:
<WorkflowFileServer>: c:\xpdl
XmlFilePath: Sample
XmlFileName: price.xml
完成的流程定义文件指向为:c:\xpdl\Sample\price.xml。



二:接口调用示例:

TestMethod
public void StartupRunEnd()
{
////StarterA:
////UserID":"10","UserName":"Long","AppName":"SamplePrice","AppInstanceID":"100","ProcessGUID":"072af8c3-482a-4b1c-890b-685ce2fcc75d
var initiator = new WfAppRunner();
initiator.AppName = "SamplePrice";
initiator.AppInstanceID = 100;
initiator.ProcessGUID = Guid.Parse("072af8c3-482a-4b1c-890b-685ce2fcc75d");
initiator.UserID = 10;
initiator.UserName = "Long";

IWorkflowService service = new WorkflowService();

//流程开始->业务员提交
service.StartProcess(initiator);

//业务员提交->计划部签字
var banFangNodeGuid = "fc8c71c5-8786-450e-af27-9f6a9de8560f";
PerformerList pList = new PerformerList();
pList.Add(new Performer(20, "Zhang"));

initiator.NextActivityPerformers = new Dictionary<Guid, PerformerList>();
initiator.NextActivityPerformers.Add(Guid.Parse(banFangNodeGuid), pList);
service.RunProcessApp(initiator);

//计划部签字->业务员签字
//办理用户身份
initiator.UserID = 20;
initiator.UserName = "Zhang";

var salesGuid = "39c71004-d822-4c15-9ff2-94ca1068d745";
pList.Clear();
pList.Add(new Performer(10, "Long"));

initiator.NextActivityPerformers.Clear();
initiator.NextActivityPerformers.Add(Guid.Parse(salesGuid), pList);
service.RunProcessApp(initiator);

//业务员签字->结束
//办理用户身份
initiator.UserID = 10;
initiator.UserName = "Lhang";

var endGuid = "b70e717a-08da-419f-b2eb-7a3d71f054de";
pList.Clear();
pList.Add(new Performer(10, "Long"));

initiator.NextActivityPerformers.Clear();
initiator.NextActivityPerformers.Add(Guid.Parse(endGuid), pList);
service.RunProcessApp(initiator);
}

Last edited Sep 16, 2013 at 9:18 AM by besley, version 1

Comments

No comments yet.