コード例 #1
0
 public string GetPaymentMstList([FromUri] PaymentModel paramters)
 {
     try
     {
         PaymentMstModel payment = new PaymentMstModel();
         payment.FOrgphid    = paramters.FOrgphid;
         payment.FYear       = paramters.FYear;
         payment.FDepphid    = paramters.FDepphid;
         payment.FName       = paramters.FName;
         payment.StartDate   = paramters.StartDate;
         payment.EndDate     = paramters.EndDate;
         payment.MinAmount   = paramters.MinAmount;
         payment.MaxAmount   = paramters.MaxAmount;
         payment.ApprovalBzs = paramters.ApprovalBzs;
         payment.PayBzs      = paramters.PayBzs;
         if (payment.FOrgphid < 1)
         {
             throw new Exception("组织信息传递不正确!");
         }
         if (payment.FDepphid < 1)
         {
             throw new Exception("部门信息传递不正确!");
         }
         var result     = this.PaymentMstService.GetPaymentMstList(paramters.PageIndex, payment, paramters.PageSize);
         var count      = result.Count;
         var pageResult = result.Skip((paramters.PageIndex - 1) * paramters.PageSize).Take(paramters.PageSize).ToList();
         return(DCHelper.ModelListToJson(pageResult, count));
     }
     catch (Exception ex)
     {
         return(DCHelper.ErrorMessage(ex.Message));
     }
 }
コード例 #2
0
 public string GetPaymentList([FromUri] PaymentModel paramters)
 {
     try
     {
         PaymentMstModel payment = new PaymentMstModel();
         payment.FOrgphid    = paramters.FOrgphid;
         payment.FYear       = paramters.FYear;
         payment.FDepphid    = paramters.FDepphid;
         payment.FName       = paramters.FName;
         payment.StartDate   = paramters.StartDate;
         payment.EndDate     = paramters.EndDate;
         payment.MinAmount   = paramters.MinAmount;
         payment.MaxAmount   = paramters.MaxAmount;
         payment.ApprovalBzs = paramters.ApprovalBzs;
         payment.PayBzs      = paramters.PayBzs;
         payment.UserId      = paramters.uid;
         if (payment.FOrgphid < 1)
         {
             throw new Exception("组织信息传递不正确!");
         }
         if (payment.FDepphid < 1)
         {
             throw new Exception("部门信息传递不正确!");
         }
         var result = this.PaymentMstService.GetPaymentList(payment);
         //取可选相同审批流是数据集合
         if (result != null && result.Count > 0)
         {
             if (paramters.ProcPhid != 0)
             {
                 List <string> orgList = result.ToList().Select(t => t.FBudcode).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 result)
                         {
                             if (res.FApproval == (byte)ApprovalType.not && procList.ToList().Find(t => t.OrgCode == res.FBudcode && t.PhId == paramters.ProcPhid) != null)
                             {
                                 res.BatchPracBz = 1;
                             }
                             else
                             {
                                 continue;
                             }
                         }
                         result = result.ToList().FindAll(t => t.BatchPracBz == 1);
                     }
                 }
             }
         }
         var count      = result.Count;
         var pageResult = result.Skip((paramters.PageIndex - 1) * paramters.PageSize).Take(paramters.PageSize).ToList();
         return(DCHelper.ModelListToJson(pageResult, count));
     }
     catch (Exception ex)
     {
         return(DCHelper.ErrorMessage(ex.Message));
     }
 }
