Exemplo n.º 1
0
        public async Task <string> PostRefreshAllPaymentsState()
        {
            //获取支付中且FSeqno不为空的数据
            var dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).Add(ORMRestrictions <byte> .Eq("FState", (byte)EnumPaymentState.DuringPayment));
            new CreateCriteria(dicWhere).Add(ORMRestrictions <string> .Gt("FSeqno", " "));

            var result = GKPaymentMstService.Find(dicWhere, new string[] { "NgInsertDt asc" }); //LoadWithPage(parameters.pageindex, parameters.pagesize, dicWhere, new string[] { "NgInsertDt asc" });

            if (result.IsError == false && result.Data != null)
            {
                IList <GKPaymentMstModel> list = result.Data;

                string errMsg = string.Empty;
                foreach (var mst in list)
                {
                    GKPaymentMstService.RefreshPaymentState(mst.PhId, out errMsg);
                }
            }

            return(DCHelper.SuccessMessage("批量刷新支付状态提交成功,后台处理中!"));
        }
        /// <summary>
        /// 获取所有审批种类对应的审批单据的总数量
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetRecordListNum()
        {
            long   Uid   = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["Uid"]);
            long   Orgid = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["Orgid"]);
            string Year  = System.Web.HttpContext.Current.Request.Params["Year"];

            if (Uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id为空!"));
            }
            if (Orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id为空!"));
            }
            if (string.IsNullOrEmpty(Year))
            {
                return(DCHelper.ErrorMessage("年度为空!"));
            }

            //设置当前数据库连接信息
            ConnectionInfoService.SetCallContextConnectString(NG3.AppInfoBase.UserConnectString);
            MultiDelegatingDbProvider.CurrentDbProviderName = NG3.AppInfoBase.DbName;

            BillRequestModel billRequest = new BillRequestModel();

            billRequest.Uid   = Uid;
            billRequest.Orgid = Orgid;
            billRequest.Year  = Year;
            var YNum = 0; //已审数量
            var NNum = 0; //待审数量

            try
            {
                //获取审批所有类型
                List <QTSysSetModel> procTypes = QTSysSetService.GetProcTypes();
                if (procTypes != null && procTypes.Count > 0)
                {
                    foreach (var sysSet in procTypes)
                    {
                        billRequest.BType     = sysSet.Value;
                        billRequest.Splx_Phid = sysSet.PhId;
                        int total = 0;
                        List <AppvalRecordVo> recordVos = GAppvalRecordService.GetDoneRecordList(billRequest, out total);
                        int total2 = 0;
                        List <AppvalRecordVo> recordVos2 = GAppvalRecordService.GetUnDoRecordList(billRequest, out total2);

                        YNum += total;
                        NNum += total2;
                    }
                }
                var dic = new Dictionary <string, object>();
                new CreateCriteria(dic).Add(ORMRestrictions <Int64> .NotEq("PhId", 0));
                new CreateCriteria(dic).Add(ORMRestrictions <List <Int32> > .In("FState", new List <int>()
                {
                    2, 0
                }));
                new CreateCriteria(dic).Add(ORMRestrictions <Int64> .Eq("OrgPhid", Orgid));
                new CreateCriteria(dic).Add(ORMRestrictions <string> .Eq("FYear", Year));
                //var Query = GKPaymentMstService.GetPaymentFailure(dic);
                var Query = GKPaymentMstService.Find(dic).Data;
                return(DataConverterHelper.SerializeObject(new
                {
                    Status = "success",
                    YNum = YNum,
                    NNum = NNum,
                    PaymentState = Query.Count//【待支付】信息提醒需求
                }));
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }
Exemplo n.º 3
0
        public string PostDelete([FromBody] BaseSingleModel parameter)
        {
            if (string.IsNullOrEmpty(parameter.id))
            {
                return(DCHelper.ErrorMessage("单据主键Phid为空!"));
            }
            if (parameter == null || string.IsNullOrEmpty(parameter.uid))
            {
                return(DCHelper.ErrorMessage("用户id为空!"));
            }
            if (string.IsNullOrEmpty(parameter.orgid))
            {
                return(DCHelper.ErrorMessage("组织编码为空!"));
            }
            if (string.IsNullOrEmpty(parameter.Ryear))
            {
                return(DCHelper.ErrorMessage("年度为空!"));
            }


            try
            {
                var result = GKPaymentMstService.Find <long>(long.Parse(parameter.id));
                if (!result.IsError && result.Data != null)
                {
                    //判断要删除的支付单的状态
                    if (result.Data.FApproval == (int)EnumBillApproval.Approved)
                    {
                        return(DCHelper.ErrorMessage("单据已审批,不能删除!"));
                    }

                    if (result.Data.FApproval == (int)EnumBillApproval.InApproval)
                    {
                        return(DCHelper.ErrorMessage("单据在审批中,不能删除!"));
                    }

                    if (result.Data.FApproval == (int)EnumBillApproval.Approved)
                    {
                        return(DCHelper.ErrorMessage("单据已审批通过,不能删除!"));
                    }

                    if (result.Data.FState == (int)EnumPaymentState.AbnormalPayment)
                    {
                        return(DCHelper.ErrorMessage("单据已审批通过,不能删除!"));
                    }

                    var result2 = GKPaymentMstService.Delete(long.Parse(parameter.id));
                    return(DataConverterHelper.SerializeObject(result2));
                }
                else
                {
                    result.Msg = "单据不存在或已被其他人删除!";
                }

                return(DataConverterHelper.SerializeObject(result));
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }