<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="工艺评审标准表">
	<query id="JdgCraftOrdDesignStd.getProductCnt" desc="获取成品成分套数">
		<![CDATA[
SELECT NVL(DECODE(T.PRODUCT_CNT_N, NULL, T.PRODUCT_CNT, T.PRODUCT_CNT_N), 1) PRODUCT_CNT_N,
       NVL(DECODE(T.RATE_N, NULL, T.RATE, T.RATE_N), '408603') RATE_N,
       NVL(DECODE(T.RATE_N, NULL, T3.BASENAME, T2.BASENAME), '炉') DESC_RATE_N,
       '0' TYPE
  FROM CRAFT_ORD_DESIGN_STD T
  LEFT JOIN COM_BASE_INFO T2
    ON T.RATE_N = T2.BASECODE
  LEFT JOIN COM_BASE_INFO T3
    ON T.RATE = T3.BASECODE, CRAFT_ORD_DESIGN C
 WHERE C.ORD_LN_PK = {0}
   AND C.CRAFT_SEQ = {1}
   AND T.DESGIN_KEY = C.DESGIN_KEY
   AND ({2} IS NULL OR {2} = '0')
UNION ALL
SELECT T.PRODUCT_CNT_FD, T.RATE_FD, T2.BASENAME DESC_RATE_FD, '1'
  FROM CRAFT_ORD_FD_CIC_COUNT T
  LEFT JOIN COM_BASE_INFO T2
    ON T.RATE_FD = T2.BASECODE
 WHERE T.ORD_LN_PK = {0}
   AND ({2} IS NULL OR {2} = '1')
		]]>
	</query>
</queryMap>