<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="计划轧管表">
	<query id="JdgPlnOrderRclS.queryCraftNoByProPlanId" desc="查询工艺DesignKey">
		<![CDATA[
SELECT C.CRAFT_NO, C.CRAFT_PATH
  FROM PLN_ORDER_RCL_S A, PLN_SALEORD B, CRAFT_ORD_DESIGN C
 WHERE B.ORD_LN_DLY_PK = A.ORD_LN_DLY_PK
   AND B.ORD_LN_PK = C.ORD_LN_PK
   AND A.CRAFT_SEQ = C.CRAFT_SEQ
   AND A.PRO_PLAN_ID || A.GX_PLAN_NO IN {0}
 GROUP BY C.CRAFT_NO, C.CRAFT_PATH
		]]>
	</query>
	
	<query id="JdgPlnOrderRclS.queryOrderNoByProPlanId" desc="查询工艺DesignKey">
		<![CDATA[
SELECT A.ORDER_NO || '/' || A.ORDER_SEQ || '/' || A.DELIVERY_NO ORDER_NO
  FROM PLN_ORDER_RCL_S A
 WHERE A.PRO_PLAN_ID || A.GX_PLAN_NO IN {0}
 GROUP BY (A.ORDER_NO || '/' || A.ORDER_SEQ || '/' || A.DELIVERY_NO)
		]]>
	</query>
	
	<query id="JdgPlnOrderRclS.queryCraftCicByProPlanId" desc="查询轧管工艺成分信息">
		<![CDATA[
 SELECT MIN(DESGIN_KEY) DESGIN_KEY, MIN(MSC_PLINE) MSC_PLINE, CIC
   FROM (SELECT FIRST_VALUE(C.DESGIN_KEY) OVER(PARTITION BY A.CIC ORDER BY A.PRO_PLAN_ID) DESGIN_KEY,
                FIRST_VALUE(A.INDEX_SEQ) OVER(PARTITION BY A.CIC ORDER BY A.PRO_PLAN_ID) MSC_PLINE,
                A.CIC CIC
           FROM PLN_ZY_RCL_M A, PLN_SALEORD B, CRAFT_ORD_DESIGN C
          WHERE B.ORD_LN_DLY_PK = A.ORD_LN_DLY_PK
            AND B.ORD_LN_PK = C.ORD_LN_PK
            AND A.CRAFT_SEQ = C.CRAFT_SEQ
            AND A.PRO_PLAN_ID || A.GX_PLAN_NO IN {0}
            AND A.JUDGE_STOVE_NO = {1})
  GROUP BY CIC
		]]>
	</query>
	
	<query id="JdgPlnOrderRclS.queryCraftPicByProPlanId" desc="查询工艺DesignKey">
		<![CDATA[
 SELECT MIN(DESGIN_KEY) DESGIN_KEY, MIN(MSC_PLINE) MSC_PLINE, PIC
   FROM (SELECT FIRST_VALUE(C.DESGIN_KEY) OVER(PARTITION BY A.PIC ORDER BY A.PRO_PLAN_ID) DESGIN_KEY,
                FIRST_VALUE(A.INDEX_SEQ) OVER(PARTITION BY A.PIC ORDER BY A.PRO_PLAN_ID) MSC_PLINE,
                A.PIC PIC
           FROM PLN_ZY_RCL_M A, PLN_SALEORD B, CRAFT_ORD_DESIGN C
          WHERE B.ORD_LN_DLY_PK = A.ORD_LN_DLY_PK
            AND B.ORD_LN_PK = C.ORD_LN_PK
            AND A.CRAFT_SEQ = C.CRAFT_SEQ
            AND A.PRO_PLAN_ID || A.GX_PLAN_NO IN {0}
            AND A.JUDGE_STOVE_NO = {1})
  GROUP BY PIC
		]]>
	</query>
	
	<query id="JdgPlnOrderRclS.queryByPk" desc="通过主键查询">
		<![CDATA[
SELECT * FROM PLN_ORDER_RCL_S T WHERE T.PRO_PLAN_ID = {0} AND T.GX_PLAN_NO = {1}
		]]>
	</query>
</queryMap>