コード例 #1
0
        public string GetAppvalRecord([FromUri] GAppvalRecordModel recordModel)
        {
            if (recordModel == null || recordModel.RefbillPhid == 0)
            {
                return(DCHelper.ErrorMessage("申请单据ID为空!"));
            }
            if (string.IsNullOrEmpty(recordModel.FBilltype))
            {
                return(DCHelper.ErrorMessage("单据类型为空!"));
            }
            if (recordModel.ProcPhid == 0)
            {
                return(DCHelper.ErrorMessage("审批流程id为空!"));
            }

            try
            {
                List <GAppvalRecordModel> recordModels = GAppvalRecordService.GetAppvalRecord(recordModel.RefbillPhid, recordModel.ProcPhid, recordModel.FBilltype);
                return(DataConverterHelper.SerializeObject(new {
                    Status = "success",
                    Data = recordModels
                }));
            }
            catch (Exception e) {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }
コード例 #2
0
        public string GetRecordListNum([FromUri] BillRequestModel billRequest)
        {
            if (billRequest == null || billRequest.Uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id为空!"));
            }

            /*if (string.IsNullOrEmpty(billRequest.OrgCode))
             * {
             *  return DCHelper.ErrorMessage("组织编码为空!");
             * }*/
            if (billRequest.Orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id为空!"));
            }
            if (string.IsNullOrEmpty(billRequest.Year))
            {
                return(DCHelper.ErrorMessage("年度为空!"));
            }

            try
            {
                //获取审批所有类型
                List <QTSysSetModel> procTypes = QTSysSetService.GetProcTypes();
                if (procTypes != null && procTypes.Count > 0)
                {
                    //若是初次加载,则获取所有组织的审批信息
                    if (billRequest.IsFirst == 1)
                    {
                        //RELATID = 'lg' AND PARENTORG IS null
                        var orgRelatitems = this.OrgRelatitem2Service.Find(t => t.RelatId == "lg" && t.ParentOrgId == 0).Data;
                        if (orgRelatitems != null && orgRelatitems.Count == 1)
                        {
                            billRequest.Orgid = orgRelatitems[0].OrgId;
                        }
                    }
                    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);

                        sysSet.YNum = total;
                        sysSet.NNum = total2;
                    }
                }
                return(DataConverterHelper.SerializeObject(new
                {
                    Status = "success",
                    Data = procTypes
                }));
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }
コード例 #3
0
        public string PostDoneRecordList([FromBody] BillRequestModel billRequest)
        {
            if (billRequest == null || billRequest.Uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id为空!"));
            }

            /*if (string.IsNullOrEmpty(billRequest.OrgCode))
             * {
             *  return DCHelper.ErrorMessage("组织编码为空!");
             * }*/
            if (billRequest.Orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id为空!"));
            }
            if (string.IsNullOrEmpty(billRequest.Year))
            {
                return(DCHelper.ErrorMessage("年度为空!"));
            }
            if (billRequest.PageIndex == 0 || billRequest.PageSize == 0)
            {
                return(DCHelper.ErrorMessage("分页参数不正确!"));
            }
            if (string.IsNullOrEmpty(billRequest.BType))
            {
                return(DCHelper.ErrorMessage("单据类型为空!"));
            }
            if (billRequest.Splx_Phid == 0)
            {
                return(DCHelper.ErrorMessage("审批类型id为空!"));
            }
            try
            {
                int total = 0;
                //若是初次加载,则获取所有组织的审批信息
                if (billRequest.IsFirst == 1)
                {
                    //RELATID = 'lg' AND PARENTORG IS null
                    var orgRelatitems = this.OrgRelatitem2Service.Find(t => t.RelatId == "lg" && t.ParentOrgId == 0).Data;
                    if (orgRelatitems != null && orgRelatitems.Count == 1)
                    {
                        billRequest.Orgid = orgRelatitems[0].OrgId;
                    }
                }
                List <AppvalRecordVo> recordVos = GAppvalRecordService.GetDoneRecordList(billRequest, out total);
                return(DataConverterHelper.SerializeObject(new
                {
                    Status = "success",
                    Data = recordVos,
                    Total = total
                }));
            }
            catch (Exception e) {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }
コード例 #4
0
        public string PostAddPayMent([FromBody] GAppvalRecordModel recordModel)
        {
            if (recordModel == null || recordModel.RefbillPhid == 0)
            {
                return(DCHelper.ErrorMessage("单据id为空!"));
            }

            try
            {
                GAppvalRecordService.PostAddPayMent(recordModel);

                return(DCHelper.SuccessMessage("生成支付单成功!"));
            }
            catch (Exception e) {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }
コード例 #5
0
        public string GetAppvalRecordList([FromUri] GAppvalRecordModel recordModel)
        {
            if (recordModel == null || recordModel.RefbillPhid == 0)
            {
                return(DCHelper.ErrorMessage("申请单据ID为空!"));
            }
            if (string.IsNullOrEmpty(recordModel.FBilltype))
            {
                return(DCHelper.ErrorMessage("单据类型为空!"));
            }
            try
            {
                List <GAppvalRecordModel> recordModels = GAppvalRecordService.GetAppvalRecordList(recordModel.RefbillPhid, recordModel.FBilltype);
                if (recordModels.Count > 0)
                {
                    recordModels[0].SortNum = 0;
                    for (int j = 1; j < recordModels.Count; j++)
                    {
                        recordModels[j].SortNum = j;
                        if (recordModels[j].PostPhid == recordModels[j - 1].PostPhid && recordModels[j].PostPhid != 0)
                        {
                            recordModels[j].SortNum = recordModels[j - 1].SortNum;
                        }
                    }

                    for (int i = 0; i < recordModels.Count; i++)
                    {
                        recordModels[i].SameNum = recordModels.FindAll(t => t.SortNum == i).Count;
                    }
                }
                return(DataConverterHelper.SerializeObject(new
                {
                    Status = "success",
                    Data = recordModels
                }));
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }
コード例 #6
0
        public string PostApprovalRecord([FromBody] GAppvalRecordModel recordModel)
        {
            if (recordModel == null)
            {
                return(DCHelper.ErrorMessage("审批数据为空!"));
            }
            if (recordModel.ProcPhid == 0)
            {
                return(DCHelper.ErrorMessage("审批流程id为空!"));
            }
            if (recordModel.PostPhid == 0)
            {
                return(DCHelper.ErrorMessage("审批岗位id为空!"));
            }
            if (string.IsNullOrEmpty(recordModel.FBilltype))
            {
                return(DCHelper.ErrorMessage("单据类型为空!"));
            }
            if (recordModel.RefbillPhid == 0)
            {
                return(DCHelper.ErrorMessage("关联单据为空!"));
            }
            if (recordModel.PhId == 0)
            {
                return(DCHelper.ErrorMessage("审批记录的id为空!"));
            }

            try
            {
                GAppvalRecordService.PostApprovalRecord(recordModel);

                return(DCHelper.SuccessMessage("审批成功!"));
            }
            catch (Exception e) {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }
コード例 #7
0
        /// <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));
            }
        }
コード例 #8
0
        public async Task <string> PostApprovalRecordList()
        {
            List <QtAttachmentModel> attachmentModels = new List <QtAttachmentModel>();

            try
            {
                GAppvalRecordModel recordModel = new GAppvalRecordModel();
                recordModel.PersistentState = PersistentState.Added;
                //判断form表单类型是否正确
                if (!Request.Content.IsMimeMultipartContent())
                {
                    var data1 = new
                    {
                        Status = ResponseStatus.Error,
                        Msg    = "请求数据不是multipart/form-data类型",
                        Data   = ""
                    };
                    return(DataConverterHelper.SerializeObject(data1));
                }
                //I6WebAppInfo i6AppInfo = (I6WebAppInfo)HttpContext.Current.Session["NGWebAppInfo"] ?? null;
                //获取AppInfo值 头部信息记录
                var base64EncodedBytes = Convert.FromBase64String(HttpContext.Current.Request.Headers.GetValues("AppInfo").First());
                var jsonText           = Encoding.UTF8.GetString(base64EncodedBytes);
                var AppInfo            = JsonConvert.DeserializeObject <AppInfoBase>(jsonText);


                //如果路径不存在,创建路径
                var    root     = System.Web.Hosting.HostingEnvironment.MapPath("~/UpLoadFiles/ApprovalRecord/");
                string date     = DateTime.Now.ToString("yyyy-MM-dd");
                string filePath = Path.Combine(root, date);
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                var multipartMemoryStreamProvider = await Request.Content.ReadAsMultipartAsync();

                var contentsList = multipartMemoryStreamProvider.Contents;

                foreach (var content in contentsList)
                {
                    //通过判断fileName是否为空,是否为文件
                    if (!string.IsNullOrEmpty(content.Headers.ContentDisposition.FileName))
                    {
                        //处理文件名字符串
                        string fileName = content.Headers.ContentDisposition.FileName.Replace("\"", string.Empty);
                        using (Stream stream = await content.ReadAsStreamAsync())
                        {
                            //文件如果大于100MB  提示不允许
                            if (stream.Length > 104857600)
                            {
                                return(DCHelper.ErrorMessage("上传的文件不能大于100MB!"));
                            }
                            byte[] bytes = new byte[stream.Length];
                            stream.Read(bytes, 0, bytes.Length);
                            stream.Seek(0, SeekOrigin.Begin);

                            //获取对应文件后缀名
                            string extension = Path.GetExtension(fileName);
                            //获取文件名
                            string b_name = Path.GetFileName(fileName);

                            //修改文件名
                            string newFileName = Guid.NewGuid().ToString("N") + extension;
                            string uploadPath  = Path.Combine(filePath, newFileName);

                            //保存文件
                            MemoryStream ms = new MemoryStream(bytes);
                            FileStream   fs = new FileStream(uploadPath, FileMode.Create);
                            ms.WriteTo(fs);
                            ms.Close();
                            fs.Close();

                            string b_urlpath = "/UpLoadFiles/ApprovalRecord/" + date + "/" + newFileName;

                            QtAttachmentModel attachmentModel = new QtAttachmentModel();
                            attachmentModel.BName           = b_name;
                            attachmentModel.BSize           = decimal.Round((decimal)stream.Length / 1024, 2);
                            attachmentModel.BTable          = "SP3_APPVAL_RECORD";
                            attachmentModel.BType           = extension;
                            attachmentModel.BUrlpath        = b_urlpath;
                            attachmentModel.PersistentState = PersistentState.Added;
                            attachmentModels.Add(attachmentModel);
                        }
                    }
                    else
                    {
                        //获取键值对值,并通过反射获取对象中的属性
                        string key   = content.Headers.ContentDisposition.Name.Replace("\"", string.Empty);
                        string value = await content.ReadAsStringAsync();

                        var item = typeof(GAppvalRecordModel).GetProperty(key);
                        if (item != null)
                        {
                            //获取数据的类型
                            var    propertyType = item.PropertyType;
                            object v;
                            if (key == "NextOperators")
                            {
                                var value2 = JsonConvert.DeserializeObject <List <long> >(value);
                                v = Convert.ChangeType(value2, propertyType);
                            }
                            else if (key == "RecordPhids")
                            {
                                var value3 = JsonConvert.DeserializeObject <List <long> >(value);
                                v = Convert.ChangeType(value3, propertyType);
                            }
                            else
                            {
                                //转换数据的类型
                                v = Convert.ChangeType(value, propertyType);
                            }

                            item.SetValue(recordModel, v);
                        }
                    }
                }

                if (AppInfo != null)
                {
                    MultiDelegatingDbProvider.CurrentDbProviderName = AppInfo.DbName;
                }

                if (recordModel == null)
                {
                    return(DCHelper.ErrorMessage("审批数据为空!"));
                }
                if (recordModel.ProcPhid == 0)
                {
                    return(DCHelper.ErrorMessage("审批流程id为空!"));
                }
                if (recordModel.PostPhid == 0)
                {
                    return(DCHelper.ErrorMessage("审批岗位id为空!"));
                }
                if (string.IsNullOrEmpty(recordModel.FBilltype))
                {
                    return(DCHelper.ErrorMessage("单据类型为空!"));
                }
                if (recordModel.RefbillPhid == 0)
                {
                    return(DCHelper.ErrorMessage("关联单据为空!"));
                }
                if (recordModel.PhId == 0)
                {
                    return(DCHelper.ErrorMessage("审批记录的id为空!"));
                }
                //批量审批
                if (recordModel.RecordPhids != null && recordModel.RecordPhids.Count > 0)
                {
                    var records = this.GAppvalRecordService.Find(t => recordModel.RecordPhids.Contains(t.PhId)).Data;
                    if (records != null && records.Count > 0)
                    {
                        //对批量审批的数据进行判别
                        foreach (var record in records)
                        {
                            if (!record.ProcPhid.Equals(recordModel.ProcPhid) || !record.PostPhid.Equals(recordModel.PostPhid))
                            {
                                return(DCHelper.ErrorMessage("只有审批流与审批岗位相同的审批记录可以批量审批!"));
                            }
                            if (record.FApproval != (byte)Approval.Wait)
                            {
                                return(DCHelper.ErrorMessage("只有待审批的记录审批!"));
                            }
                        }
                        //进行批量审批
                        foreach (var record in records)
                        {
                            GAppvalRecordModel pAppvalRecordModel = new GAppvalRecordModel();
                            pAppvalRecordModel             = recordModel;
                            pAppvalRecordModel.PhId        = record.PhId;
                            pAppvalRecordModel.RefbillPhid = record.RefbillPhid;
                            GAppvalRecordService.PostApprovalRecordList(pAppvalRecordModel, attachmentModels);
                        }
                    }
                }
                else
                {
                    GAppvalRecordService.PostApprovalRecordList(recordModel, attachmentModels);
                }
                return(DCHelper.SuccessMessage("审批成功!"));
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }