Пример #1
0
        /// <summary>
        /// 根据审批类型,单据类型,审批流程编码获取审批流程
        /// </summary>
        /// <param name="approvalTypeId">审批类型id</param>
        /// <param name="bType">单据类型</param>
        /// <param name="procCode">审批流程编码</param>
        /// <returns></returns>
        public GAppvalProcModel GetAppvalProc(long approvalTypeId, string bType, string procCode)
        {
            GAppvalProcModel procModel = null;

            SqlDao sqlDao = new SqlDao();

            DataTable dataTable = sqlDao.GetAppvalProc(approvalTypeId, bType, procCode);

            if (dataTable == null || dataTable.Rows.Count == 0)
            {
                procModel = new GAppvalProcModel();
            }
            else
            {
                IList <GAppvalProcModel> procModels = DCHelper.DataTable2List <GAppvalProcModel>(dataTable);
                List <Organize>          organizes  = new List <Organize>();
                foreach (GAppvalProcModel model in procModels)
                {
                    Organize organize = new Organize();
                    organize.OrgId   = model.OrgPhid;
                    organize.OrgCode = model.OrgCode;
                    organize.OrgName = model.OrgName;
                    organizes.Add(organize);
                }
                procModel           = procModels[0];
                procModel.Organizes = organizes;
            }

            return(procModel);
        }
Пример #2
0
        /// <summary>
        /// 根据组织id,单据类型,审批类型获取所有的审批流程
        /// </summary>
        /// <param name="orgids">组织id</param>
        /// <param name="bType">单据类型</param>
        /// <param name="splx_phid">审批类型id</param>
        /// <returns></returns>
        public List <GAppvalProcModel> GetAppvalProc(List <long> orgids, string bType, long splx_phid)
        {
            List <GAppvalProcModel> procModels = new List <GAppvalProcModel>();

            if (orgids == null || orgids.Count == 0 || string.IsNullOrEmpty(bType))
            {
                return(procModels);
            }

            string orgid = "";

            foreach (long id in orgids)
            {
                orgid = orgid + id + ",";
            }

            SqlDao    sqlDao    = new SqlDao();
            DataTable dataTable = sqlDao.GetAppvalProc(orgid.Substring(0, orgid.Length - 1), bType, splx_phid);

            if (dataTable == null || dataTable.Rows.Count == 0)
            {
                return(procModels);
            }
            else
            {
                procModels = DCHelper.DataTable2List <GAppvalProcModel>(dataTable).ToList();
            }

            return(procModels);
        }
Пример #3
0
        /// <summary>
        /// 根据组织id,单据类型,审批类型,单据主键获取所有的符合条件的审批流程
        /// </summary>
        /// <param name="orgids">组织id</param>
        /// <param name="bType">单据类型</param>
        /// <param name="splx_phid">审批类型id</param>
        /// <param name="bPhIds">主键结合</param>
        /// <returns></returns>
        public List <GAppvalProcModel> GetAppvalProcList(List <long> orgids, string bType, long splx_phid, List <long> bPhIds)
        {
            List <GAppvalProcModel> procModels    = new List <GAppvalProcModel>();
            List <GAppvalProcModel> procModelList = new List <GAppvalProcModel>();

            if (orgids == null || orgids.Count == 0 || string.IsNullOrEmpty(bType))
            {
                return(procModels);
            }

            string orgid = "";

            foreach (long id in orgids)
            {
                orgid = orgid + id + ",";
            }

            SqlDao    sqlDao    = new SqlDao();
            DataTable dataTable = sqlDao.GetAppvalProc(orgid.Substring(0, orgid.Length - 1), bType, splx_phid);

            if (dataTable == null || dataTable.Rows.Count == 0)
            {
                return(procModels);
            }
            else
            {
                procModels = DCHelper.DataTable2List <GAppvalProcModel>(dataTable).ToList();
            }
            if (bPhIds.Count > 0)
            {
                Dictionary <string, object> dic = new Dictionary <string, object>();
                new CreateCriteria(dic)
                .Add(ORMRestrictions <List <long> > .In("PhId", bPhIds));
                if (bType == BillType.FundsPay)
                {
                    var payment = this.PaymentMstRule.Find(dic);
                    if (payment.Count > 0)
                    {
                        decimal minAmount = payment.OrderBy(t => t.FAmountTotal).ToList()[0].FAmountTotal;
                        decimal maxAmount = payment.OrderByDescending(t => t.FAmountTotal).ToList()[0].FAmountTotal;
                        foreach (var proc in procModels)
                        {
                            if (RetainProc(proc.PhId, minAmount, maxAmount))
                            {
                                procModelList.Add(proc);
                            }
                        }
                    }
                    else
                    {
                        procModelList = procModels;
                    }
                }
                else if (bType == BillType.PayMent)
                {
                    var gPayment = this.GKPaymentMstRule.Find(dic);
                    if (gPayment.Count > 0)
                    {
                        decimal minAmount = gPayment.OrderBy(t => t.FAmountTotal).ToList()[0].FAmountTotal;
                        decimal maxAmount = gPayment.OrderByDescending(t => t.FAmountTotal).ToList()[0].FAmountTotal;
                        foreach (var proc in procModels)
                        {
                            if (RetainProc(proc.PhId, minAmount, maxAmount))
                            {
                                procModelList.Add(proc);
                            }
                        }
                    }
                    else
                    {
                        procModelList = procModels;
                    }
                }
                else
                {
                    procModelList = procModels;
                }
            }
            else
            {
                procModelList = procModels;
            }
            return(procModelList);
        }