From ae1459d90f53ac81177e75790d859c6a12e7ed54 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期三, 12 十一月 2025 11:09:10 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
---
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml | 88 +++++++++++++++++++++++++++++---------------
1 files changed, 58 insertions(+), 30 deletions(-)
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
index bdb9005..4d66e4d 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -72,50 +72,47 @@
detail_temp AS (
SELECT t.*
FROM glass_temp t
- WHERE NOT EXISTS (
+ WHERE NOT EXISTS(
SELECT 1
FROM hollow_big_storage_cage_details t1
WHERE t1.glass_id = t.glass_id
- AND t1.state NOT IN (8,9)
+ AND t1.state NOT IN (8, 9)
)
),
damage_latest AS (
- SELECT
- dr.glass_id,
- dr.type,
- dr.status
+ SELECT dr.glass_id,
+ dr.type,
+ dr.status
FROM (
- SELECT
- t1.glass_id,
- t1.type,
- t1.status,
- ROW_NUMBER() OVER(PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn
+ SELECT t1.glass_id,
+ t1.type,
+ t1.status,
+ ROW_NUMBER() OVER(PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn
FROM detail_temp t
INNER JOIN damage t1 ON t.flow_card_id = t1.process_id
) dr
WHERE dr.rn = 1
),
result_temp AS (
- SELECT
- t.flow_card_id,
- t.layer,
- t.glass_type,
- t.thickness,
- t.filmsId,
- t.width,
- t.height,
- COUNT(DISTINCT t.glass_id) as lack_count,
- COUNT(DISTINCT CASE WHEN t1.type IN (8,9) AND t1.status = 1 THEN t.glass_id END) as damage_count
+ SELECT t.flow_card_id,
+ t.layer,
+ t.glass_type,
+ t.thickness,
+ t.filmsId,
+ t.width,
+ t.height,
+ COUNT(DISTINCT t.glass_id) as lack_count,
+ COUNT(DISTINCT
+ CASE WHEN t1.type IN (8, 9) AND t1.status = 1 THEN t.glass_id END) as damage_count
FROM detail_temp t
LEFT JOIN damage_latest t1 ON t.glass_id = t1.glass_id
- GROUP BY
- t.flow_card_id,
- t.layer,
- t.glass_type,
- t.thickness,
- t.filmsId,
- t.width,
- t.height
+ GROUP BY t.flow_card_id,
+ t.layer,
+ t.glass_type,
+ t.thickness,
+ t.filmsId,
+ t.width,
+ t.height
)
SELECT *
FROM result_temp
@@ -137,7 +134,7 @@
, detail_temp as (
select t.*
from glass_temp t
- left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state not in (8,9)
+ left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state not in (8, 9)
where t1.glass_id is null
)
, damage_ranked AS (
@@ -164,6 +161,37 @@
select *
from damage_latest
</select>
+ <select id="queryLackByFlowCardByERP" resultType="com.mes.hollow.entity.dto.LackDetailsDTO">
+ WITH RECURSIVE nums(n) AS (
+ SELECT 1
+ UNION ALL
+ SELECT n + 1 FROM nums WHERE n < (SELECT MAX(quantity) FROM (
+ <foreach collection="flowCardIdList" item="item" separator="UNION ALL">
+ SELECT #{item.lackQuantity} AS quantity
+ </foreach>
+ ) t)
+ )
+ <foreach collection="flowCardIdList" item="item" separator="UNION ALL">
+ SELECT t1.*
+ FROM (
+ SELECT
+ g.flow_card_id AS flowCardId,
+ g.layer AS layer,
+ g.glass_type AS glassType,
+ g.filmsid AS filmsId,
+ g.width AS width,
+ g.height AS height,
+ g.thickness AS thickness
+ FROM glass_info g
+ WHERE g.flow_card_id = #{item.processId}
+ AND g.layer = #{item.technologyNumber}
+ AND g.glass_type = #{item.orderNumber}
+ LIMIT 1
+ ) t1
+ CROSS JOIN nums
+ WHERE nums.n <= #{item.lackQuantity}
+ </foreach>
+ </select>
<update id="clearDirtyFlowCardData">
--
Gitblit v1.8.0