コード例 #1
0
ファイル: PaymentMstFacade.cs プロジェクト: RaoLeigf/msyh
        /// <summary>
        /// 生成申请单编号
        /// </summary>
        /// <returns></returns>
        public string GetPaymentCode()
        {
            string paymentCode = "";
            string payment     = "";
            string code        = "";
            Dictionary <string, object> dic = new Dictionary <string, object>();

            new CreateCriteria(dic).
            Add(ORMRestrictions <long> .Ge("PhId", (long)0));
            var result = this.PaymentMstRule.Find(dic, new string[] { "FCode Desc" });

            if (result != null && result.Count > 0)
            {
                string fCode = result[0].FCode;
                if (fCode.Length == 12)
                {
                    payment = DateTime.Now.ToString("yyyyMMdd");
                    string fcode1 = fCode.Substring(0, 8);
                    if (payment.Equals(fcode1))
                    {
                        int fcode2 = int.Parse(fCode.Substring(8)) + 1;
                        if (fcode2 > 999 && fcode2 < 10000)
                        {
                            code = fcode2.ToString();
                        }
                        else if (fcode2 > 99 && fcode2 < 1000)
                        {
                            code = "0" + fcode2;
                        }
                        else if (fcode2 > 9 && fcode2 < 100)
                        {
                            code = "00" + fcode2;
                        }
                        else if (fcode2 > 0 && fcode2 < 10)
                        {
                            code = "000" + fcode2;
                        }
                        else
                        {
                            throw new Exception("申请单号生成失败!");
                        }
                    }
                    else
                    {
                        code = "0001";
                    }
                }
                else
                {
                    throw new Exception("申请单号为:" + fCode + "的申请编码生成错误,请联系管理员!");
                }
            }
            else
            {
                payment = DateTime.Now.ToString("yyyyMMdd");
                code    = "0001";
            }
            paymentCode = payment + code;
            return(paymentCode);
        }
