From c51323e6fcc84f08bc8c01e3dd6c916427f83f4e Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期四, 07 三月 2024 10:41:50 +0800
Subject: [PATCH] 设备状态长时间未变化算法更新
---
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml | 149 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 144 insertions(+), 5 deletions(-)
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
index 26d708c..4e0ace6 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -58,6 +58,7 @@
WHERE
med.equipment_id = me.id
AND med.dep_id = #{ departId }
+ ORDER BY me.equipment_id
</select>
<!--鏍规嵁浜х嚎id鏌ヨ璁惧-->
@@ -70,6 +71,7 @@
WHERE
mpe.equipment_id = me.id
AND mpe.production_id = #{ productionId }
+ ORDER BY me.equipment_id
</select>
<!--鏍规嵁浜х嚎id鏌ヨ璁惧id闆嗗悎-->
@@ -94,6 +96,7 @@
k.equipmentName,
MAX ( l.Oporation ) Oporation,
k.id,
+ k.equipment_status,
k.equipment_type equipmentType,
k.equipment_type_pictures
FROM
@@ -103,13 +106,14 @@
MAX ( t.equipmentName ) equipmentName,
MAX ( m.CollectTime ) CollectTime,
id,
+ equipment_status,
equipment_type,
equipment_type_pictures
FROM
- ( SELECT equipment_id EquipmentID, equipment_Name equipmentName, id, equipment_type FROM mdc_equipment WHERE equipment_id IN
- <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
+ ( SELECT equipment_id EquipmentID, equipment_Name equipmentName, id, equipment_type, equipment_status FROM mdc_equipment WHERE equipment_id IN
+ <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
) t
LEFT JOIN ( SELECT equipment_type_name, equipment_type_pictures FROM mdc_equipment_type) met ON t.equipment_type = met.equipment_type_name
LEFT JOIN ( SELECT EquipmentID, CollectTime, Oporation FROM EquipmentLog WHERE Oporation <![CDATA[ <> ]]> 23 ) m ON t.EquipmentID= m.EquipmentID
@@ -117,6 +121,7 @@
t.EquipmentID,
id,
equipment_type,
+ equipment_status,
equipment_type_pictures
) k
LEFT JOIN ( SELECT EquipmentID, CollectTime, Oporation FROM EquipmentLog WHERE Oporation <![CDATA[ <> ]]> 23 ) l ON k.CollectTime= l.CollectTime
@@ -126,10 +131,11 @@
k.CollectTime,
k.equipmentName,
k.id,
+ k.equipment_status,
k.equipment_type,
k.equipment_type_pictures
ORDER BY
- equipmentName
+ EquipmentID
</select>
<!--鏍规嵁閮ㄩ棬id鏌ヨ璁惧id闆嗗悎-->
@@ -146,5 +152,138 @@
</foreach>
</select>
+ <!--鏍规嵁璁惧缂栧彿鏌ヨ璁惧淇℃伅鍜岄儴闂ㄤ俊鎭�-->
+ <select id="findEquDepList" resultType="org.jeecg.modules.mdc.dto.MdcEquDepDto">
+ SELECT
+ sd.id,
+ sd.parent_id,
+ sd.depart_name,
+ sd.org_type,
+ me.equipment_id,
+ me.equipment_name,
+ me.equipment_type
+ FROM
+ mdc_equipment_depart med
+ LEFT JOIN sys_depart sd ON med.dep_id = sd.id
+ LEFT JOIN mdc_equipment me ON me.id = med.equipment_id
+ <where>
+ me.equipment_id IN
+ <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </where>
+ ORDER BY sd.depart_order
+ </select>
+
+ <!--鏍规嵁璁惧缂栧彿鏌ヨ璁惧淇℃伅鍜屼骇绾夸俊鎭�-->
+ <select id="findEquProList" resultType="org.jeecg.modules.mdc.dto.MdcEquProDto">
+ SELECT
+ mp.id,
+ mp.parent_id,
+ mp.production_name,
+ mp.org_type,
+ me.equipment_id,
+ me.equipment_name,
+ me.equipment_type
+ FROM
+ mdc_production_equipment mpe
+ LEFT JOIN mdc_production mp ON mpe.production_id = mp.id
+ LEFT JOIN mdc_equipment me ON me.id = mpe.equipment_id
+ <where>
+ me.equipment_id IN
+ <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </where>
+ ORDER BY mp.production_order
+ </select>
+
+ <!--鏍规嵁澶у睆杞﹂棿id鏌ヨ璁惧鍒楄〃-->
+ <select id="getEquipmentByWorkshopId" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+ SELECT
+ me.*
+ FROM
+ mdc_workshop_equipment mwe
+ LEFT JOIN mdc_equipment me ON me.equipment_id = mwe.equipment_id
+ <where>
+ AND mwe.workshop_id = #{ workshopEquipmentVo.workshopId }
+ <if test="workshopEquipmentVo.equipmentId != null and workshopEquipmentVo.equipmentId != ''">
+ AND mwe.equipment_id = #{ workshopEquipmentVo.equipmentId }
+ </if>
+ </where>
+ ORDER BY me.equipment_id
+ </select>
+
+ <!--鍒嗛〉鍒楄〃-->
+ <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+ SELECT
+ t1.*
+ FROM
+ mdc_equipment t1
+ LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+ LEFT JOIN mdc_production t3 ON t2.production_id = t3.id
+ <where>
+ <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
+ AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
+ </if>
+ <if test="mdcEquipment.equipmentName != null and mdcEquipment.equipmentName != '' ">
+ AND t1.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentName}),'%')
+ </if>
+ <if test="mdcEquipment.equipmentModel != null and mdcEquipment.equipmentModel != '' ">
+ AND t1.equipment_name = #{mdcEquipment.equipmentModel}
+ </if>
+ <if test="mdcEquipment.equipmentType != null and mdcEquipment.equipmentType != '' ">
+ AND t1.equipmentType = #{mdcEquipment.equipmentType}
+ </if>
+ <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' ">
+ AND t1.drive_type = #{mdcEquipment.driveType}
+ </if>
+ <if test="mdcEquipment.productionIds != null and mdcEquipment.productionIds.size() > 0 ">
+ AND t3.id IN
+ <foreach collection="mdcEquipment.productionIds" index="index" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </if>
+ </where>
+ order by t1.sort_no
+ </select>
+
+ <select id="exportXlsList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+ SELECT
+ t1.*
+ FROM
+ mdc_equipment t1
+ LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+ LEFT JOIN mdc_production t3 ON t2.production_id = t3.id
+ <where>
+ <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
+ AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
+ </if>
+ <if test="mdcEquipment.equipmentName != null and mdcEquipment.equipmentName != '' ">
+ AND t1.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentName}),'%')
+ </if>
+ <if test="mdcEquipment.equipmentModel != null and mdcEquipment.equipmentModel != '' ">
+ AND t1.equipment_name = #{mdcEquipment.equipmentModel}
+ </if>
+ <if test="mdcEquipment.equipmentType != null and mdcEquipment.equipmentType != '' ">
+ AND t1.equipment_type = #{mdcEquipment.equipmentType}
+ </if>
+ <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' ">
+ AND t1.drive_type = #{mdcEquipment.driveType}
+ </if>
+ <if test="mdcEquipment.productionIds != null and mdcEquipment.productionIds.size() > 0 ">
+ AND t3.id IN
+ <foreach collection="mdcEquipment.productionIds" index="index" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </if>
+ </where>
+ order by t1.sort_no
+ </select>
+
+ <!--鏌ヨ鍗曡〃鏁版嵁-->
+ <select id="findWorkLineLast" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
+ select top 1 spindlespeed, actualspindlespeed from [${tableName}] order by CollectTime desc
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3