Exemple #1
0
        public List <WFItem> GetRejectOrRollbackSteps(string InstanceStepExecutorId)
        {
            WFInstance                Instance;
            WFInstanceStep            InstanceStep;
            WF_M_STEP                 Step;
            WF_T_INSTANCESTEPEXECUTOR InstanceStepExecutor;

            InstanceStepExecutorDAO.GetAllInfo(InstanceStepExecutorId,
                                               out InstanceStepExecutor, out InstanceStep, out Instance, out Step);

            if (IsHideNextStep(InstanceStepExecutor.InstanceStepId))
            {
                return(new List <WFItem>());
            }

            // 查找之前走过的节点
            var listFromStepIds    = new List <string>();
            var InstanceConnectors = WFDA.Instance.GetInstanceConnectorByTo(InstanceStep.InstanceId, InstanceStep.InstanceStepId);

            // 根据节点运行时连线记录,“到节点”查找所有的之前走过的节点
            GetFromSteps(listFromStepIds, InstanceConnectors);

            List <WFItem> list = new List <WFItem>();

            using (var db = Pub.DB)
            {
                list = WFDA.Instance.GetSteps(Step.ModelId).Where(a => listFromStepIds.Contains(a.StepId) && a.StepType != "Start" && a.StepId != InstanceStepExecutor.StepId)
                       .Select(a => new WFItem()
                {
                    text = a.StepName, value = a.StepId
                }).ToList();
            }
            return(list);
        }
Exemple #2
0
        /// <summary>
        /// 转签或者加签
        /// </summary>
        /// <param name="InstanceStepExecutorId"></param>
        /// <param name="list"></param>
        /// <param name="ExecuteComment"></param>
        /// <param name="ExecuteResult"></param>
        /// <param name="p"></param>
        public void TransferOrAdditional(string InstanceStepExecutorId, List <VM_WF_M_USER> list, string ExecuteComment, string ExecuteResult, string currentUser)
        {
            WFInstance                Instance;
            WFInstanceStep            InstanceStep;
            WF_M_STEP                 Step;
            WF_T_INSTANCESTEPEXECUTOR InstanceStepExecutor;

            InstanceStepExecutorDAO.GetAllInfo(InstanceStepExecutorId,
                                               out InstanceStepExecutor, out InstanceStep, out Instance, out Step);

            ExecuteComment = string.Format("{0}\r\n{1}", ExecuteComment, InstanceStepExecutor.ExecuteComment);
            var engine = NinjectHelper.Get <IEngine>();

            if (engine == null)
            {
                throw new WFException("找不到 IEngine".GetRes());
            }

            var memo = string.Format("{0}{1}给{2}", currentUser, ExecuteResult, string.Join(",", list.Select(a => a.UserName)));

            // 加签或者转签
            for (int i = 0; i < list.Count; i++)
            {
                var user = list[i];
                var listInstanceStepExecutorIds = ExecutorImp.InsertOneAndProxy(InstanceStep.InstanceStepId, user.UserId, user.UserName
                                                                                , memo, currentUser, true);
                SaveAdditionalApproveInfo(listInstanceStepExecutorIds, ExecuteResult, InstanceStepExecutor.InstanceStepExecutorId, user.UserName);
            }
            if (ExecuteResult == "加签" && string.IsNullOrWhiteSpace(InstanceStep.Extend04))
            {
                WFDA.Instance.UpdateInstanceStepExt(InstanceStep.InstanceStepId, "Extend04", InstanceStepExecutorId, currentUser);
            }
            // 结束当前我自己的任务
            SetFinished(InstanceStepExecutorId, ExecuteResult, ExecuteComment, memo, currentUser);
        }
Exemple #3
0
        public List <WFItem> GetSubmitOrApproveSteps(string InstanceStepExecutorId)
        {
            WFInstance                Instance;
            WFInstanceStep            InstanceStep;
            WF_M_STEP                 Step;
            WF_T_INSTANCESTEPEXECUTOR InstanceStepExecutor;

            InstanceStepExecutorDAO.GetAllInfo(InstanceStepExecutorId,
                                               out InstanceStepExecutor, out InstanceStep, out Instance, out Step);

            if (IsHideNextStep(InstanceStepExecutor.InstanceStepId))
            {
                return(new List <WFItem>());
            }

            // 得到 sql 语句
            var instance = WFDA.Instance.GetInstance(InstanceStep.InstanceId);
            var data1    = WFBusinessData.AddPrefix("WF_T_INSTANCE_", WFBusinessData.CreateInstance <WF_T_INSTANCE>(instance));
            var data2    = WFBusinessData.AddPrefix("WF_T_INSTANCESTEP_", WFBusinessData.CreateInstance <WF_T_INSTANCESTEP>(InstanceStep));
            var data3    = WFBusinessData.AddPrefix("WF_T_INSTANCESTEPEXECUTOR_", WFBusinessData.CreateInstance <WF_T_INSTANCESTEPEXECUTOR>(InstanceStepExecutor));

            WFBusinessData.Merge(data2, data1);
            WFBusinessData.Merge(data3, data1);
            var businessData = data1;

            var sql = Pub.GetOriginalSql(Step.Script);

            return(GetWFItems(instance, businessData, ref sql));
        }