コード例 #2
0
ファイル: PaymentMstFacade.cs プロジェクト: RaoLeigf/msyh
        /// <summary>
        /// 修改后的获取审批单据列表的接口
        /// </summary>
        /// <param name="payment">参数结合</param>
        /// <returns></returns>
        public IList <PaymentMstModel> GetPaymentList(PaymentMstModel payment)
        {
            IList <PaymentMstModel> paymentList = new List <PaymentMstModel>();

            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(payment.FName))
            {
                Dictionary <string, object> dicCode = new Dictionary <string, object>();
                Dictionary <string, object> dicName = new Dictionary <string, object>();
                new CreateCriteria(dicCode).
                Add(ORMRestrictions <string> .Like("FCode", payment.FName));
                new CreateCriteria(dicName).
                Add(ORMRestrictions <string> .Like("FName", payment.FName));
                new CreateCriteria(dic).
                Add(ORMRestrictions.Or(dicCode, dicName));
            }
            if (payment.ApprovalBzs != null && payment.ApprovalBzs.Count > 0)
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <List <byte> > .In("FApproval", payment.ApprovalBzs));
            }
            if (payment.PayBzs != null && payment.PayBzs.Count > 0)
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <List <byte> > .In("IsPay", payment.PayBzs));
            }
            if (!string.IsNullOrEmpty(payment.StartDate.ToString()) && !string.IsNullOrEmpty(payment.EndDate.ToString()))
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <DateTime> .Ge("FDate", DateTime.Parse(payment.StartDate.ToString()))).
                Add(ORMRestrictions <DateTime> .Le("FDate", DateTime.Parse(payment.EndDate.Value.AddDays(1).ToString())));
            }
            if (!string.IsNullOrEmpty(payment.MaxAmount) && !string.IsNullOrEmpty(payment.MinAmount))
            {
                decimal max = decimal.Parse(payment.MaxAmount);
                decimal min = decimal.Parse(payment.MinAmount);
                if (max < min)
                {
                    throw new Exception("申请金额传递错误!");
                }
                new CreateCriteria(dic).
                Add(ORMRestrictions <decimal> .Ge("FAmountTotal", min)).
                Add(ORMRestrictions <decimal> .Le("FAmountTotal", max));
            }
            new CreateCriteria(dic).
            Add(ORMRestrictions <long> .Eq("FOrgphid", payment.FOrgphid)).
            Add(ORMRestrictions <long> .Eq("FDepphid", payment.FDepphid)).
            Add(ORMRestrictions <string> .Eq("FYear", payment.FYear));
            //获取符合条件的审批单据
            paymentList = this.PaymentMstRule.Find(dic, new string[] { "IsPay asc", "FCode desc" });

            if (paymentList != null && paymentList.Count > 0)
            {
                //获取单据类型与单据类型主键
                IList <QTSysSetModel> models        = QTSysSetRule.RuleHelper.Find(t => t.DicType == "splx" && t.TypeCode == "1");
                List <AppvalRecordVo> appvalRecords = new List <AppvalRecordVo>();
                SqlDao sqlDao = new SqlDao();
                if (models.Count > 0)
                {
                    OrganizeModel Org = this.OrganizationRule.Find(payment.FOrgphid);
                    payment.FOrgcode = Org.OCode;
                    appvalRecords    = sqlDao.GetRecords(payment.FYear, long.Parse(payment.UserId), models[0].Value, payment.FOrgcode, "1", models[0].PhId);
                    if (appvalRecords != null && appvalRecords.Count > 0)
                    {
                        appvalRecords = appvalRecords.FindAll(t => t.DepId == payment.FDepphid);
                    }
                }
                //该部门下存在自己未审核的数据要放最前面
                if (appvalRecords != null && appvalRecords.Count > 0)
                {
                    var refbillPhids = appvalRecords.Select(t => t.RefbillPhid);
                    var pays1        = paymentList.ToList().FindAll(t => refbillPhids.Contains(t.PhId));
                    if (pays1.Count > 0)
                    {
                        foreach (var pay in pays1)
                        {
                            pay.IsApprovalNow = 1;
                            var appvalRecord = appvalRecords.Find(t => t.RefbillPhid == pay.PhId);
                            if (appvalRecord == null)
                            {
                                throw new Exception("单据审批流查询失败!");
                            }
                            pay.RefbillPhid = appvalRecord.RefbillPhid;
                            pay.FBilltype   = appvalRecord.FBilltype;
                            pay.PostPhid    = appvalRecord.PostPhid;
                            pay.ProcPhid    = appvalRecord.ProcPhid;
                            pay.OperaPhid   = appvalRecord.OperaPhid;
                            pay.AppvalPhid  = appvalRecord.PhId;
                        }
                    }
                    var pays2 = paymentList.ToList().FindAll(t => (!refbillPhids.Contains(t.PhId)));
                    if (pays2.Count > 0)
                    {
                        foreach (var pay in pays2)
                        {
                            pay.IsApprovalNow = 0;
                        }
                    }
                    pays1.AddRange(pays2);
                    paymentList = pays1;
                }
                var payPhids = paymentList.Select(t => t.PhId).ToList();
                if (payPhids.Count > 0)
                {
                    dic.Clear();
                    new CreateCriteria(dic).
                    Add(ORMRestrictions <List <long> > .In("RefbillPhid", payPhids));
                    var GkPayments = this.GKPaymentMstRule.Find(dic);
                    if (GkPayments.Count > 0)
                    {
                        foreach (var per in paymentList)
                        {
                            var Gks = GkPayments.ToList().FindAll(t => t.RefbillPhid == per.PhId);
                            if (Gks.Count > 0)
                            {
                                per.GkPaymentCode = Gks.OrderByDescending(t => t.FCode).ToList()[0].FCode;
                            }
                        }
                    }
                }
            }
            return(paymentList);
        }
