//与写入新的进度信息,如果是最后一步或是拒绝,则更新OA模型
        private void UpdateModel(int status)
        {
            //会签需要加判断,备注需要另外处理
            oaMod = oaBll.SelReturnModel(appID);
            //throw new Exception(progBll.IsHQComplete(appID, userID, CurrentStep).ToString());
            progMod.AppID        = oaMod.ID;
            progMod.ProID        = oaMod.ProID;
            progMod.ProLevel     = CurrentStep.stepNum;
            progMod.ProLevelName = CurrentStep.stepName;
            progMod.ApproveID    = userID;
            progMod.Result       = status;
            progMod.Remind       = remindT.Text;
            progMod.CreateTime   = DateTime.Now;
            progMod.HQUserID     = userID.ToString();
            if (signRadio.Items.Count > 0 && signRadio.SelectedIndex > 0)//0是不使用签章
            {
                progMod.Sign   = signRadio.SelectedValue + ":" + curPosD.Value;
                progMod.SignID = signRadio.SelectedValue;
            }
            //用于email与sms通知功能
            string content = "";

            //是否为最后一步
            bool isLastStep = false;

            if (oaMod.ProID == 0)
            {
                isLastStep = freeBll.IsLastStep(oaMod, CurrentStep);
            }
            else
            {
                isLastStep = stepBll.IsLastStep(CurrentStep);
            }

            //增加通知功能,
            if (isLastStep && status == 99 || status == 98)
            {
                if (CurrentStep.HQoption > 0)//会签判断
                {
                    if (progBll.IsHQComplete(appID, userID, CurrentStep))
                    {
                        oaMod.Status     = status;//流程完成,全部同意
                        oaMod.CurStepNum = CurrentStep.stepNum;
                        content          = oaMod.Title + "会签完成,已进入下一步骤";
                    }
                }
                else
                {
                    oaMod.Status     = status;//流程完成,全部同意
                    oaMod.CurStepNum = CurrentStep.stepNum;
                    content          = oaMod.Title + "已完成" + CurrentStep.stepName + ",进入下一步骤";
                }
            }
            else if (status == 2) //回退
            {
                oaMod.Status = 2;

                int rbStep = DataConvert.CLng(rollBackDP.SelectedValue);
                if (rbStep > 0)
                {
                    rbStep = rbStep - 1;
                    //自由流程回退删除步骤
                    if (oaMod.IsFreePro)
                    {
                        freeBll.DelByStep(oaMod.ID, Convert.ToInt32(rollBackDP.SelectedValue));
                    }
                }
                else  //回退至上一步(-1)
                {
                    rbStep = CurrentStep.stepNum - 2;
                    //自由流程回退删除步骤
                    if (oaMod.IsFreePro)
                    {
                        freeBll.DelByStep(oaMod.ID, CurrentStep.stepNum - 1);
                    }
                }
                oaMod.CurStepNum = rbStep;
                progMod.Remind2  = "回退至" + rbStep;
                progMod.HQUserID = "";
                content          = oaMod.Title + "已被经办人回退至" + rbStep;
                //回退的时候,清除目标会签与签章信息
                progBll.ClearHQ(oaMod.ID, rbStep);
                progBll.ClearSign(oaMod.ID, rbStep);
            }
            else if (status == -1)
            {
                oaMod.Status     = status; //拒绝
                oaMod.CurStepNum = CurrentStep.stepNum;
                content          = oaMod.Title + "已被经办人" + buser.GetLogin().HoneyName + "拒绝.";
            }
            else//同意,但未至最后一步
            {
                if (CurrentStep.HQoption > 0)//需要会签
                {
                    if (progBll.IsHQComplete(appID, userID, CurrentStep))
                    {
                        oaMod.CurStepNum = CurrentStep.stepNum;
                        content          = oaMod.Title + "已完成会签审批,成功通过";
                        //if (oaMod.IsFreePro) oaMod.Status = status;//如果是自由流程就仍更新状态
                    }
                }
                else
                {
                    oaMod.CurStepNum = CurrentStep.stepNum;
                    content          = oaMod.Title + "已完成审批,成功通过";
                }
            }

            if (!string.IsNullOrEmpty(CurrentStep.EmailAlert))//Email与sms通知
            {
                //发送邮件包括会员组里的会员(需扩展支持会员组)
                string ids = "";
                if (!string.IsNullOrEmpty(CurrentStep.EmailGroup))
                {
                    ids += groupBll.GetUserIDByGroupIDS(CurrentStep.EmailGroup);
                }
                ids += CurrentStep.SmsAlert;
                ids  = ids.Trim(',');
                emailToUser(content, ids);
            }
            if (!string.IsNullOrEmpty(CurrentStep.SmsAlert))
            {
                smsTouser(content, CurrentStep.SmsAlert);
            }
            progBll.Insert(progMod);
            oaBll.UpdateByID(oaMod);
            //分发功能
            if (isLastStep && oaMod.Status == 99 && !oaMod.IsFreePro)
            {
                B_MisProcedure prodBll = new B_MisProcedure();
                M_MisProcedure prodMod = prodBll.SelReturnModel(oaMod.ProID);
                if (prodMod.NodeID > -1)//指定了节点,才分发
                {
                    commCall.AddContentToNode(oaMod, prodMod.NodeID, OAConfig.ModelID);
                }
            }
        }
示例#2
0
        //与写入新的进度信息,如果是最后一步或是拒绝,则更新OA模型
        private void UpdateModel(int status)
        {
            //会签需要加判断,备注需要另外处理
            oaMod = oaBll.SelReturnModel(appID);
            M_MisProcedure proceMod = proceBll.SelReturnModel(oaMod.ProID);

            //throw new Exception(progBll.IsHQComplete(appID, userID, CurrentStep).ToString());
            progMod.AppID        = oaMod.ID;
            progMod.ProID        = oaMod.ProID;
            progMod.ProLevel     = CurrentStep.stepNum;
            progMod.ProLevelName = CurrentStep.stepName;
            progMod.ApproveID    = userID;
            progMod.Result       = status;
            progMod.Remind       = remindT.Text;
            progMod.CreateTime   = DateTime.Now;
            progMod.HQUserID     = userID.ToString();
            //if (signRadio.Items.Count > 0 && signRadio.SelectedIndex > 0)//0是不使用签章
            //{
            //    progMod.Sign = signRadio.SelectedValue + ":" + curPosD.Value;
            //    progMod.SignID = signRadio.SelectedValue;
            //}
            //用于email与sms通知功能
            string content = "";
            //是否为最后一步
            bool isLastStep = freeBll.IsLastStep(oaMod, CurrentStep);

            //增加通知功能,
            if (isLastStep && status == 98)
            {
                if (oaMod.ProType == (int)M_MisProcedure.ProTypes.AdminFree)
                {
                    //公文流程且是最后一步,
                    status = proceMod.AllowAttach == 1 ? (int)ZLEnum.ConStatus.Filed : (int)ZLEnum.ConStatus.Audited;
                }
                if (CurrentStep.HQoption > 0)//会签判断
                {
                    if (progBll.IsHQComplete(appID, userID, CurrentStep))
                    {
                        oaMod.Status     = status;//流程完成,全部同意
                        oaMod.CurStepNum = CurrentStep.stepNum;
                        content          = oaMod.Title + "会签完成,已进入下一步骤";
                    }
                }
                else
                {
                    oaMod.Status     = status;//流程完成,全部同意
                    oaMod.CurStepNum = CurrentStep.stepNum;
                    content          = oaMod.Title + "已完成" + CurrentStep.stepName + ",进入下一步骤";
                }
            }
            else if (status == 2) //回退
            {
                #region 回退
                oaMod.Status = 2;

                int rbStep = DataConvert.CLng(rollBackDP.SelectedValue);
                if (rbStep > 0)
                {
                    rbStep = rbStep - 1;
                    //自由流程回退删除步骤
                    freeBll.DelByStep(oaMod.ID, Convert.ToInt32(rollBackDP.SelectedValue));
                }
                else  //回退至上一步(-1)
                {
                    rbStep = CurrentStep.stepNum - 2;
                    //自由流程回退删除步骤
                    freeBll.DelByStep(oaMod.ID, CurrentStep.stepNum - 1);
                }
                oaMod.CurStepNum = rbStep;
                progMod.Remind2  = "回退至" + rbStep;
                progMod.HQUserID = "";
                content          = oaMod.Title + "已被经办人回退至" + rbStep;
                //回退的时候,清除目标会签与签章信息
                progBll.ClearHQ(oaMod.ID, rbStep);
                progBll.ClearSign(oaMod.ID, rbStep);
                #endregion
            }
            else if (status == -1)
            {
                oaMod.Status     = status; //拒绝
                oaMod.CurStepNum = CurrentStep.stepNum;
                content          = oaMod.Title + "已被经办人" + buser.GetLogin().HoneyName + "拒绝.";
            }
            else//同意,但未至最后一步
            {
                if (CurrentStep.HQoption > 0)//需要会签
                {
                    if (progBll.IsHQComplete(appID, userID, CurrentStep))
                    {
                        oaMod.Status     = status;
                        oaMod.CurStepNum = CurrentStep.stepNum;
                        content          = oaMod.Title + "已完成会签审批,成功通过";
                    }
                }
                else
                {
                    oaMod.Status     = status;
                    oaMod.CurStepNum = CurrentStep.stepNum;
                    content          = oaMod.Title + "已完成审批,成功通过";
                }
            }

            if (!string.IsNullOrEmpty(CurrentStep.EmailAlert))//Email与sms通知
            {
                //发送邮件包括会员组里的会员(需扩展支持会员组)
                string ids = "";
                //if (!string.IsNullOrEmpty(CurrentStep.EmailGroup))
                //    ids += groupBll.GetUserIDByGroupIDS(CurrentStep.EmailGroup);
                ids += CurrentStep.SmsAlert;
                ids  = ids.Trim(',');
                emailToUser(content, ids);
            }
            //if (!string.IsNullOrEmpty(CurrentStep.SmsAlert))
            //{
            //    smsTouser(content, CurrentStep.SmsAlert);
            //}
            progBll.Insert(progMod);
            oaBll.UpdateByID(oaMod);
        }