<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="工艺评审工序表">
	<query id="JdgCraftOrdDesignMscPlPrc.getPhyProcessByOrdLnPk" desc="通过交货行PK查询包含理化的工序">
		<![CDATA[
SELECT C.PROCESS_CODE, C.PROCESS_DESC, B.DESGIN_KEY
          FROM CRAFT_ORD_DESIGN B, CRAFT_ORD_DESIGN_MSC_PL_PRC C
         WHERE B.ORD_LN_PK = {0}
           AND B.CRAFT_SEQ = {1}
           AND C.DESGIN_KEY = B.DESGIN_KEY
           AND C.DESGIN_KEY IS NOT NULL
           AND B.DESGIN_KEY IS NOT NULL
           AND C.MSC_PLINE = {2}
           AND EXISTS
         (SELECT 1
                  FROM CRAFT_ORD_DESIGN_MSC_PL_STI E
                 WHERE E.DESGIN_KEY = B.DESGIN_KEY
                   AND E.MSC_PLINE = C.MSC_PLINE
                   AND E.PROCESS_CODE = C.PROCESS_CODE
                   AND E.STATION_TYPE IN ('403201', '403202'))
 ORDER BY PROCESS_CODE
		]]>
	</query>

	<query id="JdgCraftOrdDesignMscPlPrc.getProcessByOrdLnPk" desc="通过交货行PK查询包含理化的工序">
		<![CDATA[
SELECT C.PROCESS_CODE, C.PROCESS_DESC
          FROM CRAFT_ORD_DESIGN B, CRAFT_ORD_DESIGN_MSC_PL_PRC C
         WHERE B.ORD_LN_PK = {0}
           AND B.CRAFT_SEQ = {1}
           AND C.DESGIN_KEY = B.DESGIN_KEY
           AND C.DESGIN_KEY IS NOT NULL
           AND B.DESGIN_KEY IS NOT NULL
           AND C.MSC_PLINE = {2}
 ORDER BY PROCESS_CODE
		]]>
	</query>
	
	<query id="JdgCraftOrdDesignMscPlPrc.getEndProcessByOrdLnPk" desc="通过交货行PK查询末工序">
		<![CDATA[
SELECT C.PROCESS_CODE
   FROM CRAFT_ORD_DESIGN B, CRAFT_ORD_DESIGN_MSC_PL_PRC C
  WHERE B.ORD_LN_PK = {0}
    AND B.CRAFT_SEQ = {1}
    AND C.DESGIN_KEY = B.DESGIN_KEY
    AND C.MSC_PLINE = {2}
  ORDER BY C.PROCESS_CODE DESC
		]]>
	</query>
</queryMap>