From 7aa4d932c658e293e96251e75094c32c629a5988 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期一, 18 三月 2024 16:31:17 +0800
Subject: [PATCH] 接口修改

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml |   50 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 38 insertions(+), 12 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 b14cfa4..06f679e 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
@@ -21,6 +21,16 @@
         WHERE t1.del_flag = 0 and t1.equipment_id = #{equipmentId}
     </select>
 
+    <!--鏍规嵁妯″瀷浼犲叆鐨勭紪鐮�  鍒ゆ柇鏀圭紪鐮佸叕鍙�/涓績/宸ユ鐨勫摢涓�绾�-->
+    <select id="findOrgType" resultType="java.lang.String">
+        select TOP 1 org_type as orgType from mdc_production where production_code = #{productionCode}
+    </select>
+
+    <!--鑾峰彇褰撳墠鐧诲綍浜烘槸涓績鍙婂搴旂殑缂栫爜-->
+    <select id="findProductionCode" resultType="java.lang.String">
+        SELECT top 1 t2.production_code  as productionCode FROM mdc_user_production t1 LEFT JOIN mdc_production t2 ON t1.pro_id = t2.id  where t1.user_id =#{userId} and t2.org_type = '2'
+    </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,
@@ -48,39 +58,55 @@
     </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
+        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>
 
     <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 COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'qualified'   <if test="workCenterId != null and workCenterId != ''"> and work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and area_id = #{areaId} </if> ) as qualifiedCount,
+            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'limitedUse'  <if test="workCenterId != null and workCenterId != ''"> and work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and area_id = #{areaId} </if> ) as  limitedUseCount,
+            ( 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="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 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,
+            ( 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)  <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  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)  <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="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  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="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  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="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  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="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 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>
+
+    <select id="getCenterTwoMaintenancePlanList"  parameterType="String" resultType="Map">
+        SELECT
+            top 1
+	        t1.id,
+            t5.name centerName,
+            SUBSTRING(CONVERT(VARCHAR(10),t1.plan_start_time, 120), 1, 10) maintenanceDate,
+            '浜岀骇淇濆吇' as content
+        FROM
+            mom_eam_equipment_maintenance_plan_detail t1
+            LEFT JOIN mom_eam_equipment_maintenance_plan t2 ON t1.plan_id= t2.id
+            left join mom_eam_maintenance_standard t3 on t1.standard_id = t3.id
+            left join mom_eam_equipment t4 on t3.equipment_id = t4.id
+            left join mom_base_area t5 on t4.work_center_id = t5.id
+        where t5.id = #{workCenterId} ORDER BY t1.plan_start_time desc
     </select>
 
 

--
Gitblit v1.9.3