<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="炉计划公共类">

	<query id="StoveCommon.getMilPlanEntity" desc="查询炉计划接收表">
            <![CDATA[
              SELECT T.ID,
       T.SEQ,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.LOT_NO,
       T.CONTRACT_NO,
       T.IMP_PROCESS,
       T.PLINE_CODE,
       T.STATUS,
       T.PRODUCER,
       T.PROCESS_STATUS,
       T.DB_LENGTH,
       T.DB_HEIGHT,
       T.ROLL_LENGTH,
       T.SAW_NUM,
       T.TARGET_LENGTH,
       T.FINISH_USER,
       T.TARGET_LIABRARY,
       T.VARIETIES,
       T.PIPE_SIZE,
       T.BUCKLE_TYPE,
       T.LENGTH_RANGE,
       T.ROLL_STANDRAD,
       T.PIPE_SECTION,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.STEEL_STANDRAD,
       T.TARGET,
       T.BRANCH,
       T.TON,
       T.CUT_TARGET,
       T.CUT_LENGTH,
       T.CUT_WEIGHT,
       T.DB_NUM,
       TO_CHAR(T.START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(T.END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       TO_CHAR(T.TOM, 'YYYY-MM-DD HH24:MI:SS') TOM,
       TO_CHAR(T.TOC, 'YYYY-MM-DD HH24:MI:SS') TOC,
       T.NODE_STATUS,
       T.CUT_HEAD_LENGTHP,
       T.CUT_TRAIL_LENGTHP,
       T.CONTROL_THICKP,
       T.OFFLINE_FLAG,
       T.IS_BATCH,
       TO_CHAR(T.OFFLINE_DATE, 'YYYY-MM-DD HH24:MI:SS') OFFLINE_DATE,
       T.CUT_TYPE,
       T.ROLLING_STATUS,
       T.PRODUCE_STANDRAD,
       T.SIMPLE_PROCESS,
       T.BACK_LINE_FLAG,
       T.BACK_PLAN_FLAG,
       T.FEED_SEQ,
       TO_CHAR(T.FEED_TIME, 'YYYY-MM-DD HH24:MI:SS') FEED_TIME,
       T.LOT_SEQ,
       T.FEED_HEAT_NO,
       T.LENGTHCP,
       T.CUT_HEAD_LENGTHA,
       T.CUT_TRAIL_LENGTHA,
       T.ORDER_LENGTHA,
       T.HOT_CHECK_FLAG,
       T.BACK_SLAB_FLAG,
       TO_CHAR(T.BACK_SLAB_TIME, 'YYYY-MM-DD HH24:MI:SS') BACK_SLAB_TIME,
       T.BATCH_MAX,
       T.CODE_SAMPLE_FLAG,
       T.VARIETIES_CODE,
       T.PIPE_SIZE_CODE,
       T.BUCKLE_TYPE_CODE,
       T.ROLL_STANDRAD_CODE,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.CHECK_NO
  FROM MIL_PLAN T
 WHERE T.ID = ?
   AND T.JUDGE_STOVE_NO = ?
              ]]>
	</query>

	<query id="StoveCommon.getMilFeedsawResultEntity" desc="查询管坯锯切实绩表">
            <![CDATA[
             SELECT 
       T.RESULT_NO,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.PLINE_CODE,
       T.FEED_NUM,
       T.BEFORE_SCRAP_NUM,
       T.AFTER_SCRAP_NUM,
       T.CUT_NUM,
       T.CUT_TARGET,
       T.CUT_LENGTH,
       T.CUT_WEIGHT,
       TO_CHAR(T.START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(T.END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       T.EXECUTIVE_PRODUCER,
       TO_CHAR(T.PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       T.PRODUCER_TEL,
       T.NODE_FUR_FLAG,
       T.REMARK,
       T.COL_MODE,
       TO_CHAR(T.COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       T.COL_USER,
       T.COL_SHIFT,
       T.COL_GROUP,
       T.BEFORE_QUALIFIED_NUM,
       T.CUT_HEIGHT,
       T.CHANGE_NUM,
       T.QA_TON,
       T.USER_ID
 FROM MIL_FEEDSAW_RESULT T
 WHERE
T.RESULT_NO = ?
AND T.JUDGE_STOVE_NO=?            
              ]]>
	</query>

	<query id="StoveCommon.getPlnOrderZgSEntity" desc="查询轧管订单排产顺序耗时">
            <![CDATA[
            SELECT *
  FROM (SELECT T.*, ROWNUM AS ROW_NUM
          FROM PLN_ORDER_ZG_S T
         WHERE T.PLINE_CODE = ?
           AND T.ORDER_NO = ?
           AND T.ORDER_SEQ = ?
           AND T.EXE_STATUS IN ('0', '1')
         ORDER BY PLAN_TIME_B) T1
 WHERE T1.ROW_NUM = 1             
              ]]>
	</query>

	<query id="StoveCommon.addPlnZyZgMEntity" desc="新增轧管炉计划">
            <![CDATA[
                INSERT INTO PLN_ZY_ZG_M(
        HEAT_PLAN_NO,
        ZY_BATCH_ID,
        PROD_INDEX,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        GPREQ_ID,
        HEATNO_LAST,
        PLINE_CODE,
        PLINE_NAME,
        ISENDGX,
        ORDER_SOURCE,
        ORD_LN_DLY_PK,
        ORDER_NO,
        ORDER_SEQ,
        DELIVERY_NO,
        REQ_BL_ID,
        GRADECODE,
        GRADENAME,
        LEN_ROLL_MAX,
        LEN_ROLL_MIN,
        AIMOUTDIAMETER,
        AIMWALLTHICK,
        AIMLENGTH,
        DIAMETER_GP,
        LENGTH_GP,
        LEN_GP_SINGLE,
        ROLL_LENGTH,
        LEN_CUTHEAD,
        LEN_CUTEND,
        OUTNUM_CUT,
        DIAMETER_MANDREL,
        PASS_CODE,
        PASS_NAME,
        INWL_ID,
        INWL_DESC,
        CUT_SINGLE_WT,
        CUT_SINGLE_NUM,
        IF_WL_MATCHED,
        OUTWL_ID,
        OUTWL_DESC,
        OUT_WT,
        OUT_NUM,
        IF_MONITOR_ZG,
        PRDCR_NO,
        MONITOR_POINT,
        CRAFT_FILE_NO,
        CRAFT_FILE_MAN,
        CRAFT_SEQ,
        STATION_ROAD,
        PLANSTATUS,
        IN_WT_REAL,
        IN_NUM_REAL,
        OUT_WT_REAL,
        OUT_NUM_REAL,
        CREATE_NAME,
        CREATE_TIME,
        UPDATE_NAME,
        UPDATE_TIME,
        PLAN_GP_NUM,
        REAL_STOVE_NO)
 VALUES( 
        '#HEAT_PLAN_NO#',
        '#ZY_BATCH_ID#',
        '#PROD_INDEX#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#GPREQ_ID#',
        '#HEATNO_LAST#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#ISENDGX#',
        '#ORDER_SOURCE#',
        '#ORD_LN_DLY_PK#',
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#DELIVERY_NO#',
        '#REQ_BL_ID#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#LEN_ROLL_MAX#',
        '#LEN_ROLL_MIN#',
        '#AIMOUTDIAMETER#',
        '#AIMWALLTHICK#',
        '#AIMLENGTH#',
        '#DIAMETER_GP#',
        '#LENGTH_GP#',
        '#LEN_GP_SINGLE#',
        '#ROLL_LENGTH#',
        '#LEN_CUTHEAD#',
        '#LEN_CUTEND#',
        '#OUTNUM_CUT#',
        '#DIAMETER_MANDREL#',
        '#PASS_CODE#',
        '#PASS_NAME#',
        '#INWL_ID#',
        '#INWL_DESC#',
        '#CUT_SINGLE_WT#',
        '#CUT_SINGLE_NUM#',
        '#IF_WL_MATCHED#',
        '#OUTWL_ID#',
        '#OUTWL_DESC#',
        '#OUT_WT#',
        '#OUT_NUM#',
        '#IF_MONITOR_ZG#',
        '#PRDCR_NO#',
        '#MONITOR_POINT#',
        '#CRAFT_FILE_NO#',
        '#CRAFT_FILE_MAN#',
        '#CRAFT_SEQ#',
        '#STATION_ROAD#',
        '#PLANSTATUS#',
        '#IN_WT_REAL#',
        '#IN_NUM_REAL#',
        '#OUT_WT_REAL#',
        '#OUT_NUM_REAL#',
        '#CREATE_NAME#',
        SYSDATE,
        '#UPDATE_NAME#',
        NULL,
        '#PLAN_GP_NUM#',
        '#REAL_STOVE_NO#')
              ]]>
	</query>


	<query id="StoveCommon.getPlnOrderZgEntity" desc="查询轧管工序合同">
            <![CDATA[
             SELECT 
       T.PRO_ORDER_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.INDEX_SEQ,
       T.BOM,
       T.BACKLOG_SEQ,
       T.STEELCODE,
       T.STEELNAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.AIMWALLTHICK,
       T.LENGTHMAX,
       T.LENGTHMIN,
       T.AIMLENGTH,
       T.OUTWL_ID,
       T.ROLL_LENGTH,
       T.OUT_LENGTH,
       T.OUTNUM_SINGLE,
       T.DIAMETER_GP,
       T.LENGTH_GP,
       T.INWL_GP,
       T.WEIGHT_GP_ONE,
       T.GETRATE,
       T.PLINE_CODE_MAY,
       T.PLINE_NAME_MAY,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.ORDERWEIGHT,
       T.ORDERNUM,
       T.MATCH_WT,
       T.MATCH_NUM,
       T.IFBUYPLAN,
       T.BUYPLANID,
       T.BUYPLAN_WT,
       T.REQ_PROD_WT,
       T.REQ_PROD_NUM,
       TO_CHAR(T.PROD_END_DATE, 'YYYY-MM-DD HH24:MI:SS') PROD_END_DATE,
       T.ORDERSTATUS,
       T.IS_PLANED,
       T.PRO_PLAN_ID,
       T.FINISHWEIGHT,
       T.ISENDGX,
       T.NEXT_GX,
       T.IS_EXTRA_ORD,
       T.IF_MONITOR_ZG,
       T.PRDCR_NO,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       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.CRAFT_SEQ,
       T.PASS_CODE,
       T.PASS_NAME,
       T.GO_TYPE,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C,
       T.STATION_ROAD,
       T.CRAFT_NO_V,
       T.BUYER_NAME,
       T.FINAL_USER_DESC,
       T.ORDER_ADD_DESC,
       T.IS_CORRECT,
       T.IN_WT,
       T.IN_NUM,
       T.INWL_DESC,
       T.OUTWL_DESC,
       T.CONFIRM_REMARK,
       T.VERSION_NO
 FROM PLN_ORDER_ZG T
 WHERE  T.PRO_PLAN_ID=?
          
              ]]>
	</query>

	<query id="StoveCommon.getPlnOrderDbkSEntity" desc="查询镦拔扩工序排产">
            <![CDATA[
             SELECT 
       T.PRO_ORDER_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.WEIGTH_S,
       T.NUM_S,
       T.GX_PRO_SEQ,
       T.PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.EXE_STATUS,
       T.IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHDISC,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.OUTDIAMETER_IN,
       T.WALLTHICK_IN,
       T.LENGTH_IN,
       T.LEN_CUTHEAD,
       T.LEN_CUTEND,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       T.ISENDGX,
       T.IF_MONITOR_DBK,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.BATCHED_WT,
       T.BATCHED_NUM,
       T.FINISHWEIGHT,
       T.FINISHNUM,
       T.IS_PLAN_OK,
       T.ZY_BATCH_ID,
       T.GRADECODE,
       T.GRADENAME,
       T.PRO_MONTH,
       T.PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T.IF_EXPORT,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.MEMO,
       TO_CHAR(T.ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') ISSUED_TIME,
       T.ISSUED_MAN,
       TO_CHAR(T.LAST_UNDOWN_TIME, 'YYYY-MM-DD HH24:MI:SS') LAST_UNDOWN_TIME,
       T.LAST_UNDOWN_MAN,
       T.VERSION_NO,
       T.PROCESSING_COST,
       T.TOTAL_COST,
       T.IF_STOVE_ISSUED,
       TO_CHAR(T.STOVE_ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') STOVE_ISSUED_TIME,
       T.STOVE_ISSUED_MAN
 FROM PLN_ORDER_DBK_S T
 WHERE
T.PRO_PLAN_ID  = (SELECT T1.PRO_PLAN_ID
                          FROM PLN_ORDER_DBK T1
                         WHERE T1.PLAN_GROUP_ID = ?)
 ORDER BY T.PLAN_TIME_B  
              ]]>
	</query>

	<query id="StoveCommon.getMaxReadyPlanNo" desc="查询最大预排序号">
            <![CDATA[
               SELECT NVL(MAX(to_number(T.READY_PLAN_NO)),0)+1 READY_PLAN_NO FROM PLN_ZY_DBK_READY T WHERE T.PRO_PLAN_ID=? 
              ]]>
	</query>

	<query id="StoveCommon.addPlnZyDbkReadyEntity" desc="新增镦拔扩炉计划预排表">
            <![CDATA[
            INSERT INTO PLN_ZY_DBK_READY(
        PRO_PLAN_ID,
        GX_PLAN_NO,
        READY_PLAN_NO,
        ZY_BATCH_ID,
        PLINE_CODE,
        PLINE_NAME,
        ZG_HEAT_PLAN_NO,
        JUDGE_STOVE_NO,
        ORDER_SOURCE,
        ORD_LN_DLY_PK,
        ORDER_NO,
        ORDER_SEQ,
        DELIVERY_NO,
        REQ_BL_ID,
        OUTWL_ID,
        OUTWL_DESC,
        ALLOT_NUM,
        ALLOT_WT,
        IF_MATCH_ODD,
        IF_DO_HEAT_PLAN,
        CREATE_TIME,
        REAL_STOVE_NO)
 VALUES( 
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#READY_PLAN_NO#',
        '#ZY_BATCH_ID#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#ZG_HEAT_PLAN_NO#',
        '#JUDGE_STOVE_NO#',
        '#ORDER_SOURCE#',
        '#ORD_LN_DLY_PK#',
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#DELIVERY_NO#',
        '#REQ_BL_ID#',
        '#OUTWL_ID#',
        '#OUTWL_DESC#',
        '#ALLOT_NUM#',
        '#ALLOT_WT#',
        '#IF_MATCH_ODD#',
        '#IF_DO_HEAT_PLAN#',
        SYSDATE,
        '#REAL_STOVE_NO#')
              ]]>
	</query>

	<query id="StoveCommon.updatePlnOrderDbkSEntity" desc="修改镦拔扩排产">
            <![CDATA[
            UPDATE PLN_ORDER_DBK_S T
   SET T.BATCHED_NUM = NVL(TO_NUMBER(T.BATCHED_NUM), 0) + TO_NUMBER(?),
       T.BATCHED_WT  = NVL(TO_NUMBER(T.BATCHED_WT), 0) + TO_NUMBER(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>

	<query id="StoveCommon.getGradeEntityByName" desc="查询钢种通过钢种名称">
            <![CDATA[
             SELECT 
       T.GRADECODE,
       T.GRADENAME,
       T.ASSORTMENT_CODE,
       T.ASSORTMENT_NAME,
       T.COEFFICIENT,
       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.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO,
       T.GRADECODE_OLD,
       T.ALLOW_BUY,
       T.BATCHING_CODE
 FROM COM_BASE_GRADE T
 WHERE
T.GRADENAME= ?
              ]]>
	</query>


	<query id="StoveCommon.addExceptionD" desc="新增炉计划异常">
            <![CDATA[
 INSERT INTO PLN_ZY_EXECPTION_D(
        ID,
        SYS_TIME,
        MESSAGE)
 VALUES( 
        (SELECT nvl(MAX(ID),0)+1 FROM PLN_ZY_EXECPTION_D) ,
        SYSDATE,
        ?)
              ]]>
	</query>

	<query id="StoveCommon.deleteZyD" desc="删除轧管炉计划">
            <![CDATA[
           DELETE FROM  PLN_ZY_ZG_M T WHERE T.REAL_STOVE_NO=?
              ]]>
	</query>

	<query id="StoveCommon.deleteDbkReady" desc="删除镦拔扩炉计划">
            <![CDATA[
           DELETE FROM  PLN_ZY_DBK_READY T WHERE T.REAL_STOVE_NO=?
              ]]>
	</query>

	<query id="StoveCommon.updatePlanE" desc="修改排产虚拟量">
            <![CDATA[
                UPDATE PLN_ORDER_DBK_S T
   SET T.BATCHED_NUM = NVL(TO_NUMBER(T.BATCHED_NUM), 0) - TO_NUMBER(?),
       T.BATCHED_WT  = NVL(TO_NUMBER(T.BATCHED_WT), 0) - TO_NUMBER(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>

	<query id="StoveCommon.queryPlnZyDbkReadyById" desc="查询镦拔扩虚拟炉计划">
            <![CDATA[
             SELECT 
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.READY_PLAN_NO,
       T.ZY_BATCH_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.ZG_HEAT_PLAN_NO,
       T.JUDGE_STOVE_NO,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.ALLOT_NUM,
       T.ALLOT_WT,
       DECODE(T.IF_MATCH_ODD,'1','Y','N')IF_MATCH_ODD,
       DECODE(T.IF_DO_HEAT_PLAN,'1','Y','N')IF_DO_HEAT_PLAN,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME
 FROM PLN_ZY_DBK_READY T
 WHERE
1=1
              ]]>
	</query>


	<query id="StoveCommon.getPlnOrderRclEntity" desc="查询热处理工序排产">
            <![CDATA[
          SELECT 
       T.PRO_ORDER_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.GRADECODE,
       T.GRADENAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHDISC,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.LENGTH_IN,
       T.AIMLENGTH,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       T.IF_MONITOR_RCL,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.GX_PRO_SEQ,
       T.PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.BATCHED_WT,
       T.BATCHED_NUM,
       T.FINISHWEIGHT,
       T.FINISHNUM,
       T.EXE_STATUS,
       T.IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       T.ZY_BATCH_ID,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.ISENDGX,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.IS_PLAN_OK,
       T.STEELCODE,
       T.STEELNAME,
       T.PRO_MONTH,
       T.PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T.IF_EXPORT,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.MEMO,
       TO_CHAR(T.ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') ISSUED_TIME,
       T.ISSUED_MAN,
       TO_CHAR(T.LAST_UNDOWN_TIME, 'YYYY-MM-DD HH24:MI:SS') LAST_UNDOWN_TIME,
       T.LAST_UNDOWN_MAN,
       T.VERSION_NO,
       T.PROCESSING_COST,
       T.TOTAL_COST,
       T.IF_STOVE_ISSUED,
       TO_CHAR(T.STOVE_ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') STOVE_ISSUED_TIME,
       T.STOVE_ISSUED_MAN,
       T.IS_ONLOAD_LINE,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C
 FROM PLN_ORDER_RCL_S T
 WHERE
T.PRO_PLAN_ID  IN (SELECT T1.PRO_PLAN_ID
                          FROM PLN_ORDER_RCL T1
                         WHERE T1.PLAN_GROUP_ID = ?)
 ORDER BY T.PLAN_TIME_B  
              ]]>
	</query>

	<query id="StoveCommon.getMaxReadyPlanNoRcl" desc="查询最大预排序号">
            <![CDATA[
               SELECT NVL(MAX(to_number(T.READY_PLAN_NO)),0)+1 READY_PLAN_NO FROM PLN_ZY_RCL_READY T WHERE T.PRO_PLAN_ID=? 
              ]]>
	</query>

	<query id="StoveCommon.addPlnZyRclReadyEntity" desc="新增热处理炉计划预排表">
            <![CDATA[
              INSERT INTO PLN_ZY_RCL_READY(
        PRO_PLAN_ID,
        GX_PLAN_NO,
        READY_PLAN_NO,
        ZY_BATCH_ID,
        PLINE_CODE,
        PLINE_NAME,
        PREVIOUS_GX,
        ZG_HEAT_PLAN_NO,
        DBK_HEAT_PLAN_NO,
        JUDGE_STOVE_NO,
        LAST_BATCH_NO,
        BATCH_GROUD_NO,
        ORDER_SOURCE,
        ORD_LN_DLY_PK,
        ORDER_NO,
        ORDER_SEQ,
        DELIVERY_NO,
        REQ_BL_ID,
        OUTWL_ID,
        OUTWL_DESC,
        ALLOT_NUM,
        ALLOT_WT,
        IF_MATCH_ODD,
        IF_DO_HEAT_PLAN,
        CREATE_TIME,
        REAL_ALLOT_NUM,
        REAL_ALLOT_WT,
        REAL_STOVE_NO,
        CRAFT_FILE_NO,
        CRAFT_SEQ,
        SEC_CRAFT_FILE_NO,
        OUT_JUDGE_STD)
 VALUES( 
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#READY_PLAN_NO#',
        '#ZY_BATCH_ID#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#PREVIOUS_GX#',
        '#ZG_HEAT_PLAN_NO#',
        '#DBK_HEAT_PLAN_NO#',
        '#JUDGE_STOVE_NO#',
        '#LAST_BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#ORDER_SOURCE#',
        '#ORD_LN_DLY_PK#',
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#DELIVERY_NO#',
        '#REQ_BL_ID#',
        '#OUTWL_ID#',
        '#OUTWL_DESC#',
        '#ALLOT_NUM#',
        '#ALLOT_WT#',
        '#IF_MATCH_ODD#',
        '#IF_DO_HEAT_PLAN#',
        SYSDATE,
        '#REAL_ALLOT_NUM#',
        '#REAL_ALLOT_WT#',
        '#REAL_STOVE_NO#',
        '#CRAFT_FILE_NO#',
        '#CRAFT_SEQ#',
        '#SEC_CRAFT_FILE_NO#',
        '#OUT_JUDGE_STD#')
              ]]>
	</query>

	<query id="StoveCommon.updatePlnOrderRclSEntity" desc="修改热处理排产">
            <![CDATA[
            UPDATE PLN_ORDER_RCL_S T
   SET T.BATCHED_NUM = NVL(TO_NUMBER(T.BATCHED_NUM), 0) + TO_NUMBER(?),
       T.BATCHED_WT  = NVL(TO_NUMBER(T.BATCHED_WT), 0) + TO_NUMBER(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>

	<query id="StoveCommon.queryPlnZyRclReadyById" desc="查询热处理虚拟炉计划">
            <![CDATA[
             SELECT 
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.READY_PLAN_NO,
       T.ZY_BATCH_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.PREVIOUS_GX,
       T.ZG_HEAT_PLAN_NO,
       T.DBK_HEAT_PLAN_NO,
       T.JUDGE_STOVE_NO,
       T.LAST_BATCH_NO,
       T.BATCH_GROUD_NO,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.ALLOT_NUM,
       T.ALLOT_WT,
       T.IF_MATCH_ODD,
       T.IF_DO_HEAT_PLAN,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.REAL_ALLOT_NUM,
       T.REAL_ALLOT_WT,
       T.REAL_STOVE_NO,
       T.CRAFT_FILE_NO,
       T.CRAFT_SEQ,
       T.SEC_CRAFT_FILE_NO,
       T.OUT_JUDGE_STD
 FROM PLN_ZY_RCL_READY T
 WHERE
1=1
              ]]>
	</query>

	<query id="StoveCommon.updatePlanF" desc="修改热处理排产虚拟量">
            <![CDATA[
                UPDATE PLN_ORDER_RCL_S T
   SET T.BATCHED_NUM = NVL(TO_NUMBER(T.BATCHED_NUM), 0) - TO_NUMBER(?),
       T.BATCHED_WT  = NVL(TO_NUMBER(T.BATCHED_WT), 0) - TO_NUMBER(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>

	<query id="StoveCommon.deleteRclReady" desc="删除热处理炉计划">
            <![CDATA[
           DELETE FROM  PLN_ZY_RCL_READY T WHERE T.REAL_STOVE_NO=?
              ]]>
	</query>

</queryMap>