|
|
|
|
@ -32,7 +32,53 @@
|
|
|
|
|
<!-- 累计工时 -->
|
|
|
|
|
hours_sub.total_hours,
|
|
|
|
|
<!-- 产品数量 -->
|
|
|
|
|
mat_sub.product_amount
|
|
|
|
|
mat_sub.product_amount,
|
|
|
|
|
<!-- 进度信息 (子查询 Pivot) -->
|
|
|
|
|
stages_sub.startup_plan_start_time,
|
|
|
|
|
stages_sub.startup_plan_end_time,
|
|
|
|
|
stages_sub.startup_real_start_time,
|
|
|
|
|
stages_sub.startup_real_end_time,
|
|
|
|
|
stages_sub.startup_reasons_explanation,
|
|
|
|
|
stages_sub.design_plan_start_time,
|
|
|
|
|
stages_sub.design_plan_end_time,
|
|
|
|
|
stages_sub.design_real_start_time,
|
|
|
|
|
stages_sub.design_real_end_time,
|
|
|
|
|
stages_sub.design_reasons_explanation,
|
|
|
|
|
stages_sub.purchase_plan_start_time,
|
|
|
|
|
stages_sub.purchase_plan_end_time,
|
|
|
|
|
stages_sub.purchase_real_start_time,
|
|
|
|
|
stages_sub.purchase_real_end_time,
|
|
|
|
|
stages_sub.purchase_reasons_explanation,
|
|
|
|
|
stages_sub.shipment_plan_start_time,
|
|
|
|
|
stages_sub.shipment_plan_end_time,
|
|
|
|
|
stages_sub.shipment_real_start_time,
|
|
|
|
|
stages_sub.shipment_real_end_time,
|
|
|
|
|
stages_sub.shipment_reasons_explanation,
|
|
|
|
|
stages_sub.implement_plan_start_time,
|
|
|
|
|
stages_sub.implement_plan_end_time,
|
|
|
|
|
stages_sub.implement_real_start_time,
|
|
|
|
|
stages_sub.implement_real_end_time,
|
|
|
|
|
stages_sub.implement_reasons_explanation,
|
|
|
|
|
stages_sub.debug_plan_start_time,
|
|
|
|
|
stages_sub.debug_plan_end_time,
|
|
|
|
|
stages_sub.debug_real_start_time,
|
|
|
|
|
stages_sub.debug_real_end_time,
|
|
|
|
|
stages_sub.debug_reasons_explanation,
|
|
|
|
|
stages_sub.pilot_run_plan_start_time,
|
|
|
|
|
stages_sub.pilot_run_plan_end_time,
|
|
|
|
|
stages_sub.pilot_run_real_start_time,
|
|
|
|
|
stages_sub.pilot_run_real_end_time,
|
|
|
|
|
stages_sub.pilot_run_reasons_explanation,
|
|
|
|
|
stages_sub.acceptance_plan_start_time,
|
|
|
|
|
stages_sub.acceptance_plan_end_time,
|
|
|
|
|
stages_sub.acceptance_real_start_time,
|
|
|
|
|
stages_sub.acceptance_real_end_time,
|
|
|
|
|
stages_sub.acceptance_reasons_explanation,
|
|
|
|
|
stages_sub.warranty_plan_start_time,
|
|
|
|
|
stages_sub.warranty_plan_end_time,
|
|
|
|
|
stages_sub.warranty_real_start_time,
|
|
|
|
|
stages_sub.warranty_real_end_time,
|
|
|
|
|
stages_sub.warranty_reasons_explanation
|
|
|
|
|
FROM
|
|
|
|
|
erp_project_info p
|
|
|
|
|
LEFT JOIN erp_project_type t1 ON t1.project_type_id = p.project_type_id
|
|
|
|
|
@ -67,6 +113,68 @@
|
|
|
|
|
WHERE del_flag = '0'
|
|
|
|
|
GROUP BY contract_id
|
|
|
|
|
) mat_sub ON p.contract_id = mat_sub.contract_id
|
|
|
|
|
<!-- 进度信息 Pivot 子查询 -->
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
s.project_id,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '启动' THEN s.plan_start_time END) AS startup_plan_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '启动' THEN s.plan_end_time END) AS startup_plan_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '启动' THEN s.real_start_time END) AS startup_real_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '启动' THEN s.real_end_time END) AS startup_real_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '启动' THEN s.reasons_explanation END) AS startup_reasons_explanation,
|
|
|
|
|
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '设计' THEN s.plan_start_time END) AS design_plan_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '设计' THEN s.plan_end_time END) AS design_plan_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '设计' THEN s.real_start_time END) AS design_real_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '设计' THEN s.real_end_time END) AS design_real_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '设计' THEN s.reasons_explanation END) AS design_reasons_explanation,
|
|
|
|
|
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '采购' THEN s.plan_start_time END) AS purchase_plan_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '采购' THEN s.plan_end_time END) AS purchase_plan_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '采购' THEN s.real_start_time END) AS purchase_real_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '采购' THEN s.real_end_time END) AS purchase_real_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '采购' THEN s.reasons_explanation END) AS purchase_reasons_explanation,
|
|
|
|
|
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '发货' THEN s.plan_start_time END) AS shipment_plan_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '发货' THEN s.plan_end_time END) AS shipment_plan_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '发货' THEN s.real_start_time END) AS shipment_real_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '发货' THEN s.real_end_time END) AS shipment_real_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '发货' THEN s.reasons_explanation END) AS shipment_reasons_explanation,
|
|
|
|
|
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '实施' THEN s.plan_start_time END) AS implement_plan_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '实施' THEN s.plan_end_time END) AS implement_plan_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '实施' THEN s.real_start_time END) AS implement_real_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '实施' THEN s.real_end_time END) AS implement_real_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '实施' THEN s.reasons_explanation END) AS implement_reasons_explanation,
|
|
|
|
|
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '调试' THEN s.plan_start_time END) AS debug_plan_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '调试' THEN s.plan_end_time END) AS debug_plan_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '调试' THEN s.real_start_time END) AS debug_real_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '调试' THEN s.real_end_time END) AS debug_real_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '调试' THEN s.reasons_explanation END) AS debug_reasons_explanation,
|
|
|
|
|
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '试运行' THEN s.plan_start_time END) AS pilot_run_plan_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '试运行' THEN s.plan_end_time END) AS pilot_run_plan_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '试运行' THEN s.real_start_time END) AS pilot_run_real_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '试运行' THEN s.real_end_time END) AS pilot_run_real_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '试运行' THEN s.reasons_explanation END) AS pilot_run_reasons_explanation,
|
|
|
|
|
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '验收' THEN s.plan_start_time END) AS acceptance_plan_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '验收' THEN s.plan_end_time END) AS acceptance_plan_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '验收' THEN s.real_start_time END) AS acceptance_real_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '验收' THEN s.real_end_time END) AS acceptance_real_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '验收' THEN s.reasons_explanation END) AS acceptance_reasons_explanation,
|
|
|
|
|
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '质保' THEN s.plan_start_time END) AS warranty_plan_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '质保' THEN s.plan_end_time END) AS warranty_plan_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '质保' THEN s.real_start_time END) AS warranty_real_start_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '质保' THEN s.real_end_time END) AS warranty_real_end_time,
|
|
|
|
|
MAX(CASE WHEN d.dict_label = '质保' THEN s.reasons_explanation END) AS warranty_reasons_explanation
|
|
|
|
|
FROM erp_project_plan_stage s
|
|
|
|
|
LEFT JOIN sys_dict_data d ON s.project_phases = d.dict_value AND d.dict_type = 'project_phases'
|
|
|
|
|
WHERE s.del_flag = '0'
|
|
|
|
|
GROUP BY s.project_id
|
|
|
|
|
) stages_sub ON p.project_id = stages_sub.project_id
|
|
|
|
|
<where>
|
|
|
|
|
p.del_flag = '0'
|
|
|
|
|
AND p.project_category <> '9'
|
|
|
|
|
|