예제 #1
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);
        }
예제 #2
0
        /// <summary>
        /// 如果有加签人,就返回到加签人,如果没有加签人,直接忽略
        /// </summary>
        /// <param name="InstanceStepId"></param>
        /// <param name="currentUser"></param>
        private void BackToAdditionalSource(string InstanceStepId, string currentUser)
        {
            var instanceStep = WFDA.Instance.GetInstanceStep(InstanceStepId);

            if (!string.IsNullOrWhiteSpace(instanceStep.Extend04))
            {
                var item = InstanceStepExecutorDAO.Get(instanceStep.Extend04);
                if (item != null)
                {
                    var list = InstanceStepExecutorDAO.QueryByExecuteStatus(InstanceStepId, Pub.Unfinished);
                    list.ForEach(a => a.Extend01 = string.Format("{0}", a.Extend01));
                    if (!list.Any(a => a.Extend01.Contains("签")))
                    {
                        // 转签加签都完成了
                        ExecutorImp.InsertOneAndProxy(InstanceStepId, item.ExecutorId, item.ExecutorName, string.Empty, currentUser, true);
                        // 需要返回到加签的来源人
                        WFDA.Instance.UpdateInstanceStepExt(InstanceStepId, "Extend04", null, currentUser);
                    }
                }
            }
        }