| | |
| | | AND T1.SLOT IS NULL |
| | | </select> |
| | | |
| | | <select id="listBySlotState" resultMap="RawGlassStorageDetailsDTO"> |
| | | <select id="patternUsage" resultMap="RawGlassStorageDetailsDTO"> |
| | | select rgsd.pattern_width, |
| | | rgsd.pattern_height, |
| | | rgsd.pattern_thickness, |
| | | rgsd.films_id, |
| | | rgsd.count + sum(lgdth.finish_count) + sum(damage_count), |
| | | rgsd.count, |
| | | sum(lgdth.finish_count) as finishCount, |
| | | sum(damage_count) as damageCount |
| | | rgsd.pattern_height, |
| | | rgsd.pattern_thickness, |
| | | rgsd.films_id, |
| | | ifnull(rgsd.count,0) + ifnull(sum(lgdth.finish_count),0) + ifnull(sum(damage_count),0) as totalCount, |
| | | ifnull(rgsd.count,0) as count, |
| | | ifnull(sum(lgdth.finish_count),0) as finishCount, |
| | | ifnull(sum(damage_count),0) as damageCount |
| | | from (select pattern_width, |
| | | pattern_height, |
| | | pattern_thickness, |
| | | films_id, |
| | | sum(case when state = 100 then remain_quantity else 0 end) as count |
| | | from raw_glass_storage_details |
| | | group by pattern_width, pattern_height, pattern_thickness, films_id) as rgsd |
| | | left JOIN load_glass_device_task_history as lgdth |
| | | on rgsd.pattern_width = lgdth.raw_glass_width |
| | | and rgsd.pattern_height = lgdth.raw_glass_height |
| | | and rgsd.pattern_thickness = lgdth.raw_glass_thickness |
| | | and rgsd.films_id = lgdth.raw_glass_films_id |
| | | where rgsd.pattern_width like "%#{processId}%" |
| | | and rgsd.pattern_height like "%#{pattern_height}%" |
| | | and rgsd.pattern_thickness like "%#{pattern_thickness}%" |
| | | and rgsd.films_id like "%#{films_id}%" |
| | | pattern_height, |
| | | pattern_thickness, |
| | | films_id, |
| | | sum(case when state = 100 then remain_quantity else 0 end) as count |
| | | from raw_glass_storage_details |
| | | group by pattern_width, pattern_height, pattern_thickness, films_id) as rgsd |
| | | left JOIN load_glass_device_task_history as lgdth |
| | | on rgsd.pattern_width = lgdth.raw_glass_width |
| | | and rgsd.pattern_height = lgdth.raw_glass_height |
| | | and rgsd.pattern_thickness = lgdth.raw_glass_thickness |
| | | and rgsd.films_id = lgdth.raw_glass_films_id |
| | | <where> |
| | | 1=1 |
| | | <if test="width != null and width != ''"> |
| | | and rgsd.pattern_width like concat('%', #{width}, '%') |
| | | </if> |
| | | <if test="height != null and height != ''"> |
| | | and rgsd.pattern_height like concat('%', #{height}, '%') |
| | | </if> |
| | | <if test="thickness != null and thickness != ''"> |
| | | and rgsd.pattern_thickness like concat('%', #{thickness}, '%') |
| | | </if> |
| | | <if test="films != null and films != ''"> |
| | | and rgsd.films_id like concat('%', #{films}, '%') |
| | | </if> |
| | | </where> |
| | | group by rgsd.pattern_width, rgsd.pattern_height, rgsd.pattern_thickness, rgsd.films_id |
| | | </select> |
| | | </mapper> |