<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="工序信息">

	<query id="PreGxInfo.getGxInfoB" desc="查询工序信息">
             <![CDATA[
          SELECT '铸造' PROCESS_CODE,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_NAME,
       TO_CHAR(T.PLAN_TIME_B, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_E
  FROM PLN_ORDER_CAST_S T
 WHERE T.PRO_PLAN_ID = ?
 ORDER BY TO_NUMBER(T.GX_PLAN_NO)
                 ]]>
	</query>

	<query id="PreGxInfo.getGxInfoC" desc="查询工序信息">
             <![CDATA[
          SELECT '锻造' PROCESS_CODE,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_NAME,
       TO_CHAR(T.PLAN_TIME_B, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_E
  FROM PLN_ORDER_DZ_S T
 WHERE T.PRO_PLAN_ID = ?
 ORDER BY TO_NUMBER(T.GX_PLAN_NO)
          
                 ]]>
	</query>

	<query id="PreGxInfo.getGxInfoD" desc="查询工序信息">
             <![CDATA[
SELECT '轧制' PROCESS_NAME,
       T.WEIGTH_S,
       T.NUM_S,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_NAME,
       '' PREVIOUS_GX,
       '' PREV_GXPLAN_ID,
       T1.NEXT_GX,
       (CASE T1.NEXT_GX
         WHEN 'E' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_DBK T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         WHEN 'F' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_RCL T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         WHEN 'G' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_JGX T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         ELSE
         (SELECT MIN(T2.PRO_PLAN_ID)
             FROM PLN_GX_JG_PROP_S T2
            WHERE T2.PLN_DIVIDE_ID = T1.PLN_DIVIDE_ID
            AND T2.ORD_LN_DLY_PK=T1.ORD_LN_DLY_PK)
       END) NEXT_PRO_PLAN_ID,
       TO_CHAR(T.PLAN_TIME_B, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_E
  FROM PLN_ORDER_ZG_S T, PLN_ORDER_ZG T1
 WHERE T1.PRO_PLAN_ID = T.PRO_PLAN_ID
                 ]]>
	</query>

	<query id="PreGxInfo.getGxInfoE" desc="查询工序信息">
             <![CDATA[
SELECT '镦拔扩' PROCESS_NAME,
       T.WEIGTH_S,
       T.NUM_S,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_NAME,
       DECODE(T.PREVIOUS_GX, '轧制', 'D', '镦拔扩', 'E', '热处理', 'F', '') PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T1.NEXT_GX,
       (CASE T1.NEXT_GX
         WHEN 'E' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_DBK T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         WHEN 'F' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_RCL T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         WHEN 'G' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_JGX T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         ELSE
         (SELECT MIN(T2.PRO_PLAN_ID)
             FROM PLN_GX_JG_PROP_S T2
            WHERE T2.PLN_DIVIDE_ID = T1.PLN_DIVIDE_ID
            AND T2.ORD_LN_DLY_PK=T1.ORD_LN_DLY_PK)
       END) NEXT_PRO_PLAN_ID,
       TO_CHAR(T.PLAN_TIME_B, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_E
  FROM PLN_ORDER_DBK_S t, Pln_Order_DBK T1
 WHERE t1.PRO_PLAN_ID = t.PRO_PLAN_ID

                 ]]>
	</query>

	<query id="PreGxInfo.getGxInfoF" desc="查询工序信息">
             <![CDATA[
SELECT '热处理' PROCESS_NAME,
       T.WEIGTH_S,
       T.NUM_S,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_NAME,
       DECODE(T.PREVIOUS_GX, '轧制', 'D', '镦拔扩', 'E', '热处理', 'F', '') PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T1.NEXT_GX,
       (CASE T1.NEXT_GX
         WHEN 'E' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_DBK T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         WHEN 'F' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_RCL T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         WHEN 'G' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_JGX T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         ELSE
         (SELECT MIN(T2.PRO_PLAN_ID)
             FROM PLN_GX_JG_PROP_S T2
            WHERE T2.PLN_DIVIDE_ID = T1.PLN_DIVIDE_ID
            AND T2.ORD_LN_DLY_PK=T1.ORD_LN_DLY_PK)
       END) NEXT_PRO_PLAN_ID,
       TO_CHAR(T.PLAN_TIME_B, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_E
  FROM PLN_ORDER_RCL_S t, Pln_Order_Rcl T1
 WHERE t1.PRO_PLAN_ID = t.PRO_PLAN_ID
                 ]]>
	</query>

	<query id="PreGxInfo.getGxInfoG" desc="查询工序信息">
             <![CDATA[
SELECT '加工' PROCESS_NAME,
       T.WEIGTH_S,
       T.NUM_S,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_NAME,
       DECODE(T.PREVIOUS_GX, '轧制', 'D', '镦拔扩', 'E', '热处理', 'F', '') PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T1.NEXT_GX,
       (CASE T1.NEXT_GX
         WHEN 'E' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_DBK T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         WHEN 'F' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_RCL T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         WHEN 'G' THEN
          (SELECT T2.PRO_PLAN_ID
             FROM PLN_ORDER_JGX T2
            WHERE T2.PLAN_GROUP_ID = T1.PLAN_GROUP_ID)
         ELSE
          (SELECT MIN(T2.PRO_PLAN_ID)
             FROM PLN_GX_JG_PROP_S T2
            WHERE T2.PLN_DIVIDE_ID = T1.PLN_DIVIDE_ID
            AND T2.ORD_LN_DLY_PK=T1.ORD_LN_DLY_PK)
       END) NEXT_PRO_PLAN_ID,
       TO_CHAR(T.PLAN_TIME_B, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_E
  FROM PLN_ORDER_JGX_S t, Pln_Order_JGX T1
 WHERE t1.PRO_PLAN_ID = t.PRO_PLAN_ID
                 ]]>
	</query>

<query id="PreGxInfo.getGxInfoH" desc="查询工序信息">
             <![CDATA[
SELECT '接箍' PROCESS_NAME,
       T.GROUP_BL_WT_S WEIGTH_S,
       T.GROUP_BL_NUM_S NUM_S,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_NAME,     
       TO_CHAR(T.PLAN_TIME_B, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'yyyy-mm-dd hh24:mm:ss') PLAN_TIME_E
  FROM PLN_GX_JG_PROP_S t
 WHERE 1 = 1
                 ]]>
	</query>
</queryMap>