<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="">
	<query id="ScrapHelper.QueryBatchNoInPortHtt" desc="查询热处理管号队列的批号">
		<![CDATA[
         SELECT DISTINCT PHY_BATCH_NO
  FROM PORT_HTT_BATCH_SAMPLE_RESULT
 WHERE HEAT_PLAN_NO =?
  AND PROCESS_SEQ =?
	  ]]>
	</query>

	<query id="ScrapHelper.QueryBatchHttPort" desc="查询热处理管号队列的批号">
		<![CDATA[
       SELECT T.HEAT_PLAN_NO,
       T.MAT_NO,
       T.M_MAT_NO,
       T.M_M_MAT_NO,
       T.LOT_NO,
       T.LOT_NO_SQE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.GROUP_NO,
       T.STOVE_NO,
       T.FLAG_STOVE_NO,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       T.ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       T.ACT_COUNT,
       T.ACT_WEIGHT,
       T.ACT_THEORY_WEIGHT,
       DECODE(T.IS_SAMPLE_PIPE, '0', '否', '1', '是') IS_SAMPLE_PIPE,
       T.SAMPLE_PIPE_LEN,
       T.GET_SAMPLE_SHIFT,
       T.GET_SAMPLE_CLASS,
       T.GET_SAMPLE_NAME,
       TO_CHAR(T.GET_SAMPLE_TIME, 'YYYY-MM-DD HH24:MI:SS') GET_SAMPLE_TIME,
       T.OLD_JUDGE_STOVE_NO,
       DECODE(T.GROUP_FLAG, '0', '未组炉', '1', '组炉') GROUP_FLAG,
       (SELECT T1.BASENAME
          FROM COM_BASE_INFO T1
         WHERE T1.BASECODE = T.OP_PROCESS
           AND T1.VALIDFLAG = '1') OP_PROCESS,
        T.OP_PROCESS OP_PROCESS_CODE,
       DECODE(T.MAT_STATUS, '00', '合格', '10', '剔除', '20', '待处理','30','另组炉','40','委外废品') MAT_STATUS,
       DECODE(T.LEVE_LOG, '00', '无', '10', '离线', '20', '返线') LEVE_LOG,
       DECODE(T.INSTORE_FLAG, '0', '未入库', '1', '已入库') INSTORE_FLAG,
       T.PRO_USER,
       DECODE(T.PRO_SHIFT, 1, '早', 2, '中', 3, '夜', 0, '常白') PRO_SHIFT,
       DECODE(T.PRO_GROUP, 1, '甲', 2, '乙', 3, '丙', 4, '丁') PRO_GROUP,
       TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
       T.REMARK,
      T.PRC_TECHNOLOGY_PATH,
      NVL(T.PROCESS_SEQ,1) PROCESS_SEQ,
      T.PHY_BATCH_NO
  FROM PORT_HTT_BATCH_SAMPLE_RESULT T
 WHERE HEAT_PLAN_NO =?
  AND PROCESS_SEQ =?
  AND PHY_BATCH_NO = ?
  ORDER BY MAT_NO
	  ]]>
	</query>


	<query id="ScrapHelper.QueryLoadHttPort" desc="查询热处理管号队列的批号">
		<![CDATA[
       SELECT T.MAT_NO,
              T.ACT_LEN,
              NVL(T.PONDER_GROSS_WT, T.ACT_WEIGHT) ACT_WEIGHT,
              '合格' MAT_STATUS,
              '未入库' INSTORE_FLAG
         FROM MAT_BC_M T, YDM_BC_BUTTRESS B
        WHERE T.MAT_NO = B.MAT_NO
          AND T.PRODUCT_FLAG = '801401'
          AND T.MAT_STATUS = '80150103'
          AND T.NEXT_PROCESS_CDOE = 'F'
          AND (T.JUDGE_STOVE_NO, NVL(T.BATCH_NO, '/'),
               NVL(T.BATCH_GROUD_NO, '/'),T.HEAT_PLAN_NO_NEXT, NVL(T.JUGDE_APPLY_CODE,'/')) IN
              (SELECT DECODE(M.REAL_PROCESS_SEQ,
                             1,
                             M.FEED_HEAT_NO,
                             M.JUDGE_STOVE_NO),
                      DECODE(M.REAL_PROCESS_SEQ,
                             1,
                             NVL(?, '/'),
                             (SELECT NVL(CHECK_NO_SHORT, '')
                                FROM COM_BASE_PLINE
                               WHERE PLINE_CODE = M.PLINE_CODE) || '000'),
                      DECODE(M.REAL_PROCESS_SEQ,
                             1,
                             ?,
                             NVL(T.BATCH_GROUD_NO, '/')),
                             HEAT_PLAN_NO,
                             NVL(?,'/')
                 FROM PLN_ZY_RCL_M M
                WHERE HEAT_PLAN_NO = ?)
        ORDER BY T.MAT_NO ASC
	  ]]>
	</query>

</queryMap>