Ejemplo n.º 1
0
        /// <summary>
        ///  审批组件任务办理时调用(现在流程中没有判断杜绝多个审批节点执行,所以如果单据已审批就修改审批人、审批时间)
        /// </summary>
        /// <param name="ec"></param>
        public void Approve(WorkFlowExecutionContext ec)
        {
            long phid = Convert.ToInt64(ec.BillInfo.PK1);
            var  mst  = base.Find(phid);

            //更改状态为:审批中
            mst.Data.FApproveStatus = Convert.ToInt32(EnumApproveStatus.Approved).ToString();
            mst.Data.FApproveDate   = DateTime.Today;
            mst.Data.FApprover      = base.UserID;
            CurrentRule.Update <Int64>(mst.Data);
            //用 FlowEnd(), 在流程结束时进行操作(approve 方法 在进行审批节点后就会调用,可能存在多个审批节点)
            //long phid = Convert.ToInt64(ec.BillInfo.PK1);
            //var mst = base.Find(phid);
            ////更新状态为已审批
            //if (mst.Data.FApproveStatus != Convert.ToInt32(EnumApproveStatus.Approved).ToString())
            //{
            //    //审批完成时,项目状态为预立项,则项目状态改为立项,审批状态改为未审批
            //    if (mst.Data.FProjStatus == 1)
            //    {
            //        mst.Data.FApproveStatus = Convert.ToInt32(EnumApproveStatus.ToBeRepored).ToString();
            //        mst.Data.FProjStatus = 2;
            //    }
            //    else
            //    {
            //        mst.Data.FApproveStatus = Convert.ToInt32(EnumApproveStatus.Approved).ToString();
            //    }

            //    mst.Data.FApproveDate = DateTime.Now;
            //    mst.Data.FApprover = base.UserID;
            //    CurrentRule.Update<Int64>(mst.Data);
            //}
        }