コード例 #3
0
        /// <summary>
        /// 获取资金拨付支付单信息
        /// </summary>
        /// <param name="phid">支付单主键</param>
        /// <returns></returns>
        public GKPayment4ZjbfModel GetPayment4Zjbf(Int64 phid)
        {
            GKPayment4ZjbfModel ret = null;

            GKPaymentMstModel mst = this.EntRule.Find(phid);

            if (mst != null)
            {
                ret = new GKPayment4ZjbfModel();
                //去业务单查部门名称
                PaymentMstModel paymentMst = PaymentMstRule.Find(mst.RefbillPhid);
                mst.fdepname = paymentMst.FDepname;
                mst.FOrgname = paymentMst.FOrgname;

                Dictionary <string, object> where = new Dictionary <string, object>();
                new CreateCriteria(where).Add(ORMRestrictions <Int64> .Eq("MstPhid", mst.PhId));
                //查询相关明细数据
                var dtlList = this.GKPaymentDtlRule.Find(where, new string[] { "QtKmdm Asc" }); //PVoucherDelService.Find(where, new string[] { "SortCode Asc" }).Data.ToList();QtKmdm

                if (dtlList.Count > 0)
                {
                    long mstPhid = mst.RefbillPhid;
                    Dictionary <string, object> where2 = new Dictionary <string, object>();
                    new CreateCriteria(where2).Add(ORMRestrictions <Int64> .Eq("MstPhid", mstPhid));

                    //资金拨付单对应项目信息
                    var bfXmList = this.PaymentXmRule.Find(where2);

                    //资金拨付单明细表
                    var bfDtlList = this.PaymentDtlRule.Find(where2);


                    var       newCodeDt = this.GetPaymentNewCodeDataTable(mst.RefbillPhid);
                    DataRow[] drs       = null;
                    Dictionary <string, string> dicNewCode = null;
                    Dictionary <string, string> dicNewCodeMstPhid = null;
                    string fNewCode = string.Empty, fNewCodeMstPhid = string.Empty;
                    string old_phid = string.Empty;

                    //给明细表赋值,写入扩展字段信息

                    ret.Mst  = mst;
                    ret.Dtls = new List <GKPaymentDtl4ZjbfModel>();

                    GKPaymentDtl4ZjbfModel        dtl4Zjbf = null;
                    PaymentDtlModel               bfDtl    = null;
                    PaymentXmModel                bfXm     = null;
                    IEnumerable <PaymentDtlModel> enuDtl   = null;
                    IEnumerable <PaymentXmModel>  enuXm    = null;


                    Dictionary <string, object> dicOrg = new Dictionary <string, object>();
                    new CreateCriteria(dicOrg)
                    .Add(ORMRestrictions <long> .NotEq("PhId", 0));
                    IList <OrganizeModel> OrgList = OrganizationRule.Find2(dicOrg);
                    //补充完善明细信息
                    foreach (GKPaymentDtlModel dtl in dtlList)
                    {
                        dtl4Zjbf = CommonUtils.TransReflection <GKPaymentDtlModel, GKPaymentDtl4ZjbfModel>(dtl);

                        if (bfDtlList.Count > 0)
                        {
                            enuDtl = bfDtlList.Where(x => x.PhId == dtl.RefbillDtlPhid && x.BudgetdtlPhid == dtl.RefbillDtlPhid2);
                            if (enuDtl.Count() > 0)
                            {
                                bfDtl = enuDtl.First();
                                if (string.IsNullOrEmpty(dtl.QtKmdm))
                                {
                                    dtl4Zjbf.QtKmdm = bfDtl.QtKmdm; //预算科目
                                    dtl4Zjbf.QtKmmc = bfDtl.QtKmmc; //预算科目名称
                                }

                                dtl4Zjbf.FDepartmentcode = bfDtl.FDepartmentcode;   //补助单位/部门代码
                                OrganizeModel Org = OrgList.ToList().Find(x => x.OCode == bfDtl.FDepartmentcode);
                                dtl4Zjbf.FDepartmentphid = Org.PhId;
                                dtl4Zjbf.FDepartmentname = bfDtl.FDepartmentname;   //补助单位/部门名称
                                if (Org.IfCorp == "N")
                                {
                                    OrganizeModel Org2 = OrgList.ToList().Find(x => x.PhId == Org.ParentOrgId);
                                    dtl4Zjbf.FDepartmentParentcode = Org2.OCode;
                                    dtl4Zjbf.FDepartmentParentphid = Org2.PhId;
                                    dtl4Zjbf.FDepartmentParentname = Org2.OName;
                                }

                                dtl4Zjbf.BudgetdtlName = bfDtl.BudgetdtlName;       //预算明细项目名称

                                //预算项目
                                enuXm = bfXmList.Where(x => x.PhId == bfDtl.PayXmPhid);
                                if (enuXm.Count() > 0)
                                {
                                    bfXm = enuXm.First();
                                    dtl4Zjbf.XmProjcode = bfXm.XmProjcode;
                                    dtl4Zjbf.XmProjname = bfXm.XmProjname;
                                    dtl4Zjbf.FSeq       = bfXm.FSeq;
                                }
                            }
                        }

                        //写重新支付单的单号
                        if (newCodeDt != null && newCodeDt.Rows.Count > 0)
                        {
                            dicNewCode         = new Dictionary <string, string>();
                            dicNewCodeMstPhid  = new Dictionary <string, string>();
                            dtl4Zjbf.FNewCodes = "";

                            //drs = newCodeDt.Select("ng_insert_dt>=#" + dtl.NgInsertDt.ToString("yyyy-MM-dd HH:mm:ss") + "#");
                            drs = newCodeDt.Select(string.Format("phid ={0}", dtl.PhId));
                            while (drs.Length > 0)
                            {
                                foreach (var row in drs)
                                {
                                    fNewCode = row["f_new_code"].ToString();
                                    if (!string.IsNullOrEmpty(fNewCode))
                                    {
                                        if (!dicNewCode.ContainsKey(fNewCode))
                                        {
                                            dicNewCode.Add(fNewCode, fNewCode);
                                        }
                                    }
                                }
                                old_phid = drs[0]["phid"].ToString();
                                if (!string.IsNullOrEmpty(old_phid))
                                {
                                    drs = newCodeDt.Select(string.Format("old_dtl_phid={0}", old_phid));
                                    if (drs.Length > 0)
                                    {
                                        fNewCodeMstPhid = drs[0]["mst_phid"].ToString();
                                        if (!dicNewCodeMstPhid.ContainsKey(fNewCodeMstPhid))
                                        {
                                            dicNewCodeMstPhid.Add(fNewCodeMstPhid, fNewCodeMstPhid);
                                        }
                                    }
                                }
                                else
                                {
                                    drs = newCodeDt.Select("1=2");
                                }
                            }

                            dtl4Zjbf.FNewCodes        = string.Join(",", dicNewCode.Values.ToArray());
                            dtl4Zjbf.FNewCodesMstPhid = string.Join(",", dicNewCodeMstPhid.Values.ToArray());
                        }

                        ret.Dtls.Add(dtl4Zjbf);
                    }
                }
                ret.Dtls = ret.Dtls.OrderBy(t => t.FSeq).ToList();
            }


            return(ret);
        }