<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="规格管理">
	<query id="ISpecManageDao.getRollSpec" desc="规格管理 查询轧管规格">  
             <![CDATA[ 
           SELECT PLINE_CODE,
               PLINE_NAME,
               INDEX_SEQ,
               GRADECODE,
               GRADENAME,
               MIN_D,
               MIN_H,
               MAX_D,
               MAX_H
          FROM COM_MSC_ROLL_R_UPSET A
         WHERE A.PLINE_CODE = ?
           AND TO_NUMBER(A.MAX_D) = TO_NUMBER(?)
           AND TO_NUMBER(A.MAX_H) = TO_NUMBER(?)
           AND A.VALIDFLAG = 1
                     ]]>
	</query>

	<query id="ISpecManageDao.saveRollSpec" desc="保存轧管规格">
         <![CDATA[
        INSERT INTO SLM_ORD_DESIGN_MSC_GZ_GG(
        DESGIN_KEY,
        MSC_PLINE,
        GRADECODE,
        GRADENAME,
        SPEC_CODE,
        SPEC_NAME,
        DIMATER,
        HEIGHT)
 VALUES( 
        '#DESGIN_KEY#',
        '#MSC_PLINE#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#DIMATER#',
        '#HEIGHT#')
         ]]>
	</query>

	<query id="ISpecManageDao.getBiltSpec" desc="查询锻造规格">
         <![CDATA[
  SELECT DISTINCT SPEC_CODE, SPEC_NAME
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE IN
       (SELECT Q.PLINE_CODE
          FROM COM_BASE_PLINE Q
         WHERE Q.PROCESS_CODE = 'D'
           and instr(q.pline_name,'外购')=0)
   AND TO_NUMBER(T.MIN_D) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_D) >= TO_NUMBER(?)
   AND TO_NUMBER(T.MIN_H) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_H) >= TO_NUMBER(?)
   AND T.VALIDFLAG = 1
   and SPEC_CODE is not null
         ]]>
	</query>

	<query id="ISpecManageDao.getBiltSpecOut" desc="查询锻造规格(外购)">
         <![CDATA[
 SELECT DISTINCT SPEC_CODE, SPEC_NAME
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE IN
       (SELECT Q.PLINE_CODE
          FROM COM_BASE_PLINE Q
         WHERE Q.PROCESS_CODE = 'D'
           and instr(q.pline_name,'外购')>0)
   AND TO_NUMBER(T.MIN_D) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_D) >= TO_NUMBER(?)
   AND TO_NUMBER(T.MIN_H) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_H) >= TO_NUMBER(?)
   AND T.VALIDFLAG = 1
         ]]>
	</query>

	<query id="ISpecManageDao.saveBiltSpec" desc="保存轧管坯料断面">
         <![CDATA[
       INSERT INTO SLM_ORD_DESIGN_MSC_BILT(
        DESGIN_KEY,
        MSC_PLINE,
        SPEC_CODE,
        B_SPEC_CODE,
        B_SPEC_NAME)
 VALUES( 
        '#DESGIN_KEY#',
        '#MSC_PLINE#',
        '#SPEC_CODE#',
        '#B_SPEC_CODE#',
        '#B_SPEC_NAME#')
         ]]>
	</query>

	<query id="ISpecManageDao.getBiltCSpecA" desc="查询铸造连铸坯规格">
         <![CDATA[
    SELECT ID_,
       SPEC_CODE_FORG,
       SPEC_NAME_FORG,
       SPEC_CODE_INGOT,
       SPEC_NAME_INGOT,
       SPEC_CODE,
       SPEC_NAME
  FROM COM_MSC_CAST_R_FORG A
 WHERE A.SPEC_CODE_FORG = ?
   and TRIM(a.SPEC_CODE_INGOT) IS NULL
   AND A.VALIDFLAG = 1
         ]]>
	</query>

	<query id="ISpecManageDao.getBiltCSpecB" desc="查询铸造钢锭规格">
         <![CDATA[
      SELECT ID_,
       SPEC_CODE_FORG,
       SPEC_NAME_FORG,
       SPEC_CODE_INGOT,
       SPEC_NAME_INGOT,
       SPEC_CODE,
       SPEC_NAME
  FROM COM_MSC_CAST_R_FORG A
 WHERE A.SPEC_CODE_FORG = ?
   AND TRIM(A.SPEC_CODE) IS NULL
   AND A.VALIDFLAG = 1
         ]]>
	</query>

	<query id="ISpecManageDao.saveBiltCSpec" desc="保存铸造坯料规格">
         <![CDATA[
         INSERT INTO SLM_ORD_DESIGN_MSC_BILT_C(
        DESGIN_KEY,
        MSC_PLINE,
        SPEC_CODE,
        B_SPEC_CODE,
        C_SPEC_CODE,
        C_SPEC_NAME,
        SPEC_CODE_S)
 VALUES( 
        '#DESGIN_KEY#',
        '#MSC_PLINE#',
        '#SPEC_CODE#',
        '#B_SPEC_CODE#',
        '#C_SPEC_CODE#',
        '#C_SPEC_NAME#',
        '#SPEC_CODE_S#')
         ]]>
	</query>

	<query id="ISpecManageDao.getBaseSpec" desc="查询基础规格根据外径、壁厚">
         <![CDATA[
   SELECT SPEC_CODE, SPEC_NAME, DIMATER, HEIGHT, WEIGHT, MSC_STYLE
  FROM COM_BASE_SPEC T
  WHERE TO_NUMBER(T.DIMATER) = TO_NUMBER(?)
    AND TO_NUMBER(T.HEIGHT) = TO_NUMBER(?)
    AND T.MSC_STYLE='A'
    AND T.VALIDFLAG = 1
         ]]>
	</query>

</queryMap>