コード例 #3
0
        public string GetExpenseMstList([FromUri] ExpenseListRequestModel param)
        {
            //string clientJsonQuery = System.Web.HttpContext.Current.Request.Params["queryfilter"];//查询条件
            //Dictionary<string, object> dicWhere = DataConverterHelper.ConvertToDic(clientJsonQuery);//查询条件转Dictionary

            //var userId = System.Web.HttpContext.Current.Request.Params["userId"];
            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            /*var dicWhereDept = new Dictionary<string, object>();
             * new CreateCriteria(dicWhereDept)
             *  .Add(ORMRestrictions<string>.Eq("Dwdm", param.UserCode)).Add(ORMRestrictions<string>.Eq("Dylx", "97")); //闭区间
             * var deptList = CorrespondenceSettingsService.Find(dicWhereDept);
             * List<string> deptL = new List<string>();
             * for (var i = 0; i < deptList.Data.Count; i++)
             * {
             *  deptL.Add(deptList.Data[i].Dydm);
             * }
             * new CreateCriteria(dicWhere)
             *     .Add(ORMRestrictions<IList<String>>.In("FBudgetDept", deptL));*/

            new CreateCriteria(dicWhere)
            .Add(ORMRestrictions <string> .Eq("FDeclarationDept", param.FDeclarationDept));
            if (param.FApprovestatus.Count > 0)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <List <string> > .In("FApprovestatus", param.FApprovestatus));
            }
            if (param.FStartdate != null)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.DateTime?> .Ge("FDateofdeclaration", param.FStartdate));
            }
            if (param.FEnddate != null)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.DateTime?> .Le("FDateofdeclaration", param.FEnddate));
            }
            if (param.MinAmount != 0)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.Decimal> .Ge("FSurplusamount", param.MinAmount));
            }
            if (param.MaxAmount != 0)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.Decimal> .Le("FSurplusamount", param.MaxAmount));
            }
            if (!string.IsNullOrEmpty(param.searchValue))
            {
                var dic1 = new Dictionary <string, object>();
                var dic2 = new Dictionary <string, object>();
                new CreateCriteria(dic1)
                .Add(ORMRestrictions <String> .Like("FPerformevaltype", param.searchValue));
                new CreateCriteria(dic2)
                .Add(ORMRestrictions <String> .Like("FProjname", param.searchValue));
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions.Or(dic1, dic2));
            }
            //根据单据号进行排序
            var result = ExpenseMstService.LoadWithPage(param.PageIndex, param.PageSize, dicWhere, new string[] { "FPerformevaltype Desc" });

            if (param.ProcPhid != 0)
            {
                var expenseList = ExpenseMstService.Find(dicWhere, new string[] { "FPerformevaltype Desc" }).Data;
                if (expenseList != null && expenseList.Count > 0)
                {
                    List <string> orgList = expenseList.ToList().Select(t => t.FBudgetDept).Distinct().ToList();
                    if (orgList != null && orgList.Count > 0)
                    {
                        var procList = this.GAppvalProcService.Find(t => orgList.Contains(t.OrgCode)).Data;
                        if (procList != null && procList.Count > 0)
                        {
                            //可以选取相同审批流的打上标记
                            foreach (var res in expenseList)
                            {
                                if (res.FApprovestatus == "1" && procList.ToList().Find(t => t.OrgCode == res.FBudgetDept && t.PhId == param.ProcPhid) != null)
                                {
                                    res.BatchPracBz = 1;
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            expenseList = expenseList.ToList().FindAll(t => t.BatchPracBz == 1);
                        }
                    }
                }

                result.Results    = expenseList.Skip((param.PageIndex - 1) * param.PageSize).Take(param.PageSize).ToList();
                result.TotalItems = expenseList.Count;
            }

            return(DCHelper.ModelListToJson <ExpenseMstModel>(result.Results, (Int32)result.TotalItems));
        }
コード例 #4
0
ファイル: PaymentMstFacade.cs プロジェクト: RaoLeigf/msyh
        /// <summary>
        /// 获取资金拨付主列表
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="payment">对象</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        public IList <PaymentMstModel> GetPaymentMstList(int pageIndex, PaymentMstModel payment, int pageSize = 20)
        {
            IList <PaymentMstModel> paymentList = new List <PaymentMstModel>();
            //DataTable dataTable = GetPaymentList(payment.FPhid);
            //List<PaymentMstModel> paymentList = DCHelper.DataTable2List<PaymentMstModel>(dataTable).ToList();

            //Dictionary<string, object> dic = new Dictionary<string, object>();
            //if (!string.IsNullOrEmpty(payment.FName))
            //{
            //    //Dictionary<string, object> dicCode = new Dictionary<string, object>();
            //    //Dictionary<string, object> dicName = new Dictionary<string, object>();
            //    //new CreateCriteria(dicCode).
            //    //        Add(ORMRestrictions<string>.Eq("FCode", payment.FName));
            //    //new CreateCriteria(dicName).
            //    //        Add(ORMRestrictions<string>.Eq("FName", payment.FName));
            //    //new CreateCriteria(dic).
            //    //        Add(ORMRestrictions.Or(dicCode, dicName));
            //    paymentList = paymentList.FindAll(t => (t.FName.IndexOf(payment.FName) > -1 || t.FCode.IndexOf(payment.FName) > -1));
            //}
            //if (!string.IsNullOrEmpty(payment.FApproval.ToString()))
            //{
            //    paymentList = paymentList.FindAll(t => t.FApproval == payment.FApproval);
            //}
            //if (!string.IsNullOrEmpty(payment.IsPay.ToString()))
            //{
            //    paymentList = paymentList.FindAll(t => t.IsPay == payment.IsPay);
            //}
            //if (!string.IsNullOrEmpty(payment.FDate.ToString()))
            //{
            //    paymentList = paymentList.FindAll(t => (t.FDate <= payment.EndDate && t.FDate >= payment.StartDate));
            //}
            //if (!string.IsNullOrEmpty(payment.FAmountTotal.ToString()))
            //{
            //    paymentList = paymentList.FindAll(t => (t.FAmountTotal <= payment.MaxAmount && t.FAmountTotal >= payment.MinAmount));
            //}

            //return paymentList;
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(payment.FName))
            {
                Dictionary <string, object> dicCode = new Dictionary <string, object>();
                Dictionary <string, object> dicName = new Dictionary <string, object>();
                new CreateCriteria(dicCode).
                Add(ORMRestrictions <string> .Like("FCode", payment.FName));
                new CreateCriteria(dicName).
                Add(ORMRestrictions <string> .Like("FName", payment.FName));
                new CreateCriteria(dic).
                Add(ORMRestrictions.Or(dicCode, dicName));
            }
            if (payment.ApprovalBzs != null && payment.ApprovalBzs.Count > 0)
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <List <byte> > .In("FApproval", payment.ApprovalBzs));
            }
            if (payment.PayBzs != null && payment.PayBzs.Count > 0)
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <List <byte> > .In("IsPay", payment.PayBzs));
            }
            //if (!string.IsNullOrEmpty(payment.ApprovalBz))
            //{
            //    new CreateCriteria(dic).
            //            Add(ORMRestrictions<byte>.Eq("FApproval", byte.Parse(payment.ApprovalBz)));
            //}
            //if (!string.IsNullOrEmpty(payment.PayBz))
            //{
            //    new CreateCriteria(dic).
            //            Add(ORMRestrictions<byte>.Eq("IsPay", byte.Parse(payment.PayBz)));
            //}
            if (!string.IsNullOrEmpty(payment.StartDate.ToString()) && !string.IsNullOrEmpty(payment.EndDate.ToString()))
            {
                new CreateCriteria(dic).
                Add(ORMRestrictions <DateTime> .Ge("FDate", DateTime.Parse(payment.StartDate.ToString()))).
                Add(ORMRestrictions <DateTime> .Le("FDate", DateTime.Parse(payment.EndDate.Value.AddDays(1).ToString())));
            }
            if (!string.IsNullOrEmpty(payment.MaxAmount) && !string.IsNullOrEmpty(payment.MinAmount))
            {
                decimal max = decimal.Parse(payment.MaxAmount);
                decimal min = decimal.Parse(payment.MinAmount);
                if (max < min)
                {
                    throw new Exception("申请金额传递错误!");
                }
                new CreateCriteria(dic).
                Add(ORMRestrictions <decimal> .Ge("FAmountTotal", min)).
                Add(ORMRestrictions <decimal> .Le("FAmountTotal", max));
            }
            //if (payment.FOrgphid > 0)
            //{
            //    new CreateCriteria(dic).
            //        Add(ORMRestrictions<long>.Eq("FOrgphid", payment.FOrgphid));
            //}
            //if (!string.IsNullOrEmpty(payment.FDepphid.ToString()))
            //{
            //    new CreateCriteria(dic).
            //        Add(ORMRestrictions<long>.Eq("FDepphid", payment.FDepphid));
            //}
            new CreateCriteria(dic).
            Add(ORMRestrictions <long> .Eq("FOrgphid", payment.FOrgphid)).
            Add(ORMRestrictions <long> .Eq("FDepphid", payment.FDepphid));
            paymentList = this.PaymentMstRule.Find(dic, new string[] { "FCode desc" });
            if (paymentList.Count > 0)
            {
                var payPhids = paymentList.Select(t => t.PhId).ToList();
                if (payPhids.Count > 0)
                {
                    dic.Clear();
                    new CreateCriteria(dic).
                    Add(ORMRestrictions <List <long> > .In("RefbillPhid", payPhids));
                    var GkPayments = this.GKPaymentMstRule.Find(dic);
                    if (GkPayments.Count > 0)
                    {
                        foreach (var per in paymentList)
                        {
                            var Gks = GkPayments.ToList().FindAll(t => t.RefbillPhid == per.PhId);
                            if (Gks.Count > 0)
                            {
                                per.GkPaymentCode = Gks.OrderByDescending(t => t.FCode).ToList()[0].FCode;
                            }
                        }
                    }
                }
            }

            return(paymentList);
        }
