<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="">
	<query id="PlanFurnProduction.querySteOrdPln" 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.PLANSTATUS,
       T.UPPER_HEATPLAN_ID,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.CCM_PRO_PLAN_ID,
       T.CCM_GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C,
       T.UPPER_PROCESS_CODE,
       T.NEXT_PROCESS_CODE,
       T.ISENDGX,
       T.IF_MATCH_ODD,
       T.IF_DO_HEAT_PLAN,
       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_LEN_CONTROL,
       T.IF_MINUS_SIC_ROLL,
       T.PROD_STANDARD,
       T.OUTPUT_STANDARD,
       T.DECISION,
       T.PROGY_MEMO,
       T.GOWHERE_CODE,
       T.GOWHERE_NAME,
       T.OUTS_BILLET_FL,
       T.GPTYPE,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.DIAMETER,
       T.LEN_GP_SINGLE,
       T.WT_GP_SINGLE,
       T.PLN_INSINGLE_NUM,
       T.PLN_INSINGLE_WT,
       T.PLN_OUTSINGLE_NUM,
       T.PLN_OUTSINGLE_W,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.OUTDIAMETER_ZG,
       T.WALLTHICK_ZG,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.THICKNESS_WALL,
       T.LEN_ROLL_MAX,
       T.LEN_ROLL_MIN,
       T.AIMLENGTH,
       T.ROLL_LENGTH,
       T.OUTNUM_CUT,
       T.CUT_TYPE,
       T.LEN_CUTEND,
       T.LEN_CUTHEAD,
       T.DIAMETER_MANDREL,
       T.PASS_CODE,
       T.PASS_NAME,
       T.IF_MONITOR,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.BOM,
       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.IS_LOAD,
       T.PLN_TYPE,
       T.INDEX_SEQ,
       T.MEMO,
       T.FEED_HEAT_NO,
       T.REDUCED_WT, 
       T1.STD_CODE,
       T1.STD_NAME,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
      (SELECT S.STD_STYLE FROM COM_BASE_STD_STYLE S WHERE S.STD_STYLE_DESC=T1.STD_STYLE_DESC AND S.VALIDFLAG='1') STD_STYLE,
       T1.STD_STYLE_DESC
  FROM PLN_ZY_ZG_M T, PLN_SALEORD T1
 WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK

       ]]>
	</query>
	<query id="PlanFurnProduction.queryPlnOrderDbk" 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,
       NVL(T.LEN_CUTHEAD,0) LEN_CUTHEAD,
       NVL(T.LEN_CUTEND,0) 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.REAL_BATCH_WT,
       T.REAL_BATCH_NUM,
        DECODE(T.IF_STOVE_ISSUED,'1','1','0') 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,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       T.WHOLE_BACKLOG_DESC,
       T.IF_CRAFT_LOCKED,
       T.WEIGTH_S_MIN,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       T.VALIDFLAG,T.DECISION,T1.SPEC_CODE,T1.SPEC_NAME,T.PASS_CODE,T.PASS_CODE, 
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.STD_STYLE_DESC,
       (SELECT S.STD_STYLE
          FROM COM_BASE_STD_STYLE S
         WHERE S.STD_STYLE_DESC = T1.STD_STYLE_DESC) STD_STYLE
 FROM PLN_ORDER_DBK_S T,PLN_SALEORD T1
 WHERE 1=1
 AND T.ORD_LN_DLY_PK=T1.ORD_LN_DLY_PK

      ]]>
	</query>
	<query id="PlanFurnProduction.queryPlnOrdeRcl" 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.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,
       DECODE(T.IF_STOVE_ISSUED,'1','1','0') 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,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       T.WHOLE_BACKLOG_DESC,
       T.IF_CRAFT_LOCKED,
       T.WEIGTH_S_MIN,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       T.VALIDFLAG,T.DECISION,T1.SPEC_CODE,T1.SPEC_NAME,
            T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.STD_STYLE_DESC,
       (SELECT S.STD_STYLE
          FROM COM_BASE_STD_STYLE S
         WHERE S.STD_STYLE_DESC = T1.STD_STYLE_DESC) STD_STYLE
 FROM PLN_ORDER_RCL_S T,PLN_SALEORD T1
 WHERE 1=1
 AND T.ORD_LN_DLY_PK=T1.ORD_LN_DLY_PK
      ]]>
	</query>
	<query id="PlanFurnProduction.queryPlnOrderJgx" 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.LENGTHMAX,
       T.LENGTHMIN,
       T.LENGTHDISC,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.SHRT_LEN_RATO,
       T.SHORTEST,
       T.LONG_LEN_RATO,
       T.LONGEST,
       T.SHRT_STOVE,
       T.AVG_LEN_MIN,
       T.DIFRNC_LEN_MAX,
       T.SIGL_LEN,
       T.ENDLEN_SPECSTD,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.LENGTH_IN,
       T.OUTNUM_CUT,
       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.IF_MONITOR_JGX,
       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.PRO_MONTH,
       T.PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T.IF_EXPORT,
       T.FINAL_USER_DESC,
       T.PROCESS_DESC_C_ZG,
       T.GROUP_ROLL_NAME,
       TO_CHAR(T.BEGIN_TIME_ZG, 'YYYY-MM-DD HH24:MI:SS') BEGIN_TIME_ZG,
       T.PRDCR_ADVC_DAY,
       T.WHOLE_BACKLOG_DESC,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       TO_CHAR(T.DELVRY_EDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_EDATE,
       T.STATION_NM,
       T.OUTLINE_SITE_250,
       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,
        DECODE(T.IF_STOVE_ISSUED,'1','1','0') 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,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       T.IF_CRAFT_LOCKED,
       T.VALIDFLAG,T.DECISION,T1.SPEC_CODE,T1.SPEC_NAME,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.STD_STYLE_DESC,
       (SELECT S.STD_STYLE
          FROM COM_BASE_STD_STYLE S
         WHERE S.STD_STYLE_DESC = T1.STD_STYLE_DESC) STD_STYLE,
          T2.PROCESS_SEQ Whole_Backlog
 FROM PLN_ORDER_JGX_S T,PLN_SALEORD T1,PLN_SALEORD_PROC T2
 WHERE 1=1
 AND T.ORD_LN_DLY_PK=T1.ORD_LN_DLY_PK
 AND T.ORD_LN_DLY_PK=T2.ORD_LN_DLY_PK
 AND T.PLN_DIVIDE_ID=T2.PLN_DIVIDE_ID
      ]]>
	</query>
	<query id="PlanFurnProduction.queryPlnOrderJg" desc="查询接箍订单信息">
      <![CDATA[
      SELECT T.*　FROM PLN_GX_JG_PROP_S T WHERE 1=1
      ]]>
	</query>
	<query id="PlanFurnProduction.addPlnZyDbk" desc="新增镦拔扩虚拟炉计划">
      <![CDATA[
      INSERT INTO PLN_ZY_DBK_M
  (HEAT_PLAN_NO,
   GX_PRO_SEQ,
   ZY_BATCH_ID,
   STOVE_NO,
   FEED_HEAT_NO,
   BATCH_NO,
   PLANSTATUS,
   UPPER_HEATPLAN_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   UPPER_PROCESS_CODE,
   NEXT_PROCESS_CODE,
   GOWHERE_CODE,
   GOWHERE_NAME,
   PROD_STANDARD,
   OUTPUT_STANDARD,
   ISENDGX,
   IF_MATCH_ODD,
   IF_DO_HEAT_PLAN,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   IF_EXPORT,
   PRIORITY,
   PRIORITY_MEMO,
   PRO_MONTH,
   PRO_DAY,
   BAL_YEAR_MONTH,
   IF_MONITOR,
   PRDCR_NO,
   MONITOR_POINT,
   BOM,
   WHOLE_BACKLOG,
   WHOLE_BACKLOG_DESC,
   STATION_ROAD,
   CIC,
   PIC,
   SIC,
   DIC,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   SEC_CRAFT_FILE_NO,
   GRADECODE,
   GRADENAME,
   STEELCODE,
   STEELNAME,
   PRODUCCODE,
   PRODUCNAME,
   MODEL_CODE,
   MODEL_DESC,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   AIMOUTDIAMETER,
   AIMWALLTHICK,
   AIMLENGTH,
   AIMLENGTH_MAX,
   AIMLENGTH_MIN,
   LEN_CUTHEAD,
   LEN_CUTEND,
   PLN_INSINGLE_NUM,
   PLN_INSINGLE_WT,
   PLN_INDOUBLE_NUM,
   PLN_INDOUBLE_WT,
   PLN_OUTSINGLE_NUM,
   PLN_OUTSINGLE_W,
   PLN_OUTDOUBLE_NUM,
   PLN_OUTDOUBLE_W,
   CREATE_NAME,
   CREATE_TIME,
   INDEX_SEQ,SPEC_CODE,
        SPEC_NAME,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,JUDGE_STOVE_NO,DECISION,ZY_BATCH_ID_ZG,PASS_CODE,PASS_NAME,FLAG_STOVE_NO)
VALUES
  ('#HEAT_PLAN_NO#',
   '#GX_PRO_SEQ#',
   '#ZY_BATCH_ID#',
   '#STOVE_NO#',
   '#FEED_HEAT_NO#',
   '#BATCH_NO#',
   '#PLANSTATUS#',
   '#UPPER_HEATPLAN_ID#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   '#UPPER_PROCESS_CODE#',
   '#NEXT_PROCESS_CODE#',
   '#GOWHERE_CODE#',
   '#GOWHERE_NAME#',
   '#PROD_STANDARD#',
   '#OUTPUT_STANDARD#',
   '#ISENDGX#',
   '#IF_MATCH_ODD#',
   '#IF_DO_HEAT_PLAN#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#IF_EXPORT#',
   '#PRIORITY#',
   '#PRIORITY_MEMO#',
   '#PRO_MONTH#',
   '#PRO_DAY#',
   '#BAL_YEAR_MONTH#',
   '#IF_MONITOR#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#BOM#',
   '#WHOLE_BACKLOG#',
   '#WHOLE_BACKLOG_DESC#',
   '#STATION_ROAD#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_FILE_MAN#',
   '#CRAFT_SEQ#',
   '#SEC_CRAFT_FILE_NO#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#OUTDIAMETER_IN#',
   '#WALLTHICK_IN#',
   '#LENGTH_IN#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#AIMOUTDIAMETER#',
   '#AIMWALLTHICK#',
   '#AIMLENGTH#',
   '#AIMLENGTH_MAX#',
   '#AIMLENGTH_MIN#',
   '#LEN_CUTHEAD#',
   '#LEN_CUTEND#',
   '#PLN_INSINGLE_NUM#',
   '#PLN_INSINGLE_WT#',
   '#PLN_INDOUBLE_NUM#',
   '#PLN_INDOUBLE_WT#',
   '#PLN_OUTSINGLE_NUM#',
   '#PLN_OUTSINGLE_W#',
   '#PLN_OUTDOUBLE_NUM#',
   '#PLN_OUTDOUBLE_W#',
   '#CREATE_NAME#',
   TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#INDEX_SEQ#', '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#','#JUDGE_STOVE_NO#','#DECISION#','#ZY_BATCH_ID_ZG#','#PASS_CODE#','#PASS_NAME#','#FLAG_STOVE_NO#')
      ]]>
	</query>
	<query id="PlanFurnProduction.addPlnZyRcl" desc="新增热处理虚拟炉计划">
      <![CDATA[
      INSERT INTO PLN_ZY_RCL_M
  (HEAT_PLAN_NO,
   GX_PRO_SEQ,
   ZY_BATCH_ID,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   PLANSTATUS,
   PER_STATUS,
   BESIDE_STATUS,
   UPPER_HEATPLAN_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   UPPER_PROCESS_CODE,
   NEXT_PROCESS_CODE,
   GOWHERE_CODE,
   GOWHERE_NAME,
   PROD_STANDARD,
   OUTPUT_STANDARD,
   ISENDGX,
   IF_MATCH_ODD,
   IF_DO_HEAT_PLAN,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   IF_EXPORT,
   PRIORITY,
   PRIORITY_MEMO,
   PRO_MONTH,
   PRO_DAY,
   BAL_YEAR_MONTH,
   IF_MONITOR,
   PRDCR_NO,
   MONITOR_POINT,
   BOM,
   WHOLE_BACKLOG,
   WHOLE_BACKLOG_DESC,
   STATION_ROAD,
   CIC,
   PIC,
   SIC,
   DIC,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   SEC_CRAFT_FILE_NO,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   PRODUCCODE,
   PRODUCNAME,
   MODEL_CODE,
   MODEL_DESC,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   OUTDIAMETER,
   WALLTHICK,
   LENGTHMIN,
   LENGTHMAX,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   PLN_INSINGLE_NUM,
   PLN_INSINGLE_WT,
   PLN_INDOUBLE_NUM,
   PLN_INDOUBLE_WT,
   PLN_OUTSINGLE_NUM,
   PLN_OUTSINGLE_W,
   PLN_OUTDOUBLE_NUM,
   PLN_OUTDOUBLE_W,
   CREATE_NAME,
   CREATE_TIME,
   DOWNMAN,
   DOWNTIME,
   INDEX_SEQ,
   SPEC_CODE,
   SPEC_NAME,
   STD_CODE,
   STD_NAME,
   STD_STYLE,
   STD_STYLE_DESC,
   DECISION,
   PROCESS_SEQ,
   FLAG_STOVE_NO,
   FEED_HEAT_NO,
   ZY_BATCH_ID_ZG,
   LOT_NO_SQE,
   IF_PRODUCT,
   REAL_PROCESS_SEQ)
VALUES
  ('#HEAT_PLAN_NO#',
   '#GX_PRO_SEQ#',
   '#ZY_BATCH_ID#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#PLANSTATUS#',
   '#PER_STATUS#',
   '#BESIDE_STATUS#',
   '#UPPER_HEATPLAN_ID#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   '#UPPER_PROCESS_CODE#',
   '#NEXT_PROCESS_CODE#',
   '#GOWHERE_CODE#',
   '#GOWHERE_NAME#',
   '#PROD_STANDARD#',
   '#OUTPUT_STANDARD#',
   '#ISENDGX#',
   '#IF_MATCH_ODD#',
   '#IF_DO_HEAT_PLAN#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#IF_EXPORT#',
   '#PRIORITY#',
   '#PRIORITY_MEMO#',
   '#PRO_MONTH#',
   '#PRO_DAY#',
   '#BAL_YEAR_MONTH#',
   '#IF_MONITOR#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#BOM#',
   '#WHOLE_BACKLOG#',
   '#WHOLE_BACKLOG_DESC#',
   '#STATION_ROAD#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_FILE_MAN#',
   '#CRAFT_SEQ#',
   '#SEC_CRAFT_FILE_NO#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#OUTDIAMETER#',
   '#WALLTHICK#',
   '#LENGTHMIN#',
   '#LENGTHMAX#',
   '#OUTDIAMETER_IN#',
   '#WALLTHICK_IN#',
   '#LENGTH_IN#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#PLN_INSINGLE_NUM#',
   '#PLN_INSINGLE_WT#',
   '#PLN_INDOUBLE_NUM#',
   '#PLN_INDOUBLE_WT#',
   '#PLN_OUTSINGLE_NUM#',
   '#PLN_OUTSINGLE_W#',
   '#PLN_OUTDOUBLE_NUM#',
   '#PLN_OUTDOUBLE_W#',
   '#CREATE_NAME#',
   TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#DOWNMAN#',
   TO_DATE('#DOWNTIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#INDEX_SEQ#',
   '#SPEC_CODE#',
   '#SPEC_NAME#',
   '#STD_CODE#',
   '#STD_NAME#',
   '#STD_STYLE#',
   '#STD_STYLE_DESC#',
   '#DECISION#',
   '#PROCESS_SEQ#',
   '#FLAG_STOVE_NO#',
   '#FEED_HEAT_NO#',
   '#ZY_BATCH_ID_ZG#',
   '#LOT_NO_SQE#',
   '#IF_PRODUCT#',
   '#REAL_PROCESS_SEQ#')
         ]]>
	</query>
	<query id="PlanFurnProduction.addPlnZyJgx" desc="新增加工线虚拟炉计划">
      <![CDATA[
      INSERT INTO PLN_ZY_JGX_M
  (HEAT_PLAN_NO,
   GX_PRO_SEQ,
   ZY_BATCH_ID,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   PLANSTATUS,
   PER_STATUS,
   BESIDE_STATUS,
   UPPER_HEATPLAN_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   UPPER_PROCESS_CODE,
   NEXT_PROCESS_CODE,
   GOWHERE_CODE,
   GOWHERE_NAME,
   PROD_STANDARD,
   OUTPUT_STANDARD,
   ISENDGX,
   IF_MATCH_ODD,
   IF_DO_HEAT_PLAN,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   IF_EXPORT,
   PRIORITY,
   PRIORITY_MEMO,
   PRO_MONTH,
   PRO_DAY,
   BAL_YEAR_MONTH,
   IF_MONITOR,
   PRDCR_NO,
   MONITOR_POINT,
   MONITOR_MENT,
   MONITOR_MAN,
   BOM,
   WHOLE_BACKLOG,
   WHOLE_BACKLOG_DESC,
   STATION_ROAD,
   CIC,
   PIC,
   SIC,
   DIC,
   WIC,
   GIC,
   CRAFT_FILE_NO,
   CRAFT_SEQ,
   CRAFT_FILE_MAN,
   SEC_CRAFT_FILE_NO,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   PRODUCCODE,
   PRODUCNAME,
   MODEL_CODE,
   MODEL_DESC,
   OUTDIAMETER,
   WALLTHICK,
   LENGTHMIN,
   LENGTHMAX,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   PLN_INSINGLE_NUM,
   PLN_INSINGLE_WT,
   PLN_INDOUBLE_NUM,
   PLN_INDOUBLE_WT,
   PLN_OUTSINGLE_NUM,
   PLN_OUTSINGLE_W,
   PLN_OUTDOUBLE_NUM,
   PLN_OUTDOUBLE_W,
   CREATE_NAME,
   CREATE_TIME,
   INDEX_SEQ,SPEC_CODE,
        SPEC_NAME,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,OUTNUM_CUT,DECISION,FLAG_STOVE_NO,FEED_HEAT_NO,ZY_BATCH_ID_ZG,LOT_NO_SQE，
        DELIVERY_STATE_CODE，
        DELIVERY_STATE_NAME)
VALUES
  ('#HEAT_PLAN_NO#',
   '#GX_PRO_SEQ#',
   '#ZY_BATCH_ID#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#PLANSTATUS#',
   '#PER_STATUS#',
   '#BESIDE_STATUS#',
   '#UPPER_HEATPLAN_ID#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   '#UPPER_PROCESS_CODE#',
   '#NEXT_PROCESS_CODE#',
   '#GOWHERE_CODE#',
   '#GOWHERE_NAME#',
   '#PROD_STANDARD#',
   '#OUTPUT_STANDARD#',
   '#ISENDGX#',
   '#IF_MATCH_ODD#',
   '#IF_DO_HEAT_PLAN#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#IF_EXPORT#',
   '#PRIORITY#',
   '#PRIORITY_MEMO#',
   '#PRO_MONTH#',
   '#PRO_DAY#',
   '#BAL_YEAR_MONTH#',
   '#IF_MONITOR#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#MONITOR_MENT#',
   '#MONITOR_MAN#',
   '#BOM#',
   '#WHOLE_BACKLOG#',
   '#WHOLE_BACKLOG_DESC#',
   '#STATION_ROAD#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#WIC#',
   '#GIC#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_SEQ#',
   '#CRAFT_FILE_MAN#',
   '#SEC_CRAFT_FILE_NO#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#OUTDIAMETER#',
   '#WALLTHICK#',
   '#LENGTHMIN#',
   '#LENGTHMAX#',
   '#OUTDIAMETER_IN#',
   '#WALLTHICK_IN#',
   '#LENGTH_IN#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#PLN_INSINGLE_NUM#',
   '#PLN_INSINGLE_WT#',
   '#PLN_INDOUBLE_NUM#',
   '#PLN_INDOUBLE_WT#',
   '#PLN_OUTSINGLE_NUM#',
   '#PLN_OUTSINGLE_W#',
   '#PLN_OUTDOUBLE_NUM#',
   '#PLN_OUTDOUBLE_W#',
   '#CREATE_NAME#',   
   TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#INDEX_SEQ#', '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#','#OUTNUM_CUT#','#DECISION#','#FLAG_STOVE_NO#','#FEED_HEAT_NO#','#ZY_BATCH_ID_ZG#','#LOT_NO_SQE#','#DELIVERY_STATE_CODE#',
        '#DELIVERY_STATE_NAME#')
      
         ]]>
	</query>
	<query id="PlanFurnProduction.QueryQcmZgApply" desc="查询轧管判定信息">
      <![CDATA[
      SELECT T.JUGDE_APPLY_CODE,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.PROCESS_CODE,
       T.PLINE_CODE,
       NVL(T.ACT_COUNT,0) ACT_COUNT,
       NVL(T.ACT_WEIGHT,0) ACT_WEIGHT,
       NVL(T.ACT_THEORY_WEIGHT,0) ACT_THEORY_WEIGHT,
       T.PRO_ORDER_ID,
       T.FACE_RESULT_CODE,
       T.SPEC_RESULT_CODE,
       T.CHEM_RESULT_CODE,
       T.PHY_RESULT_CODE,
       T.DETECT_RESULT_CODE,
       T.WPRESSURE_RESULT_CODE,
       T.PROCESS_RESULT_CODE,
       T.FACE_RESULT_PATH,
       T.SPEC_RESULT_PATH,
       T.CHEM_RESULT_PATH,
       T.PHY_RESULT_PATH,
       T.DETECT_RESULT_PATH,
       T.WPRESSURE_RESULT_PATH,
       T.PROCESS_RESULT_PATH,
       T.VALIDFLAG,
       T.APPLY_NAME,
       TO_CHAR(T.APPLY_TIME, 'YYYY-MM-DD HH24:MI:SS') APPLY_TIME,
       T.MEMO,
       T.QUALITY_GROUP,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.CRAF_NO,
       T.LOT_NO,
       T.PLINE_NAME,
       T.PRO_ORDER_NO,
       T.TARGET,
       T.PROCESS_STATUS,
       T.MAT_GOWHERE_CODE,
       T.MAT_GOWHERE_NAME,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       T.JUDGE_RESULT_CODE,
       T.JUDGE_RESULT,
       TO_CHAR(T.JUDGE_RESULT_TIME, 'YYYY-MM-DD HH24:MI:SS') JUDGE_RESULT_TIME,
       T.JUDGE_MAKER,
       T.IF_SET_ZY_PLAN,
       T.TESTING_GRADE,
       T.TESTING_TYPE,
       T.TESTING_GRADE1,
       T.TESTING_TYPE1,
       T.DETECT_RESULT_CODE1,
       T.DETECT_RESULT_PATH1,
       T.ORD_LN_DLY_PK,
       T.APPLY_FLAG,
       T.BACK_JUGDE_MEMO,
       T.INSTOCK_FLAG,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.ISENDGX,
       T.EXIT_TEMP,
       T.SAMPLE_NEWS,
       T.ACT_LEN,
       T.BELONG_CODE_JUGDE,
       T.BELONG_NAME_JUGDE,
       T.GX_PLAN_NO,
       T.INPUT_WEIGHT,
       T.INPUT_COUNT,
       T.OUTPUT_WEIGHT,
       T.OUTPUT_COUNT,
       T.BAL_YEAR_MONTH,
       T.IS_FLAG,
       T.IS_ALL_SCRAP,
       T.IS_CARRY_VOER,
       T.STOVE_NO,
       T.STEEL_STANDRAD,
       T.PRO_PLAN_ID_NEXT,
       T.GX_PLAN_NO_NEXT,
       T.LK_FLAG,
       T.HEAT_PLAN_NO_NEXT,
       T.PLINE_CODE
  FROM QCM_ZG_JUGDE_APPLY T
 WHERE T.JUGDE_APPLY_CODE = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.PROCESS_CODE=?
   AND T.BATCH_NO=?
   AND T.IS_FLAG='0'
        ]]>
	</query>
	<query id="PlanFurnProduction.QueryMatBcMApply" desc="根据判定单号查询半成品库存信息">
      <![CDATA[
SELECT T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.JUGDE_APPLY_CODE,
       T.PROCESS_CDOE,
       T.PRO_PLAN_ID_NEXT,
       T.GX_PLAN_NO_NEXT,
       T.HEAT_PLAN_NO_NEXT,
       SUM(T.ACT_COUNT) ACT_COUNT,
       SUM(T.ACT_WEIGHT) ACT_WEIGHT,
       T.NEXT_PROCESS_CDOE,
       T.CIC
  FROM MAT_BC_M T
 WHERE T.JUGDE_APPLY_CODE = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.PROCESS_CDOE = ?
   AND T.QCM_STAUS = '00'
 GROUP BY T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.BATCH_GROUD_NO,
          T.JUGDE_APPLY_CODE,
          T.PROCESS_CDOE,
          T.PRO_PLAN_ID_NEXT,
          T.GX_PLAN_NO_NEXT,
          T.HEAT_PLAN_NO_NEXT,
          T.NEXT_PROCESS_CDOE,T.CIC 
        ]]>
	</query>
	
	<query id="PlanFurnProduction.QueryMatBcMAdd" desc="根据判定单号查询半成品库存信息">
      <![CDATA[
SELECT T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.JUGDE_APPLY_CODE,
       T.PROCESS_CDOE,
       T.GRADECODE,
       T.GRADENAME,
       T.PRO_PLAN_ID_NEXT,
       T.GX_PLAN_NO_NEXT,
       T.HEAT_PLAN_NO_NEXT,
       SUM(T.ACT_COUNT) ACT_COUNT,
       SUM(CASE WHEN T.PONDER_GROSS_WT IS NULL THEN
       T.ACT_WEIGHT
       ELSE
       T.PONDER_GROSS_WT END) ACT_WEIGHT,
       T.NEXT_PROCESS_CDOE,
       T.PLINE_CODE
  FROM MAT_BC_M T
 WHERE T.JUGDE_APPLY_CODE = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.PROCESS_CDOE = ?
   AND T.QCM_STAUS = '00'
 
        ]]>
	</query>
	<query id="PlanFurnProduction.QueryPlnZyDbk" desc="查询镦拔扩虚拟炉计划">
      <![CDATA[
      SELECT T.* FROM PLN_ZY_DBK_M T
         ]]>
	</query>
	<query id="PlanFurnProduction.QueryPlnZyRcl" desc="查询热处理虚拟炉计划">
      <![CDATA[
      SELECT T.* FROM PLN_ZY_RCL_M T
         ]]>
	</query>
	<query id="PlanFurnProduction.QueryPlnZyJgx" desc="查询加工线虚拟炉计划">
      <![CDATA[
      SELECT T.* FROM PLN_ZY_JGX_M T
         ]]>
	</query>
	<query id="PlanFurnProduction.QueryPlnZyJg" desc="查询接箍虚拟炉计划">
      <![CDATA[
      SELECT T.* FROM PLN_ZY_JG_M T
         ]]>
	</query>
	<query id="PlanFurnProduction.QueryPlnZyDbkC" desc="查询镦拔扩实际炉计划">
      <![CDATA[
  SELECT M.PLANSTATUS,M.IF_MATCH_ODD,
         T.*
  FROM PLN_ZY_DBK_C T,PLN_ZY_DBK_M M
 WHERE M.HEAT_PLAN_NO = T.HEAT_PLAN_NO
   AND T.FEED_HEAT_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
   AND NVL(T.JUGDE_APPLY_CODE,'/') = NVL(?,'/')

         ]]>
	</query>
	<query id="PlanFurnProduction.QueryPlnZyRclC" desc="查询热处理实际炉计划">
      <![CDATA[
      SELECT M.PLANSTATUS,M.IF_MATCH_ODD,
         T.*
  FROM PLN_ZY_RCl_C T,PLN_ZY_RCL_M M
 WHERE M.HEAT_PLAN_NO = T.HEAT_PLAN_NO
   AND T.FEED_HEAT_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
  AND NVL(T.JUGDE_APPLY_CODE,'/') = NVL(?,'/')
         ]]>
	</query>
	<query id="PlanFurnProduction.QueryPlnZyJgxC" desc="查询加工线实际炉计划">
      <![CDATA[
SELECT  M.PLANSTATUS,M.IF_MATCH_ODD,
         T.*
  FROM PLN_ZY_JGX_C T,PLN_ZY_JGX_M M
 WHERE M.HEAT_PLAN_NO = T.HEAT_PLAN_NO
    AND T.FEED_HEAT_NO = ?
    AND T.BATCH_NO = ?
    AND T.BATCH_GROUD_NO = ?
    AND NVL(T.JUGDE_APPLY_CODE,'/') = NVL(?,'/')
         ]]>
	</query>
	<query id="PlanFurnProduction.QueryPlnZyJgC" desc="查询接箍实际炉计划">
      <![CDATA[
SELECT  M.PLANSTATUS,M.IF_MATCH_ODD,
         T.*
  FROM PLN_ZY_JG_C T,PLN_ZY_JG_M M
 WHERE M.HEAT_PLAN_NO = T.HEAT_PLAN_NO
    AND T.JUDGE_STOVE_NO = ?
    AND T.BATCH_NO = ?
    AND T.BATCH_GROUD_NO = ?
    AND NVL(T.JUGDE_APPLY_CODE,'/') = NVL(?,'/')
         ]]>
	</query>
	<query id="PlanFurnProduction.addPlnZyDbkC" desc="查询镦拔扩实际炉计划">
      <![CDATA[
       INSERT INTO PLN_ZY_DBK_C(
        HEAT_PLAN_NO,
        HEAT_PLAN_SQE,
        JUGDE_APPLY_CODE,
        ZY_BATCH_ID,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        PLINE_CODE,
        PLINE_NAME,
        OUTDIAMETER_IN,
        WALLTHICK_IN,
        LENGTH_IN,
        LENGTHMAX_IN,
        LENGTHMIN_IN,
        PLAN_INDOUBLE_NUM,
        PLAN_INDOUBLE_WT,FEED_HEAT_NO,FLAG_STOVE_NO,OUTNUM_CUT)
 VALUES( 
        '#HEAT_PLAN_NO#',
        '#HEAT_PLAN_SQE#',
        '#JUGDE_APPLY_CODE#',
        '#ZY_BATCH_ID#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#OUTDIAMETER_IN#',
        '#WALLTHICK_IN#',
        '#LENGTH_IN#',
        '#LENGTHMAX_IN#',
        '#LENGTHMIN_IN#',
        '#PLAN_INDOUBLE_NUM#',
        '#PLAN_INDOUBLE_WT#','#FEED_HEAT_NO#','#FLAG_STOVE_NO#','#OUTNUM_CUT#')
       ]]>
	</query>
	<query id="PlanFurnProduction.addPlnZyRclC" desc="查询热处理实际炉计划">
      <![CDATA[
       INSERT INTO PLN_ZY_RCL_C(
        HEAT_PLAN_NO,
        HEAT_PLAN_SQE,
        JUGDE_APPLY_CODE,
        ZY_BATCH_ID,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        PLINE_CODE,
        PLINE_NAME,
        OUTDIAMETER_IN,
        WALLTHICK_IN,
        LENGTH_IN,
        LENGTHMAX_IN,
        LENGTHMIN_IN,
        PLAN_INDOUBLE_NUM,
        PLAN_INDOUBLE_WT,FEED_HEAT_NO,FLAG_STOVE_NO)
 VALUES( 
        '#HEAT_PLAN_NO#',
        '#HEAT_PLAN_SQE#',
        '#JUGDE_APPLY_CODE#',
        '#ZY_BATCH_ID#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#OUTDIAMETER_IN#',
        '#WALLTHICK_IN#',
        '#LENGTH_IN#',
        '#LENGTHMAX_IN#',
        '#LENGTHMIN_IN#',
        '#PLAN_INDOUBLE_NUM#',
        '#PLAN_INDOUBLE_WT#','#FEED_HEAT_NO#','#FLAG_STOVE_NO#')
       ]]>
	</query>
	<query id="PlanFurnProduction.addPlnZyJgxC" desc="查询加工线实际炉计划">
      <![CDATA[
       INSERT INTO PLN_ZY_JGX_C(
        HEAT_PLAN_NO,
        HEAT_PLAN_SQE,
        JUGDE_APPLY_CODE,
        ZY_BATCH_ID,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        PLINE_CODE,
        PLINE_NAME,
        OUTDIAMETER_IN,
        WALLTHICK_IN,
        LENGTH_IN,
        LENGTHMAX_IN,
        LENGTHMIN_IN,
        PLAN_INDOUBLE_NUM,
        PLAN_INDOUBLE_WT,OUTNUM_CUT,FEED_HEAT_NO,FLAG_STOVE_NO)
 VALUES( 
        '#HEAT_PLAN_NO#',
        '#HEAT_PLAN_SQE#',
        '#JUGDE_APPLY_CODE#',
        '#ZY_BATCH_ID#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#OUTDIAMETER_IN#',
        '#WALLTHICK_IN#',
        '#LENGTH_IN#',
        '#LENGTHMAX_IN#',
        '#LENGTHMIN_IN#',
        '#PLAN_INDOUBLE_NUM#',
        '#PLAN_INDOUBLE_WT#','#OUTNUM_CUT#','#FEED_HEAT_NO#','#FLAG_STOVE_NO#')
       ]]>
	</query>
	<query id="PlanFurnProduction.addPlnZyJgC" desc="查询加工线实际炉计划">
      <![CDATA[
      INSERT INTO PLN_ZY_JG_C
  (HEAT_PLAN_NO,
   HEAT_PLAN_SQE,
   JUGDE_APPLY_CODE,
   ZY_BATCH_ID,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   FLAG_STOVE_NO,
   USE_BL_NUM,
   USE_BL_WT,
   FEED_HEAT_NO)
VALUES
  ('#HEAT_PLAN_NO#',
   '#HEAT_PLAN_SQE#',
   '#JUGDE_APPLY_CODE#',
   '#ZY_BATCH_ID#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#BATCH_GROUD_NO#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#FLAG_STOVE_NO#',
   '#USE_BL_NUM#',
   '#USE_BL_WT#',
   '#FEED_HEAT_NO#')
       ]]>
	</query>
	<query id="PlanFurnProduction.updateMatBcMR" desc="修改热处理半成品库存Mat_BC_M材料状态">
      <![CDATA[   
DECLARE
BEGIN
  FOR MYROW IN (SELECT MAT_NO
                  FROM (SELECT T.MAT_NO
                          FROM MAT_BC_M T
                         WHERE NVL(T.JUGDE_APPLY_CODE,'/') = NVL(?,'/')
                           AND T.JUDGE_STOVE_NO = ?
                           AND T.BATCH_NO = ?
                           AND T.BATCH_GROUD_NO = ?
                           AND T.HEAT_PLAN_NO_NEXT = ?
                           AND T.NEXT_PROCESS_CDOE=?
                           AND T.QCM_STAUS='00'
                         ORDER BY T.MAT_NO ASC)
                 WHERE ROWNUM <= ?) LOOP
    UPDATE MAT_BC_M T
       SET T.HANGING_FLAG = ?, T.MAT_STATUS = ?,T.LOCK_LIKU='0'
     WHERE T.MAT_NO = MYROW.MAT_NO;
  END LOOP;
END;
      ]]>
	</query>
	<query id="PlanFurnProduction.updateMatBcDbkYc" desc="修改轧管半成品库存Mat_BC_M余材">
      <![CDATA[
      UPDATE MAT_BC_M T
   SET T.PRO_PLAN_ID_NEXT = '',
       T.GX_PLAN_NO_NEXT   = '',
       T.NEXT_PROCESS_CDOE='',
       T.NEXT_PROCESS_DESC='',
       T.HEAT_PLAN_NO_NEXT=''
 WHERE T.JUDGE_STOVE_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
   AND NVL(T.JUGDE_APPLY_CODE,'/') = NVL(?,'/')
   AND T.PROCESS_CDOE = ?
   AND T.HANGING_FLAG= '0'
         ]]>
	</query>
	<query id="PlanFurnProduction.QueryMatBcM" desc="查询库存信息">
      <![CDATA[
      SELECT STOVE_NO,
       JUDGE_STOVE_NO,
       PRODUCCODE,
       PRODUCNAME,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       ORDER_NO,
       ORDER_SEQ,
       ORDER_SEQ_NO,
       NEXT_PROCESS_CDOE,
       NEXT_PROCESS_DESC,
       ACT_DIMATER,
       ACT_HEIGHT,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK,
       HEAT_PLAN_NO,
       PRO_PLAN_ID_NEXT,
       GX_PLAN_NO_NEXT,
       PRO_ORDER_ID,
       GX_PLAN_NO,
       SUM(NVL(ACT_COUNT, 0)) ACT_COUNT,
       SUM(NVL(ACT_WEIGHT, 0)) ACT_WEIGHT,
       DECODE(CUT_NUM,'','1','0','1',CUT_NUM) CUT_NUM,
       FLAG_STOVE_NO_ZG,
       CIC
  FROM MAT_BC_M
 WHERE PRO_PLAN_ID_NEXT = ?
   AND GX_PLAN_NO_NEXT = ?
   AND JUDGE_STOVE_NO = ?
   --AND PROCESS_CDOE=?
   AND LOCK_FLAG = '0'
   AND HANGING_FLAG = '0'
   AND QCM_STAUS='00'
   GROUP BY 
   STOVE_NO,
       JUDGE_STOVE_NO,
       PRODUCCODE,
       PRODUCNAME,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       ORDER_NO,
       ORDER_SEQ,
       ORDER_SEQ_NO,
       NEXT_PROCESS_CDOE,
       NEXT_PROCESS_DESC,
       ACT_DIMATER,
       ACT_HEIGHT,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK,
       HEAT_PLAN_NO,
       PRO_PLAN_ID_NEXT,
       GX_PLAN_NO_NEXT,
       PRO_ORDER_ID,
       GX_PLAN_NO,CUT_NUM,FLAG_STOVE_NO_ZG,CIC
        ]]>
	</query>
	<query id="PlanFurnProduction.QueryMatBcH" desc="根据炉计划ID查询库存信息">
      <![CDATA[
      SELECT STOVE_NO,
       JUDGE_STOVE_NO,
       PRODUCCODE,
       PRODUCNAME,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       ORDER_NO,
       ORDER_SEQ,
       ORDER_SEQ_NO,
       NEXT_PROCESS_CDOE,
       NEXT_PROCESS_DESC,
       ACT_DIMATER,
       ACT_HEIGHT,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK,
       HEAT_PLAN_NO,
       PRO_PLAN_ID_NEXT,
       GX_PLAN_NO_NEXT,
       PRO_ORDER_ID,
       GX_PLAN_NO,
       SUM(NVL(ACT_COUNT, 0)) ACT_COUNT,
       SUM(NVL(ACT_WEIGHT, 0)) ACT_WEIGHT,
       DECODE(CUT_NUM,'','1','0','1',CUT_NUM) CUT_NUM,
       FLAG_STOVE_NO_ZG,
       HEAT_PLAN_NO_NEXT
  FROM MAT_BC_M
 WHERE PRO_ORDER_ID= ?
   AND JUDGE_STOVE_NO = ?
   AND LOCK_FLAG = '0'
   AND HANGING_FLAG = '0'
   AND QCM_STAUS='00'
   GROUP BY 
   STOVE_NO,
       JUDGE_STOVE_NO,
       PRODUCCODE,
       PRODUCNAME,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       ORDER_NO,
       ORDER_SEQ,
       ORDER_SEQ_NO,
       NEXT_PROCESS_CDOE,
       NEXT_PROCESS_DESC,
       ACT_DIMATER,
       ACT_HEIGHT,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK,
       HEAT_PLAN_NO,
       PRO_PLAN_ID_NEXT,
       GX_PLAN_NO_NEXT,
       PRO_ORDER_ID,
       GX_PLAN_NO,CUT_NUM,FLAG_STOVE_NO_ZG,HEAT_PLAN_NO_NEXT
        ]]>
	</query>
	<query id="PlanFurnProduction.QueryDbkGroup" desc="查询镦拔扩去向">
      <![CDATA[
      SELECT DECODE(T.ISENDGX,
              '1',
              (CASE
                WHEN D.TRANSIT_TYP = '110501' THEN
                 '汽运' || '  ' ||
                 (SELECT D1.DELVRY_ADDR
                    FROM SLM_ORDER_LINE_DELIVERY D1
                   WHERE D1.VALIDFLAG = '1'
                     AND INSTR(D1.DELVRY_ADDR, '客户库') > 0
                     AND D1.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK)
                WHEN D.TRANSIT_TYP = '110502' THEN
                 '铁运' || '  ' ||
                 (SELECT C.STATION_NM
                    FROM SLM_ORDER_DELIVERY_TRANSIT Y, SLM_BASE_STATION C
                   WHERE Y.VALIDFLAG = '1'
                     AND Y.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
                     AND Y.STATION_NO = C.STATION_NO
                     AND C.VALIDFLAG = '1'
                     AND Y.INDEX_SEQ = '1')
                ELSE
                (SELECT MAX(M.PLINE_NAME)
                    FROM PLN_GX_JG_M M, PLN_JG_AND_BL B
                   WHERE M.PRO_PLAN_ID = B.PRO_PLAN_ID
                     AND B.REQ_BL_ID = T.ORD_LN_DLY_PK)
              END),
              (CASE WHEN T.WHOLE_BACKLOG_DESC LIKE '%热处理%' THEN
                 (SELECT MAX(S3.PLINE_NAME)
                    FROM PLN_ORDER_RCL_S S3
                   WHERE S3.PREV_GXPLAN_ID= T.PRO_PLAN_ID )
                  WHEN T.WHOLE_BACKLOG_DESC LIKE '%加工%' THEN
                 (SELECT MAX(S3.PLINE_NAME)
                    FROM PLN_ORDER_JGX_S S3
                   WHERE S3.PREV_GXPLAN_ID= T.PRO_PLAN_ID)
                ELSE
                 ''
              END)) AF_INFO
  FROM PLN_ORDER_DBK_S T,
       (SELECT MIN(S.NEXT_GX) NEXT_GX,
               S.PRO_PLAN_ID,
               MIN(S.PLAN_GROUP_ID) PLAN_GROUP_ID
          FROM PLN_ORDER_DBK S
         GROUP BY S.PRO_PLAN_ID) T2,
       SLM_ORDER_LINE_DELIVERY D
 WHERE T.PRO_PLAN_ID = T2.PRO_PLAN_ID(+)
   AND T.ORD_LN_DLY_PK = D.ORD_LN_DLY_PK(+)
   AND T.PLINE_CODE = ?
   AND T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
        ]]>
	</query>
	<query id="PlanFurnProduction.QueryRclGroup" desc="查询热处理去向">
      <![CDATA[
     SELECT (CASE
         WHEN T.ORD_LN_DLY_PK LIKE '%ZZBY-%' AND
              T.WHOLE_BACKLOG_DESC NOT LIKE '%加工%' THEN
          (SELECT MAX(M.PLINE_NAME)
             FROM PLN_GX_JG_M M, PLN_JG_AND_BL B
            WHERE M.PRO_PLAN_ID = B.PRO_PLAN_ID
              AND B.REQ_BL_ID = T.ORD_LN_DLY_PK)
         ELSE
          DECODE(T.ISENDGX,
                 '1',
                 (CASE
                   WHEN D.TRANSIT_TYP = '110501' THEN
                    '汽运' || '  ' ||
                    (SELECT D1.DELVRY_ADDR
                       FROM SLM_ORDER_LINE_DELIVERY D1
                      WHERE D1.VALIDFLAG = '1'
                        AND INSTR(D1.DELVRY_ADDR, '客户库') > 0
                        AND D1.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK)
                   WHEN D.TRANSIT_TYP = '110502' THEN
                    '铁运' || '  ' ||
                    (SELECT C.STATION_NM
                       FROM SLM_ORDER_DELIVERY_TRANSIT Y, SLM_BASE_STATION C
                      WHERE Y.VALIDFLAG = '1'
                        AND Y.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
                        AND Y.STATION_NO = C.STATION_NO
                        AND C.VALIDFLAG = '1'
                        AND Y.INDEX_SEQ = '1')
                   ELSE
                    (SELECT MAX(M.PLINE_NAME)
                       FROM PLN_GX_JG_M M, PLN_JG_AND_BL B
                      WHERE M.PRO_PLAN_ID = B.PRO_PLAN_ID
                        AND B.REQ_BL_ID = T.ORD_LN_DLY_PK)
                 END),
                 (CASE
                   WHEN T.WHOLE_BACKLOG_DESC LIKE '%加工%' THEN
                    (SELECT MAX(S3.PLINE_NAME)
                       FROM PLN_ORDER_JGX_S S3
                      WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                   ELSE
                    ''
                 END))
       END) AF_INFO
  FROM PLN_ORDER_RCL_S T,
       (SELECT MIN(S.NEXT_GX) NEXT_GX,
               S.PRO_PLAN_ID,
               MIN(S.PLAN_GROUP_ID) PLAN_GROUP_ID
          FROM PLN_ORDER_RCL S
         GROUP BY S.PRO_PLAN_ID) T2,
       SLM_ORDER_LINE_DELIVERY D
 WHERE T.PRO_PLAN_ID = T2.PRO_PLAN_ID(+)
   AND T.ORD_LN_DLY_PK = D.ORD_LN_DLY_PK(+)
   AND T.PLINE_CODE = ?
   AND T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
        ]]>
	</query>
	<query id="PlanFurnProduction.QueryJgxGroup" desc="查询加工线去向">
      <![CDATA[
      SELECT CASE
         WHEN D.TRANSIT_TYP = '110501' THEN
          '汽运' || '  ' ||
          (SELECT D1.DELVRY_ADDR
             FROM SLM_ORDER_LINE_DELIVERY D1
            WHERE D1.VALIDFLAG = '1'
              AND INSTR(D1.DELVRY_ADDR, '客户库') > 0
              AND D1.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK)
         WHEN D.TRANSIT_TYP = '110502' THEN
          '铁运' || '  ' ||
          (SELECT C.STATION_NM
             FROM SLM_ORDER_DELIVERY_TRANSIT Y, SLM_BASE_STATION C
            WHERE Y.VALIDFLAG = '1'
              AND Y.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
              AND Y.STATION_NO = C.STATION_NO
              AND C.VALIDFLAG = '1'
              AND Y.INDEX_SEQ = '1')
         ELSE
          (SELECT  MAX(M.PLINE_NAME)
                    FROM PLN_GX_JG_M M, PLN_JG_AND_BL B
                   WHERE M.PRO_PLAN_ID = B.PRO_PLAN_ID
                     AND B.REQ_BL_ID = T.ORD_LN_DLY_PK)
       END AF_INFO
  FROM PLN_ORDER_JGX_S T,
       (SELECT MIN(S.NEXT_GX) NEXT_GX,
               S.PRO_PLAN_ID,
               MIN(S.PLAN_GROUP_ID) PLAN_GROUP_ID
          FROM PLN_ORDER_JGX S
         GROUP BY S.PRO_PLAN_ID) T2,
       SLM_ORDER_LINE_DELIVERY D
 WHERE T.PRO_PLAN_ID = T2.PRO_PLAN_ID(+)
   AND T.ORD_LN_DLY_PK = D.ORD_LN_DLY_PK(+)
   AND T.PLINE_CODE = ?
   AND T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
        ]]>
	</query>
	<query id="PlanFurnProduction.QueryWgZg" desc="外购查询轧管信息">
      <![CDATA[
      SELECT T.ZY_BATCH_ID,
       T.ORIGINAL_NUMBER,
       T.Output_Standard,
       T.PROD_STANDARD,
       T1.PROCESS_SEQ,
       (SELECT S1.CRAFT_PATH
          FROM CRAFT_FILE_LV2 S1
         WHERE INSTR(T2.CRAFT_FILE_LV2_D, S1.PK) > 0
           AND INSTR(S1.PLINE_CODE, T.PLINE_CODE) > 0
           AND S1.VALIDFLAG = '1'
           AND S1.PROCESS_CODE = 'D') SEC_CRAFT_FILE_NO
  FROM PLN_ORDER_ZG_S T,
       PLN_SALEORD_PROC T1,
       (SELECT Q2.CRAFT_FILE_LV2_D, Q1.ORD_LN_DLY_PK
          FROM PLN_SALEORD Q1, CRAFT_ORD_DESIGN Q2
         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK(+)
           AND Q2.VALIDFLAG(+) = '1') T2
 WHERE T1.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
   AND T1.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID
   AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK(+)
   AND T.ORD_LN_DLY_PK = ?
 ORDER BY TO_NUMBER(T.GX_PRO_SEQ) DESC
        ]]>
	</query>
	<query id="PlanFurnProduction.queryMrialBom" desc="通过Bom查询下工序投入产出">
      <![CDATA[
      SELECT T.*
  FROM SLM_ORD_DESIGN_BOM T,
       CRAFT_ORD_LINE_BOM T1,
       CRAFT_ORD_DESIGN   T2,
       PLN_SALEORD        T3
 WHERE T.BOM = T1.BOM
   AND T1.DESGIN_KEY = T2.DESGIN_KEY
   AND T2.ORD_LN_PK = T3.ORD_LN_PK
   --AND T2.VALIDFLAG != '0'
   -- AND T.BOM = ?
   AND T.MSC_PLINE = ?
   AND T3.ORD_LN_DLY_PK = ?
   AND T.GRADECODE=?
       ]]>
	</query>
	<query id="PlanFurnProduction.getQueryBomJgx" desc="通过Bom查询下工序投入产出">
      <![CDATA[
      SELECT T.*
  FROM SLM_ORD_DESIGN_BOM_K T,
       CRAFT_ORD_LINE_BOM   T1,
       CRAFT_ORD_DESIGN     T2,
       PLN_SALEORD          T3
 WHERE T.BOM = T1.BOM
   AND T1.DESGIN_KEY = T2.DESGIN_KEY
   AND T2.ORD_LN_PK = T3.ORD_LN_PK
   AND T3.ORD_LN_DLY_PK = ?
   AND T.IN_MATERIAL_NO=?
      
        ]]>
	</query>
	<query id="PlanFurnProduction.queryCodeJg" desc="查询接箍基础信息">
      <![CDATA[
      SELECT T.STYLE_JG,
       T.DIAMETER,
       T.CHECK_J_VAL,
       T.DIAMETER_JG,
       T.HEIGHT_JG,
       T.LENGTH_JG,
       T.WEIGHT_JG,
       T.PRODUCCODE_JG,
       T.PRODUCCODE_JG_DESC,
       T.STD_CODE,T.STD_NAME,
       T.STD_STYLE,T.STD_STYLE_DESC 
  FROM COM_MSC_JG T
 WHERE T.CODE_JG = ?
   AND T.VALIDFLAG = '1'
       ]]>
	</query>
	<query id="PlanFurnProduction.addPlnZyJg" desc="查询接箍炉计划">
      <![CDATA[
      INSERT INTO PLN_ZY_JG_M
  (HEAT_PLAN_NO,
   PRO_PLAN_ID,
   JG_GROUP_ID,
   GX_PLAN_NO,
   JUDGE_STOVE_NO,
   PLINE_CODE,
   PLINE_NAME,
   CODE_JG_BL,
   BL_WL_ID,
   BL_WL_DESC,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   MIN_D,
   MIN_H,
   AIMLENGTH_BL,
   AIM_CUT_LEN,
   LENGTH_MIN,
   LENGTH_MAX,
   TAPER,
   CODE_JG,
   MODEL_CODE,
   MODEL_DESC,
   OUTDIAMETER,
   WALLTHICK,
   SPEC_JG,
   SPEC_JG_DESC,
   STYLE_JG,
   DIAMETER,
   CHECK_J_VAL,
   AIMLENGTH,
   SINGLEWEIGHT,
   COAT_TYPE,
   PLAN_JG_NUM,
   PLAN_BL_NUM,
   PLAN_BL_WT,
   MONITORDEMAND,
   IF_MONITOR_JG,
   PRDCR_NO,
   CUT_MACH_GRP_NO,
   CUT_MACH_GRP_NM,
   DEMAND_COPPER,
   LATHE_GRP_NO,
   LATHE_GRP_NM,
   DEMAND_DETECTION,
   DEMAND_BLAST,
   DEMAND_BONDERIZING,
   PLANSTATUS,
   MEMO,
   CREATE_NAME,
   CREATE_TIME,
   CRAFT_FILE_NO,
   CRAFT_SEQ,
   ORD_LN_DLY_PK,
   SINGLE_CUT_NUN,
   IF_MATCH_ODD,
   IF_DO_HEAT_PLAN,
   OUTWL_ID,
   OUTWL_DESC,
   STOVE_NO,
   FLAG_STOVE_NO,
   GX_PRO_SEQ,
   PRO_DAY,
   BAL_YEAR_MONTH,
   PROD_STANDARD,
   OUTPUT_STANDARD,UPPER_HEATPLAN_ID,UPPER_PROCESS_CODE,
   STD_CODE,STD_NAME,STD_STYLE,STD_STYLE_DESC,PRODUCCODE_JG,PRODUCCODE_JG_DESC,FEED_HEAT_NO)
VALUES
  ('#HEAT_PLAN_NO#',
   '#PRO_PLAN_ID#',
   '#JG_GROUP_ID#',
   '#GX_PLAN_NO#',
   '#JUDGE_STOVE_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#CODE_JG_BL#',
   '#BL_WL_ID#',
   '#BL_WL_DESC#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#MIN_D#',
   '#MIN_H#',
   '#AIMLENGTH_BL#',
   '#AIM_CUT_LEN#',
   '#LENGTH_MIN#',
   '#LENGTH_MAX#',
   '#TAPER#',
   '#CODE_JG#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#OUTDIAMETER#',
   '#WALLTHICK#',
   '#SPEC_JG#',
   '#SPEC_JG_DESC#',
   '#STYLE_JG#',
   '#DIAMETER#',
   '#CHECK_J_VAL#',
   '#AIMLENGTH#',
   '#SINGLEWEIGHT#',
   '#COAT_TYPE#',
   '#PLAN_JG_NUM#',
   '#PLAN_BL_NUM#',
   '#PLAN_BL_WT#',
   '#MONITORDEMAND#',
   '#IF_MONITOR_JG#',
   '#PRDCR_NO#',
   '#CUT_MACH_GRP_NO#',
   '#CUT_MACH_GRP_NM#',
   '#DEMAND_COPPER#',
   '#LATHE_GRP_NO#',
   '#LATHE_GRP_NM#',
   '#DEMAND_DETECTION#',
   '#DEMAND_BLAST#',
   '#DEMAND_BONDERIZING#',
   '#PLANSTATUS#',
   '#MEMO#',
   '#CREATE_NAME#',
   TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#CRAFT_FILE_NO#',
   '#CRAFT_SEQ#',
   '#ORD_LN_DLY_PK#',
   '#SINGLE_CUT_NUN#',
   '#IF_MATCH_ODD#',
   '#IF_DO_HEAT_PLAN#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#STOVE_NO#',
   '#FLAG_STOVE_NO#',
   '#GX_PRO_SEQ#',
   '#PRO_DAY#',
   '#BAL_YEAR_MONTH#',
   '#PROD_STANDARD#',
   '#OUTPUT_STANDARD#','#UPPER_HEATPLAN_ID#','#UPPER_PROCESS_CODE#',
   '#STD_CODE#','#STD_NAME#','#STD_STYLE#','#STD_STYLE_DESC#',
   '#PRODUCCODE_JG#','#PRODUCCODE_JG_DESC#','#FEED_HEAT_NO#')
          ]]>
	</query>
</queryMap>