Ejemplo n.º 1
0
        public override void UnExecTaskExec(string taskExecID)
        {
            string           id           = GetQueryString("ID");
            WorkflowEntities flowEntities = FormulaHelper.GetEntities <WorkflowEntities>();
            S_WF_InsTaskExec taskExec     = flowEntities.Set <S_WF_InsTaskExec>().SingleOrDefault(c => c.ID == taskExecID);
            string           stepCode     = taskExec.S_WF_InsTask.S_WF_InsDefStep.Code;

            PostingFO.ChangeStatus(id, stepCode);
            base.UnExecTaskExec(taskExecID);
        }
Ejemplo n.º 2
0
        public override bool ExecTaskExec(Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing, string nextExecUserIDs, string nextExecUserNames, string nextExecUserIDsGroup, string nextExecRoleIDs, string nextExecOrgIDs, string execComment)
        {
            WorkflowEntities entitiesFlow = FormulaHelper.GetEntities <WorkflowEntities>();
            bool             flowComplete = base.ExecTaskExec(taskExec, routing, nextExecUserIDs, nextExecUserNames, nextExecUserIDsGroup, nextExecRoleIDs, nextExecOrgIDs, execComment);
            S_D_Posting      model        = entities.Set <S_D_Posting>().Find(taskExec.S_WF_InsFlow.FormInstanceID);

            if (taskExec.S_WF_InsTask.Status == FlowTaskStatus.Complete.ToString())
            {
                if (model != null)
                {
                    if (string.IsNullOrEmpty(model.InsFlowID))
                    {
                        model.InsFlowID = taskExec.S_WF_InsTask.InsFlowID;
                    }

                    string[] arr = new string[2] {
                        routing.InsDefStepID, routing.EndID
                    };
                    List <S_WF_InsDefStep> steps = entitiesFlow.Set <S_WF_InsDefStep>().Where(c => arr.Contains(c.ID)).ToList();
                    string endID = routing.EndID;
                    if (steps.Find(c => c.ID == endID) != null)
                    {
                        model.Status = steps.Find(c => c.ID == endID).Code;
                    }
                    string exStatus = string.Empty;
                    string stepID   = routing.InsDefStepID;
                    if (steps.Find(c => c.ID == stepID) != null)
                    {
                        exStatus = steps.Find(c => c.ID == stepID).Code;
                    }
                    if (model.Status == PostingStatus.Draft.ToString())
                    {
                        string[] arrExecSteps = string.IsNullOrEmpty(model.ExecutedSteps) ? new string[1] {
                            exStatus
                        } : (model.ExecutedSteps + "," + exStatus).Split(',');
                        foreach (string str in arrExecSteps)
                        {
                            if (!string.IsNullOrEmpty(str))
                            {
                                string[] arrValTxt = new string[2] {
                                    str, str + "ID"
                                };
                                foreach (string s in arrValTxt)
                                {
                                    PropertyInfo pi = model.GetType().GetProperty(s, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
                                    if (pi != null && pi.CanWrite)
                                    {
                                        pi.SetValue(model, string.Empty, null);
                                    }
                                }
                            }
                        }
                        model.ExecutedSteps = string.Empty;
                    }
                    else
                    {
                        if (exStatus != string.Empty)
                        {
                            if (string.IsNullOrEmpty(model.ExecutedSteps))
                            {
                                model.ExecutedSteps = exStatus;
                            }
                            else
                            {
                                model.ExecutedSteps += "," + exStatus;
                            }
                        }
                    }
                    //转PDF
                    if (steps.Find(c => c.ID == stepID).Code == PostingStatus.TaoHong.ToString())
                    {
                        if (string.IsNullOrEmpty(model.MergeDocID))
                        {
                            model.MergeDocID = model.DocID;
                        }
                        PostingFO.AddPDFTask(model.MergeDocID);
                    }
                    entities.SaveChanges();
                }
            }

            return(flowComplete);
        }