Ejemplo n.º 1
0
        /// <summary>
        /// 获得流程模型模板
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static WorkflowTemplate GetWorkflowTemplate(OT_WorkflowTemplateDraft model)
        {
            XmlNode          WorkflowPackage  = XMLHelper.GetRootNode(model.Content);
            WorkflowTemplate workflowTemplate = new WorkflowTemplate();

            workflowTemplate.WorkflowCode        = XMLHelper.GetNodeValue(WorkflowPackage, "WorkflowCode");
            workflowTemplate.InstanceName        = XMLHelper.GetNodeValue(WorkflowPackage, "InstanceName");
            workflowTemplate.Creator             = model.Creator;
            workflowTemplate.ModifiedBy          = model.ModifiedBy;
            workflowTemplate.CreatedTime         = Convert.ToString(model.CreatedTime);
            workflowTemplate.ModifiedTime        = Convert.ToString(model.ModifiedTime);
            workflowTemplate.Description         = XMLHelper.GetNodeValue(WorkflowPackage, "Description");
            workflowTemplate.Height              = 0;
            workflowTemplate.Width               = 0;
            workflowTemplate.BizObjectSchemaCode = XMLHelper.GetNodeValue(WorkflowPackage, "BizObjectSchemaCode");
            List <ActivityModel> activites = new List <ActivityModel>();

            #region 获取开始节点
            activites.AddRange(GetActivities(WorkflowPackage, "Activities/StartActivity"));
            #endregion
            #region 获取结束节点
            activites.AddRange(GetActivities(WorkflowPackage, "Activities/EndActivity"));
            #endregion
            #region 获取手工节点
            activites.AddRange(GetActivities(WorkflowPackage, "Activities/FillSheetActivity"));
            #endregion
            #region 获取传阅节点
            activites.AddRange(GetActivities(WorkflowPackage, "Activities/CirculateActivity"));
            #endregion
            #region 获取连接点节点
            activites.AddRange(GetActivities(WorkflowPackage, "Activities/ConnectionActivity"));
            #endregion
            #region 获取业务动作节点
            activites.AddRange(GetActivities(WorkflowPackage, "Activities/BizActionActivity"));
            #endregion
            #region 获取审批节点集合
            activites.AddRange(GetActivities(WorkflowPackage, "Activities/ApproveActivity"));
            #endregion

            workflowTemplate.Activities = activites;

            workflowTemplate.Rules = GetRules(WorkflowPackage);
            return(workflowTemplate);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 画图页面
        /// </summary>
        /// <returns></returns>
        public ActionResult ProcessDesigner(string ObjectId)
        {
            List <OT_WorkflowTemplateDraft> modelList = _workflowTemplateDraftService.SelectData <OT_WorkflowTemplateDraft>(@"SELECT [ObjectID]
      ,[Content]
      ,[Creator]
      ,[ModifiedBy]
      ,[CreatedTime]
      ,[ModifiedTime]
      ,[WorkflowCode]
      ,[BizObjectSchemaCode]
      ,[ParentObjectID]
      ,[ParentPropertyName]
      ,[ParentIndex],ProcessName
  FROM [Work6-OA].[dbo].[OT_WorkflowTemplate] where ObjectId='" + ObjectId + "'");
            OT_WorkflowTemplateDraft        model     = modelList[0];
            WorkflowTemplate workflowTemplate         = WorkflowHelper.GetWorkflowTemplate(model);

            ViewData["WorkflowTemplate"] = new JavaScriptSerializer().Serialize(workflowTemplate);
            return(View());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 画图页面
        /// </summary>
        /// <returns></returns>
        public ActionResult DesignerPage()
        {
            List <OT_WorkflowTemplateDraft> modelList = _workflowTemplateDraftService.SelectData <OT_WorkflowTemplateDraft>(@"SELECT [ObjectID]
      ,[Content]
      ,[Creator]
      ,[ModifiedBy]
      ,[CreatedTime]
      ,[ModifiedTime]
      ,[WorkflowCode]
      ,[BizObjectSchemaCode]
      ,[ParentObjectID]
      ,[ParentPropertyName]
      ,[ParentIndex]
  FROM [DataMip].[dbo].[OT_WorkflowTemplateDraft]");
            OT_WorkflowTemplateDraft        model     = modelList[0];
            var WorkflowPackage = XMLHelper.GetRootNode(model.Content);
            WorkflowTemplate workflowTemplate = new WorkflowTemplate();

            workflowTemplate.WorkflowCode        = XMLHelper.GetNodeValue(WorkflowPackage, "WorkflowCode");
            workflowTemplate.InstanceName        = XMLHelper.GetNodeValue(WorkflowPackage, "InstanceName");
            workflowTemplate.Creator             = modelList[0].Creator;
            workflowTemplate.ModifiedBy          = modelList[0].ModifiedBy;
            workflowTemplate.CreatedTime         = Convert.ToString(modelList[0].CreatedTime);
            workflowTemplate.ModifiedTime        = Convert.ToString(modelList[0].ModifiedTime);
            workflowTemplate.Description         = XMLHelper.GetNodeValue(WorkflowPackage, "Description");
            workflowTemplate.Height              = 0;
            workflowTemplate.Width               = 0;
            workflowTemplate.BizObjectSchemaCode = XMLHelper.GetNodeValue(WorkflowPackage, "BizObjectSchemaCode");
            List <ActivityModel> activites = new List <ActivityModel>();


            #region 获取开始节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/StartActivity"));


            #endregion
            #region 获取结束节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/EndActivity"));

            #endregion
            #region 获取手工节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/FillSheetActivity"));

            #endregion
            #region 获取传阅节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/CirculateActivity"));

            #endregion
            #region 获取连接点节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/ConnectionActivity"));

            #endregion
            #region 获取业务动作节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/BizActionActivity"));

            #endregion
            #region 获取审批节点集合
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/ApproveActivity"));

            #endregion

            workflowTemplate.Activities = activites;



            List <LineRuleModel> rules    = new List <LineRuleModel>();
            XmlNodeList          ruleList = XMLHelper.GetNodeList(WorkflowPackage, "Rules/Rule");
            foreach (XmlNode rule in ruleList)
            {
                LineRuleModel ruleModel = new LineRuleModel();
                ruleModel.DisplayName      = XMLHelper.GetNodeValue(rule, "Text");
                ruleModel.IsRule           = true;
                ruleModel.PreActivityCode  = XMLHelper.GetNodeValue(rule, "PreActivityCode");
                ruleModel.PostActivityCode = XMLHelper.GetNodeValue(rule, "PostActivityCode");
                ruleModel.UtilizeElse      = Convert.ToBoolean(XMLHelper.GetNodeValue(rule, "UtilizeElse"));
                ruleModel.FixedPoint       = Convert.ToBoolean(XMLHelper.GetNodeValue(rule, "FixedPoint"));
                ruleModel.Formula          = XMLHelper.GetNodeValue(rule, "Formula");
                ruleModel.TextX            = XMLHelper.GetNodeValue(rule, "TextX");
                ruleModel.TextY            = XMLHelper.GetNodeValue(rule, "TextX");
                XmlNodeList   pointList = XMLHelper.GetNodeList(rule, "Points/Point");
                List <string> points    = new List <string>();
                foreach (XmlNode item in pointList)
                {
                    points.Add(item.InnerText);
                }
                ruleModel.Points    = points;
                ruleModel.FontSize  = Convert.ToInt32(XMLHelper.GetNodeValue(rule, "FontSize"));
                ruleModel.FontColor = XMLHelper.GetNodeValue(rule, "FontColor");
                ruleModel.ID        = XMLHelper.GetNodeValue(rule, "ID");
                rules.Add(ruleModel);
            }
            workflowTemplate.Rules       = rules;
            ViewData["WorkflowTemplate"] = new JavaScriptSerializer().Serialize(workflowTemplate);
            return(View());
        }