<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="钢种">
	<query id="GradeDao.getGrade" desc="查询钢种">  
             <![CDATA[ 
      SELECT T1.MSC,
       T1.MSC_PLINE,
       T1.GRADECODE,
       T1.GRADENAME,
       T1.MANAGE_CATEGORY,
       T1.PRIORITY,
       T2.WHOLE_BACKLOG,
       T2.WHOLE_BACKLOG_DESC,
       T3.ASSORTMENT_CODE,
       T3.ASSORTMENT_NAME,
       T3.ALLOW_BUY
  FROM COM_MSC_GRADE T1, COM_MSC_BACKLOG T2, COM_BASE_GRADE T3
 WHERE T1.MSC = T2.MSC
   AND T1.MSC_PLINE = T2.MSC_PLINE
   AND T1.GRADECODE = T3.GRADECODE
   AND T1.VALIDFLAG = '1'
   AND T2.VALIDFLAG != '0'
   AND T1.MSC = ?
   AND T1.MSC_PLINE = ?
                     ]]>
	</query>
	
	<query id="GradeDao.getBlCraftGrade" desc="查询钢种">  
       <![CDATA[ 
SELECT B.MSC,
       B.MSC_PLINE,
       T2.GRADECODE,
       T2.GRADENAME,
       T2.MANAGE_CATEGORY,
       T2.PRIORITY,
       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,
               MIN(T.MANAGE_CATEGORY) MANAGE_CATEGORY,
               MIN(T.PRIORITY) PRIORITY
          FROM CRAFT_ORD_DESIGN_MSC_PL_GZ T, CRAFT_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="GradeDao.saveGrade" desc="保存质量设计钢种">  
             <![CDATA[ 
             INSERT INTO CRAFT_ORD_DESIGN_MSC_PL_GZ
                        (DESGIN_KEY,
                         MSC_PLINE,
                         WHOLE_BACKLOG,
                         WHOLE_BACKLOG_DESC,
                         GRADECODE,
                         GRADENAME,
                         ASSORTMENT_CODE,
                         ASSORTMENT_NAME,
                         PRIORITY)
                 VALUES
                        (?, ?, ?, ?, ?, ?, ?, ?, ?)    
                     ]]>
	</query>

	<query id="GradeDao.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>