营配数据质量核查,关于营销mis系统与配电gis系统里面的sql语句查询,做为积累使用,下次就不用重复写同样的语句了。
1.配电gis线路导出数据:
select r.name 线路名称,r.run_status 运行状态,r.voltage_level 电压等级,
r.manager_depart 管理部门,r.belong_substation 所属厂站
from ods_sc.T_D2_PD_FEEDER r where r.gsdm=‘040100‘ and r.run_status <>‘退运‘ and r.voltage_level=‘10kV‘
and r.manager_depart not in
(‘江南供电分局‘,‘青秀供电分局‘,‘兴宁供电分局‘,‘城西供电分局‘,‘五象供电分局‘)
2.配电gis变压器导出数据
select t2.NAME 变压器名称,t2.BELONG_FEEDER 所属线路,t2.RUN_STATUS 运行状态,
t2.MANAGER_DEPART 管理部门,t2.TRANSFORMER_TYPE 变压器类型,t2.BYQH 变压器号 ,t2.VOLTAGE_LEVEL 电压等级
from ods_yx.v_gis_byq_count t2 where t2.GSDM=‘040100‘ and
t2.voltage_level=‘10kV‘
and (t2.manager_depart not in
(‘江南供电分局‘,‘青秀供电分局‘,‘兴宁供电分局‘,‘城西供电分局‘,‘五象供电分局‘) or t2.MANAGER_DEPART is null) and
t2.transformer_type in (‘配变‘, ‘公变‘,‘专变‘)
3.配电gis系统用户导出数据
select user_no 用户号,user_name 用户名,x.MANAGER_DEPART 管理部门 from
ods_yx.V_GIS_USER_yhyzx x where x.GSDM=‘040100‘ and x.MANAGER_DEPART is null
4.营销mis线路导出数据
select l1.line_name 线路名称,
(select max(param_value) from ods_yx.sys_param_value v where v.gdjdm=‘040100‘ and v.param_code=l1.volt_level_code
and v.param_type_code=‘VOLT_LEVEL‘) 电压等级,
(select max(param_value) from ods_yx.sys_param_value v where v.gdjdm=‘040100‘ and v.param_code=l1.line_type
and v.param_type_code=‘LINE_TYPE‘) 线路性质,
(select max(NEXT_DEPT_NAME) from ods_yx.VIEW_NEXT_BUSI v where v.gdjdm=‘040100‘ and
v.NEXT_DEPT_CODE=l1.business_place_code) 所属营业区域
from ods_yx.line l1 where l1.business_place_code in (#)
and l1.volt_level_code=‘08‘ and l1.line_type in (1,5,10)
5.营销mis变压器导出数据
select trans_no 变压号,user_no 户号,desk_name 变压器名称,
(select max(NEXT_DEPT_NAME) from ods_yx.VIEW_NEXT_BUSI v where v.gdjdm=‘040100‘ and
v.NEXT_DEPT_CODE=n.business_place_code) 所属营业区域,
(select max(param_value) from ods_yx.sys_param_value v where v.gdjdm=‘040100‘ and v.param_code=n.trans_state
and v.param_type_code=‘TRANS_STATUS_FLAG‘) 变压器运行状态,
(select max(param_value) from ods_yx.sys_param_value v where v.gdjdm=‘040100‘ and v.param_code=n.is_pub_trans
and v.param_type_code=‘IS_PUB_TRANS‘) 公专变类型,
(select max(param_value) from ods_yx.sys_param_value v where v.gdjdm=‘040100‘ and v.param_code=n.volt_level_code
and v.param_type_code=‘VOLT_LEVEL‘) 电压等级
from ods_yx.trans_run n where n.business_place_code in (#) and n.volt_level_code=‘08‘
6.营销mis用户导出数据
select t1.user_no 用户号,t1.user_name 用户名,
(select max(param_value) from ods_yx.sys_param_value v where v.gdjdm=‘040100‘ and v.param_code=t1.user_state
and v.param_type_code=‘USER_STATUS‘) 用户状态,
(select max(NEXT_DEPT_NAME) from ods_yx.VIEW_NEXT_BUSI v where v.gdjdm=‘040100‘ and
v.NEXT_DEPT_CODE=t1.business_place_code) 所属营业区域,
(select max(param_value) from ods_yx.sys_param_value v where v.gdjdm=‘040100‘ and v.param_code=t2.self_supply_mode
and v.param_type_code=‘SELF_SUPPLY_MODE‘) 供电方式
from ods_yx.user_files t1,ods_yx.power_file t2 where t1.user_no=t2.user_no and
t1.business_place_code in (#) and t1.user_state<>‘2‘
and t2.self_supply_mode in (‘5‘,‘6‘)
7.生产mis系统参数信息
select ywbm,nr from PD_GY_SBZDB where sjbm=‘5012‘ 设备状态
--配电站信息
select * from pd_gy_sb_pdzlxxb where id in( select id from pd_gy_sb_wjjgb where bs=‘BDZ‘);
--电压等级
SELECT ywbm, nrFROM PD_GY_SBZDB WHERE sjbm = ‘5004‘;
--产权性质
SELECT GY_DM_XTDMB.YWBM, GY_DM_XTDMB.NR FROM GY_DM_XTDMB WHERE GY_DM_XTDMB.SJBM = ‘371‘
8.县级生产mis重复变压器号
select id,byqh as 变压器号,wlsbmc as 物理设备名称,sbxslj as 设备显示路径 ,
(select max(xlmc) from dw_scxj.pd_gy_sb_xlxxb b where b.id=ssxl and gsdm=‘040102‘) as 所属线路
from ods_yx.xj_sc_gb where byqh in (select byqh
from ods_yx.xj_sc_gb tzb
where tzb.gsdm =‘040102‘ group by byqh having count(1)>1
)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。