<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "穿孔">
<query id = "FrmPerforationReport.doQueryData" desc = "查询">
<![CDATA[
SELECT T2.LOT_NO,
       REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '') JUDGE_STOVE_NO,
       (SELECT B.PLINE_NAME
          FROM COM_BASE_PLINE B
         WHERE B.PLINE_CODE = T.PLINE_CODE) PLINE_CODE,
       T1.STEELNAME,
       T1.GRADENAME,
       T.CAPILLARY_SIZE AS SPECIFIED_SIZE,
       T.AMOUNT_OF_BORAX,
       T.BORAX_PRESSURE,
       T.HEAD_DIAMETER,
       T.DP_GG,
       T.ZG_ZJ,
       T.BITE_ANGLE,
       T.ZG_LOCA_UP,
       T.ZG_LOCA_DOWN,
       T.DB_LOCA,
       T.ROLL_MOTOR_SJB,
       T.ROLL_MOTOR_SPEED,
       
       T.ROLLER_SPACE,
       T.GUIDE_SPACE,
       T.FRONT_EXTENDING_QUANTITY,
       T.KZ_TEMP,
       T.GUIDE_DISC_MOTOR_LOCA,
       T.DT_CODE,
       COUNT(T2.STATUS) PERFORATION_NUM,
       CASE
         WHEN T2.STATUS = '1' THEN
          COUNT(T2.STATUS)
         ELSE
          0
       END SCRAP_NUM,
       T2.SCRAP_REASON,
       TO_CHAR(T2.END_PERFORATION_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       DECODE(T2.COL_SHIFT, '1', '早班', '2', '中班', '3', '夜班','0', '常白班') COL_SHIFT,
       DECODE(T2.COL_GROUP, '1', '甲', '2', '乙', '3', '丙', '4', '丁') COL_GROUP,
       T2.COL_USER,
       T.REMARK
  FROM MIL_PERFORATION_RACK T2
  LEFT JOIN MIL_PERFORATION_RESULT T
    ON T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
  LEFT JOIN MIL_PLAN T1
    ON T2.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO
 WHERE 1 = 1
   AND T2.END_PERFORATION_TIME >= to_date(?, 'yyyy-MM-dd HH24:mi:ss')
   AND T2.END_PERFORATION_TIME <= to_date(?, 'yyyy-MM-dd HH24:mi:ss')
   AND T2.COL_SHIFT || '&' LIKE ('%' || ? || '%')
   AND T2.COL_GROUP || '&' LIKE ('%' || ? || '%')
   AND T2.JUDGE_STOVE_NO  || '&' LIKE ('%' || ? || '%')

]]>
</query>
</queryMap>