<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="炉号生成">

	<query id="StoveNoGenerate" desc="熔炼炉号生成">
             <![CDATA[
SELECT ? ||
       LPAD(NVL(MAX(TO_NUMBER(SUBSTR(A.STOVE_NO, LENGTH(A.STOVE_NO) - 3)) + 1),
                ?),
            4,
            '0') STOVE_NO
  FROM PLN_STEELFORFURNACE A
 WHERE STOVE_NO LIKE ? || '____'
	]]>
</query>

	<query id="JudgeStoveNoGenerate" desc="判定炉号生成">
		<![CDATA[
SELECT LPAD(NVL(MAX(TO_NUMBER(JUDGE_STOVE_NO) +1), ?),6,'0') JUDGE_STOVE_NO
	FROM (SELECT JUDGE_STOVE_NO FROM PLN_STEELFOR_ORD_LKJUDGESTOVE UNION ALL SELECT JUDGE_STOVE_NO FROM PLN_STEELFOR_ORD  WHERE JUDGE_STOVE_NO IS NOT NULL)
	WHERE TO_NUMBER(JUDGE_STOVE_NO) >= TO_NUMBER(?)
	AND TO_NUMBER(JUDGE_STOVE_NO) <= TO_NUMBER(?)
	]]>
	</query>


	<query id="SelectJudgeStoveByCast" desc="获取多定尺的判定炉号">
		<![CDATA[
             SELECT DISTINCT JUDGE_STOVE_NO
	FROM PLN_STEELFOR_ORD
	WHERE
	JUDGE_STOVE_NO LIKE TO_CHAR(SYSDATE,'yy') || '____'
	AND  FURNACENO IN
	(SELECT FURNACENO FROM PLN_STEELFORFURNACE WHERE CAST_NO IN @CAST )
	ORDER BY JUDGE_STOVE_NO
	]]>
	</query>

	<query id="SelectJudgeStoveByCasSeq" desc="获取多定尺的判定炉号">
		<![CDATA[
             SELECT DISTINCT JUDGE_STOVE_NO
	FROM PLN_STEELFOR_ORD
	WHERE
	JUDGE_STOVE_NO LIKE TO_CHAR(SYSDATE,'yy') || '____'
	AND  FURNACENO IN
	(SELECT FURNACENO FROM PLN_STEELFORFURNACE WHERE CAST_NO IN (SELECT CAST_NO FROM PLN_STEELFORCAST WHERE PLINE_CODE=? AND CAST_SEQ>=? ) )
	ORDER BY JUDGE_STOVE_NO
	]]>
	</query>

	<query id="SelectJudgeStoveByFurnaceNo" desc="获取多定尺的判定炉号">
		<![CDATA[
             SELECT DISTINCT JUDGE_STOVE_NO
	FROM PLN_STEELFOR_ORD
	WHERE
	JUDGE_STOVE_NO LIKE TO_CHAR(SYSDATE,'yy') || '____'
	AND  FURNACENO IN @FURNACENO
	ORDER BY JUDGE_STOVE_NO
	]]>
	</query>



	<query id="SelectStoveByCast" desc="查询j浇次熔炼炉号">
		<![CDATA[
                     SELECT DISTINCT STOVE_NO
    FROM PLN_STEELFORFURNACE
   WHERE STOVE_NO IS NOT NULL
         AND CAST_NO IN @CAST
         ORDER BY STOVE_NO
                            ]]>
	</query>

	<query id="SelectStoveByFurnaceNo" desc="查询j浇次熔炼炉号">
		<![CDATA[
                     SELECT DISTINCT STOVE_NO
    FROM PLN_STEELFORFURNACE
   WHERE STOVE_NO IS NOT NULL
         AND FURNACENO IN @FURNACENO
          ORDER BY STOVE_NO
                            ]]>
	</query>


</queryMap>