<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="锻造炉计划">

	<query id="FrmPlanStoveC.queryPlanStoveC" desc="查询锻造炉计划">
            <![CDATA[
        SELECT T.HEAT_PLAN_NO,
       T.GX_PRO_SEQ,
       T.ZY_BATCH_ID,
       CASE
         WHEN T.STOVE_NO IS NULL THEN
          (SELECT O.STOVE_NO
             FROM PLN_STEELFOR_ORD O
            WHERE O.FURNACENO || '/' || O.SEQUENCENO = T.UPPER_HEATPLAN_ID)
         ELSE
          T.STOVE_NO
       END STOVE_NO,
       CASE
         WHEN T.JUDGE_STOVE_NO IS NULL THEN
          (SELECT O.JUDGE_STOVE_NO
             FROM PLN_STEELFOR_ORD O
            WHERE O.FURNACENO || '/' || O.SEQUENCENO = T.UPPER_HEATPLAN_ID)
         ELSE
          T.JUDGE_STOVE_NO
       END JUDGE_STOVE_NO,
       CASE
         WHEN T.FLAG_STOVE_NO IS NULL THEN
          (SELECT O.FLAG_STOVE_NO
             FROM PLN_STEELFOR_ORD O
            WHERE O.FURNACENO || '/' || O.SEQUENCENO = T.UPPER_HEATPLAN_ID)
         ELSE
          T.FLAG_STOVE_NO
       END FLAG_STOVE_NO,
       T.UPPER_HEATPLAN_ID,
       DECODE(T.PLANSTATUS,
              '00',
              '计划',
              '10',
              '下发',
              '20',
              '生产中',
              '30',
              '生成完成',
              '40',
              '关闭') PLANSTATUS,
       T.UPPER_PROCESS_CODE,
       T.NEXT_PROCESS_CODE,
       DECODE(T.ISENDGX, '0', '/', '1', '是') ISENDGX,
       DECODE(T.IF_MATCH_ODD, '0', '正常', '2', '利库') IF_MATCH_ODD,
       DECODE(T.IF_DO_HEAT_PLAN, '0', '/', '1', '是') IF_DO_HEAT_PLAN,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.CCM_PRO_PLAN_ID,
       T.CCM_GX_PLAN_NO,
       T.GOWHERE_CODE,
       T.GOWHERE_NAME,
       T.PLINE_CODE,
       T.PLINE_NAME,
       DECODE(T.CASTINGTYPE, '1', '连铸', '2', '模铸') CASTINGTYPE,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.WLID_IN,
       T.WLDESC_IN,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.PLN_INSINGLE_NUM,
       T.PLN_INSINGLE_WT,
       T.CUT_NUM_GP,
       T.PLN_INDOUBLE_NUM,
       T.PLN_INDOUBLE_WT,
       T.DIAMETER_OUT,
       T.LENGTH_OUT,
       T.OUT_WT_ONE,
       T.PLN_OUTSINGLE_NUM,
       T.PLN_OUTSINGLE_W,
       T.CUT_NUM_OUT,
       T.PLN_OUTDOUBLE_NUM,
       T.PLN_OUTDOUBLE_W,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.PRO_DAY,
       T.BAL_YEAR_MONTH,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DOWNMAN,
       TO_CHAR(T.DOWNTIME, 'YYYY-MM-DD HH24:MI:SS') DOWNTIME,
       DECODE(T.SUBCONTRACT_FLAG, '0', '/', '1', '是') SUBCONTRACT_FLAG,
       T.LEN_GP_SINGLE_OUT,
       T1.HEAT_PLAN_SQE,
       T1.DIAMETER,
       T1.LEN_GP_SINGLE,
       T1.WT_GP_SINGLE,
       T1.CUT_NUM_GP,
       T1.LENGTH_M,
       T1.WEIGHT_M,
       T1.PLAN_INDOUBLE_NUM,
       T1.PLAN_INDOUBLE_WT,
       T1.REAL_INDOUBLE_NUM,
       T1.REAL_INDOUBLE_WT
  FROM PLN_ZY_DZ_M T, PLN_ZY_DZ_C T1
 WHERE T.HEAT_PLAN_NO = T1.HEAT_PLAN_NO(+)
   AND T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO=?
 ORDER BY T.PLANSTATUS ASC, T.GX_PRO_SEQ ASC
              ]]>
	</query>
	<query id="FrmPlanStoveC.getPlanZyDzC" desc="查询锻造实际炉计划">
             <![CDATA[  
              SELECT 
       T.HEAT_PLAN_NO,
       T.HEAT_PLAN_SQE,
       T.JUGDE_APPLY_CODE,
       T.ZY_BATCH_ID,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.DIAMETER,
       T.LEN_GP_SINGLE,
       T.WT_GP_SINGLE,
       T.CUT_NUM_GP,
       T.LENGTH_M,
       T.WEIGHT_M,
       T.PLAN_INDOUBLE_NUM,
       T.PLAN_INDOUBLE_WT,
       T.REAL_INDOUBLE_NUM,
       T.REAL_INDOUBLE_WT,
       T.FLAG_STOVE_NO,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
 FROM PLN_ZY_DZ_C T
 WHERE T.HEAT_PLAN_NO = ?
              ]]>
	</query>
	<query id="FrmPlanStoveC.getPlanZyDzM" desc="查询锻造虚拟炉计划">
             <![CDATA[  
               SELECT 
       T.HEAT_PLAN_NO,
       T.GX_PRO_SEQ,
       T.ZY_BATCH_ID,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.FLAG_STOVE_NO,
       T.UPPER_HEATPLAN_ID,
       T.PLANSTATUS,
       T.NODE_ESTATUS,
       T.UPPER_PROCESS_CODE,
       T.NEXT_PROCESS_CODE,
       T.ISENDGX,
       T.IF_MATCH_ODD,
       T.IF_DO_HEAT_PLAN,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.CCM_PRO_PLAN_ID,
       T.CCM_GX_PLAN_NO,
       T.GOWHERE_CODE,
       T.GOWHERE_NAME,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.CASTINGTYPE,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.WLID_IN,
       T.WLDESC_IN,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.PROD_STANDARD,
       T.OUTPUT_STANDARD,
       T.DIAMETER_IN,
       T.LENGTH_IN,
       T.WT_ONE_IN,
       T.LEN_GP_SINGLE,
       T.WT_GP_SINGLE,
       T.PLN_INSINGLE_NUM,
       T.PLN_INSINGLE_WT,
       T.CUT_NUM_GP,
       T.PLN_INDOUBLE_NUM,
       T.PLN_INDOUBLE_WT,
       T.DIAMETER_OUT,
       T.LENGTH_OUT,
       T.OUT_WT_ONE,
       T.PLN_OUTSINGLE_NUM,
       T.PLN_OUTSINGLE_W,
       T.CUT_NUM_OUT,
       T.PLN_OUTDOUBLE_NUM,
       T.PLN_OUTDOUBLE_W,
       T.LEN_CUTHEAD,
       T.LEN_CUTEND,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.IF_EXPORT,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       T.PRO_MONTH,
       T.IF_MONITOR,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.BOM,
       T.INDEX_SEQ,
       T.WHOLE_BACKLOG,
       T.WHOLE_BACKLOG_DESC,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.SEC_CRAFT_FILE_NO,
       T.STATION_ROAD,
       T.PRO_DAY,
       T.BAL_YEAR_MONTH,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DOWNMAN,
       TO_CHAR(T.DOWNTIME, 'YYYY-MM-DD HH24:MI:SS') DOWNTIME,
       T.SUBCONTRACT_FLAG,
       T.LEN_GP_SINGLE_OUT
 FROM PLN_ZY_DZ_M T
 WHERE T.HEAT_PLAN_NO = ?
              ]]>
	</query>
	<query id="FrmPlanStoveC.QueryMatGpCx" desc="查询管坯物料状态撤销">
             <![CDATA[ 
SELECT *
  FROM (SELECT T.*
          FROM MAT_GP_M T
         WHERE T.MNG_LOCK_FLAG = '0'
           AND T.LOCK_FLAG = '0'
           AND T.HANGING_FLAG='1'
           AND T.OUTSOURCING_FLAG='0'
           AND T.JUDGE_STOVE_NO = ?
           AND T.ACT_LEN = ?
           AND T.FIX_LEN = ?
           AND T.FIX_NUM = ?
              ]]>
	</query>
		<query id="FrmPlanStoveC.getOrderZz" desc="查询锻造订单对应铸造订单">
             <![CDATA[          
SELECT T2.*
  FROM (SELECT T.PRO_PLAN_ID,
               T.GX_PLAN_NO,
               NVL(T.PLAN_WT_SOLD, '0') AS PLAN_WT_SOLD,
               NVL(T.PLAN_NUM_SOLD, '0') AS PLAN_NUM_SOLD
          FROM PLN_ORDER_CAST_S T
         WHERE T.PRO_PLAN_ID = ?) T2
 WHERE T2.PLAN_WT_SOLD > 0
 ORDER BY T2.PLAN_WT_SOLD ASC
               ]]>
	</query>
</queryMap>