diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index 7c36f1f..02e1a61 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -28,5 +28,17 @@
$ProjectFileDir$
+
+ sqlserver.ms
+ true
+ com.microsoft.sqlserver.jdbc.SQLServerDriver
+ jdbc:sqlserver://172.18.96.4:1433
+
+
+
+
+
+ $ProjectFileDir$
+
\ No newline at end of file
diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml
index c3f8137..0dfa1b4 100644
--- a/.idea/sqldialects.xml
+++ b/.idea/sqldialects.xml
@@ -5,6 +5,7 @@
+
@@ -12,6 +13,8 @@
+
+
diff --git a/dw/dwd/dwd_engine_equipment_inspection_task_d.sql b/dw/dwd/dwd_engine_equipment_inspection_task_d.sql
index b3ae6a3..f09a28f 100644
--- a/dw/dwd/dwd_engine_equipment_inspection_task_d.sql
+++ b/dw/dwd/dwd_engine_equipment_inspection_task_d.sql
@@ -8,4 +8,7 @@ select
, TaskEndTime -- 任务结束时间
, TaskStatue -- 任务状态
from ods_erp_tb_eq_flow_task_inspection_d
-where IsClose = 0
\ No newline at end of file
+where IsClose = 0
+-- and CommId = '214309'
+-- and TaskEndTime <= DATE_SUB(CURDATE(),INTERVAL 1 SECOND)
+-- and TaskEndTime>='2024-07-01'
\ No newline at end of file
diff --git a/finereport/kanban/pc/工程.sql b/finereport/kanban/pc/工程.sql
index 3ac5c07..a53c238 100644
--- a/finereport/kanban/pc/工程.sql
+++ b/finereport/kanban/pc/工程.sql
@@ -84,8 +84,8 @@ where 1=1
${IF(LEN(p_ym)>0," AND right(list_ym,2) ='" +right(p_ym,2) + "'","")}
and MeterType in ('水表','电表')
order by list_ym asc
-
-
+;
+-- ----------------------------------------------------------------------------------------------------------
-- 设备巡查
select
${IF(LEN(p_area)>0,"organ_code, organ_name, comm_id code, comm_name name,","organ_code code, organ_name name,")}
@@ -99,6 +99,65 @@ where 1=1
${IF(LEN(p_ym)>0," AND task_ym ='" + left(p_ym,4) + right(p_ym,2) + "'","")}
+SELECT
+SUM(task_finish_num) / sum(task_num)
+FROM dws_engine_equipment_inspect_task_m
+where task_ym = '202407';
+
+
+-- 【erp设备巡检完成率】
+
+select
+ SUM(完成率分母) AS 完成率分母
+ ,SUM(完成率分子) AS 完成率分子
+from
+ (
+ select
+ CommId
+ ,count(0) 完成率分母
+ ,sum(case when TaskStatue=2 then 1 else 0 end) 完成率分子
+ -- select *
+ from Tb_Eq_Flow_Task_Inspection where IsClose = 0
+ and TaskEndTime>='2024-07-01'
+ and TaskEndTime<='2024-07-23 23:59:59'
+ -- and TaskStatue='2'
+ and IsClose=0 group by CommId
+ )t
+;
+
+
+-- ods
+SELECT
+ count(1) as total_task
+ ,sum(case when TaskStatue = 2 then 1 else 0 end) as finish_task
+-- ,sum(case when TaskStatue = 2 then 1 else 0 end) / count(1) as finish_task_rate
+-- select *
+from dw.ods_erp_tb_eq_flow_task_inspection_d
+where IsClose = 0
+ and TaskEndTime>='2024-07-01'
+ and TaskEndTime<= '2024-07-23 23:59:59'
+-- AND TaskStatue = '2'
+ and TaskEndTime<= DATE_SUB(CURDATE(),INTERVAL 1 SECOND)
+;
+
+
+-- dwd
+select
+
+
+ sum(case when TaskStatue = 2 then 1 else 0 end) task_finish_num
+ , count(*) task_num
+from dw.dwd_engine_equipment_inspection_task_d a
+join (select distinct organ_code, organ_name, comm_id, comm_name from dw.dim_organ_mapping where comm_id is not null) b
+ on a.CommId = b.comm_id
+where TaskEndTime <= DATE_SUB(CURDATE(),INTERVAL 1 SECOND)
+ and TaskEndTime>='2024-07-01'
+;
+
+-- 59180 - 59134
+-- ---------------------------------------------------------------------------------------------------------------
+
+
-- 水电收缴率
select
@@ -110,7 +169,6 @@ where ParentCostCode = '0008'
-- 异常抬杆
-
select
organ_code , organ_name
, sum(manualOutNum) manualOutNum
diff --git a/finereport/kanban/pc/总裁.sql b/finereport/kanban/pc/总裁.sql
index fc641c3..6283126 100644
--- a/finereport/kanban/pc/总裁.sql
+++ b/finereport/kanban/pc/总裁.sql
@@ -14,4 +14,40 @@ where 1=1
${if(len(organ)=0,"","and organ_code = '"+organ+"'")}
and left(ym,4) = '2024'
group by ym
-order by ym asc
\ No newline at end of file
+order by ym asc
+
+
+
+-- 【设备巡检】
+
+-- 【old】
+select
+ sum(task_finish_num)
+ , sum(task_num)
+ , sum(task_finish_num) / sum(task_num) inspection_finish_rate
+FROM dws_engine_equipment_inspect_task_m
+ where task_ym = date_format(current_date(),'%Y%m')
+ ${if(len(organ)=0,"","and organ_code = '"+organ+"'")}
+;
+
+-- 【new】
+
+select
+comm_id
+,comm_name
+,task_ym
+ sum(task_finish_num) / sum(task_num) as inspection_finish_rate
+FROM dws_engine_equipment_inspect_task_m
+where task_ym = date_format(current_date(),'%Y%m')
+group by
+ comm_id
+ ,comm_name
+ ,task_ym
+;
+
+ ${if(len(organ)=0,"","and organ_code = '"+organ+"'")}
+
+
+
+
+ 设备巡查.select(task_finish_num) / 设备巡查.select(task_num)
\ No newline at end of file
diff --git a/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql b/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql
new file mode 100644
index 0000000..362cf6a
--- /dev/null
+++ b/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql
@@ -0,0 +1,85 @@
+drop table if exists dw.ods_innoveco_metrics_finish_d;
+CREATE TABLE IF NOT EXISTS dw.ods_innoveco_metrics_finish_d (
+ id INT AUTO_INCREMENT PRIMARY KEY COMMENT '自增id'
+ ,ym VARCHAR(50) COMMENT '年月'
+ ,organ_code VARCHAR(50) COMMENT '片区ID'
+ ,organ_name VARCHAR(50) COMMENT '片区名称'
+ ,business_type VARCHAR(50) COMMENT '业务类型'
+ ,revenue_type VARCHAR(50) COMMENT '收入类型'
+ ,revenue_value DECIMAL(16,2) COMMENT '收入值'
+ ,update_time datetime COMMENT '更新时间'
+ ,update_user VARCHAR(100) COMMENT '更新人'
+
+)COMMENT = '多经四大业务指标完成情况填报表'
+;
+
+
+
+truncate table dw.ods_innoveco_metrics_finish_d;
+
+select
+ id -- 自增id'
+ ,ym -- 年月'
+ ,organ_code
+ ,organ_name -- 片区'
+ ,business_type -- 业务类型'
+ ,revenue_type -- 收入'
+ ,revenue_value -- 收入值'
+,update_user
+,update_time
+from dw.ods_innoveco_metrics_finish_d
+;
+
+
+-- 【tianbao_innoveco_input】
+
+select
+ id -- 自增id'
+ ,ym -- 年月'
+ ,organ_name -- 片区'
+ ,business_type -- 业务类型'
+ ,revenue_type -- 收入'
+ ,revenue_value -- 收入值'
+from dw.ods_innoveco_metrics_finish_d
+where ym = '${p_ym}'
+;
+
+
+
+-- 【erp_片区】
+SELECT
+ organ_code
+,organ_name
+FROM
+(
+ SELECT DISTINCT
+ organ_code AS organ_code
+ ,organ_name AS organ_name
+ , CASE
+ WHEN organ_code = '0102' THEN 1 -- 成都片区
+ WHEN organ_code = '0101' THEN 2 -- 乐山片区
+ WHEN organ_code = '0115' THEN 3 -- 眉山片区
+ WHEN organ_code = '0120' THEN 4 -- 攀西片区
+ WHEN organ_code = '0106' THEN 5 -- 长春片区
+ WHEN organ_code = '0109' THEN 6 -- 大湾片区
+ WHEN organ_code = '0108' THEN 7 -- 商写片区
+ WHEN organ_code = '0116' THEN 8 -- 川东北片区
+ WHEN organ_code = '0103' THEN 9 -- 库尔勒片区
+ WHEN organ_code = '0117' THEN 10 -- 乌鲁木齐片区
+ WHEN organ_code = '0118' THEN 11 -- 喀什片区
+ WHEN organ_code = '0114' THEN 13 -- 雅华片区
+ else 999
+ END AS RK
+FROM dim_organ_mapping
+where organ_code is not null
+and organ_code <> '0121'
+UNION
+SELECT
+ DISTINCT
+ cx_oragan_code AS organ_code
+ , cx_oragan_name AS organ_name
+ , 14 AS RK
+FROM dim_organ_mapping
+where cx_oragan_code = '6001'
+ )T
+ORDER BY T.RK;
diff --git a/映射表规范.md b/映射表规范.md
index 9e6eb95..707ffef 100644
--- a/映射表规范.md
+++ b/映射表规范.md
@@ -25,3 +25,9 @@
| 214351002 | 【成都】港基·叠香庄园 |
| 214350002 | 【成都】翰香府 |
+
+【创新四大业务指标完成情况 新增片区如下】 2024-07-24
+
+| 片区id | 片区 |
+|------|----------|
+| 6001 | 资阳佳美|