处理结构表函数的方法

 //批量添加
        public JsonResult PLADD(string count, string r_time, string r_sb, string r_fl, string ksrq, string jsrq, string ssrq)
        {
            string tbsql = "SELECT * FROM SYS_RPT_LIST WHERE tcategory=" + r_time + " AND isreport=" + r_sb + " AND pcategory=" + r_fl;
            DataTable tb = DBHelperYW.Query(tbsql).Tables[0];
            //删除台帐数据
            Delete(ssrq, ksrq, jsrq);
            //执行台帐数据生成过程
            ExecuteProc("PROC_TZ_FORWARD_REPORT_2nd", ssrq, ksrq, jsrq);
            int c = 0;
            string r = "";
            try
            {
                foreach (DataRow item in tb.Rows)
                {
                    //获得报表结构数据
                    string jgtb = item["structfile"].ToString(); //JGTB50010
                    //获得报表数据
                    string datatb = item["datafile"].ToString(); //TB50010
                    //实例化报表结构、数据加工处理、方法参数匹配
                    StatisticsOfBusinessUnit statisticsOfBusinessUnit = new StatisticsOfBusinessUnit(jgtb, datatb, ksrq, jsrq, ssrq, false);
                    //叠加需要导入的数据
                    c += statisticsOfBusinessUnit.ExportLocal();
                }
                //处理报表中的合计、小计值
                //ExecuteProc("PROC_TZ_FORWARD_UPDATE2", ssrq, ksrq, jsrq);

                string tbName = DBHelperYW.Query(tbsql).Tables[0].Rows[0]["DATAFILE"].ToString().Trim();
                if (tbName == "TB50010")
                {
                    ExecuteProc("PROC_TZ_FORWARD_UPDATE", ssrq, ksrq, jsrq);
                }
                if (tbName == "TB5006")
                {
                    ExecuteProc("PROC_TZ_FORWARD_UPDATE2", ssrq, ksrq, jsrq);
                }
               
                r = "[{'success':'共生成了" + count + "张报表,成功" + c + "张,失败" + (int.Parse(count) - c) + "张!'}]";
            }
            catch (Exception ex)
            {
                r = "[{'susess':'程序异常" + ex.Message + "'}]";
            }
            return Json(r, JsonRequestBehavior.AllowGet);
        }

 

posted @ 2016-05-12 11:34  韩梦芫  阅读(240)  评论(0编辑  收藏  举报