Exemplo n.º 1
0
        /// <summary>
        ///  根据当前登录人ID,票单号提取处理表单的信息
        /// </summary>
        /// <param name="userId">当前用户id</param>
        /// <param name="formId">票单号</param>
        /// <param name="businessType">业务类别 </param>
        /// <returns></returns>
        public static DealInfo GetDealFormInfo(Guid userId, Guid formId, string businessType)
        {
            var dealInfo = new DealInfo();
            var wfinstance = WfInstanceBusiness.GetWfInstanceBusinessByFormID(formId);
            var lev = WfSupportGroupMembersBusiness.GetSupportGroupMemberLevel(userId.ToString(), wfinstance.CurrentDealDeptId,
                                                                               businessType);
            dealInfo.DealFormId = Interfaces.GetDealForm(formId);

            if (wfinstance.CurrentStateType == (int)EnumWfStateType.Parllel)
            {
                GetParallelDealPersonAuth(formId, wfinstance.CurrentWfState, userId, lev, ref dealInfo);
            }
            else
            {
                if (userId == Guid.Empty)
                {
                    dealInfo.HasAuth = false;
                    dealInfo.DealWays = null;
                }
                else if (wfinstance.CurrentDealPersonLevel == 0 && userId == wfinstance.StartUserID)
                //申请人(处理人级别为0的是申请人)
                {
                    dealInfo.HasAuth = true;
                    dealInfo.DealWays = GetDealWays(formId);
                }
                else if (wfinstance.CurrentDealPersonID.ToUpper() == userId.ToString().ToUpper()) //容错处理,如果当前处理人已经是当前登录人,允许处理
                {
                    dealInfo.HasAuth = true;
                    dealInfo.DealWays = GetDealWays(formId);
                }
                else if (lev != null && lev.Contains(wfinstance.CurrentDealPersonLevel)) //有权限
                {
                    if (string.IsNullOrEmpty(wfinstance.CurrentDealPersonID))
                    {
                        dealInfo.HasAuth = true;
                        dealInfo.DealWays = GetDealWays(formId);
                    }
                    else if (wfinstance.CurrentDealPersonID.ToUpper() == userId.ToString().ToUpper())
                    {
                        dealInfo.HasAuth = true;
                        dealInfo.DealWays = GetDealWays(formId);
                    }
                    else //可以转入
                    {
                        dealInfo.HasAuth = true;
                        dealInfo.DealWays = new Dictionary<string, DealWaysInfo>();
                        var dealwaysInfo = new DealWaysInfo();
                        dealwaysInfo.DealWayFormId = "PublicDeal";
                        dealwaysInfo.DealWayId = Common.DealWayIdofSnatch;
                        dealwaysInfo.DealWayName = "转入";
                        dealwaysInfo.IsNewBusiness = false;
                        dealInfo.DealWays.Add(dealwaysInfo.DealWayId, dealwaysInfo);
                    }
                }
                else
                {
                    dealInfo.HasAuth = false;
                    dealInfo.DealWays = null;
                }
            }
            Dictionary<string, DealWaysInfo> dealWaysInfos = dealInfo.DealWays;
            var result = GetRisebutton(businessType, lev, ref dealWaysInfos);
            dealInfo.DealWays = dealWaysInfos;
            dealInfo.HasAuth = dealInfo.HasAuth ? dealInfo.HasAuth : result;
            return dealInfo;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 取并发环节处理人权限
        /// </summary>
        /// <param name="formId"></param>
        /// <param name="currentWfStateId"></param>
        /// <param name="currentUserId"></param>
        /// <param name="currentUserlev"> </param> 
        private static void GetParallelDealPersonAuth(Guid formId, Guid currentWfStateId, Guid currentUserId, List<int> currentUserlev, ref  DealInfo dealInfo)
        {
            var sql =
                string.Format(
                    "select * from WF_InstanceStates with (nolock) where FormID='{0}'  and WfState='{1}' and CompleteTime is null ", formId, currentWfStateId);
            var dt = DataHelper.ExecuteQuery(sql);
            var lev = new List<int>();
            var supportorIds = new List<string>();
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lev.Add(Convert.ToInt32(row["DealPersonLevel"]));
                    supportorIds.Add(row["TransactUserID"].ToString().ToUpper());
                }

                if (supportorIds.Contains(currentUserId.ToString().ToUpper())) //有权限,当前用户是处理人之一
                {
                    dealInfo.HasAuth = true;
                    dealInfo.DealWays = GetDealWays(formId);
                }
                else //当前用户不是指定用户,看看能否转入
                {
                    var isTheLevel = false;
                    if (currentUserlev != null)
                    {
                        foreach (var clev in currentUserlev) //当前用户的级别
                        {
                            if (lev.Contains(clev))
                            {
                                isTheLevel = true;
                                break;
                            }
                        }
                    }
                    if (isTheLevel) //同级用户有处理权限
                    {
                        dealInfo.HasAuth = true;
                        dealInfo.DealWays = new Dictionary<string, DealWaysInfo>();
                        var dealwaysInfo = new DealWaysInfo();
                        dealwaysInfo.DealWayFormId = "";
                        dealwaysInfo.DealWayId = Common.DealWayIdofSnatch;
                        dealwaysInfo.DealWayName = "转入";
                        dealwaysInfo.IsNewBusiness = false;
                        dealInfo.DealWays.Add(dealwaysInfo.DealWayId, dealwaysInfo);
                    }
                    else //不同级,没权限
                    {
                        dealInfo.HasAuth = false;
                        dealInfo.DealWays = null;
                    }
                }

            }
            else //数据异常,不给处理权限。
            {
                dealInfo.HasAuth = false;
                dealInfo.DealWays = null;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 故障升级按钮的显示控制:当前登录人是热线,而且当前处在非故障定级环节,此时显示故障升级按钮,允许用户升级(修改故障级别并发送相关通知)
        /// </summary>
        private static bool GetRisebutton(string businessType, List<int> currentUserLevels, ref  Dictionary<string, DealWaysInfo> dealWays)
        {
            if (businessType == "CF" && currentUserLevels != null && currentUserLevels.Contains(1)) //故障,且当前登录人为热线组
            {
                if (dealWays != null && dealWays.Count > 0)
                {
                    var iscontain = false;
                    foreach (var dealWaysInfo in dealWays)
                    {
                        if (dealWaysInfo.Value.DealWayName == "故障定级")
                        {
                            iscontain = true;
                            break;
                        }
                    }

                    if (!iscontain)
                    {
                        var dealwaysInfo = new DealWaysInfo();
                        dealwaysInfo.DealWayFormId = "CFRise";
                        dealwaysInfo.DealWayId = Common.DealWayIdofIncidentRise;
                        dealwaysInfo.DealWayName = "故障升级";
                        dealwaysInfo.IsNewBusiness = false;

                        dealWays.Add(Common.DealWayIdofIncidentRise, dealwaysInfo);
                    }
                }
                else
                {
                    dealWays = new Dictionary<string, DealWaysInfo>();
                    var dealwaysInfo = new DealWaysInfo();
                    dealwaysInfo.DealWayFormId = "CFRise";
                    dealwaysInfo.DealWayId = Common.DealWayIdofIncidentRise;
                    dealwaysInfo.DealWayName = "故障升级";
                    dealwaysInfo.IsNewBusiness = false;

                    dealWays.Add(Common.DealWayIdofIncidentRise, dealwaysInfo);
                }
                return true;
            }
            else
                return false;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 取当前状态的处理方式
        /// </summary>
        /// <param name="formId"></param>
        /// <returns></returns>
        private static Dictionary<string, DealWaysInfo> GetDealWays(Guid formId)
        {
            var sql =
                string.Format(
                    " select distinct DealWayId,DealWayName,c.FormIdOuter,c.BusinessType,case   c.BusinessType when (select top 1 BusinessType from V_WF_QueryHand with (nolock) where FormID = '{0}' ) then 0 " +
                    "    when 'PUBLIC'  then 0   else 1 end   IsNewBusiness  from WF_Instance a with (nolock), WF_DealWay b with (nolock) left join  WF_DealForms c with (nolock) on b.FormId =c.FormID where a.FormID = '{0}' and  a.TemplateID=b.TemplateId and  a.CurrentWfState=b.StateId  ",
                    formId);

            var dt = DataHelper.ExecuteQuery(sql);
            if (dt != null && dt.Rows.Count > 0)
            {
                var result = new Dictionary<string, DealWaysInfo>();
                foreach (DataRow row in dt.Rows)
                {
                    var dealways = new DealWaysInfo();

                    if (row["BusinessType"].ToString() == "QSTB" &&
                        (row["DealWayName"].ToString() == "要求回复" || row["DealWayName"].ToString() == "无需回复"))
                    //快速通报写死的东东!!!!!!!!!!!!!!!!要改!!!!!!!!!!!!!!!!
                    {
                        dealways.DealWayId = Common.DealWayIdofPublishQR;
                        dealways.DealWayName = "发布";
                        dealways.DealWayFormId = row["FormIdOuter"].ToString();
                        dealways.IsNewBusiness = row["IsNewBusiness"].ToString() == "1";

                        if (!result.ContainsKey(Common.DealWayIdofPublishQR))
                        {
                            result.Add(dealways.DealWayId, dealways);
                        }
                    }
                    else if (row["BusinessType"].ToString() == "MO" &&
                        (row["DealWayName"].ToString() == "人事处提交技术处" || row["DealWayName"].ToString() == "提交"))
                    {
                        dealways.DealWayId = Common.DealWayIdofMOHR;
                        dealways.DealWayName = "提交";
                        dealways.DealWayFormId = row["FormIdOuter"].ToString();
                        dealways.IsNewBusiness = row["IsNewBusiness"].ToString() == "1";

                        if (!result.ContainsKey(Common.DealWayIdofMOHR))
                        {
                            result.Add(dealways.DealWayId, dealways);
                        }
                    }
                    else
                    {
                        dealways.DealWayId = row["DealWayId"].ToString();
                        dealways.DealWayName = row["DealWayName"].ToString();
                        dealways.DealWayFormId = row["FormIdOuter"].ToString();
                        dealways.IsNewBusiness = row["IsNewBusiness"].ToString() == "1";
                        result.Add(row["DealWayId"].ToString(), dealways);
                    }

                }
                return result;
            }
            else
            {
                return null;
            }
        }