workflow统计报表(配置的行政区关系生成)

workflow统计报表(配置的行政区关系生成)
javascript 脚本

function getTotalInsertSQL(tID,dwdm,dwmc){
var t="insert into total_zw_fx "; 
t+="SELECT '"+dwdm+"' as dwdm,'"+dwmc+"' as dwmc,";
t+="lq.SDGNQ AS 水稻面积,";
t+="lq.XMGNQ AS 小麦面积,";
t+="lq.YMGNQ AS 玉米面积,";
t+="lq.DDBHQ AS 大豆面积,";
t+="lq.MHBHQ AS 棉花面积,";
t+="lq.TLZBHQ AS 糖料蔗面积,";
t+="lq.YCZBHQ AS 油菜面积,";
t+="lq.TRXJBHQ AS 天然橡胶面积,";
t+="lq.xmsdfzq AS 水稻小麦面积,";
t+="lq.xmymfzq AS 小麦玉米面积,";
t+="lq.xmddfzq AS 小麦大豆面积,";
t+="lq.sdycfzq AS 水稻油菜面积";
t+=" FROM ";
t+="(SELECT ";
t+="round(sum(sdgnqdkmj)*0.0015,2) AS SDGNQ,";
t+="round(sum(xmgnqdkmj)*0.0015,2) AS XMGNQ,";
t+="round(sum(ymgnqdkmj)*0.0015,2) AS YMGNQ,";
t+="round(sum(ddbhqdkmj)*0.0015,2) AS DDBHQ,";
t+="round(sum(mhbhqdkmj)*0.0015,2) AS MHBHQ,";
t+="round(sum(tlzbhqdkmj)*0.0015,2) AS TLZBHQ,";
t+="round(sum(yczbhqdkmj)*0.0015,2) AS YCZBHQ,";
t+="round(sum(trxjbhqdkmj)*0.0015,2) AS TRXJBHQ,";
t+="round(sum(xmsdfzqdkmj)*0.0015,2) AS xmsdfzq,";
t+="round(sum(xmymfzqdkmj)*0.0015,2) AS xmymfzq,";
t+="round(sum(xmddfzqdkmj)*0.0015,2) AS xmddfzq,";
t+="round(sum(xmddfzqdkmj)*0.0015,2) AS sdycfzq";
t+=" FROM dkmjtj ";
t+=" where xzqdm in (select dwdm from tdcb_xzdw where pid in";
t+="(select id from tdcb_xzdw where pid='"+tID+"'))";
t+=") AS lq";
   return t;
};
function callbackSuccess(){
    var t_sql = "select id,dwdm,dwmc from tdcb_xzdw where jb='6'";
    var dt    = GetDataBySQL2(t_sql);
    if(dt && dt.rows && dt.rows.length>0){
        for(var i=0;i<dt.rows.length;i++){
            var item = dt.rows[i];
            var tID  = item.id;
            var dwdm = item.dwdm;
            var dwmc = item.dwmc;
            //
            var t = getTotalInsertSQL(tID,dwdm,dwmc);
            InsertUpdateSQL(t,null,null,null);
        }
        ShowAlert('分析完毕');
    }
};

DataDelete("total_zw_fx","1=1",callbackSuccess,null,null);
function getTotalInsertSQL(tID,dwdm,dwmc){
var t="insert into total_lq_xian_hj_fx  ";
t+="SELECT  '"+dwdm+"' as dwdm,'"+dwmc+"' as dwmc,";        
t+="SUM ( LQPKS ) AS PKS,";     
t+="SUM ( LQDKS ) AS DKS,";     
t+="SUM ( SJDDXZCSL ) AS XZCSL,";     
t+="round( SUM ( dkmj ) * 0.0001, 4 ) AS 两区总面积,";     
t+="round( SUM ( CASE WHEN lqlx IN ( '11', '12', '14' ) THEN dkmj ELSE 0 END ) * 0.0001,4) AS 功能区总面积,";     
t+="round( SUM ( CASE WHEN lqlx IN ( '21', '23', '24', '26', '27' ) THEN dkmj ELSE 0 END ) * 0.0001,4) AS 保护区总面积,";     
t+="round( SUM ( CASE WHEN lqlx IN ( '13', '15', '22', '25' ) THEN dkmj ELSE 0 END ) * 0.0001,4) AS 复种区总面积";
t+=" FROM ";     
t+="  LQTJXX ";     
t+=" where substr(lqdm,1,9) in(select dwdm from tdcb_xzdw where pid='"+tID+"') ";      

 return t;
}
var tID   = GetValue('tree1');
var t_sql = "select dwdm from tdcb_xzdw where id='"+tID+"'";
SetValueBySQL('textbox1',t_sql);
GetObject('grid1').RefreshViewData();



var tID=GetValue('tree1');
var t_sql = "select dwdm from tdcb_xzdw where id='"+tID+"'";
var xzqdm   = GetValueBySQL2(t_sql);



//获取乡镇代码SQL
var tID = GetValue('tree1');
//ShowAlert(tID);
var xiang_sql = "select dwdm from tdcb_xzdw where pid='"+tID+"'";
SetValue('textbox1',xiang_sql);
GetObject('grid1').RefreshViewData();


where (gdomain like '%[$ keyword]%' or qsdwdm like '%[$ keyword]%' or lqdkdm like '%[$ keyword]%'   or lqdkmc like '%[$ keyword]%') 
and substr(lqdkdm,1,12) in([$ dwdm]) 
order by bsm asc 


dwdm=GetValue('textbox1')

到乡镇代码级别
where  length(dwdm)<=9  and  ( [$ dwdm in user.xian.xiang] or [$ dwdm like user.xiang])



var tID = GetValue('tree1');
//ShowAlert(tID);
var xiang_sql = "select id from tdcb_xzdw where pid='"+tID+"'";
var tsql      = "select dwdm from tdcb_xzdw where pid in("+xiang_sql+") order by dwdm asc";
//获取所有村代码
GetDataBySQL(tsql,function(d){
   if(d && d.rows && d.rows.length>0) {
       ShowAlert(d.rows.length);
       var t = "";
       for(var i=0;i<d.rows.length;i++){
           if(t.length<=0) t="'"+d.rows[i].dwdm+"'";
           else t+=",'"+d.rows[i].dwdm+"'";
       }
       SetValue('textbox1',t);
       GetObject('grid1').RefreshViewData();
   }
   else {
       SetValue('textbox1',"''");
       GetObject('grid1').RefreshViewData();
   }
});




var xzqdm   = GetValue('tree1');
var mapCtrl = GetObject('map1');
//
if(xzqdm.length<=6){
     var tWhere = "xzqdm = '"+xzqdm+"'";
     mapCtrl.locationDK('县级行政区',tWhere,true,1.2);
}else{
     var tWhere = "xjqydm = '"+xzqdm+"'";
     mapCtrl.locationDK('乡级区域',tWhere,true,1.2);
}
//var tLayer  = mapCtrl.getMapFeatureLayer('两区地块',mapCtrl);
//if(tLayer){
    //mapCtrl.mapObj.map.removeLayer(mapCtrl.getLayer('两区地块'));
    //
    //mapCtrl.mapObj.map.addLayer(tLayer);
    //tLayer.setDefinitionExpression("lqdkdm like '"+xzqdm+"%'");
//}
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页