Ejemplo n.º 2
0
        public IRuleDefinition <T> ExclusiveRule(string ruleId)
        {
            Guard.NotDefault(ruleId, "ruleId");
            Guid id = Guid.Parse(ruleId);

            CurrentRule.AddExclusionRule(id);
            return(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 流程发起时调用(一般用于修改表单状态为送审中、或是维护表单已挂工作流)
        /// </summary>
        /// <param name="ec"></param>
        public void FlowStart(WorkFlowExecutionContext ec)
        {
            long phid = Convert.ToInt64(ec.BillInfo.PK1);
            var  mst  = base.Find(phid);

            //更改状态为:审批中
            mst.Data.FApprovestatus = Convert.ToInt32(EnumApproveStatus.IsPending).ToString();
            mst.Data.FApprovedate   = DateTime.Now;
            //mst.Data.FDateofdeclaration = DateTime.Now;
            CurrentRule.Update <Int64>(mst.Data);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 流程被终止时调用
        /// </summary>
        /// <param name="ec"></param>
        public void FlowAbort(WorkFlowExecutionContext ec)
        {
            long phid = Convert.ToInt64(ec.BillInfo.PK1);
            var  mst  = base.Find(phid);

            //更新状态为待上报
            mst.Data.FApprovestatus = Convert.ToInt32(EnumApproveStatus.ToBeRepored).ToString();
            mst.Data.FProjstatus    = 1;//项目立项审批驳回-->从预立项从新修改,发起;状态默认预立项;
            //mst.Data.FDateofdeclaration = new Nullable<DateTime>();
            mst.Data.FApprovedate = new Nullable <DateTime>();
            CurrentRule.Update <Int64>(mst.Data);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 审批节点回退时调用进行单据取消审批操作
        /// </summary>
        /// <param name="ec"></param>
        public void CancelApprove(WorkFlowExecutionContext ec)
        {
            long phid = Convert.ToInt64(ec.BillInfo.PK1);
            var  mst  = base.Find(phid);

            //更新状态为审批中
            mst.Data.FApprovestatus = Convert.ToInt32(EnumApproveStatus.IsPending).ToString();
            // mst.Data.FDateofdeclaration = new Nullable<DateTime>();
            mst.Data.FApprovedate = new Nullable <DateTime>();
            CurrentRule.Update <Int64>(mst.Data);

            //throw new NotImplementedException();
        }
Ejemplo n.º 6
0
        private RuleResult PostCheck(RuleResult beforeTearingDown)
        {
            CurrentRule.TearDown();
            //If current is not the default, and report the greater
            if (beforeTearingDown == RuleResult.DoesNotApply)
            {
                return(beforeTearingDown);
            }

            if (CurrentRuleResult > beforeTearingDown)
            {
                return(CurrentRuleResult);
            }
            return(beforeTearingDown);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 流程结束时调用
        /// </summary>
        /// <param name="ec"></param>
        public void FlowEnd(WorkFlowExecutionContext ec)
        {
            long phid = Convert.ToInt64(ec.BillInfo.PK1);
            var  mst  = base.Find(phid);

            //更新状态为已审批
            if (mst.Data.FApprovestatus != Convert.ToInt32(EnumApproveStatus.Approved).ToString())
            {
                mst.Data.FApprovestatus = Convert.ToInt32(EnumApproveStatus.Approved).ToString();
            }

            mst.Data.FApprovedate = DateTime.Today;
            mst.Data.FApprover    = base.UserID;
            CurrentRule.Update <Int64>(mst.Data);
        }
Ejemplo n.º 8
0
        public void AddCondition([NotNull] RuleEditor.ConditionItem conditionItem)
        {
            Assert.ArgumentNotNull(conditionItem, nameof(conditionItem));

            if (CurrentRule == null)
            {
                return;
            }

            var conditionsElement = CurrentRule.Element(@"conditions");

            if (conditionsElement == null)
            {
                conditionsElement = new XElement(@"conditions");
                CurrentRule.Add(conditionsElement);
            }

            AddNewConditionElement(conditionsElement, conditionItem);
        }
Ejemplo n.º 9
0
        public void AddAction([NotNull] RuleEditor.ActionItem actionItem)
        {
            Assert.ArgumentNotNull(actionItem, nameof(actionItem));

            if (CurrentRule == null)
            {
                return;
            }

            var actionsElement = CurrentRule.Element(@"actions");

            if (actionsElement == null)
            {
                actionsElement = new XElement(@"actions");
                CurrentRule.Add(actionsElement);
            }

            AddNewActionElement(actionsElement, actionItem);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 流程结束时调用
        /// </summary>
        /// <param name="ec"></param>
        public void FlowEnd(WorkFlowExecutionContext ec)
        {
            long phid = Convert.ToInt64(ec.BillInfo.PK1);
            var  mst  = base.Find(phid);

            //更新状态为已审批
            if (mst.Data.FApproveStatus != Convert.ToInt32(EnumApproveStatus.Approved).ToString())
            {
                mst.Data.FApproveStatus = Convert.ToInt32(EnumApproveStatus.Approved).ToString();


                mst.Data.FApproveDate = DateTime.Today;
                mst.Data.FApprover    = base.UserID;
                CurrentRule.Update <Int64>(mst.Data);
            }
            //调整单据审批结束将原调整中改为调整完成
            if (mst.Data.FType == "tz")
            {
                Dictionary <string, object> dicWhere = new Dictionary <string, object>();
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <string> .Eq("FDeclarationDept", mst.Data.FDeclarationDept))
                .Add(ORMRestrictions <string> .Eq("FProjAttr", mst.Data.FProjAttr))
                .Add(ORMRestrictions <string> .Eq("FApproveStatus", "6"));
                IList <GHSubjectModel> models = GHSubjectRule.Find(dicWhere);
                if (models.Count > 0)
                {
                    foreach (GHSubjectModel a in models)
                    {
                        a.FApproveStatus = "7";
                        //a.PersistentState = PersistentState.Modified;
                        CurrentRule.Update <Int64>(a);
                    }
                    //GHSubjectRule.Save(models, "");
                    //CurrentRule.Update<Int64>(models);
                }
            }
            //throw new NotImplementedException();
        }
Ejemplo n.º 11
0
 public IRuleDefinition <T> ExclusiveRule(Guid ruleId)
 {
     Guard.NotDefault(ruleId, "ruleId");
     CurrentRule.AddExclusionRule(ruleId);
     return(this);
 }