From ce8cb72035593058a572b905bedd327cad579f18 Mon Sep 17 00:00:00 2001 From: hyingbo <1363390067@qq.com> Date: 星期四, 19 六月 2025 13:58:17 +0800 Subject: [PATCH] Revert "首页本月三保、下月三保、下下月三保统计调整" --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml | 302 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 297 insertions(+), 5 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml index aaaeb4b..fe785c8 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml @@ -70,8 +70,8 @@ </select> <select id="getFactoryThisMonthMaintenanceFinishList" parameterType="String" resultType="Map"> - select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id - where t1.del_flag = '0' and t1.status = '5' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) + select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id left join mom_eam_maintenance_cycle t4 on t1.maintenance_cycle_id = t4.id + where t1.del_flag = '0' and t1.status = '5' and t4.maintenance_type = '3' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) </select> <select id="getEquipmentTechnologyStatusList" parameterType="String" resultType="Map"> @@ -81,6 +81,34 @@ ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'disabled' <if test="workCenterId != null and workCenterId != ''"> and work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and area_id = #{areaId} </if> ) as disabledCount </select> + + <select id="getEquipmentByTechnologyStatus" parameterType="Map" resultType="Map"> + SELECT + t1.id, + t2.name as factoryName, + t3.name as productName, + t1.num as equipmentNum, + t1.name as equipmentName, + t1.model as equipmentModel, + t1.specification, + t4.item_text as technologyStatus + FROM + mom_eam_equipment t1 + left join mom_base_area t2 on t1.work_center_id = t2.id + left join mom_base_area t3 on t1.area_id = t3.id + left join (SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status') t4 ON t4.item_value = t1.technology_status + WHERE t1.del_flag = '0' + <if test="workCenterId != null and workCenterId != ''"> + and t1.work_center_id = #{workCenterId} + </if> + <if test="areaId != null and areaId != ''"> + and t1.area_id = #{areaId} + </if> + <if test="technologyStatus != null and technologyStatus != ''"> + and t1.technology_status = #{technologyStatus} + </if> + </select> + <select id="getReportRepairEquipmentList" parameterType="String" resultType="Map"> SELECT ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id WHERE t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> ) as failurTotalCount, @@ -88,21 +116,216 @@ ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id where t1.del_flag = '0' and t1.is_stop = '2' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> ) as stopCount </select> + <select id="getEquipmentByReportRepair" parameterType="Map" resultType="Map"> + SELECT + t1.id, + t5.name AS factoryName, + t3.name AS productName, + t2.num AS equipmentNum, + t2.name AS equipmentName, + t2.model AS equipmentModel, + t2.specification, + t4.item_text AS technologyStatus + FROM + mom_eam_equipment_report_repair t1 + LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id + LEFT JOIN mom_base_area t5 ON t2.work_center_id = t5.id + LEFT JOIN mom_base_area t3 ON t2.area_id = t3.id + LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status' ) t4 ON t4.item_value = t2.technology_status + WHERE t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) + <if test="workCenterId != null and workCenterId != ''"> + and t2.work_center_id = #{workCenterId} + </if> + <if test="areaId != null and areaId != ''"> + and t2.area_id = #{areaId} + </if> + <if test="isStop != null and isStop != ''"> + and t1.is_stop = #{isStop} + </if> + </select> + <select id="getThisMonthMaintenanceList" parameterType="String" resultType="Map"> - select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if> + select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if> + </select> + + <select id="showThisMonthMaintenanceList" parameterType="Map" resultType="Map"> + SELECT + t1.id, + t2.name as factoryName, + t3.name as productName, + t1.num as equipmentNum, + t1.name as equipmentName, + t1.model as equipmentModel, + t1.specification, + t4.item_text as technologyStatus + FROM + mom_eam_equipment t1 + left join mom_base_area t2 on t1.work_center_id = t2.id + left join mom_base_area t3 on t1.area_id = t3.id + left join (SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status') t4 ON t4.item_value = t1.technology_status + WHERE t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) + <if test="workCenterId != null and workCenterId != ''"> + and t1.work_center_id = #{workCenterId} + </if> + <if test="areaId != null and areaId != ''"> + and t1.area_id = #{areaId} + </if> </select> <select id="getNextMonthMaintenanceList" parameterType="String" resultType="Map"> select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH, 1, GETDATE()), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if> </select> + <select id="showNextMonthMaintenanceList" parameterType="Map" resultType="Map"> + SELECT + t1.id, + t2.name as factoryName, + t3.name as productName, + t1.num as equipmentNum, + t1.name as equipmentName, + t1.model as equipmentModel, + t1.specification, + t4.item_text as technologyStatus + FROM + mom_eam_equipment t1 + left join mom_base_area t2 on t1.work_center_id = t2.id + left join mom_base_area t3 on t1.area_id = t3.id + left join (SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status') t4 ON t4.item_value = t1.technology_status + WHERE t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH, 1, GETDATE()), 120), 1, 7) + <if test="workCenterId != null and workCenterId != ''"> + and t1.work_center_id = #{workCenterId} + </if> + <if test="areaId != null and areaId != ''"> + and t1.area_id = #{areaId} + </if> + </select> + <select id="getNextNextMonthMaintenanceList" parameterType="String" resultType="Map"> select count(0) as totalCount from mom_eam_equipment t1 where t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH,2 , GETDATE()), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if> </select> + <select id="showNextNextMonthMaintenanceList" parameterType="Map" resultType="Map"> + SELECT + t1.id, + t2.name as factoryName, + t3.name as productName, + t1.num as equipmentNum, + t1.name as equipmentName, + t1.model as equipmentModel, + t1.specification, + t4.item_text as technologyStatus + FROM + mom_eam_equipment t1 + left join mom_base_area t2 on t1.work_center_id = t2.id + left join mom_base_area t3 on t1.area_id = t3.id + left join (SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status') t4 ON t4.item_value = t1.technology_status + WHERE t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH,2 , GETDATE()), 120), 1, 7) + <if test="workCenterId != null and workCenterId != ''"> + and t1.work_center_id = #{workCenterId} + </if> + <if test="areaId != null and areaId != ''"> + and t1.area_id = #{areaId} + </if> + </select> + <select id="getThisMonthMaintenanceFinishList" parameterType="String" resultType="Map"> - select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id - where t1.del_flag = '0' and t1.status = '5' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> + select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id left join mom_eam_maintenance_cycle t4 on t1.maintenance_cycle_id = t4.id + where t1.del_flag = '0' and t1.status = '5' and t4.maintenance_type = '3' + and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) + <if test="workCenterId != null and workCenterId != ''">and t2.work_center_id = #{workCenterId} </if> + <if test="areaId != null and areaId != ''">and t2.area_id = #{areaId} </if> + </select> + + <select id="showThisMonthMaintenanceFinishList" parameterType="Map" resultType="Map"> + SELECT + t1.id, + t20.name AS factoryName, + t30.name AS productName, + t2.num AS equipmentNum, + t2.name AS equipmentName, + t2.model AS equipmentModel, + t2.specification, + t40.item_text AS technologyStatus + FROM + mom_eam_daily_maintenance_order t1 + LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id + LEFT JOIN mom_eam_maintenance_cycle t4 ON t1.maintenance_cycle_id = t4.id + LEFT JOIN mom_base_area t20 ON t2.work_center_id = t20.id + LEFT JOIN mom_base_area t30 ON t2.area_id = t30.id + LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status' ) t40 ON t40.item_value = t2.technology_status + WHERE t1.del_flag = '0' AND t1.status = '5' AND t4.maintenance_type = '3' + AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t1.actual_end_time, 120 ), 1, 7 ) = SUBSTRING ( CONVERT ( VARCHAR ( 10 ), GETDATE( ), 120 ), 1, 7 ) + <if test="workCenterId != null and workCenterId != ''"> + and t2.work_center_id = #{workCenterId} + </if> + <if test="areaId != null and areaId != ''"> + and t2.area_id = #{areaId} + </if> + </select> + + <select id="get3MaintenancePostponeCount" parameterType="String" resultType="Map"> + select count(0) as totalCount from (select DISTINCT t2.id from mom_eam_plan_change_apply t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id + where SUBSTRING(CONVERT(VARCHAR(10), t2.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) and t2.area_id = #{areaId} ) t4 + </select> + + <select id="show3MaintenancePostponeCount" parameterType="Map" resultType="Map"> + SELECT DISTINCT + t2.id, + t20.name AS factoryName, + t30.name AS productName, + t2.num AS equipmentNum, + t2.name AS equipmentName, + t2.model AS equipmentModel, + t2.specification, + t4.item_text AS technologyStatus + FROM + mom_eam_plan_change_apply t1 + LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id + LEFT JOIN mom_base_area t20 ON t2.work_center_id = t20.id + LEFT JOIN mom_base_area t30 ON t2.area_id = t30.id + LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status' ) t4 ON t4.item_value = t2.technology_status + where SUBSTRING(CONVERT(VARCHAR(10), t2.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) + and t2.area_id = #{areaId} + </select> + + <select id="get3MaintenanceOverdueCount" parameterType="String" resultType="Map"> + SELECT + count(0) as totalCount + FROM + mom_eam_daily_maintenance_order t1 + LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id + left join mom_eam_maintenance_cycle t4 on t1.maintenance_cycle_id = t4.id + WHERE + t1.del_flag = '0' + and t1.status = '3' + and t4.maintenance_type = '3' + and SUBSTRING(CONVERT(VARCHAR(10), t1.plan_start_time, 120), 1, 10) < SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) + and SUBSTRING(CONVERT(VARCHAR(10), t2.next_third_maintenance_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) + <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> + </select> + + <select id="show3MaintenanceOverdueCount" parameterType="Map" resultType="Map"> + SELECT DISTINCT + t2.id, + t20.name AS factoryName, + t30.name AS productName, + t2.num AS equipmentNum, + t2.name AS equipmentName, + t2.model AS equipmentModel, + t2.specification, + t40.item_text AS technologyStatus + FROM + mom_eam_daily_maintenance_order t1 + LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id + LEFT JOIN mom_eam_maintenance_cycle t4 ON t1.maintenance_cycle_id = t4.id + LEFT JOIN mom_base_area t20 ON t2.work_center_id = t20.id + LEFT JOIN mom_base_area t30 ON t2.area_id = t30.id + LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status' ) t40 ON t40.item_value = t2.technology_status + WHERE t1.del_flag = '0' AND t1.status = '3' AND t4.maintenance_type = '3' + and SUBSTRING(CONVERT(VARCHAR(10), t1.plan_start_time, 120), 1, 10) < SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) + and SUBSTRING(CONVERT(VARCHAR(10), t2.next_third_maintenance_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10) + <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> + </select> <select id="getCenterTwoMaintenancePlanList" parameterType="String" resultType="Map"> @@ -148,5 +371,74 @@ where t4.area_id = #{areaId} and SUBSTRING(CONVERT(VARCHAR(10), t1.plan_start_time, 120), 1, 7) = #{maintenanceDate} </select> + <!-- 棣栭〉 绗洓绾� 瀵瑰簲宸ュ尯涓嬶紝璁惧鍙拌处淇℃伅灞曠ず锛� --> + <select id="getAreaEquipmentList" parameterType="String" resultType="Map"> + SELECT + t1.id, + t1.id as value, + t1.num, + t1.num as text, + t1.name, + t1.model, + t1.specification, + t1.equipment_importance_id as abc, + t2.name as equipmentCategoryName, + t3.name as siteName, + t4.name as areaName, + t5.name as workShopName, + t1.system, + t6.depart_name as manageName, + t7.item_text as equipmentStatus, + t8.item_text as technology_status, + t1.next_second_maintenance_time AS nextSecondMaintenanceTime, + t1.next_third_maintenance_time as nextThirdMaintenanceTime + FROM + mom_eam_equipment t1 + LEFT JOIN mom_eam_equipment_category t2 ON t1.equipment_category_id = t2.id + left join mom_base_area t3 on t1.work_center_id = t3.id + left join mom_base_area t4 on t1.factory_model_id = t4.id + left join mom_base_area t5 on t1.area_id = t5.id + left join sys_depart t6 on t1.manage_id = t6.id + LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'equipment_status' ) t7 ON t7.item_value = t1.equipment_status + LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status' ) t8 ON t8.item_value = t1.technology_status + where t1.del_flag = '0' + <if test="areaId != null and areaId != ''"> + and t1.area_id = #{areaId} + </if> + <if test="equipmentNum != null and equipmentNum != ''"> + and t1.num = #{equipmentNum} + </if> + <if test="equipmentIds != null"> + and t1.id in + <foreach collection='equipmentIds' index='index' item='item' open='(' separator=',' close=')'>#{item}</foreach> + </if> + </select> + + <!-- 棣栭〉 绗洓绾� 褰撳墠鐧诲綍浜虹殑鎿嶄綔璇侊紱 --> + <select id="getOperationCertificate" parameterType="String" resultType="Map"> + SELECT + t1.id, + t1.num, + SUBSTRING(CONVERT(VARCHAR(10),t1.issue_date, 120), 1, 10) AS issueDate, + SUBSTRING(CONVERT(VARCHAR(10),t1.end_time, 120), 1, 10) as endTime, + t1.current_cycle_score AS currentCycleScore, + t2.realname, + t1.equipment_ids AS equipmentIds + FROM + mom_eam_operation_certificate t1 + LEFT JOIN sys_user t2 on t1.user_id = t2.username + where t1.del_flag = '0' and t1.user_id = #{username} + </select> + + <select id="getEquipmentReportRepairCount" parameterType="String" resultType="Map"> + SELECT + count(0) AS repairCount + FROM + mom_eam_equipment_report_repair t1 + where t1.del_flag = '0' + and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) + and t1.equipment_id = #{equipmentId} + </select> + </mapper> \ No newline at end of file -- Gitblit v1.9.3