<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="工艺评审主表">
	<query id="JdgCraftOrdDesign.getOrdLnInfo" desc="获取合同行信息">
		<![CDATA[
SELECT A.*
  FROM SLM_ORDER_LINE A, CRAFT_ORD_DESIGN B
 WHERE B.ORD_LN_PK = A.ORD_LN_PK
   AND B.DESGIN_KEY = {0}
		]]>
	</query>
	<query id="JdgCraftOrdDesign.queryCraftNoByOrdLnPk" desc="查询工艺DesignKey">
		<![CDATA[
SELECT B.CRAFT_NO, B.CRAFT_PATH
  FROM CRAFT_ORD_DESIGN B
 WHERE B.ORD_LN_PK = {0}
   AND B.CRAFT_SEQ = {1}
 GROUP BY B.CRAFT_NO, B.CRAFT_PATH
		]]>
	</query>
	<query id="JdgCraftOrdDesign.queryCreateTimeByOrdLnPk" desc="查询工艺DesignKey">
		<![CDATA[
 SELECT TO_CHAR(B.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME
   FROM CRAFT_ORD_DESIGN B
  WHERE B.ORD_LN_PK = {0}
    AND B.CRAFT_SEQ = (SELECT MIN(A.CRAFT_SEQ)
                         FROM CRAFT_ORD_DESIGN A
                        WHERE A.ORD_LN_PK = B.ORD_LN_PK)
		]]>
	</query>
	<query id="JdgCraftOrdDesign.queryOrderNoByOrdLnPk" desc="查询工艺DesignKey">
		<![CDATA[
SELECT C.ORDER_NO || '/' || B.ORDER_SEQ ORDER_NO
  FROM SLM_ORDER_LINE B,
       SLM_ORDER_HEAD C
 WHERE B.ORD_LN_PK = {0}
   AND C.ORD_PK = B.ORD_PK
 GROUP BY (C.ORDER_NO || '/' || B.ORDER_SEQ)
		]]>
	</query>
	
	<query id="JdgCraftOrdDesign.getNewByOrdLnPk" desc="通过合同行查询最新生效的工艺">
		<![CDATA[
SELECT T.DESGIN_KEY, T.CRAFT_SEQ, T.CRAFT_NO
  FROM CRAFT_ORD_DESIGN T
 WHERE T.ORD_LN_PK = {0}
   AND T.VALIDFLAG = '1'
		]]>
	</query>

	<query id="JdgCraftOrdDesign.getCraftInfo" desc="通过交货行行查询工艺">
		<![CDATA[
			SELECT T.DESGIN_KEY, T.CRAFT_SEQ, T.CRAFT_NO
				FROM CRAFT_ORD_DESIGN T
			WHERE T.ORD_LN_PK = (SELECT T.ORD_LN_PK FROM PLN_SALEORD T WHERE T.ORD_LN_DLY_PK = {0})
		]]>
	</query>
</queryMap>