代码提交

This commit is contained in:
liang.chao 2026-02-05 14:27:46 +08:00
parent 3fe0fe901d
commit 3f42f95b41
2 changed files with 272 additions and 253 deletions

View File

@ -635,6 +635,7 @@
LEFT JOIN v_mtp_status vs on mm.ID = vs.maId LEFT JOIN v_mtp_status vs on mm.ID = vs.maId
WHERE 30> to_days(ifnull(mm.NEXT_CHECK_TIME,now())) - to_days(now()) WHERE 30> to_days(ifnull(mm.NEXT_CHECK_TIME,now())) - to_days(now())
group by mm.ID
</select> </select>
@ -691,20 +692,24 @@
<select id="getTotalChangeWarn" parameterType="com.bonus.index.beans.IndexTotalWarnBean" resultType="com.bonus.index.beans.IndexTotalWarnBean"> <select id="getTotalChangeWarn" parameterType="com.bonus.index.beans.IndexTotalWarnBean" resultType="com.bonus.index.beans.IndexTotalWarnBean">
SELECT SELECT
mt.ID, mt.ID,
mt2.`NAME` as maType, mt2.`NAME` AS maType,
mt.`NAME` as maName, mt.`NAME` AS maName,
mt.UNIT as maUnit, mt.UNIT AS maUnit,
mt.is_count as isCount, mt.is_count AS isCount,
t1.TIME as time, t1.TIME AS time,
t1.content t1.content
FROM ma_total_change t1 FROM ma_total_change t1
LEFT JOIN mm_type mt on mt.ID = t1.type_id LEFT JOIN mm_type mt ON mt.ID = t1.type_id
LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID LEFT JOIN mm_type mt2 ON mt.PARENT_ID = mt2.ID
WHERE NOT EXISTS ( WHERE
SELECT 1 DATEDIFF(NOW(), t1.time) &lt; 30
FROM ma_total_change t2 AND NOT EXISTS (
WHERE t2.type_id = t1.type_id AND t2.time > t1.time SELECT 1
FROM ma_total_change t2
WHERE
t2.type_id = t1.type_id
AND t2.time > t1.time
) )
<if test="maType != null and maType != ''"> <if test="maType != null and maType != ''">
and mt2.`NAME` like concat('%', #{maType}, '%') and mt2.`NAME` like concat('%', #{maType}, '%')
@ -1369,25 +1374,27 @@
<select id="getPlanDetailsAboutExpireList" resultType="com.bonus.index.beans.IndexInuseWarnBean"> <select id="getPlanDetailsAboutExpireList" resultType="com.bonus.index.beans.IndexInuseWarnBean">
SELECT SELECT
'车辆需求计划' as type, '车辆需求计划' as type,
cpd.id, cpd.id,
bp.`NAME` as projectName, bp.`NAME` as projectName,
cpd.model_id modelId, cpd.model_id modelId,
cpd.need_num needNum, cpd.need_num needNum,
cpd.need_day needDay, cpd.need_day needDay,
cpa.need_time backDate, cpa.need_time backDate,
cpd.remark, cpd.remark,
cmti.type maType, cmti.type maType,
cmti.`NAME` maName, cmti.`NAME` maName,
cmti.model maModel, cmti.model maModel,
cmti.unit maUnit cmti.unit maUnit
FROM FROM
car_plan_details cpd car_plan_details cpd
LEFT JOIN car_plan_apply cpa ON cpd.apply_id = cpa.id LEFT JOIN car_plan_apply cpa ON cpd.apply_id = cpa.id
LEFT JOIN bm_project bp ON cpa.pro_id = bp.ID LEFT JOIN bm_project bp ON cpa.pro_id = bp.ID
LEFT JOIN car_ma_type_info cmti ON cpd.model_id = cmti.id LEFT JOIN car_ma_type_info cmti ON cpd.model_id = cmti.id
WHERE bp.`NAME` IS NOT NULL WHERE bp.`NAME` IS NOT NULL
and cpa.status = 1 and cpa.status = 2
and cpa.dispatch_num = 0
and cpa.status_type = 1
<if test="projectName != null and projectName != ''"> <if test="projectName != null and projectName != ''">
and bp.`NAME` like concat('%', #{projectName}, '%') and bp.`NAME` like concat('%', #{projectName}, '%')
</if> </if>
@ -1414,7 +1421,9 @@
LEFT JOIN st_plan_apply spa ON spd.apply_id = spa.id LEFT JOIN st_plan_apply spa ON spd.apply_id = spa.id
LEFT JOIN bm_project bp ON spa.project_id = bp.ID LEFT JOIN bm_project bp ON spa.project_id = bp.ID
WHERE bp.`NAME` IS NOT NULL WHERE bp.`NAME` IS NOT NULL
and spa.status = 1 and spa.status = 2
and spa.ck_num = 0
and spa.status_type = 1
<if test="projectName != null and projectName != ''"> <if test="projectName != null and projectName != ''">
and bp.`NAME` like concat('%', #{projectName}, '%') and bp.`NAME` like concat('%', #{projectName}, '%')
</if> </if>
@ -1442,7 +1451,8 @@
LEFT JOIN t_plan_apply tpa on tpa.id=tpd.apply_id LEFT JOIN t_plan_apply tpa on tpa.id=tpd.apply_id
LEFT JOIN bm_project pro on tpa.project_id=pro.ID LEFT JOIN bm_project pro on tpa.project_id=pro.ID
WHERE pro.`NAME` is not null WHERE pro.`NAME` is not null
and tpa.status = 1 and tpa.status = 2
and tpa.status_type = 1
<if test="maName != null and maName != ''"> <if test="maName != null and maName != ''">
and tpd.`NAME` like concat('%', #{maName}, '%') and tpd.`NAME` like concat('%', #{maName}, '%')
</if> </if>

View File

@ -196,23 +196,32 @@
UNION UNION
SELECT SELECT
0 AS storageNum, 0 AS storageNum,
0 AS checkNum, 0 AS checkNum,
COUNT(DISTINCT maId) as useNum, COUNT(*) AS useNum,
0 as changeNum 0 AS changeNum
FROM FROM (
( SELECT 1
SELECT FROM
DISTINCT ps.machine as maId, ma_type_project_storage ps
to_days(now()) -to_days(ps.start_date) as days INNER JOIN mm_machines mm ON ps.machine = mm.ID
FROM INNER JOIN mm_type mt ON mm.TYPE = mt.ID
ma_type_project_storage ps LEFT JOIN mm_type mt2 ON mt.PARENT_ID = mt2.ID
LEFT JOIN mm_machines mm on ps.machine = mm.ID LEFT JOIN wf_lease_agreement wla ON ps.agreement_id = wla.ID
WHERE ps.`status` =1 and ps.is_count = 0 LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID
and mm.BATCH_STATUS = 6 LEFT JOIN bm_company bc ON bp.COMPANY_ID = bc.ID
GROUP BY ps.machine WHERE
) rs ps.status = 1
WHERE rs.days> 180 AND ps.end_date IS NULL
AND mm.BATCH_STATUS = 6
AND DATEDIFF(NOW(), ps.start_date) > 180
GROUP BY
mt.ID,
mt2.ID,
wla.ID,
bp.ID,
bc.ID
) AS t
UNION UNION
SELECT SELECT