qushaowei
2024-03-14 f11a932fd83e13cd8d7726e053181bc40f3a3240
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.eam.mapper.CalibrationOrderMapper">
    <select id="getPrecisionParameterList"  parameterType="String" resultType="Map">
        SELECT
            t1.id,
            t2.id as precisionParametersId,
            t2.num,
            t2.name,
            t3.id as unitId,
            t3.name as unitName,
            t1.leave_factory_value as leaveFactoryValue,
            t1.actual_value as actualValue,
            t1.allowable_range as allowableRange,
            t1.upper_limit as upperLimit,
            t1.lower_limit AS lowerLimit
        FROM
            mom_eam_equipment_precision_parameters t1
        LEFT JOIN mom_eam_precision_parameters t2 ON t1.precision_parameters_id = t2.id
        LEFT JOIN mom_base_unit t3 ON t2.unit_id = t3.id
        WHERE t1.del_flag = 0 and t1.equipment_id = #{equipmentId}
    </select>
 
    <select id="getFactoryEquipmentTechnologyStatusList"  parameterType="String" resultType="Map">
        SELECT
            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'qualified') as qualifiedCount,
            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'limitedUse') as  limitedUseCount,
            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'disabled')  as disabledCount
    </select>
 
    <select id="getFactoryReportRepairEquipmentList"  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)) as failurTotalCount,
            ( 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 = '1' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)) as  noStopCount,
            ( 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)) as  stopCount
    </select>
 
    <select id="getFactoryThisMonthMaintenanceList"  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)
    </select>
 
    <select id="getFactoryNextMonthMaintenanceList"  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)
    </select>
 
    <select id="getFactoryNextNextMonthMaintenanceList"  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)
    </select>
 
    <select id="getFactoryThisMonthMaintenanceFinishList"  parameterType="String" resultType="Map">
        select count(0) as totalConnt 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>
 
    <select id="getEquipmentTechnologyStatusList"  parameterType="String" resultType="Map">
        SELECT
            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'qualified' and work_center_id = #{factoryModelId}) as qualifiedCount,
            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'limitedUse' and work_center_id = #{factoryModelId}) as  limitedUseCount,
            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'disabled' and work_center_id = #{factoryModelId})  as disabledCount
    </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)  and t2.work_center_id = #{factoryModelId}) as failurTotalCount,
            ( 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 = '1' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)  and t2.work_center_id = #{factoryModelId}) as  noStopCount,
            ( 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)  and t2.work_center_id = #{factoryModelId}) as  stopCount
    </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)  and t1.work_center_id = #{factoryModelId}
    </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)  and t1.work_center_id = #{factoryModelId}
    </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)  and t1.work_center_id = #{factoryModelId}
    </select>
 
    <select id="getThisMonthMaintenanceFinishList"  parameterType="String" resultType="Map">
        select count(0) as totalConnt 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)   and t2.work_center_id = #{factoryModelId}
    </select>
 
 
</mapper>