コード例 #5
0
ファイル: GAppvalPostService.cs プロジェクト: RaoLeigf/msyh
        /// <summary>
        /// 获取岗位列表
        /// </summary>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页大小</param>
        /// <param name="orgId">组织id</param>
        /// <param name="uCode">用户编码</param>
        /// <param name="searchOrgid">搜索的组织</param>
        /// <param name="enableMark">是否启用</param>
        /// <param name="PostName">搜索字段</param>
        /// <returns></returns>
        public List <GAppvalPostAndOpersModel> GetAppvalPostOpersList(int PageIndex, int PageSize, long orgId, string uCode, List <long> searchOrgid, string enableMark, string PostName)
        {
            Dictionary <string, object>     dic = new Dictionary <string, object>();
            List <GAppvalPostAndOpersModel> gAppvalPostAndOpers = new List <GAppvalPostAndOpersModel>();

            if (!string.IsNullOrEmpty(PostName))
            {
                Dictionary <string, object> dicName = new Dictionary <string, object>();
                new CreateCriteria(dicName)
                .Add(ORMRestrictions <string> .Like("FCode", PostName));
                Dictionary <string, object> dicCode = new Dictionary <string, object>();
                new CreateCriteria(dicCode)
                .Add(ORMRestrictions <string> .Like("FName", PostName));
                new CreateCriteria(dic)
                .Add(ORMRestrictions.Or(dicCode, dicName));
            }
            if (uCode != "Admin")
            {
                new CreateCriteria(dic)
                .Add(ORMRestrictions <long> .Eq("OrgPhid", orgId));
            }
            else
            {
                new CreateCriteria(dic)
                .Add(ORMRestrictions <long> .Ge("PhId", (long)0));
            }
            if (searchOrgid != null && searchOrgid.Count > 0)
            {
                new CreateCriteria(dic)
                .Add(ORMRestrictions <List <long> > .In("OrgPhid", searchOrgid));
            }
            if (!string.IsNullOrEmpty(enableMark))
            {
                if (enableMark == "1")
                {
                    new CreateCriteria(dic)
                    .Add(ORMRestrictions <Byte> .Eq("FEnable", (byte)0));
                }
                else if (enableMark == "2")
                {
                    new CreateCriteria(dic)
                    .Add(ORMRestrictions <Byte> .Eq("FEnable", (byte)1));
                }
            }
            var result = this.GAppvalPostFacade.LoadWithPage(PageIndex, PageSize, dic, new string[] { "IsSystem desc", " FCode Asc" });

            if (result.Results.Count > 0)
            {
                foreach (var gAppvalPost in result.Results)
                {
                    GAppvalPostAndOpersModel gAppval = new GAppvalPostAndOpersModel();
                    gAppval.GAppvalPost = gAppvalPost;
                    dic.Clear();
                    new CreateCriteria(dic)
                    .Add(ORMRestrictions <long> .Eq("PostPhid", gAppvalPost.PhId));
                    var res = this.GAppvalPost4OperFacade.Find(dic).Data;
                    if (res.Count > 0)
                    {
                        var codeList = res.ToList().Select(t => t.OperatorCode).ToList();
                        dic.Clear();
                        new CreateCriteria(dic)
                        .Add(ORMRestrictions <List <string> > .In("Dwdm", codeList))
                        .Add(ORMRestrictions <string> .Eq("Dylx", "08"))
                        .Add(ORMRestrictions <int> .Eq("DefInt1", 1));
                        //根据操作员编码查找对应组织部门信息
                        var opers = this.CorrespondenceSettingsFacade.Find(dic).Data;//操作员编码:Dwdm;操作员姓名:DefStr1;部门代码:DefStr3;组织代码:Dydm
                        if (opers.Count > 0)
                        {
                            Dictionary <string, object> dic2 = new Dictionary <string, object>();
                            Dictionary <string, object> dic3 = new Dictionary <string, object>();
                            var depList = opers.ToList().Select(t => t.Dydm).ToList();
                            var orgList = opers.ToList().Select(t => t.DefStr3).ToList();
                            new CreateCriteria(dic2)
                            .Add(ORMRestrictions <List <string> > .In("OCode", depList));
                            new CreateCriteria(dic3)
                            .Add(ORMRestrictions <List <string> > .In("OCode", orgList));
                            dic.Clear();
                            new CreateCriteria(dic).Add(ORMRestrictions.Or(dic2, dic3));
                            var orgs = this.OrganizationFacade.Find(dic).Data;

                            foreach (CorrespondenceSettingsModel data in opers)
                            {
                                if (orgs.Where(t => t.OCode == data.Dydm).ToList().Count > 0)
                                {
                                    data.DefStr4 = orgs.Where(t => t.OCode == data.Dydm).ToList()[0].OName;//DefStr4:组织名称
                                }
                                if (orgs.Where(t => t.OCode == data.DefStr3).ToList().Count > 0)
                                {
                                    data.DefStr5 = orgs.Where(t => t.OCode == data.DefStr3).ToList()[0].OName;//DefStr5:部门名称
                                }
                            }


                            foreach (GAppvalPost4OperModel gAppvalPost4Oper in res)
                            {
                                var corr = opers.Where(t => t.Dwdm == gAppvalPost4Oper.OperatorCode).ToList();
                                if (corr.Count > 0)
                                {
                                    //将组织部门名存入到对象
                                    gAppvalPost4Oper.OrgCode      = corr[0].Dydm;
                                    gAppvalPost4Oper.OrgName      = corr[0].DefStr4;
                                    gAppvalPost4Oper.DepCode      = corr[0].DefStr3;
                                    gAppvalPost4Oper.DepName      = corr[0].DefStr5;
                                    gAppvalPost4Oper.OperatorName = corr[0].DefStr1;
                                }
                            }
                        }
                        gAppval.GAppvalPost4Opers = res;
                    }

                    gAppvalPostAndOpers.Add(gAppval);
                }
            }
            return(gAppvalPostAndOpers);
        }