<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="钢种">
	<query id="IGradeDao.getGrade" desc="查询钢种">  
             <![CDATA[ 
             SELECT A.MSC,
                    A.MSC_PLINE,
                    A.GRADECODE,
                    A.GRADENAME,
                    B.WHOLE_BACKLOG,
                    B.WHOLE_BACKLOG_DESC,
                    C.ASSORTMENT_CODE,
                    C.ASSORTMENT_NAME,
                    C.ALLOW_BUY
               FROM COM_MSC_GRADE A, COM_MSC_BACKLOG B, COM_BASE_GRADE C
              WHERE A.MSC = B.MSC
                AND A.MSC_PLINE = B.MSC_PLINE
                AND A.GRADECODE = C.GRADECODE
                AND A.VALIDFLAG = '1'
                AND B.VALIDFLAG != '0'
                AND A.MSC = ?
                AND A.MSC_PLINE = ?
                     ]]>
	</query>
	
	<query id="IGradeDao.getBlSlmGrade" desc="查询钢种">  
       <![CDATA[ 
SELECT B.MSC,
       B.MSC_PLINE,
       T2.GRADECODE,
       T2.GRADENAME,
       B.WHOLE_BACKLOG,
       B.WHOLE_BACKLOG_DESC,
       T2.ASSORTMENT_CODE,
       T2.ASSORTMENT_NAME,
       C.ALLOW_BUY
  FROM (SELECT T.GRADECODE,
               MIN(T.GRADENAME) GRADENAME,
               MIN(T.ASSORTMENT_CODE) ASSORTMENT_CODE,
               MIN(T.ASSORTMENT_NAME) ASSORTMENT_NAME
          FROM SLM_ORD_DESIGN_MSC_PL_GZ T, SLM_ORD_DESIGN_MSC_JG_BL A
         WHERE A.DESGIN_KEY = ?
           AND T.DESGIN_KEY = A.DESGIN_KEY_BL
         GROUP BY T.GRADECODE) T2,
       COM_MSC_BACKLOG B,
       COM_BASE_GRADE C
 WHERE B.MSC = ?
   AND B.MSC_PLINE = ?
   AND C.GRADECODE = T2.GRADECODE
      ]]>
	</query>

	<query id="IGradeDao.saveGrade" desc="保存质量设计钢种">  
             <![CDATA[ 
             INSERT INTO SLM_ORD_DESIGN_MSC_PL_GZ
                        (DESGIN_KEY,
                         MSC_PLINE,
                         WHOLE_BACKLOG,
                         WHOLE_BACKLOG_DESC,
                         GRADECODE,
                         GRADENAME,
                         ASSORTMENT_CODE,
                         ASSORTMENT_NAME)
                 VALUES
                        (?, ?, ?, ?, ?, ?, ?, ?)    
                     ]]>
	</query>

	<query id="IGradeDao.getGradeAndSpec" desc="查询钢种与规格关系">  
             <![CDATA[ 
          SELECT MSC,
                 MSC_PLINE,
                 GRADECODE,
                 GRADENAME,
                 HEIGHT_MIN,
                 DIMATER_MIN,
                 DIMATER_MAX,
                 HEIGHT_MIAX
            FROM COM_MSC_GRADE_R_SPEC T
           WHERE T.MSC = ?
             AND T.MSC_PLINE = ?
             AND T.GRADECODE = ?
             AND T.VALIDFLAG = 1
                     ]]>
	</query>



</queryMap>