<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="排产公共类">

	<query id="ProducHelperBean.getPlanOrderB" desc="查询铸造排产">
             <![CDATA[
             SELECT T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.GPREQ_ID,
       T.GPTYPE,
       T.CASTINGTYPE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.PLINE_CODE_A,
       T.PLINE_NAME_A,
       T.GRADECODE,
       T.GRADENAME,
       T.DIAMETER_LZ,
       T.LEN_GP_SINGLE,
       T.CUT_NUM_GP,
       T.CUT_LOSE_LEN,
       T.LENGTH_LZ,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.WLID_IN,
       T.WLDESC_IN,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.IF_MONITOR_LG,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.WT_CAST_ONE,
       NVL(T.PLAN_WT_S,0) PLAN_WT_S,
       NVL(T.PLAN_NUM_S,0) PLAN_NUM_S,
       T.CAST_NUM_CALC,
       T.FURNACE_NUM_CALC,
       T.FURNACE_WT,
       T.GX_PRO_SEQ,
       T.PRO_MONTH,
       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,
        NVL(T.PLANED_WT,0) PLANED_WT,
        NVL(T.PLANED_NUM,0) PLANED_NUM,
       T.FINISHWEIGHT,
       T.FINISH_NUM,
       T.EXE_STATUS,
       T.IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       T.IS_PLAN_OK,
       T.CAST_NUM,
       T.FURNACE_NUM,
       T.ADD_WT_BEGIN,
       T.ADD_WT_END,
       T.IF_CONNECT_AHEAD,
       T.ADD_WT_AHEAD,
       T.IF_CONNECT_NEXT,
       T.ADD_WT_NEXT,
       T.MEMO,
       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,
       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.PROCESSING_COST_A,
       T.TOTAL_COST_A,
       T.PROCESSING_COST_B,
       T.TOTAL_COST_B,
       NVL(T.PLAN_WT_MIN,0) PLAN_WT_MIN,
       T.CRAFT_NO,T.GOWHERE_NAME,T.GOWHERE_CODE,T.STEEL_JUDGEMENT,
       NVL(T.PLAN_WT_SOLD,0) PLAN_WT_SOLD,
       NVL(T.PLAN_NUM_SOLD,0) PLAN_NUM_SOLD,T.CRAFT_PATH,T.IF_CONFIRM,T.IF_AMOUNT
  FROM PLN_ORDER_CAST_S T
 WHERE 1=1
               ]]>
	</query>

	<query id="ProducHelperBean.getPlanOrderC" desc="查询锻造排产">
             <![CDATA[  
             SELECT T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.CASTINGTYPE,
       T.GRADECODE,
       T.GRADENAME,
       T.DIAMETER_OUT,
       T.LENGTH_OUT,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.OUT_WT_ONE,
       T.OUT_WT_TOT,
       T.OUT_NUM_TOT,
       T.DIAMETER_IN,
       T.LENGTH_IN,
       T.WT_ONE_IN,
       T.WLID_IN,
       T.WLDESC_IN,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       T.DZ_LOSE_ADD,
       T.DZ_CUT_HEAD_END,
       T.DZ_BURN_LOSE,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.GX_PRO_SEQ,
       T.PRO_MONTH,
       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.IS_PLAN_OK,
       T.ZY_BATCH_ID,
       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.PROCESSING_COST,
       T.TOTAL_COST
  FROM PLN_ORDER_DZ_S T
 WHERE 1=1
               ]]>
	</query>

	<query id="ProducHelperBean.getPlanOrderD" 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.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHDISC,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.LEN_ROLL_MAX,
       T.LEN_ROLL_MIN,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.DIAMETER_GP,
       T.LEN_GP_SINGLE,
       T.ROLL_LENGTH,
       T.LEN_CUTHEAD,
       T.LEN_CUTEND,
       T.OUTNUM_CUT,
       T.DIAMETER_MANDREL,
       T.PASS_CODE,
       T.PASS_NAME,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       T.ISENDGX,
       T.IF_MONITOR_ZG,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.PRO_MONTH,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       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.IS_PLAN_OK,
       T.GPREQ_IF_OK,
       T.GPREQ_ID,
       T.ZY_BATCH_ID,
       T.CIC_GROUP_GP,
       T.PIC_GROUP_GP,
       T.SIC_GROUP_GP,
       T.DIC_GROUP_GP,
       T.WIC_GROUP_GP,
       T.GIC_GROUP_GP,
       T.CIC_GP,
       T.PIC_GP,
       T.SIC_GP,
       T.DIC_GP,
       T.WIC_GP,
       T.GIC_GP,
       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.OUTDIAMETER_ZG,
       T.WALLTHICK_ZG,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       T.WHOLE_BACKLOG_DESC,
       T.IF_CRAFT_LOCKED,
       T.IF_LEN_CONTROL,
       T.IF_MINUS_SIC_ROLL,
       T.AIMWALLTHICK_OLD,
       T.WEIGTH_S_OLD,
       T.NUM_S_OLD,
       T.WALL_UPDATE_USER,
       TO_CHAR(T.WALL_UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') WALL_UPDATE_TIME,
       NVL(T.TUBE_END_RATIO,0) TUBE_END_RATIO,
       NVL(T.GPREQ_NUM,0) GPREQ_NUM,
       NVL(T.GPREQ_WEIGHT,0) GPREQ_WEIGHT,
       T.VERIFY1,
       T.VERIFY2,
       T.VERIFY3,
       NVL(T.WEIGTH_S_MIN,0) WEIGTH_S_MIN,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       NVL(T.PLANS_NUM,0) PLANS_NUM,
       T.ORIGINAL_NUMBER,
       T.PROD_STANDARD,
       T.OUTPUT_STANDARD,
       T.THICKNESS_WALL,
       T.DECISION,
       T.PROGY_MEMO,
       T.OUTS_BILLET_FL,
       T.APPLY_NO,
       T.APPLY_STATUS,
       T.ISSUED_MEMO,
       T.ACTUAL_WEIGHT,T.PLINE_CODE_ZZ,T.PLINE_NAME_ZZ,T.GPREQ_IF_DZ,
       T.GRADECODE_LK,
       T.GRADENAME_LK,
       T.CIC_GROUP_LK,
       NVL(T.GPREQ_WEIGHT_MIN,0) GPREQ_WEIGHT_MIN
  FROM PLN_ORDER_ZG_S T
 WHERE 1 = 1
               ]]>
	</query>

	<query id="ProducHelperBean.getPlanOrderE" desc="查询镦拔扩排产">
             <![CDATA[
  
SELECT (CASE
         WHEN (SELECT COUNT(1)
                 FROM PLN_ZY_DBK_C Z1
                WHERE Z1.PRO_PLAN_ID = T.PRO_PLAN_ID
                  AND Z1.GX_PLAN_NO = T.GX_PLAN_NO) > 0 THEN
          'Y'
         ELSE
          ''
       END) IF_ZY_READY,
       (CASE
         WHEN (SELECT COUNT(1)
                 FROM PLN_ZY_DBK_M Z1
                WHERE Z1.PRO_PLAN_ID = T.PRO_PLAN_ID
                  AND Z1.GX_PLAN_NO = T.GX_PLAN_NO) > 0 THEN
          'Y'
         ELSE
          ''
       END) IF_ZY_M,
       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.REAL_BATCH_WT,
       T.REAL_BATCH_NUM,
       T.IF_STOVE_ISSUED,
       TO_CHAR(T.STOVE_ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') STOVE_ISSUED_TIME,
       T.STOVE_ISSUED_MAN,
       T1.MODEL_DESC,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       T.WHOLE_BACKLOG_DESC,
       T.IF_CRAFT_LOCKED, 
       NVL(T.WEIGTH_S_MIN,0) WEIGTH_S_MIN,
       T.PRIORITY,
       T.PRIORITY_MEMO,T.PROCESS_CODE_C,T.PROCESS_DESC_C,T.DECISION,T.FINAL_USER_DESC,T.PASS_CODE,T.PASS_NAME
  FROM PLN_ORDER_DBK_S T,
       (SELECT Q1.DELVRY_RANGE_TPE,
               Q1.DELVRY_RANGE_MAX,
               Q1.DELVRY_RANGE_MIN,
               Q1.MODEL_DESC,
               Q2.DELVRY_QTY,
               Q2.ORD_LN_DLY_PK
          FROM SLM_ORDER_LINE Q1, SLM_ORDER_LINE_DELIVERY Q2
         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK) T1
 WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK(+)
               ]]>
	</query>

	<query id="ProducHelperBean.getPlanOrderF" 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,
       T.PROGY_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.GROUP_RCL,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       T.WHOLE_BACKLOG_DESC,
       T.IF_CRAFT_LOCKED, 
       NVL(T.WEIGTH_S_MIN,0) WEIGTH_S_MIN,
       T.PRIORITY,
       T.PRIORITY_MEMO,T.DECISION,T.PRDCR_ADVC_DAY,T.IF_STOVE_ISSUED
  FROM PLN_ORDER_RCL_S T
 WHERE 1=1
               ]]>
	</query>

	<query id="ProducHelperBean.getPlanOrderG" 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.STEELCODE,
       T.STEELNAME,
       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.MODEL_CODE,
       T.MODEL_DESC,
       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') 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,
       T.GROUP_JGX,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       T.IF_CRAFT_LOCKED,T.DECISION,T.IF_STOVE_ISSUED
  FROM PLN_ORDER_JGX_S T
 WHERE 1=1
               ]]>
	</query>


	<query id="ProducHelperBean.getPlanOrderH" desc="查询接箍排产">
             <![CDATA[
        SELECT T.PRO_PLAN_ID,
       T.JG_GROUP_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.GX_PRO_SEQ,
       T.CODE_JG,
       T.SPEC_JG_DESC,
       T.CODE_JG_BL,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.BL_WL_ID,
       T.BL_WL_DESC,
       T.MIN_D,
       T.MIN_H,
       T.AIMLENGTH_BL,
       T.AIM_CUT_LEN,
       T.LENGTH_MIN,
       T.LENGTH_MAX,
       T.TAPER,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.DEMAND_DETECTION,
       T.DEMAND_BONDERIZING,
       T.DEMAND_COPPER,
       T.DEMAND_BLAST,
       T.GROUP_NUM_S,
       NVL(T.SINGLE_CUT_NUN,0) SINGLE_CUT_NUN,
       T.GROUP_BL_NUM_S,
       T.GROUP_BL_WT_S,
       T.IS_PLAN_OK,
       T.MATCHNUM_JG,
       T.PRO_MONTH,
       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.MATCHWT_BL,
       T.MATCHNUM_BL,
       T.BATCHED_WT,
       T.BATCHED_NUM,
       T.BATCHED_NUM_OUT,
       T.REAL_BATCHED_WT,
       T.REAL_BATCHED_NUM,
       T.PRODUCED_NUM,
       T.EXE_STATUS,
       T.IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       T.IS_STOVE_ISSUED,
       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.PROCESSING_COST,
       T.TOTAL_COST,
       T.IF_MONITOR_JG,
       T.PRDCR_NO,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       TO_CHAR(T.STOVE_ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') STOVE_ISSUED_TIME,
       T.STOVE_ISSUED_MAN,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       T.SPEC_JG,
       T.GROUP_WT_S,
       T.REQ_BL_ID,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.MONITOR_POINT,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.VERSION_NO,
       T.STYLE_JG,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.PRODUCCODE_JG,
       T.PRODUCCODE_JG_DESC,
       T.CODE_BL_ALL,T.MEMO,T.ORDER_SOURCE,T.IF_MONITOR_BL,T.DECISION
  FROM PLN_GX_JG_PROP_S T
 WHERE 1 = 1
               ]]>
	</query>


	<query id="ProducHelperBean.updatePlanOrderB" desc="修改铸造排产">
             <![CDATA[
             UPDATE PLN_ORDER_CAST_S T
   SET T.PLINE_CODE       = '#PLINE_CODE#',
       T.PLINE_NAME       = '#PLINE_NAME#',
       T.PLAN_WT_S        = '#PLAN_WT_S#',
       T.PLAN_NUM_S       = '#PLAN_NUM_S#',
       T.GX_PRO_SEQ       = '#GX_PRO_SEQ#',
       T.PLAN_USETIME     = '#PLAN_USETIME#',
       T.PLAN_TIME_B      = TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
       T.PLAN_TIME_E      = TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
       T.EXE_STATUS       = '#EXE_STATUS#',
       T.IS_REPAIR_PLN    = '#IS_REPAIR_PLN#',
       T.REPAIR_TYPE      = '#REPAIR_TYPE#',
       T.IS_PLAN_OK       = '#IS_PLAN_OK#',
       T.ISSUED_TIME      = TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
       T.ISSUED_MAN       = '#ISSUED_MAN#',
       T.LAST_UNDOWN_TIME = TO_DATE('#LAST_UNDOWN_TIME#','YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = '#LAST_UNDOWN_MAN#',
       T.PLINE_CODE_A     ='#PLINE_CODE_A#',
       T.PLINE_NAME_A     ='#PLINE_NAME_A#',
       T.PLAN_WT_MIN     ='#PLAN_WT_MIN#',
       T.CRAFT_NO = '#CRAFT_NO#'
 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
   AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
               ]]>
	</query>

	<query id="ProducHelperBean.updatePlanOrderC" desc="修改锻造排产">
             <![CDATA[  
             UPDATE PLN_ORDER_DZ_S T
   SET T.PLINE_CODE       = '#PLINE_CODE#',
       T.PLINE_NAME       = '#PLINE_NAME#',
       T.WEIGTH_S         = '#WEIGTH_S#',
       T.NUM_S            = '#NUM_S#',
       T.GX_PRO_SEQ       = '#GX_PRO_SEQ#',
       T.PLAN_USETIME     = '#PLAN_USETIME#',
       T.PLAN_TIME_B      = TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
       T.PLAN_TIME_E      = TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
       T.EXE_STATUS       = '#EXE_STATUS#',
       T.IS_REPAIR_PLN    = '#IS_REPAIR_PLN#',
       T.REPAIR_TYPE      = '#REPAIR_TYPE#',
       T.IS_PLAN_OK       = '#IS_PLAN_OK#',
       T.ISSUED_TIME      = TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
       T.ISSUED_MAN       = '#ISSUED_MAN#',
       T.LAST_UNDOWN_TIME = TO_DATE('#LAST_UNDOWN_TIME#',
                                    'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = '#LAST_UNDOWN_MAN#'
 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
   AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
               ]]>
	</query>

	<query id="ProducHelperBean.updatePlanOrderD" desc="修改轧管排产">
             <![CDATA[
             UPDATE PLN_ORDER_ZG_S T
   SET T.PLINE_CODE       = '#PLINE_CODE#',
       T.PLINE_NAME       = '#PLINE_NAME#',
       T.WEIGTH_S         = '#WEIGTH_S#',
       T.NUM_S            = '#NUM_S#',
       T.GX_PRO_SEQ       = '#GX_PRO_SEQ#',
       T.PLAN_USETIME     = '#PLAN_USETIME#',
       T.PLAN_TIME_B      = TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
       T.PLAN_TIME_E      = TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
       T.EXE_STATUS       = '#EXE_STATUS#',
       T.IS_REPAIR_PLN    = '#IS_REPAIR_PLN#',
       T.REPAIR_TYPE      = '#REPAIR_TYPE#',
       T.IS_PLAN_OK       = '#IS_PLAN_OK#',
       T.ISSUED_TIME      = TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
       T.ISSUED_MAN       = '#ISSUED_MAN#',
       T.LAST_UNDOWN_TIME = TO_DATE('#LAST_UNDOWN_TIME#',
                                    'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = '#LAST_UNDOWN_MAN#',
       T.IN_WEIGHT_S      = '#IN_WEIGHT_S#',
       T.IN_NUM_S         = '#IN_NUM_S#',
       T.ADD_WT_IN        = '#ADD_WT_IN#',
       T.ADD_NUM_IN       = '#ADD_NUM_IN#',
       T.MATCH_WT_IN      = '#MATCH_WT_IN#',
       T.MATCH_NUM_IN     = '#MATCH_NUM_IN#',
       T.BATCHED_WT       = '#BATCHED_WT#',
       T.BATCHED_NUM      = '#BATCHED_NUM#',
       T.GPREQ_NUM ='#GPREQ_NUM#',
       T.GPREQ_WEIGHT='#GPREQ_WEIGHT#',
       T.WEIGTH_S_MIN='#WEIGTH_S_MIN#',
       T.PLANS_NUM=   '#PLANS_NUM#',
       T.ORIGINAL_NUMBER='#ORIGINAL_NUMBER#',
       T.ACTUAL_WEIGHT     ='#ACTUAL_WEIGHT#',
       T.GPREQ_WEIGHT_MIN     ='#GPREQ_WEIGHT_MIN#'
 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
   AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
               ]]>
	</query>
	<query id="ProducHelperBean.updatePlanOrderDStratFin" desc="手动设置生产完成">
             <![CDATA[
             UPDATE PLN_ORDER_ZG_S T
   SET T.GX_PRO_SEQ       = '#GX_PRO_SEQ#',
       T.PLAN_USETIME     = '#PLAN_USETIME#',
       T.PLAN_TIME_B      = TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
       T.PLAN_TIME_E      = TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
       T.EXE_STATUS       = '#EXE_STATUS#',
       T.MEMO             ='#MEMO#',
       T.ZY_BATCH_ID ='#ZY_BATCH_ID#'
 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
   AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
               ]]>
	</query>
	<query id="ProducHelperBean.updatePlanOrderE" desc="修改镦拔扩排产">
             <![CDATA[  
UPDATE PLN_ORDER_DBK_S T
   SET T.PLINE_CODE       = '#PLINE_CODE#',
       T.PLINE_NAME       = '#PLINE_NAME#',
       T.WEIGTH_S         = '#WEIGTH_S#',
       T.NUM_S            = '#NUM_S#',
       T.GX_PRO_SEQ       = '#GX_PRO_SEQ#',
       T.PLAN_USETIME     = '#PLAN_USETIME#',
       T.PLAN_TIME_B      = TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
       T.PLAN_TIME_E      = TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
       T.EXE_STATUS       = '#EXE_STATUS#',
       T.IS_REPAIR_PLN    = '#IS_REPAIR_PLN#',
       T.REPAIR_TYPE      = '#REPAIR_TYPE#',
       T.IS_PLAN_OK       = '#IS_PLAN_OK#',
       T.ISSUED_TIME      = TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
       T.ISSUED_MAN       = '#ISSUED_MAN#',
       T.LAST_UNDOWN_TIME = TO_DATE('#LAST_UNDOWN_TIME#',
                                    'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = '#LAST_UNDOWN_MAN#',
       T.MEMO             = '#MEMO#',
       T.IN_WEIGHT_S      = '#IN_WEIGHT_S#',
       T.IN_NUM_S         = '#IN_NUM_S#',
       T.ADD_WT_IN        = '#ADD_WT_IN#',
       T.ADD_NUM_IN       = '#ADD_NUM_IN#',
       T.WEIGTH_S_MIN     ='#WEIGTH_S_MIN#'
 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
   AND T.GX_PLAN_NO = '#GX_PLAN_NO#'

               ]]>
	</query>

	<query id="ProducHelperBean.updatePlanOrderF" desc="修改热处理排产">
             <![CDATA[
             UPDATE PLN_ORDER_RCL_S T
   SET T.PLINE_CODE       = '#PLINE_CODE#',
       T.PLINE_NAME       = '#PLINE_NAME#',
       T.WEIGTH_S         = '#WEIGTH_S#',
       T.NUM_S            = '#NUM_S#',
       T.GX_PRO_SEQ       = '#GX_PRO_SEQ#',
       T.PLAN_USETIME     = '#PLAN_USETIME#',
       T.PLAN_TIME_B      = TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
       T.PLAN_TIME_E      = TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
       T.EXE_STATUS       = '#EXE_STATUS#',
       T.IS_REPAIR_PLN    = '#IS_REPAIR_PLN#',
       T.REPAIR_TYPE      = '#REPAIR_TYPE#',
       T.IS_PLAN_OK       = '#IS_PLAN_OK#',
       T.ISSUED_TIME      = TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
       T.ISSUED_MAN       = '#ISSUED_MAN#',
       T.LAST_UNDOWN_TIME = TO_DATE('#LAST_UNDOWN_TIME#',
                                    'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = '#LAST_UNDOWN_MAN#',
       T.MEMO             = '#MEMO#',
       T.PROGY_MEMO             = '#PROGY_MEMO#',
       T.IN_WEIGHT_S      = '#IN_WEIGHT_S#',
       T.IN_NUM_S         = '#IN_NUM_S#',
       T.ADD_WT_IN        = '#ADD_WT_IN#',
       T.ADD_NUM_IN       = '#ADD_NUM_IN#',
       T.WEIGTH_S_MIN     ='#WEIGTH_S_MIN#',
       T.GROUP_RCL        ='#GROUP_RCL#'
 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
   AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
               ]]>
	</query>

	<query id="ProducHelperBean.updatePlanOrderG" desc="修改加工排产">
             <![CDATA[  
             UPDATE PLN_ORDER_JGX_S T
   SET T.PLINE_CODE       = '#PLINE_CODE#',
       T.PLINE_NAME       = '#PLINE_NAME#',
       T.WEIGTH_S         = '#WEIGTH_S#',
       T.NUM_S            = '#NUM_S#',
       T.GX_PRO_SEQ       = '#GX_PRO_SEQ#',
       T.PLAN_USETIME     = '#PLAN_USETIME#',
       T.PLAN_TIME_B      = TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
       T.PLAN_TIME_E      = TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
       T.EXE_STATUS       = '#EXE_STATUS#',
       T.IS_REPAIR_PLN    = '#IS_REPAIR_PLN#',
       T.REPAIR_TYPE      = '#REPAIR_TYPE#',
       T.IS_PLAN_OK       = '#IS_PLAN_OK#',
       T.ISSUED_TIME      = TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
       T.ISSUED_MAN       = '#ISSUED_MAN#',
       T.LAST_UNDOWN_TIME = TO_DATE('#LAST_UNDOWN_TIME#',
                                    'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = '#LAST_UNDOWN_MAN#',
       T.MEMO             = '#MEMO#',
        T.IN_WEIGHT_S      = '#IN_WEIGHT_S#',
       T.IN_NUM_S         = '#IN_NUM_S#',
       T.ADD_WT_IN        = '#ADD_WT_IN#',
       T.ADD_NUM_IN       = '#ADD_NUM_IN#',
       T.GROUP_JGX        ='#GROUP_JGX#'
 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
   AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
               ]]>
	</query>

	<query id="ProducHelperBean.updatePlanOrderH" desc="修改接箍排产">
             <![CDATA[  
             UPDATE PLN_GX_JG_PROP_S T
   SET T.PLINE_CODE       = '#PLINE_CODE#',
       T.PLINE_NAME       = '#PLINE_NAME#',
       T.GX_PRO_SEQ      = '#GX_PRO_SEQ#',
       T.GROUP_NUM_S      = '#GROUP_NUM_S#',
       T.GROUP_WT_S      = '#GROUP_WT_S#',
       T.GROUP_BL_NUM_S   = '#GROUP_BL_NUM_S#',
       T.GROUP_BL_WT_S    = '#GROUP_BL_WT_S#',
       T.IS_PLAN_OK       = '#IS_PLAN_OK#',
       T.PLAN_USETIME     = '#PLAN_USETIME#',
       T.PLAN_TIME_B      = TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
       T.PLAN_TIME_E      = TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
       T.BATCHED_NUM_OUT  = '#BATCHED_NUM_OUT#',
       T.EXE_STATUS       = '#EXE_STATUS#',
       T.IS_REPAIR_PLN    = '#IS_REPAIR_PLN#',
       T.REPAIR_TYPE      = '#REPAIR_TYPE#',
       T.ISSUED_TIME      = TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
       T.ISSUED_MAN       = '#ISSUED_MAN#',
       T.LAST_UNDOWN_TIME = TO_DATE('#LAST_UNDOWN_TIME#',
                                    'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = '#LAST_UNDOWN_MAN#',
       T.MEMO             = '#MEMO#'
 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
   AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
               ]]>
	</query>

	<query id="ProducHelperBean.deletePlanOrderB" desc="删除铸造排产">
             <![CDATA[  
           DELETE FROM PLN_ORDER_CAST_S T WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.deletePlanOrderC" desc="删除锻造排产">
             <![CDATA[  
            DELETE FROM PLN_ORDER_DZ_S T WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.deletePlanOrderD" desc="删除轧管排产">
             <![CDATA[  
        DELETE FROM PLN_ORDER_ZG_S T WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.deletePlanOrderE" desc="删除镦拔扩排产">
             <![CDATA[  
        DELETE FROM PLN_ORDER_DBK_S T WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.deletePlanOrderF" desc="删除热处理排产">
             <![CDATA[  
        DELETE FROM PLN_ORDER_RCL_S T WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.deletePlanOrderG" desc="删除加工排产">
             <![CDATA[  
        DELETE FROM PLN_ORDER_JGX_S T WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.deletePlanOrderH" desc="删除接箍排产">
             <![CDATA[  
        DELETE FROM PLN_GX_JG_PROP_S T WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.addPlanOrderB" desc="新增铸造排产">
             <![CDATA[
             INSERT INTO PLN_ORDER_CAST_S
  (PRO_PLAN_ID,
   GX_PLAN_NO,
   GPREQ_ID,
   GPTYPE,
   CASTINGTYPE,
   PLINE_CODE,
   PLINE_NAME,
   PLINE_CODE_A,
   PLINE_NAME_A,
   GRADECODE,
   GRADENAME,
   DIAMETER_LZ,
   LEN_GP_SINGLE,
   CUT_NUM_GP,
   CUT_LOSE_LEN,
   LENGTH_LZ,
   MATERIAL_NO,
   MATERIAL_NAME,
   WLID_IN,
   WLDESC_IN,
   CIC,
   PIC,
   SIC,
   DIC,
   WIC,
   GIC,
   IF_MONITOR_LG,
   PRDCR_NO,
   MONITOR_POINT,
   WT_CAST_ONE,
   PLAN_WT_S,
   PLAN_NUM_S,
   CAST_NUM_CALC,
   FURNACE_NUM_CALC,
   FURNACE_WT,
   GX_PRO_SEQ,
   PRO_MONTH,
   PLAN_USETIME,
   PLAN_TIME_B,
   PLAN_TIME_E,
   PLANED_WT,
   PLANED_NUM,
   FINISHWEIGHT,
   FINISH_NUM,
   EXE_STATUS,
   IS_REPAIR_PLN,
   REPAIR_TYPE,
   IS_PLAN_OK,
   CAST_NUM,
   FURNACE_NUM,
   ADD_WT_BEGIN,
   ADD_WT_END,
   IF_CONNECT_AHEAD,
   ADD_WT_AHEAD,
   IF_CONNECT_NEXT,
   ADD_WT_NEXT,
   MEMO,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   ISSUED_TIME,
   ISSUED_MAN,
   LAST_UNDOWN_TIME,
   LAST_UNDOWN_MAN,
   PROCESSING_COST_A,
   TOTAL_COST_A,
   PROCESSING_COST_B,
   TOTAL_COST_B,
   PLAN_WT_MIN,
   GOWHERE_NAME,
   GOWHERE_CODE,
   CRAFT_NO,
   CRAFT_PATH,
   IF_CONFIRM,
   STEEL_JUDGEMENT,
   IF_AMOUNT,
   PROGY_MEMO)
VALUES
  ('#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#GPREQ_ID#',
   '#GPTYPE#',
   '#CASTINGTYPE#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#PLINE_CODE_A#',
   '#PLINE_NAME_A#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#DIAMETER_LZ#',
   '#LEN_GP_SINGLE#',
   '#CUT_NUM_GP#',
   '#CUT_LOSE_LEN#',
   '#LENGTH_LZ#',
   '#MATERIAL_NO#',
   '#MATERIAL_NAME#',
   '#WLID_IN#',
   '#WLDESC_IN#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#WIC#',
   '#GIC#',
   '#IF_MONITOR_LG#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#WT_CAST_ONE#',
   '#PLAN_WT_S#',
   '#PLAN_NUM_S#',
   '#CAST_NUM_CALC#',
   '#FURNACE_NUM_CALC#',
   '#FURNACE_WT#',
   '#GX_PRO_SEQ#',
   '#PRO_MONTH#',
   '#PLAN_USETIME#',
   TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
   TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
   '#PLANED_WT#',
   '#PLANED_NUM#',
   '#FINISHWEIGHT#',
   '#FINISH_NUM#',
   '#EXE_STATUS#',
   '#IS_REPAIR_PLN#',
   '#REPAIR_TYPE#',
   '#IS_PLAN_OK#',
   '#CAST_NUM#',
   '#FURNACE_NUM#',
   '#ADD_WT_BEGIN#',
   '#ADD_WT_END#',
   '#IF_CONNECT_AHEAD#',
   '#ADD_WT_AHEAD#',
   '#IF_CONNECT_NEXT#',
   '#ADD_WT_NEXT#',
   '#MEMO#',
   '#CREATE_NAME#',
   SYSDATE,
   '#UPDATE_NAME#',
   TO_DATE('#UPDATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#ISSUED_MAN#',
   TO_DATE('#LAST_UNDOWN_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#LAST_UNDOWN_MAN#',
   '#PROCESSING_COST_A#',
   '#TOTAL_COST_A#',
   '#PROCESSING_COST_B#',
   '#TOTAL_COST_B#',
   '#PLAN_WT_MIN#',
   '#GOWHERE_NAME#',
   '#GOWHERE_CODE#',
   '#CRAFT_NO#',
   '#CRAFT_PATH#',
   '#IF_CONFIRM#',
   '#STEEL_JUDGEMENT#',
   '#IF_AMOUNT#',
   '#PROGY_MEMO#')
               ]]>
	</query>

	<query id="ProducHelperBean.addPlanOrderC" desc="新增锻造排产">
             <![CDATA[ 
             INSERT INTO PLN_ORDER_DZ_S
  (PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   CASTINGTYPE,
   GRADECODE,
   GRADENAME,
   DIAMETER_OUT,
   LENGTH_OUT,
   OUTWL_ID,
   OUTWL_DESC,
   OUT_WT_ONE,
   OUT_WT_TOT,
   OUT_NUM_TOT,
   DIAMETER_IN,
   LENGTH_IN,
   WT_ONE_IN,
   WLID_IN,
   WLDESC_IN,
   IN_WEIGHT_S,
   IN_NUM_S,
   WEIGTH_S,
   NUM_S,
   ADD_WT_IN,
   ADD_NUM_IN,
   MATCH_WT_IN,
   MATCH_NUM_IN,
   DZ_LOSE_ADD,
   DZ_CUT_HEAD_END,
   DZ_BURN_LOSE,
   CIC,
   PIC,
   SIC,
   DIC,
   WIC,
   GIC,
   GX_PRO_SEQ,
   PRO_MONTH,
   PLAN_USETIME,
   PLAN_TIME_B,
   PLAN_TIME_E,
   BATCHED_WT,
   BATCHED_NUM,
   FINISHWEIGHT,
   FINISHNUM,
   EXE_STATUS,
   IS_REPAIR_PLN,
   REPAIR_TYPE,
   IS_PLAN_OK,
   ZY_BATCH_ID,
   ISSUED_TIME,
   ISSUED_MAN,
   LAST_UNDOWN_TIME,
   LAST_UNDOWN_MAN,
   PROCESSING_COST,
   TOTAL_COST)
VALUES
  ('#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#CASTINGTYPE#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#DIAMETER_OUT#',
   '#LENGTH_OUT#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#OUT_WT_ONE#',
   '#OUT_WT_TOT#',
   '#OUT_NUM_TOT#',
   '#DIAMETER_IN#',
   '#LENGTH_IN#',
   '#WT_ONE_IN#',
   '#WLID_IN#',
   '#WLDESC_IN#',
   '#IN_WEIGHT_S#',
   '#IN_NUM_S#',
   '#WEIGTH_S#',
   '#NUM_S#',
   '#ADD_WT_IN#',
   '#ADD_NUM_IN#',
   '#MATCH_WT_IN#',
   '#MATCH_NUM_IN#',
   '#DZ_LOSE_ADD#',
   '#DZ_CUT_HEAD_END#',
   '#DZ_BURN_LOSE#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#WIC#',
   '#GIC#',
   '#GX_PRO_SEQ#',
   '#PRO_MONTH#',
   '#PLAN_USETIME#',
   TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
   TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
   '#BATCHED_WT#',
   '#BATCHED_NUM#',
   '#FINISHWEIGHT#',
   '#FINISHNUM#',
   '#EXE_STATUS#',
   '#IS_REPAIR_PLN#',
   '#REPAIR_TYPE#',
   '#IS_PLAN_OK#',
   '#ZY_BATCH_ID#',
   TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#ISSUED_MAN#',
   TO_DATE('#LAST_UNDOWN_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#LAST_UNDOWN_MAN#',
   '#PROCESSING_COST#',
   '#TOTAL_COST#')
               ]]>
	</query>

	<query id="ProducHelperBean.addPlanOrderD" desc="新增轧管排产">
             <![CDATA[
            INSERT INTO PLN_ORDER_ZG_S
  (PRO_ORDER_NO,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLAN_GROUP_ID,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   PLN_DIVIDE_ID,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   PLINE_CODE,
   PLINE_NAME,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   OUTDIAMETER,
   WALLTHICK,
   LENGTHDISC,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   LEN_ROLL_MAX,
   LEN_ROLL_MIN,
   AIMOUTDIAMETER,
   AIMWALLTHICK,
   AIMLENGTH,
   DIAMETER_GP,
   LEN_GP_SINGLE,
   ROLL_LENGTH,
   LEN_CUTHEAD,
   LEN_CUTEND,
   OUTNUM_CUT,
   DIAMETER_MANDREL,
   PASS_CODE,
   PASS_NAME,
   IN_WEIGHT_S,
   IN_NUM_S,
   WEIGTH_S,
   NUM_S,
   ADD_WT_IN,
   ADD_NUM_IN,
   MATCH_WT_IN,
   MATCH_NUM_IN,
   ISENDGX,
   IF_MONITOR_ZG,
   PRDCR_NO,
   MONITOR_POINT,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   STATION_ROAD,
   PRO_MONTH,
   CIC,
   PIC,
   SIC,
   DIC,
   WIC,
   GIC,
   GX_PRO_SEQ,
   PLAN_USETIME,
   PLAN_TIME_B,
   PLAN_TIME_E,
   BATCHED_WT,
   BATCHED_NUM,
   FINISHWEIGHT,
   FINISHNUM,
   EXE_STATUS,
   IS_REPAIR_PLN,
   REPAIR_TYPE,
   IS_PLAN_OK,
   GPREQ_IF_OK,
   GPREQ_ID,
   ZY_BATCH_ID,
   CIC_GROUP_GP,
   PIC_GROUP_GP,
   SIC_GROUP_GP,
   DIC_GROUP_GP,
   WIC_GROUP_GP,
   GIC_GROUP_GP,
   CIC_GP,
   PIC_GP,
   SIC_GP,
   DIC_GP,
   WIC_GP,
   GIC_GP,
   IF_EXPORT,
   CREATE_TIME,
   MEMO,
   ISSUED_TIME,
   ISSUED_MAN,
   LAST_UNDOWN_TIME,
   LAST_UNDOWN_MAN,
   VERSION_NO,
   PROCESSING_COST,
   TOTAL_COST,
   IF_STOVE_ISSUED,
   STOVE_ISSUED_TIME,
   STOVE_ISSUED_MAN,
   IS_ONLOAD_LINE,
   OUTDIAMETER_ZG,
   WALLTHICK_ZG,
   MSC,
   INDEX_SEQ,
   BOM,
   WHOLE_BACKLOG_DESC,
   IF_LEN_CONTROL,
   IF_MINUS_SIC_ROLL,
   TUBE_END_RATIO,
   GPREQ_NUM,
   GPREQ_WEIGHT,
   WEIGTH_S_MIN,
   PRIORITY,
   PRIORITY_MEMO,PLANS_NUM,VERIFY1,VERIFY2,VERIFY3,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   PROD_STANDARD,
   OUTPUT_STANDARD,
   THICKNESS_WALL,
   DECISION,OUTS_BILLET_FL,
   APPLY_NO,APPLY_STATUS,ISSUED_MEMO,
   ACTUAL_WEIGHT,PROGY_MEMO,PLINE_CODE_ZZ,
   PLINE_NAME_ZZ,GPREQ_IF_DZ,GRADECODE_LK,GRADENAME_LK,CIC_GROUP_LK,GPREQ_WEIGHT_MIN)
  VALUES
  ( '#PRO_ORDER_NO#',
         '#PRO_PLAN_ID#',
         '#GX_PLAN_NO#',
         '#PLAN_GROUP_ID#',
         '#ORDER_SOURCE#',
         '#ORD_LN_DLY_PK#',
         '#PLN_DIVIDE_ID#',
         '#ORDER_NO#',
         '#ORDER_SEQ#',
         '#DELIVERY_NO#',
         '#REQ_BL_ID#',
         '#PLINE_CODE#',
         '#PLINE_NAME#',
         '#STEELCODE#',
         '#STEELNAME#',
         '#GRADECODE#',
         '#GRADENAME#',
         '#OUTDIAMETER#',
         '#WALLTHICK#',
         '#LENGTHDISC#',
         '#INWL_ID#',
         '#INWL_DESC#',
         '#OUTWL_ID#',
         '#OUTWL_DESC#',
         '#LEN_ROLL_MAX#',
         '#LEN_ROLL_MIN#',
         '#AIMOUTDIAMETER#',
         '#AIMWALLTHICK#',
         '#AIMLENGTH#',
         DECODE('#PLINE_CODE#','C072',
			  DECODE('#PASS_NAME#','383','380','454','450','#DIAMETER_GP#'),
		 '#DIAMETER_GP#'),
         '#LEN_GP_SINGLE#',
         '#ROLL_LENGTH#',
         '#LEN_CUTHEAD#',
         '#LEN_CUTEND#',
         '#OUTNUM_CUT#',
         '#DIAMETER_MANDREL#',
         '#PASS_CODE#',
         '#PASS_NAME#',
         '#IN_WEIGHT_S#',
         '#IN_NUM_S#',
         '#WEIGTH_S#',
         '#NUM_S#',
         '#ADD_WT_IN#',
         '#ADD_NUM_IN#',
         '#MATCH_WT_IN#',
         '#MATCH_NUM_IN#',
         '#ISENDGX#',
         '#IF_MONITOR_ZG#',
         '#PRDCR_NO#',
         '#MONITOR_POINT#',
         '#CRAFT_FILE_NO#',
         '#CRAFT_FILE_MAN#',
         '#CRAFT_SEQ#',
         '#STATION_ROAD#',
         '#PRO_MONTH#',
         '#CIC#',
         '#PIC#',
         '#SIC#',
         '#DIC#',
         '#WIC#',
         '#GIC#',
         '#GX_PRO_SEQ#',
         '#PLAN_USETIME#',
         TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
         TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
         '#BATCHED_WT#',
         '#BATCHED_NUM#',
         '',
         '',
         '#EXE_STATUS#',
         '#IS_REPAIR_PLN#',
         '#REPAIR_TYPE#',
         '#IS_PLAN_OK#',
         '#GPREQ_IF_OK#',
         '#GPREQ_ID#',
         '#ZY_BATCH_ID#',
         '#CIC_GROUP_GP#',
         '#PIC_GROUP_GP#',
         '#SIC_GROUP_GP#',
         '#DIC_GROUP_GP#',
         '#WIC_GROUP_GP#',
         '#GIC_GROUP_GP#',
         '#CIC_GP#',
         '#PIC_GP#',
         '#SIC_GP#',
         '#DIC_GP#',
         '#WIC_GP#',
         '#GIC_GP#',
         '#IF_EXPORT#',
         SYSDATE,
         '#MEMO#',
         TO_DATE('#ISSUED_TIME#','YYYY-MM-DD HH24:MI:SS'),
         '#ISSUED_MAN#',
         TO_DATE('#LAST_UNDOWN_TIME#','YYYY-MM-DD HH24:MI:SS'),
         '#LAST_UNDOWN_MAN#',
         '#VERSION_NO#',
         '#PROCESSING_COST#',
         '#TOTAL_COST#',
         '#IF_STOVE_ISSUED#',
         TO_DATE('#STOVE_ISSUED_TIME#','YYYY-MM-DD HH24:MI:SS'),
         '#STOVE_ISSUED_MAN#',
         '#IS_ONLOAD_LINE#',
         '#OUTDIAMETER_ZG#',
         '#WALLTHICK_ZG#',
         '#MSC#',
         '#INDEX_SEQ#',
         '#BOM#',
         '#WHOLE_BACKLOG_DESC#',
         '#IF_LEN_CONTROL#',
         '#IF_MINUS_SIC_ROLL#',
         '#TUBE_END_RATIO#',
         '#GPREQ_NUM#',
         '#GPREQ_WEIGHT#',
         '#WEIGTH_S_MIN#',
         '#PRIORITY#',
         '#PRIORITY_MEMO#','#PLANS_NUM#','#VERIFY1#','#VERIFY2#','#VERIFY3#',
         '#PROCESS_CODE_C#',
     	'#PROCESS_DESC_C#',
   		'#PROD_STANDARD#',
  	    '#OUTPUT_STANDARD#',
   		'#THICKNESS_WALL#',
   		'#DECISION#','#OUTS_BILLET_FL#','#APPLY_NO#','#APPLY_STATUS#','#ISSUED_MEMO#','#ACTUAL_WEIGHT#','#PROGY_MEMO#',
   		'#PLINE_CODE_ZZ#','#PLINE_NAME_ZZ#','#GPREQ_IF_DZ#','#GRADECODE_LK#','#GRADENAME_LK#','#CIC_GROUP_LK#','#GPREQ_WEIGHT_MIN#')
               ]]>
	</query>

	<query id="ProducHelperBean.addPlanOrderE" desc="新增镦拔扩排产">
             <![CDATA[ 
  INSERT INTO PLN_ORDER_DBK_S
  (PRO_ORDER_NO,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLAN_GROUP_ID,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   PLN_DIVIDE_ID,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   PLINE_CODE,
   PLINE_NAME,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   WEIGTH_S,
   NUM_S,
   GX_PRO_SEQ,
   PLAN_USETIME,
   PLAN_TIME_B,
   PLAN_TIME_E,
   EXE_STATUS,
   IS_REPAIR_PLN,
   REPAIR_TYPE,
   OUTDIAMETER,
   WALLTHICK,
   LENGTHDISC,
   AIMOUTDIAMETER,
   AIMWALLTHICK,
   AIMLENGTH,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LEN_CUTHEAD,
   LEN_CUTEND,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   IN_WEIGHT_S,
   IN_NUM_S,
   ADD_WT_IN,
   ADD_NUM_IN,
   MATCH_WT_IN,
   MATCH_NUM_IN,
   ISENDGX,
   IF_MONITOR_DBK,
   PRDCR_NO,
   MONITOR_POINT,
   CIC,
   PIC,
   SIC,
   DIC,
   WIC,
   GIC,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   STATION_ROAD,
   BATCHED_WT,
   BATCHED_NUM,
   FINISHWEIGHT,
   FINISHNUM,
   IS_PLAN_OK,
   ZY_BATCH_ID,
   GRADECODE,
   GRADENAME,
   PRO_MONTH,
   PREVIOUS_GX,
   PREV_GXPLAN_ID,
   IF_EXPORT,
   CREATE_TIME,
   MEMO,
   ISSUED_TIME,
   ISSUED_MAN,
   LAST_UNDOWN_TIME,
   LAST_UNDOWN_MAN,
   VERSION_NO,
   PROCESSING_COST,
   TOTAL_COST,
   REAL_BATCH_WT,
   REAL_BATCH_NUM,
   IF_STOVE_ISSUED,
   STOVE_ISSUED_TIME,
   STOVE_ISSUED_MAN,
   MSC,
   INDEX_SEQ,
   BOM,
   WHOLE_BACKLOG_DESC,
   WEIGTH_S_MIN,
   PRIORITY,
   PRIORITY_MEMO,PROCESS_CODE_C,PROCESS_DESC_C,DECISION,FINAL_USER_DESC,PASS_CODE,PASS_NAME)
 VALUES
  ('#PRO_ORDER_NO#',
         '#PRO_PLAN_ID#',
         '#GX_PLAN_NO#',
         '#PLAN_GROUP_ID#',
         '#ORDER_SOURCE#',
         '#ORD_LN_DLY_PK#',
         '#PLN_DIVIDE_ID#',
         '#ORDER_NO#',
         '#ORDER_SEQ#',
         '#DELIVERY_NO#',
         '#REQ_BL_ID#',
         '#PLINE_CODE#',
         '#PLINE_NAME#',
         '#INWL_ID#',
         '#INWL_DESC#',
         '#OUTWL_ID#',
         '#OUTWL_DESC#',
         '#WEIGTH_S#',
         '#NUM_S#',
         '#GX_PRO_SEQ#',
         '#PLAN_USETIME#',
         TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
         TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
         '#EXE_STATUS#',
         '#IS_REPAIR_PLN#',
         '#REPAIR_TYPE#',
         '#OUTDIAMETER#',
         '#WALLTHICK#',
         '#LENGTHDISC#',
         '#AIMOUTDIAMETER#',
         '#AIMWALLTHICK#',
         '#AIMLENGTH#',
         '#OUTDIAMETER_IN#',
         '#WALLTHICK_IN#',
         '#LENGTH_IN#',
         '#LEN_CUTHEAD#',
         '#LEN_CUTEND#',
         '#LENGTHMAX_IN#',
         '#LENGTHMIN_IN#',
         '#IN_WEIGHT_S#',
         '#IN_NUM_S#',
         '#ADD_WT_IN#',
         '#ADD_NUM_IN#',
         '#MATCH_WT_IN#',
         '#MATCH_NUM_IN#',
         '#ISENDGX#',
         '#IF_MONITOR_DBK#',
         '#PRDCR_NO#',
         '#MONITOR_POINT#',
         '#CIC#',
         '#PIC#',
         '#SIC#',
         '#DIC#',
         '#WIC#',
         '#GIC#',
         '#CRAFT_FILE_NO#',
         '#CRAFT_FILE_MAN#',
         '#CRAFT_SEQ#',
         '#STATION_ROAD#',
         '#BATCHED_WT#',
         '#BATCHED_NUM#',
         '#FINISHWEIGHT#',
         '#FINISHNUM#',
         '#IS_PLAN_OK#',
         '#ZY_BATCH_ID#',
         '#GRADECODE#',
         '#GRADENAME#',
         '#PRO_MONTH#',
         '#PREVIOUS_GX#',
         '#PREV_GXPLAN_ID#',
         '#IF_EXPORT#',
         SYSDATE,
         '#MEMO#',
         NULL,
         '#ISSUED_MAN#',
         NULL,
         '#LAST_UNDOWN_MAN#',
         '#VERSION_NO#',
         '#PROCESSING_COST#',
         '#TOTAL_COST#',
         '#REAL_BATCH_WT#',
         '#REAL_BATCH_NUM#',
         '#IF_STOVE_ISSUED#',
         NULL,
         '#STOVE_ISSUED_MAN#',
         '#MSC#',
         '#INDEX_SEQ#',
         '#BOM#',
         '#WHOLE_BACKLOG_DESC#',
         '#WEIGTH_S_MIN#',
         '#PRIORITY#',
         '#PRIORITY_MEMO#','#PROCESS_CODE_C#','#PROCESS_DESC_C#','#DECISION#',
         '#FINAL_USER_DESC#','#PASS_CODE#','#PASS_NAME#')
               ]]>
	</query>

	<query id="ProducHelperBean.addPlanOrderF" desc="新增热处理排产">
             <![CDATA[  
           INSERT INTO PLN_ORDER_RCL_S
  (PRO_ORDER_NO,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLAN_GROUP_ID,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   PLN_DIVIDE_ID,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   PLINE_CODE,
   PLINE_NAME,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   GRADECODE,
   GRADENAME,
   OUTDIAMETER,
   WALLTHICK,
   LENGTHDISC,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   LENGTH_IN,
   AIMLENGTH,
   IN_WEIGHT_S,
   IN_NUM_S,
   WEIGTH_S,
   NUM_S,
   MATCH_WT_IN,
   MATCH_NUM_IN,
   IF_MONITOR_RCL,
   PRDCR_NO,
   MONITOR_POINT,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   STATION_ROAD,
   GX_PRO_SEQ,
   PLAN_USETIME,
   PLAN_TIME_B,
   PLAN_TIME_E,
   BATCHED_WT,
   BATCHED_NUM,
   FINISHWEIGHT,
   FINISHNUM,
   EXE_STATUS,
   IS_REPAIR_PLN,
   REPAIR_TYPE,
   ZY_BATCH_ID,
   ADD_WT_IN,
   ADD_NUM_IN,
   ISENDGX,
   CIC,
   PIC,
   SIC,
   DIC,
   WIC,
   GIC,
   IS_PLAN_OK,
   STEELCODE,
   STEELNAME,
   PRO_MONTH,
   PREVIOUS_GX,
   PREV_GXPLAN_ID,
   IF_EXPORT,
   CREATE_TIME,
   MEMO,
   ISSUED_TIME,
   ISSUED_MAN,
   LAST_UNDOWN_TIME,
   LAST_UNDOWN_MAN,
   VERSION_NO,
   PROCESSING_COST,
   TOTAL_COST,
   MSC,
   INDEX_SEQ,
   BOM,
   WHOLE_BACKLOG_DESC,
   WEIGTH_S_MIN,
   PRIORITY,
   PRIORITY_MEMO,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   DECISION,
   PRDCR_ADVC_DAY,
   GROUP_RCL,
   PROGY_MEMO)
VALUES
  ('#PRO_ORDER_NO#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLAN_GROUP_ID#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#PLN_DIVIDE_ID#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#OUTDIAMETER#',
   '#WALLTHICK#',
   '#LENGTHDISC#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#LENGTH_IN#',
   '#AIMLENGTH#',
   '#IN_WEIGHT_S#',
   '#IN_NUM_S#',
   '#WEIGTH_S#',
   '#NUM_S#',
   '#MATCH_WT_IN#',
   '#MATCH_NUM_IN#',
   '#IF_MONITOR_RCL#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_FILE_MAN#',
   '#CRAFT_SEQ#',
   '#STATION_ROAD#',
   '#GX_PRO_SEQ#',
   '#PLAN_USETIME#',
   TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
   TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
   '#BATCHED_WT#',
   '#BATCHED_NUM#',
   '#FINISHWEIGHT#',
   '#FINISHNUM#',
   '#EXE_STATUS#',
   '#IS_REPAIR_PLN#',
   '#REPAIR_TYPE#',
   '#ZY_BATCH_ID#',
   '#ADD_WT_IN#',
   '#ADD_NUM_IN#',
   '#ISENDGX#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#WIC#',
   '#GIC#',
   '#IS_PLAN_OK#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#PRO_MONTH#',
   '#PREVIOUS_GX#',
   '#PREV_GXPLAN_ID#',
   '#IF_EXPORT#',
   TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#MEMO#',
   TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#ISSUED_MAN#',
   TO_DATE('#LAST_UNDOWN_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#LAST_UNDOWN_MAN#',
   '#VERSION_NO#',
   '#PROCESSING_COST#',
   '#TOTAL_COST#',
   '#MSC#',
   '#INDEX_SEQ#',
   '#BOM#',
   '#WHOLE_BACKLOG_DESC#',
   '#WEIGTH_S_MIN#',
   '#PRIORITY#',
   '#PRIORITY_MEMO#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   '#DECISION#',
   '#PRDCR_ADVC_DAY#',
   '#GROUP_RCL#',
   '#PROGY_MEMO#')
               ]]>
	</query>

	<query id="ProducHelperBean.addPlanOrderG" desc="新增加工排产">
             <![CDATA[ 
            INSERT INTO PLN_ORDER_JGX_S
  (PRO_ORDER_NO,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLAN_GROUP_ID,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   PLN_DIVIDE_ID,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   PLINE_CODE,
   PLINE_NAME,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   WEIGTH_S,
   NUM_S,
   GX_PRO_SEQ,
   PLAN_USETIME,
   PLAN_TIME_B,
   PLAN_TIME_E,
   EXE_STATUS,
   IS_REPAIR_PLN,
   REPAIR_TYPE,
   STEELCODE,
   STEELNAME,
   OUTDIAMETER,
   WALLTHICK,
   LENGTHMAX,
   LENGTHMIN,
   LENGTHDISC,
   AIMWALLTHICK,
   AIMLENGTH,
   SHRT_LEN_RATO,
   SHORTEST,
   LONG_LEN_RATO,
   LONGEST,
   SHRT_STOVE,
   AVG_LEN_MIN,
   DIFRNC_LEN_MAX,
   SIGL_LEN,
   ENDLEN_SPECSTD,
   MODEL_CODE,
   MODEL_DESC,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   LENGTH_IN,
   OUTNUM_CUT,
   IN_WEIGHT_S,
   IN_NUM_S,
   ADD_WT_IN,
   ADD_NUM_IN,
   MATCH_WT_IN,
   MATCH_NUM_IN,
   IF_MONITOR_JGX,
   PRDCR_NO,
   MONITOR_POINT,
   CIC,
   PIC,
   SIC,
   DIC,
   WIC,
   GIC,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   STATION_ROAD,
   BATCHED_WT,
   BATCHED_NUM,
   FINISHWEIGHT,
   FINISHNUM,
   IS_PLAN_OK,
   ZY_BATCH_ID,
   PRO_MONTH,
   PREVIOUS_GX,
   PREV_GXPLAN_ID,
   IF_EXPORT,
   FINAL_USER_DESC,
   PROCESS_DESC_C_ZG,
   GROUP_ROLL_NAME,
   BEGIN_TIME_ZG,
   PRDCR_ADVC_DAY,
   WHOLE_BACKLOG_DESC,
   PRIORITY,
   PRIORITY_MEMO,
   DELVRY_EDATE,
   STATION_NM,
   OUTLINE_SITE_250,
   CREATE_TIME,
   MEMO,
   ISSUED_TIME,
   ISSUED_MAN,
   LAST_UNDOWN_TIME,
   LAST_UNDOWN_MAN,
   VERSION_NO,
   PROCESSING_COST,
   TOTAL_COST,
   MSC,
   INDEX_SEQ,
   BOM,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   DECISION,
   GROUP_JGX，
   PROGY_MEMO)
VALUES
  ('#PRO_ORDER_NO#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLAN_GROUP_ID#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#PLN_DIVIDE_ID#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#WEIGTH_S#',
   '#NUM_S#',
   '#GX_PRO_SEQ#',
   '#PLAN_USETIME#',
   TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
   TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
   '#EXE_STATUS#',
   '#IS_REPAIR_PLN#',
   '#REPAIR_TYPE#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#OUTDIAMETER#',
   '#WALLTHICK#',
   '#LENGTHMAX#',
   '#LENGTHMIN#',
   '#LENGTHDISC#',
   '#AIMWALLTHICK#',
   '#AIMLENGTH#',
   '#SHRT_LEN_RATO#',
   '#SHORTEST#',
   '#LONG_LEN_RATO#',
   '#LONGEST#',
   '#SHRT_STOVE#',
   '#AVG_LEN_MIN#',
   '#DIFRNC_LEN_MAX#',
   '#SIGL_LEN#',
   '#ENDLEN_SPECSTD#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#LENGTH_IN#',
   '#OUTNUM_CUT#',
   '#IN_WEIGHT_S#',
   '#IN_NUM_S#',
   '#ADD_WT_IN#',
   '#ADD_NUM_IN#',
   '#MATCH_WT_IN#',
   '#MATCH_NUM_IN#',
   '#IF_MONITOR_JGX#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#WIC#',
   '#GIC#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_FILE_MAN#',
   '#CRAFT_SEQ#',
   '#STATION_ROAD#',
   '#BATCHED_WT#',
   '#BATCHED_NUM#',
   '#FINISHWEIGHT#',
   '#FINISHNUM#',
   '#IS_PLAN_OK#',
   '#ZY_BATCH_ID#',
   '#PRO_MONTH#',
   '#PREVIOUS_GX#',
   '#PREV_GXPLAN_ID#',
   '#IF_EXPORT#',
   '#FINAL_USER_DESC#',
   '#PROCESS_DESC_C_ZG#',
   '#GROUP_ROLL_NAME#',
   TO_DATE('#BEGIN_TIME_ZG#', 'YYYY-MM-DD HH24:MI:SS'),
   '#PRDCR_ADVC_DAY#',
   '#WHOLE_BACKLOG_DESC#',
   '#PRIORITY#',
   '#PRIORITY_MEMO#',
   TO_DATE('#DELVRY_EDATE#', 'YYYY-MM-DD'),
   '#STATION_NM#',
   '#OUTLINE_SITE250#',
   TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#MEMO#',
   TO_DATE('#ISSUED_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#ISSUED_MAN#',
   TO_DATE('#LAST_UNDOWN_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#LAST_UNDOWN_MAN#',
   '#VERSION_NO#',
   '#PROCESSING_COST#',
   '#TOTAL_COST#',
   '#MSC#',
   '#INDEX_SEQ#',
   '#BOM#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   'A',
   '#GROUP_JGX#',
   '#PROGY_MEMO#')
               ]]>
	</query>


	<query id="ProducHelperBean.addPlanOrderH" desc="新增接箍排产">
             <![CDATA[ 
            INSERT INTO PLN_GX_JG_PROP_S
  (PRO_PLAN_ID,
   JG_GROUP_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   GX_PRO_SEQ,
   CODE_JG,
   SPEC_JG_DESC,
   CODE_JG_BL,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   BL_WL_ID,
   BL_WL_DESC,
   MIN_D,
   MIN_H,
   AIMLENGTH_BL,
   AIM_CUT_LEN,
   LENGTH_MIN,
   LENGTH_MAX,
   TAPER,
   MODEL_CODE,
   MODEL_DESC,
   DEMAND_DETECTION,
   DEMAND_BONDERIZING,
   DEMAND_COPPER,
   DEMAND_BLAST,
   GROUP_NUM_S,
   SINGLE_CUT_NUN,
   GROUP_BL_NUM_S,
   GROUP_BL_WT_S,
   IS_PLAN_OK,
   MATCHNUM_JG,
   PRO_MONTH,
   PLAN_USETIME,
   PLAN_TIME_B,
   PLAN_TIME_E,
   MATCHWT_BL,
   MATCHNUM_BL,
   BATCHED_WT,
   BATCHED_NUM,
   BATCHED_NUM_OUT,
   REAL_BATCHED_WT,
   REAL_BATCHED_NUM,
   PRODUCED_NUM,
   EXE_STATUS,
   IS_REPAIR_PLN,
   REPAIR_TYPE,
   IS_STOVE_ISSUED,
   ISSUED_TIME,
   ISSUED_MAN,
   LAST_UNDOWN_TIME,
   LAST_UNDOWN_MAN,
   PROCESSING_COST,
   TOTAL_COST,
   IF_MONITOR_JG,
   PRDCR_NO,
   CREATE_TIME,
   ORD_LN_DLY_PK,
   PLN_DIVIDE_ID,
   REQ_BL_ID,
   SPEC_JG,
   GROUP_WT_S,
   OUTWL_ID,
   OUTWL_DESC,
   MONITOR_POINT,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   STATION_ROAD,
   VERSION_NO,STYLE_JG,
   STD_CODE,
   STD_NAME,
   STD_STYLE,
   STD_STYLE_DESC,
   PRODUCCODE_JG,
   PRODUCCODE_JG_DESC,CODE_BL_ALL,ORDER_SOURCE,IF_MONITOR_BL,DECISION)
VALUES
  ('#PRO_PLAN_ID#',
   '#JG_GROUP_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#GX_PRO_SEQ#',
   '#CODE_JG#',
   '#SPEC_JG_DESC#',
   '#CODE_JG_BL#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#BL_WL_ID#',
   '#BL_WL_DESC#',
   '#MIN_D#',
   '#MIN_H#',
   '#AIMLENGTH_BL#',
   '#AIM_CUT_LEN#',
   '#LENGTH_MIN#',
   '#LENGTH_MAX#',
   '#TAPER#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#DEMAND_DETECTION#',
   '#DEMAND_BONDERIZING#',
   '#DEMAND_COPPER#',
   '#DEMAND_BLAST#',
   '#GROUP_NUM_S#',
   '#SINGLE_CUT_NUN#',
   '#GROUP_BL_NUM_S#',
   '#GROUP_BL_WT_S#',
   '#IS_PLAN_OK#',
   '#MATCHNUM_JG#',
   '#PRO_MONTH#',
   '#PLAN_USETIME#',
   TO_DATE('#PLAN_TIME_B#', 'YYYY-MM-DD HH24:MI:SS'),
   TO_DATE('#PLAN_TIME_E#', 'YYYY-MM-DD HH24:MI:SS'),
   '#MATCHWT_BL#',
   '#MATCHNUM_BL#',
   '#BATCHED_WT#',
   '#BATCHED_NUM#',
   '#BATCHED_NUM_OUT#',
   '#REAL_BATCHED_WT#',
   '#REAL_BATCHED_NUM#',
   '#PRODUCED_NUM#',
   '#EXE_STATUS#',
   '#IS_REPAIR_PLN#',
   '#REPAIR_TYPE#',
   '0',
   NULL,
   '#ISSUED_MAN#',
   NULL,
   '#LAST_UNDOWN_MAN#',
   '#PROCESSING_COST#',
   '#TOTAL_COST#',
   '#IF_MONITOR_JG#',
   '#PRDCR_NO#',
   SYSDATE,
   '#ORD_LN_DLY_PK#',
   '#PLN_DIVIDE_ID#',
   '#REQ_BL_ID#',
   '#SPEC_JG#',
   '#GROUP_WT_S#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#MONITOR_POINT#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_FILE_MAN#',
   '#CRAFT_SEQ#',
   '#STATION_ROAD#',
   '#VERSION_NO#',
   '#STYLE_JG#',
   '#STD_CODE#',
   '#STD_NAME#',
   '#STD_STYLE#',
   '#STD_STYLE_DESC#',
   '#PRODUCCODE_JG#',
   '#PRODUCCODE_JG_DESC#','#CODE_BL_ALL#','#ORDER_SOURCE#','#IF_MONITOR_BL#','#DECISION#')
               ]]>
	</query>

	<query id="ProducHelperBean.queryPlanOrderB" desc="查询铸造排产(界面)">
             <![CDATA[ 
             SELECT T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.GPREQ_ID,
       DECODE(T.GPTYPE,'1','铸坯','2','锻坯','')GPTYPE,
       DECODE(T.CASTINGTYPE,'1','连铸','2','模铸','')CASTINGTYPE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.PLINE_CODE_A,
       T.PLINE_NAME_A,
       T.GRADECODE,
       T.GRADENAME,
       T.DIAMETER_LZ,
       T.LEN_GP_SINGLE,
       T.CUT_NUM_GP,
       T.CUT_LOSE_LEN,
       T.LENGTH_LZ,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.WLID_IN,
       T.WLDESC_IN,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       DECODE(T.IF_MONITOR_LG, '1', '是', '否') IF_MONITOR_LG,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.WT_CAST_ONE,
       T.PLAN_WT_S,
       T.PLAN_NUM_S,
       T.CAST_NUM_CALC,
       T.FURNACE_NUM_CALC,
       T.FURNACE_WT,
       T.GX_PRO_SEQ,
       T.PRO_MONTH,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) 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.PLANED_WT,
       T.PLANED_NUM,
       T.FINISHWEIGHT,
       T.FINISH_NUM,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', '是', '否') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       DECODE(T.IS_PLAN_OK, '1','是', '否') IS_PLAN_OK,
       T.CAST_NUM,
       T.FURNACE_NUM,
       T.ADD_WT_BEGIN,
       T.ADD_WT_END,
       DECODE(T.IF_CONNECT_AHEAD, '1', '是', '否') IF_CONNECT_AHEAD,
       T.ADD_WT_AHEAD,
       DECODE(T.IF_CONNECT_NEXT, '1','是', '否') IF_CONNECT_NEXT,
       T.ADD_WT_NEXT,
       T.MEMO,
       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,
       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.PROCESSING_COST_A,
       T.TOTAL_COST_A,
       T.PROCESSING_COST_B,
       T.TOTAL_COST_B
  FROM PLN_ORDER_CAST_S T
 WHERE 1 = 1 
               ]]>
	</query>

	<query id="ProducHelperBean.queryPlanOrderC" desc="查询锻造排产(界面)">
             <![CDATA[  
             SELECT T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       DECODE(T.CASTINGTYPE, '1', '连铸', '2', '模铸', '') CASTINGTYPE,
       T.GRADECODE,
       T.GRADENAME,
       T.DIAMETER_OUT,
       T.LENGTH_OUT,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.OUT_WT_ONE,
       T.OUT_WT_TOT,
       T.OUT_NUM_TOT,
       T.DIAMETER_IN,
       T.LENGTH_IN,
       T.WT_ONE_IN,
       T.WLID_IN,
       T.WLDESC_IN,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       T.DZ_LOSE_ADD,
       T.DZ_CUT_HEAD_END,
       T.DZ_BURN_LOSE,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.GX_PRO_SEQ,
       T.PRO_MONTH,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) 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.FINISHWEIGHT,
       T.FINISHNUM,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', '是', '否') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       DECODE(T.IS_PLAN_OK, '1','是', '否') IS_PLAN_OK,
       T.ZY_BATCH_ID,
       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.PROCESSING_COST,
       T.TOTAL_COST,
       T.GPREQ_ID,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       (SELECT TO_CHAR(WM_CONCAT(S1.ORDER_NO_SEQ)) ORDER_NO_SEQ
          FROM (SELECT S.ORDER_NO || '/' || S.ORDER_SEQ ORDER_NO_SEQ,
                       S.GPREQ_ID
                  FROM PLN_ORDER_ZG_S S, PLN_ORDER_DZ_S T1
                 WHERE S.GPREQ_ID IS NOT NULL
                   AND S.GPREQ_ID = T1.PRO_PLAN_ID
                 GROUP BY S.GPREQ_ID, S.ORDER_NO, S.ORDER_SEQ) S1
         WHERE S1.GPREQ_ID = T.PRO_PLAN_ID) ORDER_NO_SEQ,
       (SELECT NVL(SUM(T1.PLN_INSINGLE_NUM), 0)
          FROM PLN_ZY_DZ_M T1
         WHERE T1.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND T1.GX_PLAN_NO = T.GX_PLAN_NO) BATCHED_NUM,
       (SELECT NVL(SUM(T1.PLN_INSINGLE_WT), 0)
          FROM PLN_ZY_DZ_M T1
         WHERE T1.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND T1.GX_PLAN_NO = T.GX_PLAN_NO) BATCHED_WT
  FROM PLN_ORDER_DZ_S T
 WHERE 1 = 1
               ]]>
	</query>
	<!-- TZH 2024.8.7  add  24.9.15 新增单倍尺坯料重量、是否上传产销字段 -->
	<query id="ProducHelperBean.queryPlanOrderCxMes" desc="查询无合同产销传到MES的数据">
             <![CDATA[
             select PLAN_NO , -- 计划号
				SG_GRADE  , --钢种名称
				WALL_THICKNESS  , --壁厚
				PRODUCT_CATEGORY_CODE , --产品类别编码
				PRODUCT_CATEGORY  , -- 产品类别名称
				OUTER_DIAM  , --外径
				LENGTH  , --长度(mm)
				RULER_LENGTH  , --倍尺长度(mm)
				PLAN_TYPE , -- 坯料计划类型(0正式合同 1意向合同 2备坯)
				LENGTH_RANGE  , --长度范围
				CONTROLS_THICKNESS  , --控制壁厚(mm)
				PASS , --孔型
				BREED , --品种
				HEAD_TAIL_LENGTH  , -- 切头尾长度
				CONTRACT_LENGT  , --合同长度
				CONTRACTED_QUANTITY , --合同量
				QUANTITY_PURCHASED  , --采购量(吨)
				DELIVERY_STATUS , --交货状态
				SECTION , --断面(mm)
				CONTRACT_BUYER  , --合同厂家
				DELIVERY_DATE,  --交货期
				WG_D ,--毛管外径
				WG_H ,--毛管壁厚
				DIAMETER_MANDREL,  --芯棒直径(mm)
			MGCD,--毛管长度
XBZJ,--芯棒直径
ZZCD,--轧制长度
GGFQS,--钢管分切数
CPCD,--成品长度
QT,--切头
QW,--切尾
BCS,--倍尺数
DBCPLCD,--单倍尺坯料长度
GPZJ,--管坯直径
HTCGZL_MAX,--计算最大量
HTCGZL_MIN,--计算最小量
SSL, --烧损率
MZ,--米重
ZZZL,--轧制重量
JHLC,--交货量差
DBCPLZL, --单倍尺坯料重量
(case when CX_FLAG ='1' then '已上传' else '未上传' end ) CX_FLAG --是否上传CX 0 未上传  1已上传

				from T_Po_Demand_Plan  
				where 1=1 
              ]]>
	</query>

	<query id="ProducHelperBean.queryPlanOrderD" 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  MIN(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.VALIDFLAG = '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 TO_CHAR((MIN(S3.PLAN_TIME_B) - T.PLAN_TIME_B), 'FM9990.00') || '天,' ||
                         MAX(S3.PLINE_NAME) || ',' || COUNT(1) || '条'
                    FROM PLN_ORDER_DBK_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%热处理%' THEN
                 (SELECT TO_CHAR((MIN(S3.PLAN_TIME_B) - T.PLAN_TIME_B), 'FM9990.00') || '天,' ||
                         MAX(S3.PLINE_NAME) || ',' || COUNT(1) || '条' 
                    FROM PLN_ORDER_RCL_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%加工%' THEN
                 (SELECT TO_CHAR((MIN(S3.PLAN_TIME_B) - T.PLAN_TIME_B), 'FM9990.00') || '天,' ||
                         MAX(S3.PLINE_NAME) || ',' || COUNT(1) || '条' 
                    FROM PLN_ORDER_JGX_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                ELSE
                 ''
              END)) AF_INFO,
       (CASE
         WHEN T.WHOLE_BACKLOG_DESC LIKE '%镦拔扩%' THEN
          (SELECT TO_CHAR(MIN(S3.PLAN_TIME_B), 'YYYY-MM-DD HH24:MI:SS') AF_PLAN_TIME_B
             FROM PLN_ORDER_DBK_S S3
            WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
         WHEN T.WHOLE_BACKLOG_DESC LIKE '%热处理%' THEN
          (SELECT TO_CHAR(MIN(S3.PLAN_TIME_B), 'YYYY-MM-DD HH24:MI:SS') AF_PLAN_TIME_B
             FROM PLN_ORDER_RCL_S S3
            WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
         WHEN T.WHOLE_BACKLOG_DESC LIKE '%加工%' THEN
          (SELECT TO_CHAR(MIN(S3.PLAN_TIME_B), 'YYYY-MM-DD HH24:MI:SS') AF_PLAN_TIME_B
             FROM PLN_ORDER_JGX_S S3
            WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
         ELSE
          ''
       END) AF_PLAN_TIME_B,
         DECODE((CASE
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%镦拔扩%' THEN
                 (SELECT min(S3.EXE_STATUS)
                    FROM PLN_ORDER_DBK_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%热处理%' THEN
                 (SELECT min(S3.EXE_STATUS)
                    FROM PLN_ORDER_RCL_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%加工%' THEN
                 (SELECT min(S3.EXE_STATUS)       
                    FROM PLN_ORDER_JGX_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                ELSE
                 ''
              END),
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') EXE_STATUS_AFTER,
       D.TRANSIT_TYP,
       D.DELVRY_ADDR,
       D.VALIDFLAG,
       T.ORD_LN_DLY_PK,
       D.ORD_LN_DLY_PK,
       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,
       DECODE(T.ISENDGX,
              '1',
              NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/'),
              T.PRO_PLAN_ID) PRO_PLAN_NO,
       NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/') ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHDISC,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.LEN_ROLL_MAX,
       T.LEN_ROLL_MIN,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.DIAMETER_GP,
       T.LEN_GP_SINGLE,
       T.ROLL_LENGTH,
       T.LEN_CUTHEAD,
       T.LEN_CUTEND,
       T.OUTNUM_CUT,
       T.DIAMETER_MANDREL,
       T.PASS_CODE,
       T.PASS_NAME,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       DECODE(T.ISENDGX, '1', '是', '/') ISENDGX,
       DECODE(T.IF_MONITOR_ZG, '1', '是', '/') IF_MONITOR_ZG,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.STATION_ROAD,
       T.PRO_MONTH,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.GX_PRO_SEQ,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) 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,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3' , '关闭A' , '') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', '是', '/') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       DECODE(T.IS_PLAN_OK, '1', '是', '/') IS_PLAN_OK,
       DECODE(T.GPREQ_IF_OK, '1', '是', '/') GPREQ_IF_OK,
       T.GPREQ_ID,
       T.ZY_BATCH_ID,
       T.CIC_GROUP_GP,
       T.PIC_GROUP_GP,
       T.SIC_GROUP_GP,
       T.DIC_GROUP_GP,
       T.WIC_GROUP_GP,
       T.GIC_GROUP_GP,
       T.CIC_GP,
       T.PIC_GP,
       T.SIC_GP,
       T.DIC_GP,
       T.WIC_GP,
       T.GIC_GP,
       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', '是', '/') IF_STOVE_ISSUED,
       DECODE(T.IS_NOTICE_EP,'0','未通知','1','已通知')IS_NOTICE_EP,
       T.IS_NOTICE_USER,
       TO_CHAR(T.IS_NOTICE_TIME, 'YYYY-MM-DD HH24:MI:SS') IS_NOTICE_TIME,
       TO_CHAR(T.STOVE_ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') STOVE_ISSUED_TIME,
       T.STOVE_ISSUED_MAN,
       T.IS_ONLOAD_LINE,
       T.OUTDIAMETER_ZG,
       T.WALLTHICK_ZG,
       T.WHOLE_BACKLOG_DESC,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       (SELECT S1.CRAFT_PATH
          FROM CRAFT_FILE_LV2 S1
         WHERE INSTR(T1.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') CRAFT_FILE_LV2_G,
      (SELECT CD.CRAFT_PATH  FROM CRAFT_ORD_DESIGN CD WHERE CD.ORD_LN_PK=T1.ORD_LN_PK AND CD.CRAFT_SEQ=T.CRAFT_SEQ) CRAFT_PATH,
       T.CRAFT_SEQ,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.STD_STYLE_DESC,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
       T1.MODEL_DESC,
       DECODE(T.IF_LEN_CONTROL, '1', '是', '0', '/') IF_LEN_CONTROL,
       DECODE(T.IF_MINUS_SIC_ROLL, '1', '是', '0', '/') IF_MINUS_SIC_ROLL,
       T.TUBE_END_RATIO,
       T.GPREQ_NUM,
       T.GPREQ_WEIGHT,
       T.VERIFY1,
       T.VERIFY2,
       T.VERIFY3,
       NVL(T.WEIGTH_S_MIN, 0) WEIGTH_S_MIN,
       (SELECT T9.BASENAME
          FROM COM_BASE_INFO T9
         WHERE T9.BASECODE = T.PRIORITY) PRIORITY,
       T.PRIORITY_MEMO,
       NVL(T.PLANS_NUM, 0) PLANS_NUM,
       T.ORIGINAL_NUMBER,
       T1.FINAL_USER_DESC,
       T.PROD_STANDARD,
       T.OUTPUT_STANDARD,
       T.THICKNESS_WALL,
       T.DECISION,
       T.PROCESS_DESC_C,
       T.APPLY_NO,
       DECODE(T.APPLY_STATUS,
              '00',
              '作废',
              '10',
              '申请',
              '20',
              '审批通过',
              '30',
              '审批不通过') APPLY_STATUS,
       T.ISSUED_MEMO,
       DECODE(T.OUTS_BILLET_FL, '0', '自炼', '1', '外购') OUTS_BILLET_FL,
       T1.OUTS_STL_PIPE_FL,
       T1.LEN_NO,
       T1.LENGTHDISC_N,
       T1.LEN_NO_N,
       T.PROGY_MEMO,
       (SELECT P.GRADECODE_ALL
          FROM PLN_SALEORD_PROC P
         WHERE P.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
           AND P.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID) GRADECODE_ALL,
       T1.PRD_CLS,
			 CASE
				WHEN T.ORDER_NO LIKE 'TH%' THEN
					(SELECT SALE_ORG_DESC FROM SLM_ORDER_HEAD WHERE ORDER_NO = (
					SELECT CUSTM_ORDER_NO FROM SLM_ORDER_HEAD WHERE ORDER_NO = T.ORDER_NO  AND VALIDFLAG = 1
					)  AND VALIDFLAG = 1)
				ELSE
					T1.ORDERFROM
			END ORDERFROM,
       T1.PRODUCE_SORT,
       (SELECT SP.HR_CAPCTY
          FROM SLM_BASE_MATERIAL_D_PL SP
         WHERE SP.PLINE_CODE = T.PLINE_CODE
           AND SP.IN_MATERIAL_NO = T.INWL_ID
           AND SP.OUT_MATERIAL_NO = T.OUTWL_ID) HR_CAPCTY,    
           DECODE(T.PASSIVE,'1','主动','0','被动') PASSIVE,
           DECODE(B.CODE_JG_BL,'',B.CODE_DJ_BL,B.CODE_JG_BL) REQ_BL_ID,
           T.GRADECODE_LK,T.GRADENAME_LK,T.CIC_GROUP_LK,
            (SELECT GET_GP_MAT_NUM_ZL(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) FURNA_NUM,
       (SELECT GET_GP_MAT_WT_ZL(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) FURNA_WEIGHT,
       (SELECT GET_GP_MAT_NUM(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) PEND_NUM,
       (SELECT GET_GP_MAT_WT(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) PEND_WEIGHT,
       (SELECT GET_GP_PLNZGM_NUM(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) LJ_NUM,
       (SELECT GET_GP_PLNZGM_WT(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) LJ_WEIGHT,
       (SELECT GET_GP_WT_CK(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) CK_WEIGHT,
       (SELECT GET_GP_NUM_CK(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) CK_NUM,
       (SELECT GET_ZG_REDUCED_WT(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) REDUCED_WT,
       (SELECT GET_ZG_YJCC_NUM(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) EXPECT_NUM,
       (SELECT GET_ZG_YJCC_WT(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) EXPECT_WT,
       (SELECT GET_GP_LJB_NUM(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) LJ_NUM_B,
       (SELECT GET_GP_LJB_WT(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) LJ_WEIGHT_B,
       (SELECT GET_ZG_TS(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) PHY_NAME,
       (SELECT LISTAGG(C.GRADENAME, ',') WITHIN GROUP(ORDER BY C.GRADENAME ASC) PROD_GRADENAME
          FROM (SELECT DISTINCT(M.GRADENAME) GRADENAME, M.PRO_PLAN_ID, M.GX_PLAN_NO
                  FROM PLN_ZY_ZG_M M) C
         WHERE C.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND C.GX_PLAN_NO = T.GX_PLAN_NO
           GROUP BY C.PRO_PLAN_ID ,C.GX_PLAN_NO) PROD_GRADENAME,
       T1.CUSTM_ORDER_NO,
       TO_CHAR(L.PRDCT_WGT, 'FM9999990.000') PRDCT_WGT,
       DECODE(L.DELVRY_RANGE_TPE,
              '%',
              '-' || L.DELVRY_RANGE_MIN || '%' || ',+' || L.DELVRY_RANGE_MAX || '%',
              '(' || L.DELVRY_RANGE_MIN || ',' || L.DELVRY_RANGE_MAX || ')') DELVRY_RANGE_TPE,
	   TO_CHAR(D.DELVRY_EDATE,'YYYY-MM-DD') DELVRY_EDATE,T1.TOTLENGTH_M,T1.ORDER_QTY,T1.ORDERWEIGHT,T1.ORDER_UNIT,
	    (SELECT B.DEPARTNAME FROM SLM_ORDER_HEAD A LEFT JOIN CORE_APP_DEPARTMENT B ON A.CREATE_DEPT = B.DEPARTID WHERE A.ORD_PK = L.ORD_PK ) DEPARTNAME,
	    (SELECT A.PENALTY_DESC FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = L.ORD_PK ) PENALTY_DESC,
	    (SELECT A.CREATE_NAME FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = L.ORD_PK ) ORDER_CREATE_NAME,
	    (SELECT A.DOCUMENTARY_NAME FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = L.ORD_PK ) ORDER_DOCUMENTARY_NAME,
	    DECODE(t.ORDER_TEAM,'1','是','0','否','')ORDER_TEAM
  FROM PLN_ORDER_ZG_S T,
       (SELECT Q1.PRODUCCODE,
               Q1.PRODUCNAME,
               Q1.STD_CODE,
               Q1.STD_NAME,
               Q1.STD_STYLE_DESC,
               Q1.SPEC_CODE,
               Q1.SPEC_NAME,
               Q1.ORD_LN_DLY_PK,
               Q1.ORD_LN_PK,
               Q1.STEELCODE,
               Q1.STEELNAME,
               Q1.DELVRY_RANGE_TPE,
               Q1.DELVRY_RANGE_MAX,
               Q1.DELVRY_RANGE_MIN,
               Q1.DELVRY_QTY,
               Q1.MODEL_DESC,
               NVL(Q4.ABRVITION,Q4.CUSTOMER_NM) FINAL_USER_DESC,
               Q1.LENGTHMAX,
               Q1.LENGTHMIN,
               Q1.OUTS_BILLET_FL,
               Q1.OUTS_STL_PIPE_FL,
               Q1.LENGTHDISC_N,
               Q1.LEN_NO_N,
               Q1.LEN_NO,
               (SELECT F.CUSTM_ORDER_NO FROM SLM_ORDER_HEAD F WHERE F.ORD_PK = Q1.ORD_PK )CUSTM_ORDER_NO,
               Q2.CRAFT_FILE_LV2_D,
               (SELECT A.PRODUC_DESC
                  FROM COM_BASE_PRODUCT A
                 WHERE A.PRODUCCODE = Q1.PRODUCCODE
                   AND A.VALIDFLAG = '1') PRD_CLS,
               (SELECT A.BASENAME
                  FROM COM_BASE_INFO A
                 WHERE A.BASECODE = Q1.ORDERFROM) ORDERFROM,
               Q1.PRODUCE_SORT, Q2.CRAFT_SEQ,Q1.TOTLENGTH_M,Q1.ORDER_QTY,Q1.ORDERWEIGHT,Q1.ORDER_UNIT,
               Q2.DESGIN_KEY     
          FROM PLN_SALEORD              Q1,
               CRAFT_ORD_DESIGN         Q2,
               CRAFT_ORD_DESIGN_APPOINT Q3,
               SLM_BASE_CUSTOMER        Q4
         WHERE Q1.ORD_LN_PK = Q3.ORD_LN_PK(+)
           AND Q1.FINAL_USER = Q4.CUSTOMER_NO(+)
           AND Q1.ORD_LN_PK = Q2.ORD_LN_PK(+)
           AND Q2.VALIDFLAG(+) = '1') T1,
       (SELECT MIN(S.NEXT_GX) NEXT_GX,
               S.PRO_PLAN_ID,
               MIN(S.PLAN_GROUP_ID) PLAN_GROUP_ID
          FROM PLN_ORDER_ZG S
         GROUP BY S.PRO_PLAN_ID) T2,
       SLM_ORDER_LINE_DELIVERY D,SLM_ORDER_LINE L,PLN_PORDER_BL_REQ B
 WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK(+)
   AND T.PRO_PLAN_ID = T2.PRO_PLAN_ID(+)
   AND T.ORD_LN_DLY_PK = D.ORD_LN_DLY_PK(+)
   AND T.ORD_LN_DLY_PK=B.REQ_BL_ID(+)
   AND D.ORD_LN_PK=L.ORD_LN_PK(+)
               ]]>
	</query>

	<query id="ProducHelperBean.queryPlanOrderDEasy">
		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,
		DECODE(T.ISENDGX,
		'1',
		NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/'),
		T.PRO_PLAN_ID) PRO_PLAN_NO,	
		NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/') ORDER_NO,
		T.ORDER_SEQ,
		T.DELIVERY_NO,
		T.REQ_BL_ID,
		T.PLINE_CODE,
		T.PLINE_NAME,
		T.STEELCODE,
		T.STEELNAME,
		T.GRADECODE,
		T.GRADENAME,
		T.OUTDIAMETER,
		T.WALLTHICK,
		T.LENGTHDISC,
		T.INWL_ID,
		T.INWL_DESC,
		T.OUTWL_ID,
		T.OUTWL_DESC,
		T.LEN_ROLL_MAX,
		T.LEN_ROLL_MIN,
		T.AIMOUTDIAMETER,
		T.AIMWALLTHICK,
		T.AIMLENGTH,
		T.DIAMETER_GP,
		T.LEN_GP_SINGLE,
		T.ROLL_LENGTH,
		T.LEN_CUTHEAD,
		T.LEN_CUTEND,
		T.OUTNUM_CUT,
		T.DIAMETER_MANDREL,
		T.PASS_CODE,
		T.PASS_NAME,
		T.IN_WEIGHT_S,
		T.IN_NUM_S,
		T.WEIGTH_S,
		T.NUM_S,
		T.ADD_WT_IN,
		T.ADD_NUM_IN,
		T.MATCH_WT_IN,
		T.MATCH_NUM_IN,
		DECODE(T.ISENDGX, '1', '是', '/') ISENDGX,
		DECODE(T.IF_MONITOR_ZG, '1', '是', '/') IF_MONITOR_ZG,
		T.PRDCR_NO,
		T.MONITOR_POINT,
		T.CRAFT_FILE_NO,
		T.CRAFT_FILE_MAN,
		T.CRAFT_SEQ,
		T.STATION_ROAD,
		T.PRO_MONTH,
		T.CIC,
		T.PIC,
		T.SIC,
		T.DIC,
		T.WIC,
		T.GIC,
		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,
		DECODE(T.EXE_STATUS,
		'0',
		'计划',
		'1',
		'生产中',
		'2',
		'已生产',
		'3',
		'关闭A',
		'') EXE_STATUS,
		DECODE(T.IS_REPAIR_PLN, '1', '是', '/') IS_REPAIR_PLN,
		T.REPAIR_TYPE,
		DECODE(T.IS_PLAN_OK, '1', '是', '/') IS_PLAN_OK,
		DECODE(T.GPREQ_IF_OK, '1', '是', '/') GPREQ_IF_OK,
		T.GPREQ_ID,
		T.ZY_BATCH_ID,
		T.CIC_GROUP_GP,
		T.PIC_GROUP_GP,
		T.SIC_GROUP_GP,
		T.DIC_GROUP_GP,
		T.WIC_GROUP_GP,
		T.GIC_GROUP_GP,
		T.CIC_GP,
		T.PIC_GP,
		T.SIC_GP,
		T.DIC_GP,
		T.WIC_GP,
		T.GIC_GP,
		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', '是', '/') 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.OUTDIAMETER_ZG,
		T.WALLTHICK_ZG,
		T.PROCESS_CODE_C,
		T.PROCESS_DESC_C,
		T.MSC,
		T.INDEX_SEQ,
		T.BOM,
		T.WHOLE_BACKLOG_DESC,
		T.IF_CRAFT_LOCKED,
		DECODE(T.IF_LEN_CONTROL, '1', '是', '0', '/') IF_LEN_CONTROL,
		DECODE(T.IF_MINUS_SIC_ROLL, '1', '是', '0', '/') IF_MINUS_SIC_ROLL,
		T.AIMWALLTHICK_OLD,
		T.WEIGTH_S_OLD,
		T.NUM_S_OLD,
		T.WALL_UPDATE_USER,
		TO_CHAR(T.WALL_UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') WALL_UPDATE_TIME,
		T.TUBE_END_RATIO,
		T.GPREQ_NUM,
		T.GPREQ_WEIGHT,
		T.VERIFY1,
		T.VERIFY2,
		T.VERIFY3,
		T.WEIGTH_S_MIN,
		T.PRIORITY,
		T.PRIORITY_MEMO,
		T.PLANS_NUM,
		T.ORIGINAL_NUMBER,
		T.PROD_STANDARD,
		T.OUTPUT_STANDARD,
		T.PIPE_LENGTH_MIN,
		T.PIPE_LENGTH_MAX,
		T.THICKNESS_WALL,
		T.DECISION,
		T.APPLY_NO,
		T.APPLY_STATUS,
		T.ISSUED_MEMO,
		T.PROGY_MEMO,
		DECODE(T.OUTS_BILLET_FL, '0', '自炼', '1', '外购') OUTS_BILLET_FL,
		T.ACTUAL_WEIGHT,
		T.STATE_SINGLE,
		T.PASSIVE,
		T.TAKE_NUM,
		T.TAKE_WT,
		T.PLINE_CODE_ZZ,
		T.PLINE_NAME_ZZ,
		T.GPREQ_IF_DZ,
		T.GRADECODE_LK,
		T.GRADENAME_LK,
		T.CIC_GROUP_LK,
		T.VALIDFLAG,
		T.GPREQ_WEIGHT_MIN,
		T.BATCHED_WT_G,
		T.BATCHED_NUM_G，
		(CASE
		WHEN
		T4.FST_DRAWEE_UNIT ='120607'
		THEN
		T3.BALNCE_PRICE
		WHEN
		T4.FST_DRAWEE_UNIT ='120608' AND T4.SUPPLY_UNIT='120501'
		THEN
		T3.BALNCE_PRICE
		WHEN
		T4.FST_DRAWEE_UNIT  !='120607' AND T4.SUPPLY_UNIT='120504'
		THEN
		T3.BALNCE_PRICE_ORG
		ELSE
		T3.BALNCE_PRICE
		END) BALNCE_PRICE,
		(SELECT F.CUSTM_ORDER_NO FROM SLM_ORDER_HEAD F WHERE F.ORD_PK = T5.ORD_PK )CUSTM_ORDER_NO,
		 NVL(T6.ABRVITION,T6.CUSTOMER_NM) FINAL_USER_DESC,
		T5.PRODUCNAME,
		T5.STD_NAME,
		T5.SPEC_NAME,
		T5.MODEL_DESC,
		T5.STD_STYLE_DESC
		FROM PLN_ORDER_ZG_S T
		LEFT JOIN SLM_ORDER_LINE_DELIVERY T2
		ON T2.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
		LEFT JOIN SLM_ORDER_LINE T3
		ON T3.ORD_LN_PK = T2.ORD_LN_PK
		LEFT JOIN SLM_ORDER_HEAD T4
		ON T4.ORD_PK = T2.ORD_PK
		LEFT JOIN PLN_SALEORD T5
		ON T5.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
		LEFT JOIN SLM_BASE_CUSTOMER T6
		ON T5.FINAL_USER = T6.CUSTOMER_NO
		WHERE 1 = 1
	</query>

	<query id="ProducHelperBean.queryPlanOrderE" desc="查询镦拔扩排产(界面)">
             <![CDATA[  
      SELECT (CASE
         WHEN T.WHOLE_BACKLOG_DESC LIKE '%轧制%' THEN
          (SELECT TO_CHAR((T.PLAN_TIME_B - MIN(TP.PLAN_TIME_B)), 'FM9990.00') || '天,' ||
                  MIN(TP.PLINE_NAME) || ',' || COUNT(1) || '条'
             FROM PLN_ORDER_ZG_S TP
            WHERE TP.PRO_PLAN_ID = T.PREV_GXPLAN_ID)
         ELSE
          ''
       END) PRE_INFO,
       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.VALIDFLAG = '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 TO_CHAR((T.PLAN_TIME_B - MIN(S3.PLAN_TIME_B)), 'FM9990.00') || '天,' ||
                         MAX(S3.PLINE_NAME) || ',' || COUNT(1) || '条'
                    FROM PLN_ORDER_RCL_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
              
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%加工%' THEN
                 (SELECT TO_CHAR((T.PLAN_TIME_B - MIN(S3.PLAN_TIME_B)), 'FM9990.00') || '天,' ||
                         MAX(S3.PLINE_NAME) || ',' || COUNT(1) || '条'
                    FROM PLN_ORDER_JGX_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                ELSE
                 ''
              END)) AF_INFO,
       DECODE((CASE
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%轧制%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_ZG_S S3
                   WHERE S3.PRO_PLAN_ID= T.PREV_GXPLAN_ID )
                ELSE
                 ''
              END),
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') BEFORE_STATE,
       DECODE((CASE
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%热处理%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_RCL_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
              
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%加工%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_JGX_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                ELSE
                 ''
              END),
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') AFTER_STATE,
       '' IF_ZY_READY,
       (CASE
         WHEN (SELECT COUNT(1)
                 FROM PLN_ZY_DBK_M Z1
                WHERE Z1.PRO_PLAN_ID = T.PRO_PLAN_ID
                  AND Z1.GX_PLAN_NO = T.GX_PLAN_NO) > 0 THEN
          'Y'
         ELSE
          ''
       END) IF_ZY_M,
       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,
       DECODE(T.ISENDGX,
              '1',
              NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/'),
              T.PRO_PLAN_ID) PRO_PLAN_NO,
       NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/') 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,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) 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,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', '是', '/') 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,
       DECODE(T.ISENDGX, '1', '是', '/') ISENDGX,
       DECODE(T.IF_MONITOR_DBK, '1', '是', '/') IF_MONITOR_DBK,
        DECODE(T.IS_NOTICE_EP,'0','未通知','1','已通知')IS_NOTICE_EP,
       T.IS_NOTICE_USER,
       TO_CHAR(T.IS_NOTICE_TIME, 'YYYY-MM-DD HH24:MI:SS') IS_NOTICE_TIME,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.STATION_ROAD,
       (SELECT SUM(NVL(M.PLN_INSINGLE_WT, 0))
          FROM PLN_ZY_DBK_M M
         WHERE M.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND M.GX_PLAN_NO = T.GX_PLAN_NO) BATCHED_WT,
       (SELECT SUM(NVL(M.PLN_INSINGLE_NUM, 0))
          FROM PLN_ZY_DBK_M M
         WHERE M.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND M.GX_PLAN_NO = T.GX_PLAN_NO) BATCHED_NUM,
       (SELECT SUM(NVL(C.PLAN_INDOUBLE_WT, 0))-SUM(NVL(C.REAL_INDOUBLE_WT, 0))
          FROM PLN_ZY_DBK_C C,PLN_ZY_DBK_M M  WHERE C.HEAT_PLAN_NO = M.HEAT_PLAN_NO AND C.PRO_PLAN_ID=T.PRO_PLAN_ID AND C.GX_PLAN_NO=T.GX_PLAN_NO
       ) REAL_BATCH_WT,
       (SELECT SUM(NVL(C.PLAN_INDOUBLE_NUM, 0))-SUM(NVL(C.REAL_INDOUBLE_NUM, 0))
          FROM PLN_ZY_DBK_C C,PLN_ZY_DBK_M M  WHERE C.HEAT_PLAN_NO = M.HEAT_PLAN_NO AND C.PRO_PLAN_ID=T.PRO_PLAN_ID AND C.GX_PLAN_NO=T.GX_PLAN_NO
        ) REAL_BATCH_NUM,
      (SELECT SUM(NVL(M.REAL_INDOUBLE_WT,0)) FROM PLN_ZY_DBK_C M WHERE M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO AND M.IF_FLAG='0') Real_Indouble_Wt,
      (SELECT SUM(NVL(M.REAL_INDOUBLE_NUM,0)) FROM PLN_ZY_DBK_C M WHERE M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO AND M.IF_FLAG='0') Real_Indouble_Num,
      (SELECT SUM(NVL(M.REAL_OUTDOUBLE_WT,0)) FROM PLN_ZY_DBK_C M WHERE M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO AND M.IF_FLAG='0') FINISHWEIGHT,
      (SELECT SUM(NVL(M.REAL_OUTDOUBLE_NUM,0)) FROM PLN_ZY_DBK_C M WHERE M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO AND M.IF_FLAG='0') FINISHNUM,
      NVL((SELECT SUM(M.PLN_OUTSINGLE_W) FROM PLN_ZY_DBK_M M WHERE M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO AND M.IF_FLAG='0'),0) Expect_Wt,
      NVL((SELECT SUM(M.PLN_OUTSINGLE_NUM) FROM PLN_ZY_DBK_M M WHERE M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO AND M.IF_FLAG='0'),0) Expect_Num,
       DECODE(T.IS_PLAN_OK, '1', '是', '/') 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,
       DECODE(T.IF_STOVE_ISSUED, '1', '是', '/') IF_STOVE_ISSUED,
       TO_CHAR(T.STOVE_ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') STOVE_ISSUED_TIME,
       T.STOVE_ISSUED_MAN,
       DECODE(T.IS_ONLOAD_LINE, '1', '是', '/') IS_ONLOAD_LINE,
       T.WHOLE_BACKLOG_DESC,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       S.PRODUCCODE,
       S.PRODUCNAME,
       S.STD_CODE,
       S.STD_NAME,
       S.STD_STYLE_DESC,
       T2.ORDER_SPEC_CODE,
       T2.ORDER_SPEC_DESC,
       S.SPEC_CODE,
       S.SPEC_NAME,
       S.STEELCODE,
       S.STEELNAME,
       (SELECT LV.CRAFT_PATH
          FROM CRAFT_FILE_LV2 LV
         WHERE INSTR(T2.CRAFT_FILE_LV2_E, LV.PK) > 0
           AND INSTR(LV.PLINE_CODE, T.PLINE_CODE) > 0
           AND LV.VALIDFLAG = '1'
           AND LV.PROCESS_CODE = 'E') CRAFT_FILE_LV2_G,
       NVL(T.WEIGTH_S_MIN, 0) MIN_WGT,
       (SELECT CD.CRAFT_PATH
          FROM CRAFT_ORD_DESIGN CD
         WHERE CD.ORD_LN_PK = T2.ORD_LN_PK
           AND CD.CRAFT_SEQ = T.CRAFT_SEQ) CRAFT_PATH,
       T.CRAFT_SEQ,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       (SELECT T9.BASENAME
          FROM COM_BASE_INFO T9
         WHERE T9.BASECODE = T.PRIORITY) PRIORITY,
       T.PRIORITY_MEMO,T.DECISION,
       (SELECT SUM(NVL(Z.PLANS_NUM, 0))
          FROM PLN_ORDER_ZG_S  Z
         WHERE Z.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
           AND Z.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID) OUTPUT_NUM,
      (Select  TO_CHAR(MIN(Z.PLAN_TIME_B),'YYYY-MM-DD HH24:MI:SS') from PLN_ORDER_ZG_S Z where Z.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK AND Z.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID) zg_Start_Time,
      T.PASS_NAME,T.PASS_CODE,T.FINAL_USER_DESC,
       (SELECT SP.HR_CAPCTY
          FROM SLM_BASE_MATERIAL_E_PL SP
         WHERE SP.PLINE_CODE = T.PLINE_CODE
           AND SP.IN_MATERIAL_NO = T.INWL_ID
           AND SP.OUT_MATERIAL_NO = T.OUTWL_ID) HR_CAPCTY,
(SELECT GET_DBK_PRDCR_ADVC_DAY(T.PRO_PLAN_ID) FROM DUAL) PRDCR_ADVC_DAY,
(SELECT A.PENALTY_DESC FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = D.ORD_PK ) PENALTY_DESC,
(SELECT A.CREATE_NAME FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = D.ORD_PK ) ORDER_CREATE_NAME,
(SELECT A.DOCUMENTARY_NAME FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = D.ORD_PK ) ORDER_DOCUMENTARY_NAME,
DECODE(t.ORDER_TEAM,'1','是','0','否','')ORDER_TEAM
  FROM PLN_ORDER_DBK_S T,
       (SELECT 
               Q1.ORDER_SPEC_CODE,
               Q1.ORDER_SPEC_DESC,
               Q2.ORD_LN_DLY_PK,
               Q2.ORD_LN_PK,             
               Q1.DELVRY_RANGE_TPE,
               Q1.DELVRY_RANGE_MAX,
               Q1.DELVRY_RANGE_MIN,
               Q2.DELVRY_QTY,
               Q4.CRAFT_NAME,
               Q3.CRAFT_FILE_LV2_E
          FROM SLM_ORDER_LINE           Q1,
               SLM_ORDER_LINE_DELIVERY  Q2,
               CRAFT_ORD_DESIGN         Q3,
               CRAFT_ORD_DESIGN_APPOINT Q4
         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK
           AND Q1.ORD_LN_PK = Q4.ORD_LN_PK(+)
           AND Q1.ORD_LN_PK = Q3.ORD_LN_PK(+)
           AND Q3.VALIDFLAG(+) = '1') T2,
       (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) T3,PLN_SALEORD S,
         SLM_ORDER_LINE_DELIVERY D
 WHERE T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK(+)
    AND T.PRO_PLAN_ID = T3.PRO_PLAN_ID(+)
    AND T.ORD_LN_DLY_PK = S.ORD_LN_DLY_PK(+)
     AND T.ORD_LN_DLY_PK = D.ORD_LN_DLY_PK(+)
               ]]>
	</query>

	<query id="ProducHelperBean.queryPlanOrderF" desc="查询热处理排产(界面)">
             <![CDATA[  
SELECT (CASE
          WHEN T.WHOLE_BACKLOG_DESC LIKE '%镦拔扩%' THEN
          (SELECT TO_CHAR((T.PLAN_TIME_B - MIN(TP.PLAN_TIME_B)), 'FM9990.00') || '天,' ||
                  MIN(TP.PLINE_NAME) || ',' || COUNT(1) || '条'
             FROM PLN_ORDER_DBK_S TP
            WHERE TP.PRO_PLAN_ID = T.PREV_GXPLAN_ID)
         WHEN T.WHOLE_BACKLOG_DESC LIKE '%轧制%' THEN
          (SELECT TO_CHAR((T.PLAN_TIME_B - MIN(TP.PLAN_TIME_B)), 'FM9990.00') || '天,' ||
                  MIN(TP.PLINE_NAME) || ',' || COUNT(1) || '条'
             FROM PLN_ORDER_ZG_S TP
            WHERE TP.PRO_PLAN_ID = T.PREV_GXPLAN_ID)  
         ELSE
          ''
       END) PRE_INFO,
      (CASE WHEN T.ORD_LN_DLY_PK LIKE '%ZZBY-J%' AND T.WHOLE_BACKLOG_DESC NOT LIKE '%加工%' THEN
           '天,' || (SELECT MAX(M.PLINE_NAME)|| ','|| COUNT(1) || '条'
                    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.VALIDFLAG = '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 TO_CHAR((T.PLAN_TIME_B - MIN(S3.PLAN_TIME_B)), 'FM9990.00') || '天,' ||
                         MAX(S3.PLINE_NAME) || ',' || COUNT(1) || '条'
                    FROM PLN_ORDER_JGX_S S3
                   WHERE S3.PREV_GXPLAN_ID = T.PRO_PLAN_ID)
                ELSE
                 ''
              END))END) AF_INFO,
       DECODE((CASE
        WHEN T.WHOLE_BACKLOG_DESC LIKE '%镦拔扩%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_DBK_S S3
                   WHERE S3.PRO_PLAN_ID= T.PREV_GXPLAN_ID )
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%轧制%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_ZG_S S3
                   WHERE S3.PRO_PLAN_ID= T.PREV_GXPLAN_ID )
                ELSE
                 ''
              END),
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') BEFORE_STATE,
       DECODE((CASE
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%加工%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_JGX_S S3
                   WHERE  S3.PREV_GXPLAN_ID= T.PRO_PLAN_ID )
                ELSE
                 ''
              END),
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') AFTER_STATE,
       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,
       DECODE(T.ISENDGX,
              '1',
              NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/'),
              T.PRO_PLAN_ID) PRO_PLAN_NO,
       NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/') 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,
       DECODE(T.IF_MONITOR_RCL, '1', '是', '/') IF_MONITOR_RCL,
        DECODE(T.IS_NOTICE_EP,'0','未通知','1','已通知')IS_NOTICE_EP,
       T.IS_NOTICE_USER,
       TO_CHAR(T.IS_NOTICE_TIME, 'YYYY-MM-DD HH24:MI:SS') IS_NOTICE_TIME,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.STATION_ROAD,
       T.GX_PRO_SEQ,
       TO_CHAR(ROUND(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) 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,
    DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', '是', '/') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       T.ZY_BATCH_ID,
       T.ADD_WT_IN,
       T.ADD_NUM_IN,
       DECODE(T.ISENDGX, '1', '是', '/') ISENDGX,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       DECODE(T.IS_PLAN_OK, '1', '是', '/') 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,
       T.PROGY_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.WHOLE_BACKLOG_DESC,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       T.GROUP_RCL,
       T1.SALE_ORG_DESC,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.STD_STYLE_DESC,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       (SELECT S1.CRAFT_PATH
          FROM CRAFT_FILE_LV2 S1
         WHERE INSTR(T1.CRAFT_FILE_LV2_F, S1.PK) > 0
           AND INSTR(S1.PLINE_CODE, T.PLINE_CODE) > 0
           AND S1.VALIDFLAG = '1'
           AND S1.PROCESS_CODE = 'F') CRAFT_FILE_LV2_G, --二级工艺文件
      (SELECT CD.CRAFT_PATH  FROM CRAFT_ORD_DESIGN CD WHERE CD.ORD_LN_PK=T1.ORD_LN_PK AND CD.CRAFT_SEQ=T.CRAFT_SEQ) CRAFT_PATH,
      T1.CRAFT_CHANGE_MEMO,
       T.CRAFT_SEQ,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       DECODE(T.IF_STOVE_ISSUED,'1','是','/') IF_STOVE_ISSUED,
       T.STOVE_ISSUED_MAN,
       TO_CHAR(T.STOVE_ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') STOVE_ISSUED_TIME,
       NVL((SELECT A.ABRVITION
             FROM SLM_BASE_CUSTOMER A
            WHERE A.CUSTOMER_NO = DECODE(T1.FINAL_USER,
                                         NULL,
                                         T1.BUYER_ID,
                                         '/',
                                         T1.BUYER_ID,
                                         T1.FINAL_USER)),
           DECODE(T1.FINAL_USER_DESC,
                  NULL,
                  T1.BUYER_NAME,
                  '/',
                  T1.BUYER_NAME,
                  T1.FINAL_USER_DESC)) FINAL_USER_DESC,
       (SELECT T9.BASENAME
          FROM COM_BASE_INFO T9
         WHERE T9.BASECODE = T.PRIORITY) PRIORITY,
         nvl(T.WEIGTH_S_MIN,0) WEIGTH_S_MIN,
       T.PRIORITY_MEMO,
          (SELECT SUM(NVL(Z.PLANS_NUM, 0))
          FROM PLN_ORDER_ZG_S  Z
         WHERE Z.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
           AND Z.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID) OUTPUT_NUM,
      (Select  TO_CHAR(MIN(Z.PLAN_TIME_B),'YYYY-MM-DD HH24:MI:SS') from PLN_ORDER_ZG_S Z where Z.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK AND Z.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID) zg_Start_Time,
      T.DECISION,
           (SELECT SP.HR_CAPCTY
          FROM SLM_BASE_MATERIAL_F_PL SP
         WHERE SP.PLINE_CODE = T.PLINE_CODE
           AND SP.IN_MATERIAL_NO = T.INWL_ID
           AND SP.OUT_MATERIAL_NO = T.OUTWL_ID) HR_CAPCTY,
(SELECT GET_PRDCR_ADVC_DAY(T.PRO_PLAN_ID) FROM DUAL) PRDCR_ADVC_DAY,
T.PROCESS_DESC_C, M1.BATCHED_WT,
       M1.BATCHED_NUM,
       M3.FINISHWEIGHT,
       M3.FINISHNUM,
       M1.Expect_Wt, M1.Expect_Num,
       m2.Real_Batch_Wt,
       m2.Real_Batch_Num,
       m3.Real_Indouble_Wt,
       m3.Real_Indouble_Num,
       TO_CHAR(D.DELVRY_EDATE,'YYYY-MM-DD') DELVRY_EDATE,
       (SELECT A.PENALTY_DESC FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = D.ORD_PK ) PENALTY_DESC,
       (SELECT A.CREATE_NAME FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = D.ORD_PK ) ORDER_CREATE_NAME,
	   (SELECT A.DOCUMENTARY_NAME FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = D.ORD_PK ) ORDER_DOCUMENTARY_NAME,
       DECODE(t.ORDER_TEAM,'1','是','0','否','')ORDER_TEAM,
       (SELECT MIN(LEN_ROLL_MIN)
             FROM PLN_ORDER_ZG_S TP
            WHERE TP.PRO_PLAN_ID = T.PREV_GXPLAN_ID) LEN_ROLL_MIN
  FROM PLN_ORDER_RCL_S T,
       (SELECT Q1.PRODUCCODE,
               Q1.PRODUCNAME,
               Q1.STD_CODE,
               Q1.STD_NAME,
               Q1.STD_STYLE_DESC,
               Q1.SPEC_CODE,
               Q1.SPEC_NAME,
               Q1.ORD_LN_DLY_PK,
               Q1.ORD_LN_PK,
               Q1.STEELCODE,
               Q1.STEELNAME,
               Q1.DELVRY_RANGE_TPE,
               Q1.DELVRY_RANGE_MAX,
               Q1.DELVRY_RANGE_MIN,
               Q1.DELVRY_QTY,
               Q3.CRAFT_NAME,
               Q1.FINAL_USER,
               Q1.FINAL_USER_DESC,
               Q1.BUYER_ID,
               Q1.BUYER_NAME,
               Q1.MODEL_CODE,
               Q1.MODEL_DESC,
               Q4.SALE_ORG_DESC,
               Q2.CRAFT_FILE_LV2_F,
               Q2.CRAFT_CHANGE_MEMO
          FROM PLN_SALEORD              Q1,
               CRAFT_ORD_DESIGN         Q2,
               CRAFT_ORD_DESIGN_APPOINT Q3,
               SLM_ORDER_HEAD           Q4
         WHERE Q1.ORD_LN_PK = Q3.ORD_LN_PK(+)
           AND Q1.ORD_PK = Q4.ORD_PK(+) 
            AND Q1.ORD_LN_PK = Q2.ORD_LN_PK(+)
           AND Q2.VALIDFLAG(+) = '1') T1,
       (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,
       PLN_GX_RCL_M T3, SLM_ORDER_LINE_DELIVERY D,
       (SELECT SUM(NVL(M.PLN_INSINGLE_WT, 0)) BATCHED_WT,
               SUM(NVL(M.PLN_INSINGLE_NUM, 0)) BATCHED_NUM,
               SUM(NVL(M.PLN_OUTSINGLE_W, 0)) Expect_Wt,
               SUM(NVL(M.PLN_OUTSINGLE_NUM, 0)) Expect_Num,
               M.PRO_PLAN_ID,
               M.GX_PLAN_NO
          FROM PLN_ZY_RCL_M M,PLN_ORDER_RCL_S s
         WHERE M.PRO_PLAN_ID = s.PRO_PLAN_ID
           AND M.GX_PLAN_NO = s.GX_PLAN_NO
           AND M.IF_FLAG='0'
         group by M.PRO_PLAN_ID, M.GX_PLAN_NO) m1,  
          (SELECT SUM(NVL(C.PLAN_INDOUBLE_WT, 0))-SUM(NVL(C.REAL_INDOUBLE_WT, 0)) Real_Batch_Wt,
               SUM(NVL(C.PLAN_INDOUBLE_NUM, 0))- SUM(NVL(C.REAL_INDOUBLE_NUM, 0)) Real_Batch_Num,
               M.PRO_PLAN_ID,
               M.GX_PLAN_NO
          FROM PLN_ZY_RCL_C C, PLN_ZY_RCL_M M,PLN_ORDER_RCL_S s
         WHERE C.HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND C.PRO_PLAN_ID = s.PRO_PLAN_ID
           AND C.GX_PLAN_NO = s.GX_PLAN_NO
           AND M.IF_FLAG='0'
          -- AND M.PLANSTATUS IN ('00', '10')
         GROUP BY M.PRO_PLAN_ID, M.GX_PLAN_NO) M2,
               (SELECT SUM(NVL(M.REAL_INDOUBLE_WT, 0)) Real_Indouble_Wt,
               SUM(NVL(M.REAL_INDOUBLE_NUM, 0)) Real_Indouble_Num,
                SUM(NVL(M.REAL_OUTDOUBLE_WT, 0)) FINISHWEIGHT,
               SUM(NVL(M.REAL_OUTDOUBLE_NUM, 0)) FINISHNUM,
               M.PRO_PLAN_ID,
               M.GX_PLAN_NO
          FROM PLN_ZY_RCL_C M,PLN_ORDER_RCL_S s
         WHERE M.PRO_PLAN_ID = s.PRO_PLAN_ID
           AND M.GX_PLAN_NO = s.GX_PLAN_NO
           AND M.IF_FLAG='0'
         GROUP BY M.PRO_PLAN_ID, M.GX_PLAN_NO) M3
 WHERE T.PRO_PLAN_ID = T3.PRO_PLAN_ID(+)
   AND T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK(+)
   AND T.PRO_PLAN_ID = T2.PRO_PLAN_ID(+)
    AND T.ORD_LN_DLY_PK = D.ORD_LN_DLY_PK(+)
      and t.PRO_PLAN_ID = m1.PRO_PLAN_ID(+)
   AND t.GX_PLAN_NO = m1.GX_PLAN_NO(+)
     and t.PRO_PLAN_ID = m2.PRO_PLAN_ID(+)
   AND t.GX_PLAN_NO = m2.GX_PLAN_NO(+)
     and t.PRO_PLAN_ID = m3.PRO_PLAN_ID(+)
   AND t.GX_PLAN_NO = m3.GX_PLAN_NO(+)
               ]]>
	</query>



	<query id="ProducHelperBean.queryPlanOrderG" desc="查询加工排产(界面)">
             <![CDATA[  
                        SELECT (CASE
                         WHEN T.WHOLE_BACKLOG_DESC LIKE '%热处理%' THEN
          (SELECT TO_CHAR((T.PLAN_TIME_B - MIN(TP.PLAN_TIME_B)), 'fm9990.00') || '天,' ||
                  MIN(TP.PLINE_NAME) || ',' || COUNT(1) || '条'
             FROM PLN_ORDER_RCL_S TP
            WHERE TP.PRO_PLAN_ID = T.PREV_GXPLAN_ID)
               WHEN T.WHOLE_BACKLOG_DESC LIKE '%镦拔扩%' THEN
          (SELECT TO_CHAR((T.PLAN_TIME_B - MIN(TP.PLAN_TIME_B)), 'fm9990.00') || '天,' ||
                  MIN(TP.PLINE_NAME) || ',' || COUNT(1) || '条'
             FROM PLN_ORDER_DBK_S TP
            WHERE TP.PRO_PLAN_ID = T.PREV_GXPLAN_ID)
         WHEN T.WHOLE_BACKLOG_DESC LIKE '%轧制%' THEN
          (SELECT TO_CHAR((T.PLAN_TIME_B - MIN(TP.PLAN_TIME_B)), 'fm9990.00') || '天,' ||
                  MIN(TP.PLINE_NAME) || ',' || COUNT(1) || '条'
             FROM PLN_ORDER_ZG_S TP
            WHERE TP.PRO_PLAN_ID = T.PREV_GXPLAN_ID)
         ELSE
          ''
       END) PRE_INFO,
       CASE WHEN D.TRANSIT_TYP = '110501' THEN
                 '汽运' || '  ' ||
                 (SELECT MAX(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 MAX(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.VALIDFLAG = '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,
       DECODE((CASE
        WHEN T.WHOLE_BACKLOG_DESC LIKE '%热处理%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_RCL_S S3
                   WHERE S3.PRO_PLAN_ID= T.PREV_GXPLAN_ID)
                      WHEN T.WHOLE_BACKLOG_DESC LIKE '%镦拔扩%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_DBK_S S3
                   WHERE S3.PRO_PLAN_ID= T.PREV_GXPLAN_ID)
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%轧制%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_ZG_S S3
                   WHERE S3.PRO_PLAN_ID= T.PREV_GXPLAN_ID)
                ELSE
                 ''
              END),
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') BEFORE_STATE,
       T.IF_EXPORT,
       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.WHOLE_BACKLOG_DESC,
       T.MSC,
       T.INDEX_SEQ,
       T.BOM,
       (SELECT T9.BASENAME
          FROM COM_BASE_INFO T9
         WHERE T9.BASECODE = T.PRIORITY) PRIORITY,
       T.PRIORITY_MEMO,
       TO_CHAR(T.DELVRY_EDATE, 'YYYY-MM-DD') DELVRY_EDATE,
       T.STATION_NM,
       T.OUTLINE_SITE_250,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.MEMO,
       T.PROGY_MEMO,
       T.PRO_ORDER_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/') PRO_PLAN_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       NULLIF(T.ORDER_NO || '/' || T.ORDER_SEQ, '/') ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.STEELCODE,
       T.STEELNAME,
       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.MODEL_CODE,
       T.MODEL_DESC,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.LENGTH_IN,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.IN_WEIGHT_S,
       T.IN_NUM_S,
       T.WEIGTH_S,
       T.NUM_S,
       T.MATCH_WT_IN,
       T.MATCH_NUM_IN,
       DECODE(T.IF_MONITOR_JGX, '1', '是', '/') IF_MONITOR_JGX,
        DECODE(T.IS_NOTICE_EP,'0','未通知','1','已通知')IS_NOTICE_EP,
       T.IS_NOTICE_USER,
       TO_CHAR(T.IS_NOTICE_TIME, 'YYYY-MM-DD HH24:MI:SS') IS_NOTICE_TIME,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.STATION_ROAD,
       T.GX_PRO_SEQ,
       TO_CHAR(round(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) 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,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', '是', '/') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       DECODE(T.IS_PLAN_OK, '1', '是', '/') IS_PLAN_OK,
       T.ZY_BATCH_ID,
       T.PRO_MONTH,
       T.PREVIOUS_GX,
       T.PREV_GXPLAN_ID,
       T.GROUP_JGX,
       (SELECT NVL(L2.ABRVITION,L2.CUSTOMER_NM) FROM PLN_SALEORD L1,SLM_BASE_CUSTOMER L2 WHERE L1.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
       AND L1.FINAL_USER = L2.CUSTOMER_NO)FINAL_USER_DESC,
       T2.SALE_ORG_DESC,
       S.PRODUCCODE,
       S.PRODUCNAME,
       S.STD_CODE,
       S.STD_NAME,
       S.STD_STYLE_DESC,
       T2.ORDER_SPEC_CODE,
       T2.ORDER_SPEC_DESC,
       S.SPEC_CODE,
       S.SPEC_NAME,
        (SELECT CD.CRAFT_PATH  FROM CRAFT_ORD_DESIGN CD WHERE CD.ORD_LN_PK=T2.ORD_LN_PK AND CD.CRAFT_SEQ=T.CRAFT_SEQ) CRAFT_PATH,
       T.CRAFT_SEQ,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       (SELECT LV.CRAFT_PATH
          FROM CRAFT_FILE_LV2 LV
         WHERE INSTR(T2.CRAFT_FILE_LV2_G, LV.PK) > 0
           AND INSTR(LV.PLINE_CODE, T.PLINE_CODE) > 0
           AND LV.VALIDFLAG = '1'
           AND LV.PROCESS_CODE = 'G') CRAFT_FILE_LV2_G,
       T3.ADD_ASK1,
       T3.ADD_ASK2,
       T3.ADD_ASK3,
       T3.ADD_ASK4,
       T3.ADD_ASK5,
       T3.ADD_ASK6,
       T3.ADD_ASK7,
       T3.ADD_ASK8,
       T3.ADD_ASK9,
       T3.ADD_ASK10,
       T3.ADD_ASK11,
       T3.ADD_ASK12,
       T3.ADD_ASK13,
        (SELECT SUM(NVL(ZG.PLANS_NUM, 0))
          FROM PLN_ORDER_ZG_S ZG
         WHERE ZG.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
           AND ZG.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID) OUTPUT_NUM,
       (SELECT TO_CHAR(MIN(Z.PLAN_TIME_B), 'YYYY-MM-DD HH24:MI:SS')
          FROM PLN_ORDER_ZG_S Z
         WHERE Z.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
           AND Z.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID) ZG_START_TIME,
       NVL((SELECT SUM(M.PREDICT_TON)
             FROM MIL_PLAN M, PLN_ORDER_ZG_S Z
            WHERE M.PRO_PLAN_ID = Z.PRO_PLAN_ID
              AND M.GX_PLAN_NO = Z.GX_PLAN_NO
              AND Z.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
              AND Z.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID
              AND SUBSTR(M.JUDGE_STOVE_NO, 8, 2) = '01'),
           0) EXPECT_WT,
       NVL((SELECT SUM(M.PREDICT_PIECE)
             FROM MIL_PLAN M, PLN_ORDER_ZG_S Z
            WHERE M.PRO_PLAN_ID = Z.PRO_PLAN_ID
              AND M.GX_PLAN_NO = Z.GX_PLAN_NO
              AND Z.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
              AND Z.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID
              AND SUBSTR(M.JUDGE_STOVE_NO, 8, 2) = '01'),
           0) EXPECT_NUM,
        (SELECT Z1.GRADENAME
          FROM (SELECT Z.GRADENAME,Z.ORD_LN_DLY_PK,Z.PLN_DIVIDE_ID
                  FROM PLN_ORDER_ZG_S Z
                  ORDER BY TO_NUMBER(Z.GX_PRO_SEQ)) Z1
         WHERE ROWNUM = 1
           AND Z1.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
           AND Z1.PLN_DIVIDE_ID = T.PLN_DIVIDE_ID) GRADENAME,
       DECODE(T.IF_STOVE_ISSUED, '1', '是', '/') IF_STOVE_ISSUED,
       TO_CHAR(T.STOVE_ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') STOVE_ISSUED_TIME,
       T.STOVE_ISSUED_MAN,
       T.ISSUED_MAN,
       TO_CHAR(T.ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') ISSUED_TIME,
       TO_CHAR(T.LAST_UNDOWN_TIME, 'YYYY-MM-DD HH24:MI:SS') LAST_UNDOWN_TIME,
       T.LAST_UNDOWN_MAN,
       T.OUTNUM_CUT,T.DECISION,
          (SELECT SP.HR_CAPCTY
          FROM SLM_BASE_MATERIAL_K_PL SP
         WHERE SP.PLINE_CODE = T.PLINE_CODE
           AND SP.IN_MATERIAL_NO = T.INWL_ID
           AND SP.OUT_MATERIAL_NO = T.OUTWL_ID) HR_CAPCTY,
(SELECT GET_JGX_PRDCR_ADVC_DAY(T.PRO_PLAN_ID) FROM DUAL) PRDCR_ADVC_DAY,   M1.BATCHED_WT,
       M1.BATCHED_NUM,
       M3.FINISHWEIGHT,
       M3.FINISHNUM,
       M1.Expect_Wt_J, M1.Expect_Num_J,
       m2.Real_Batch_Wt,
       m2.Real_Batch_Num,
       m3.Real_Indouble_Wt,
       m3.Real_Indouble_Num,
       TO_CHAR(D.DELVRY_EDATE,'YYYY-MM-DD') DELVRY_EDATE,
       TO_NUMBER(NVL(M5.PIECES,0 )) + TO_NUMBER(NVL(M6.PIECES,0 )) KC_ALL_COUNT,
	   NVL(M4.PIECES,0)TRANSIT_COUNT,
	   (SELECT A.PENALTY_DESC FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = D.ORD_PK ) PENALTY_DESC,
	   (SELECT A.CREATE_NAME FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = D.ORD_PK ) ORDER_CREATE_NAME,
	   (SELECT A.DOCUMENTARY_NAME FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = D.ORD_PK ) ORDER_DOCUMENTARY_NAME,
	   DECODE(t.ORDER_TEAM,'1','是','0','否','')ORDER_TEAM
  FROM PLN_ORDER_JGX_S T,PLN_GX_JGX_M T1,
       (SELECT Q1.ORDER_SPEC_CODE,
               Q1.ORDER_SPEC_DESC,
               Q2.ORD_LN_DLY_PK,
               Q2.ORD_LN_PK,
               Q1.DELVRY_RANGE_TPE,
               Q1.DELVRY_RANGE_MAX,
               Q1.DELVRY_RANGE_MIN,
               Q2.DELVRY_QTY,
               Q4.CRAFT_NAME,
               Q5.SALE_ORG_DESC,
               Q1.FINAL_USER_DESC,
               Q3.CRAFT_FILE_LV2_G
          FROM SLM_ORDER_LINE           Q1,
               SLM_ORDER_LINE_DELIVERY  Q2,
               CRAFT_ORD_DESIGN         Q3,
               CRAFT_ORD_DESIGN_APPOINT Q4,
               SLM_ORDER_HEAD           Q5
         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK
           AND Q1.ORD_LN_PK = Q4.ORD_LN_PK(+)
           AND Q1.ORD_PK = Q5.ORD_PK
           AND Q1.ORD_LN_PK = Q3.ORD_LN_PK(+)
           AND Q3.VALIDFLAG(+) = '1') T2,
       (SELECT *
          FROM (SELECT Q.ASK_ITME_DESC,
                       Q.ASK_SUB_ITME_VAL_DESC,
                       Q.ORD_LN_DLY_PK
                  FROM (SELECT Q3.ASK_ITME_DESC,
                               Q1.ORD_LN_DLY_PK,
                               LISTAGG(Q3.ASK_SUB_ITME_VAL_DESC, ' ** ') WITHIN GROUP(ORDER BY Q3.ASK_ITME) ASK_SUB_ITME_VAL_DESC
                          FROM SLM_ORDER_LINE_DELIVERY Q1,
                               SLM_ORDER_LINE          Q2,
                               SLM_ORDER_ADD_ASK       Q3
                         WHERE Q1.ORD_LN_PK = Q2.ORD_LN_PK
                           AND Q2.ADD_ASK_NO = Q3.ADD_ASK_NO
                           AND Q1.VALIDFLAG = '1'
                           AND Q2.VALIDFLAG = '1'
                           AND Q2.CREATE_NAME IS NOT NULL
                           AND Q3.VALIDFLAG = '1'
                         GROUP BY Q3.ASK_ITME_DESC, Q1.ORD_LN_DLY_PK) Q) PIVOT(MAX(ASK_SUB_ITME_VAL_DESC) FOR ASK_ITME_DESC IN('喷标' AS
                                                                                                                               ADD_ASK1,
                                                                                                                               '涂漆' AS
                                                                                                                               ADD_ASK2,
                                                                                                                               '保护帽' AS
                                                                                                                               ADD_ASK3,
                                                                                                                               '丝扣油' AS
                                                                                                                               ADD_ASK4,
                                                                                                                               '计重方式' AS
                                                                                                                               ADD_ASK5,
                                                                                                                               '包装要求' AS
                                                                                                                               ADD_ASK6,
                                                                                                                               '质量' AS
                                                                                                                               ADD_ASK7,
                                                                                                                               '交货材料' AS
                                                                                                                               ADD_ASK8,
                                                                                                                               '发货结算约定' AS
                                                                                                                               ADD_ASK9,
                                                                                                                               '特殊通径' AS
                                                                                                                               ADD_ASK10,
                                                                                                                               '特殊端部加工' AS
                                                                                                                               ADD_ASK11,
                                                                                                                               '取样备注' AS
                                                                                                                               ADD_ASK12,
                                                                                                                               '表面质量' AS
                                                                                                                               ADD_ASK13))) T3,
       PLN_SALEORD S,
       SLM_ORDER_LINE_DELIVERY D,  (SELECT SUM(NVL(M.PLN_INSINGLE_WT, 0)) BATCHED_WT,
               SUM(NVL(M.PLN_INSINGLE_NUM, 0)) BATCHED_NUM,
               SUM(NVL(M.PLN_OUTSINGLE_W, 0)) Expect_Wt_J,
               SUM(NVL(M.PLN_OUTSINGLE_NUM, 0)) Expect_Num_J,
               M.PRO_PLAN_ID,
               M.GX_PLAN_NO
          FROM PLN_ZY_JGX_M M,PLN_ORDER_JGX_S s
         WHERE M.PRO_PLAN_ID = s.PRO_PLAN_ID
           AND M.GX_PLAN_NO = s.GX_PLAN_NO
           AND M.IF_FLAG='0'
         group by M.PRO_PLAN_ID, M.GX_PLAN_NO) m1,  
          (SELECT SUM(NVL(C.PLAN_INDOUBLE_WT, 0))-SUM(NVL(C.REAL_INDOUBLE_WT, 0)) Real_Batch_Wt,
               SUM(NVL(C.PLAN_INDOUBLE_NUM, 0))- SUM(NVL(C.REAL_INDOUBLE_NUM, 0)) Real_Batch_Num,
               M.PRO_PLAN_ID,
               M.GX_PLAN_NO
          FROM PLN_ZY_JGX_C C, PLN_ZY_JGX_M M,PLN_ORDER_JGX_S s
         WHERE C.HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND C.PRO_PLAN_ID = s.PRO_PLAN_ID
           AND C.GX_PLAN_NO = s.GX_PLAN_NO
           AND M.IF_FLAG='0'
           --AND M.PLANSTATUS IN ('00', '10')
         GROUP BY M.PRO_PLAN_ID, M.GX_PLAN_NO) M2,
               (SELECT SUM(NVL(M.REAL_INDOUBLE_WT, 0)) Real_Indouble_Wt,
               SUM(NVL(M.REAL_INDOUBLE_NUM, 0)) Real_Indouble_Num,
                SUM(NVL(M.REAL_OUTDOUBLE_WT, 0)) FINISHWEIGHT,
               SUM(NVL(M.REAL_OUTDOUBLE_NUM, 0)) FINISHNUM,
               M.PRO_PLAN_ID,
               M.GX_PLAN_NO
          FROM PLN_ZY_JGX_C M,PLN_ORDER_JGX_S s
         WHERE M.PRO_PLAN_ID = s.PRO_PLAN_ID
           AND M.GX_PLAN_NO = s.GX_PLAN_NO
           AND M.IF_FLAG='0'
         GROUP BY M.PRO_PLAN_ID, M.GX_PLAN_NO) M3,
         (SELECT
					JG.ORD_LN_DLY_PK,
				NVL(SUM( CU.QUALIFIED_NUMBER ),0) PIECES
			FROM
				PLN_ZY_JG_WORKBILL M,
				PLN_ORDER_JG JG,
				COUPLING_CUT_RESULT CU
			WHERE
				M.CODE_JG = JG.CODE_JG
				AND M.ZY_BILL_STATUS IN ( '2' )
				AND CU.WO_ID = M.WO_ID GROUP BY JG.ORD_LN_DLY_PK) M4,
				(
				SELECT
				MI.ORD_LN_DLY_PK,
					SUM( B.PIECES ) PIECES
				FROM
					COUPLING_MAT_M M,
					COUPLING_MAT_BUTTRESS B,
					PLN_ZY_JG_MIDDLE MI
				WHERE
					M.MAT_NO = B.MAT_NO
					AND MI.MAT_NO = M.MAT_NO
					AND MI.MAT_NO_XH = B.MAT_NO_XH
					GROUP BY MI.ORD_LN_DLY_PK
				) M5,
				(
				SELECT
					JG.ORD_LN_DLY_PK,
					SUM(
						TO_NUMBER(  NVL(MD.DEAL_NUM , 0 ) ) - TO_NUMBER( NVL( MD.USED_NUM, 0 ) ) - TO_NUMBER( NVL( MD.FAILL_NUM, 0 ) )
					) PIECES
				FROM
					COUPLING_MAT_DEAL MD,
					PLN_ORDER_JG JG
				WHERE
					MD.OUT_FLAG = '2'
					AND MD.CODE_JG = JG.CODE_JG
					GROUP BY JG.ORD_LN_DLY_PK
				)M6
 WHERE T.PRO_PLAN_ID=T1.PRO_PLAN_ID(+)
 AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK(+)
   AND T.ORD_LN_DLY_PK = T3.ORD_LN_DLY_PK(+)
   AND T.ORD_LN_DLY_PK = S.ORD_LN_DLY_PK(+)
   AND T.ORD_LN_DLY_PK = D.ORD_LN_DLY_PK(+)
    and t.PRO_PLAN_ID = m1.PRO_PLAN_ID(+)
   AND t.GX_PLAN_NO = m1.GX_PLAN_NO(+)
     and t.PRO_PLAN_ID = m2.PRO_PLAN_ID(+)
   AND t.GX_PLAN_NO = m2.GX_PLAN_NO(+)
     and t.PRO_PLAN_ID = m3.PRO_PLAN_ID(+)
   AND t.GX_PLAN_NO = m3.GX_PLAN_NO(+)
   		AND t.ORD_LN_DLY_PK = M4.ORD_LN_DLY_PK ( + )
		AND t.ORD_LN_DLY_PK = M5.ORD_LN_DLY_PK ( + )
		AND t.ORD_LN_DLY_PK = M6.ORD_LN_DLY_PK ( + )
               ]]>
	</query>

	<query id="ProducHelperBean.queryPlanOrderH" desc="查询接箍排产(界面)">
             <![CDATA[ 
SELECT T.PRO_PLAN_ID,
       T.JG_GROUP_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.GX_PRO_SEQ,
       T.CODE_JG,
       T.SPEC_JG_DESC,
       T.CODE_JG_BL,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.BL_WL_ID,
       T.BL_WL_DESC,
       T.MIN_D,
       T.MIN_H,
       T.AIMLENGTH_BL,
       T.AIM_CUT_LEN,
       T.LENGTH_MIN,
       T.LENGTH_MAX,
       T.TAPER,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.DEMAND_DETECTION,
       T.DEMAND_BONDERIZING,
       (SELECT T1.BASENAME
          FROM COM_BASE_INFO T1
         WHERE T1.BASECODE = T.DEMAND_COPPER) DEMAND_COPPER,
       T.DEMAND_BLAST,
       T.GROUP_NUM_S,
       T.SINGLE_CUT_NUN,
       T.GROUP_BL_NUM_S,
       T.GROUP_BL_WT_S,
       DECODE(T.IS_PLAN_OK, '1', '是', '/') IS_PLAN_OK,
       T.MATCHNUM_JG,
       T.PRO_MONTH,
       TO_CHAR(round(TO_NUMBER(NVL(T.PLAN_USETIME, '0')) / 60, 2)) 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.MATCHWT_BL,
       T.MATCHNUM_BL,
      (SELECT SUM(M.PLAN_BL_NUM) FROM PLN_ZY_JG_M M WHERE M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO) BATCHED_NUM,
      (SELECT SUM(M.PLAN_BL_WT) FROM PLN_ZY_JG_M M WHERE M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO) BATCHED_WT,
      (SELECT SUM(M.PLAN_JG_NUM) FROM PLN_ZY_JG_M M WHERE M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO) BATCHED_NUM_OUT,
      (SELECT SUM(C.USE_BL_WT) FROM PLN_ZY_JG_C C,PLN_ZY_JG_M M WHERE C.HEAT_PLAN_NO=M.HEAT_PLAN_NO AND M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO ) REAL_BATCHED_WT,
      (SELECT SUM(C.USE_BL_NUM) FROM PLN_ZY_JG_C C,PLN_ZY_JG_M M WHERE C.HEAT_PLAN_NO=M.HEAT_PLAN_NO AND M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO ) REAL_BATCHED_NUM,
      (SELECT SUM(C.OUT_JG_NUM) FROM PLN_ZY_JG_C C,PLN_ZY_JG_M M WHERE C.HEAT_PLAN_NO=M.HEAT_PLAN_NO AND M.PRO_PLAN_ID=T.PRO_PLAN_ID AND M.GX_PLAN_NO=T.GX_PLAN_NO ) PRODUCED_NUM,
       DECODE(T.EXE_STATUS,
              '0',
              '计划',
              '1',
              '生产中',
              '2',
              '已生产',
              '3',
              '关闭A',
              '') EXE_STATUS,
       DECODE(T.IS_REPAIR_PLN, '1', '是', '/') IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       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.PROCESSING_COST,
       T.TOTAL_COST,
       DECODE(T.IF_MONITOR_JG, '1', '是', '/') IF_MONITOR_JG,
       T.PRDCR_NO,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       DECODE(T.IS_STOVE_ISSUED, '1', '是', '/') IS_STOVE_ISSUED,
       TO_CHAR(T.STOVE_ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') STOVE_ISSUED_TIME,
       T.STOVE_ISSUED_MAN,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       T.SPEC_JG,
       T.GROUP_WT_S,
       T.REQ_BL_ID,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.MONITOR_POINT,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.STATION_ROAD,
       T.VERSION_NO,
       (SELECT CD.CRAFT_PATH
          FROM CRAFT_ORD_DESIGN CD
         WHERE CD.ORD_LN_PK = T.CODE_JG_BL
           AND CD.CRAFT_SEQ = T.CRAFT_SEQ) CRAFT_PATH,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.PRODUCCODE_JG,
       T.PRODUCCODE_JG_DESC,
       T.DECISION,
       (SELECT T1.BASENAME
          FROM COM_BASE_INFO T1
         WHERE T1.BASECODE = T.STYLE_JG) STYLE_JG,
         T.CODE_BL_ALL,
        T.ORDER_SOURCE,
         (SELECT GET_JG_PRDCR_ADVC_DAY(T.PRO_PLAN_ID) FROM DUAL) PRDCR_ADVC_DAY,
                     DECODE(T.IF_MONITOR_BL, '1', '是', '/') IF_MONITOR_BL,
          (SELECT DECODE(MIN(S1.EXE_STATUS),
                      '0',
                      '计划',
                      '1',
                      '生产中',
                      '2',
                      '已生产',
                      '3',
                      '关闭')
          FROM PLN_ORDER_JGX_S S1, PLN_ORDER_JG J, PLN_JG_AND_BL B
 WHERE J.PRO_PLAN_ID = B.PRO_PLAN_ID
   AND S1.ORD_LN_DLY_PK = J.ORD_LN_DLY_PK
   AND B.REQ_BL_ID = T.ORD_LN_DLY_PK 
   ) CP_EXE_STATUS,
   (SELECT MIN(S1.ORDER_NO||'/'||S1.ORDER_SEQ)
          FROM PLN_ORDER_JGX_S S1, PLN_ORDER_JG J, PLN_JG_AND_BL B
         WHERE J.PRO_PLAN_ID = B.PRO_PLAN_ID
           AND S1.ORD_LN_DLY_PK = J.ORD_LN_DLY_PK
           AND B.REQ_BL_ID = T.ORD_LN_DLY_PK)CP_ORDER_NO,
     DECODE(T.IS_NOTICE_EP,'0','未通知','1','已通知')IS_NOTICE_EP,
       T.IS_NOTICE_USER,
       TO_CHAR(T.IS_NOTICE_TIME, 'YYYY-MM-DD HH24:MI:SS') IS_NOTICE_TIME
  FROM PLN_GX_JG_PROP_S T
 WHERE 1=1
               ]]>
	</query>
	<!-- AND J.PRO_PLAN_ID_S=T.PRO_PLAN_ID -->

	<query id="ProducHelperBean.getPlineCapacityB" desc="查询铸造产线能力">
             <![CDATA[ 
              SELECT T.HR_CAPCTY  FROM SLM_BASE_MATERIAL_B_PL T WHERE T.IN_MATERIAL_NO = ?  AND T.OUT_MATERIAL_NO = ? AND T.PLINE_CODE = ?
               ]]>
	</query>

	<query id="ProducHelperBean.getPlineCapacityC" desc="查询锻造产线能力">
             <![CDATA[ 
              SELECT T.HR_CAPCTY  FROM SLM_BASE_MATERIAL_C_PL T WHERE T.IN_MATERIAL_NO = ?  AND T.OUT_MATERIAL_NO = ? AND T.PLINE_CODE = ?
               ]]>
	</query>

	<query id="ProducHelperBean.getPlineCapacityD" desc="查询轧管产线能力">
             <![CDATA[ 
              SELECT T.HR_CAPCTY  FROM SLM_BASE_MATERIAL_D_PL T WHERE T.IN_MATERIAL_NO = ?  AND T.OUT_MATERIAL_NO = ? AND T.PLINE_CODE = ?
               ]]>
	</query>

	<query id="ProducHelperBean.getPlineCapacityE" desc="查询镦拔扩产线能力">
             <![CDATA[ 
              SELECT T.HR_CAPCTY  FROM SLM_BASE_MATERIAL_E_PL T WHERE T.IN_MATERIAL_NO = ?  AND T.OUT_MATERIAL_NO = ? AND T.PLINE_CODE = ?
               ]]>
	</query>

	<query id="ProducHelperBean.getPlineCapacityF" desc="查询热处理产线能力">
             <![CDATA[ 
              SELECT T.HR_CAPCTY  FROM SLM_BASE_MATERIAL_F_PL T WHERE T.IN_MATERIAL_NO = ?  AND T.OUT_MATERIAL_NO = ? AND T.PLINE_CODE = ?
               ]]>
	</query>

	<query id="ProducHelperBean.getPlineCapacityG" desc="查询加工产线能力">
             <![CDATA[ 
              SELECT T.HR_CAPCTY  FROM SLM_BASE_MATERIAL_K_PL T WHERE T.IN_MATERIAL_NO = ?  AND T.OUT_MATERIAL_NO = ? AND T.PLINE_CODE = ?
               ]]>
	</query>

	<query id="ProducHelperBean.getPlineCapacityH" desc="查询接箍产线能力">
             <![CDATA[ 
              SELECT T.HR_CAPCTY  FROM SLM_BASE_MATERIAL_H_PL T WHERE T.IN_MATERIAL_NO = ?  AND T.OUT_MATERIAL_NO = ? AND T.PLINE_CODE = ?
               ]]>
	</query>


	<query id="ProducHelperBean.statusChange" desc="状态调整">
             <![CDATA[ 
             set t.exe_status = (case
                        when to_number(t.gx_pro_seq) > to_number(?) then
                         '0'
                        when to_number(t.gx_pro_seq) < to_number(?) then
                         '2'
                        when to_number(t.gx_pro_seq) = to_number(?) and
                             to_number(t.gx_pro_seq) != 1 then
                         '1'
                        when to_number(t.gx_pro_seq) = to_number(?) and
                             t.exe_status = '1' then
                         '0'
                        else
                         '1'
                      end)
 where t.pline_code = ?
   and t.exe_status != '3'
   and to_number(t.gx_pro_seq) > 0
               ]]>
	</query>
	<query id="ProducHelperBean.statusChangeStr" desc="状态调整时修改轧批号">
             <![CDATA[
UPDATE PLN_ORDER_ZG_S T SET T.ZY_BATCH_ID1=T.ZY_BATCH_ID,
T.ZY_BATCH_ID=''
WHERE T.EXE_STATUS>'1'
AND T.PLINE_CODE=?
AND T.ZY_BATCH_ID IS NOT NULL   
                ]]>
	</query>
	<query id="ProducHelperBean.queryLZData" desc="查询炼轧系统数据">
             <![CDATA[ 
select
       sum(case 状态
             when 0 then
              成品吨
             else
              0
           end)   FINISH_WGT,
       sum(case 状态
             when 1 then
              成品吨
             when 2 then
              成品吨
             else
              0
           end)   UNFINISH_WGT,
           CONVERT(varchar(100), min(case 状态
             when 1 then
              生产时间
             when 2 then
              生产时间
             else
              null
           end), 20)
         UNFINISH_TIME,
       sum(case 状态
             when 1 then
              1
             when 2 then
              1
             else
              0
           end)   UNFINISH_NUM,
       PK码  PK
  from V_LZ_CX_STATUS t
 group by t.PK码
               ]]>
	</query>
	<query id="ProducHelperBean.queryLZDataZg" desc="查询轧管炼轧系统数据">
             <![CDATA[ 
SELECT [订单号]
      ,[序号]
      ,[LJ支]
      ,[LJ吨]
      ,[装炉支]
      ,[装炉吨]
      ,[出库支]
      ,[出库吨]
  FROM [TPCO_CXPLAN].[dbo].[V_ZG_DOWN_LOG-FORJYHRQ-Tab_ZLPlan-new]
               ]]>
	</query>
	<query id="ProducHelperBean.generateZyBatchNoC" desc="生成作业批次号">
             <![CDATA[ 
             UPDATE PLN_ORDER_DZ_S T SET T.ZY_BATCH_ID=? WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.generateZyBatchNoD" desc="生成作业批次号">
             <![CDATA[ 
             UPDATE PLN_ORDER_ZG_S T SET T.ZY_BATCH_ID=? WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.generateZyBatchNoE" desc="镦拔扩生成作业批次号">
             <![CDATA[ 
             UPDATE PLN_ORDER_DBK_S T SET T.ZY_BATCH_ID=? WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.updateZyBatchNoEM" desc="镦拔扩实际炉计划修改作业批次号">
             <![CDATA[ 
           UPDATE PLN_ZY_DBK_M T SET T.ZY_BATCH_ID=? WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.updateZyBatchNoER" desc="镦拔扩虚拟炉计划修改作业批次号">
             <![CDATA[ 
             UPDATE PLN_ZY_DBK_C T SET T.ZY_BATCH_ID=? WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.generateZyBatchNoF" desc="生成作业批次号">
             <![CDATA[ 
             UPDATE PLN_ORDER_RCL_S T SET T.ZY_BATCH_ID=? WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.generateZyBatchNoG" desc="生成作业批次号">
             <![CDATA[ 
             UPDATE PLN_ORDER_JGX_S T SET T.ZY_BATCH_ID=? WHERE T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.stoveIssuedE" desc="下发排产">
             <![CDATA[ 
            UPDATE PLN_ORDER_DBK_S T
   SET T.IF_STOVE_ISSUED   = ?,
       T.STOVE_ISSUED_TIME = TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
       T.STOVE_ISSUED_MAN  = ?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
               ]]>
	</query>

	<query id="ProducHelperBean.stoveIssuedEM" desc="下发排产的虚拟炉计划">
             <![CDATA[ 
          UPDATE Pln_Zy_Dbk_m T SET T.PLANSTATUS = ?,T.GOWHERE_CODE=?,T.GOWHERE_NAME=?,T.DOWNMAN=?,T.DOWNTIME=TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
          T.ZY_BATCH_ID=?,T.CRAFT_FILE_NO=?,T.CRAFT_FILE_MAN=?,T.CRAFT_SEQ=?,t.IF_PRODUCT=? WHERE  T.HEAT_PLAN_NO= ?
               ]]>
	</query>
	<query id="ProducHelperBean.stoveIssuedEC" desc="下发排产的实际炉计划">
             <![CDATA[ 
          UPDATE Pln_Zy_Dbk_C T SET T.ZY_BATCH_ID=? WHERE  T.HEAT_PLAN_NO= ?
               ]]>
	</query>
	<query id="ProducHelperBean.updateStoveIssuedNum" desc="修改排产和待投入量">
             <![CDATA[ 
         UPDATE PLN_ORDER_DBK_S T
   SET T.NUM_S       = TO_NUMBER(?),
       T.WEIGTH_S    = TO_NUMBER(?),
       T.IN_NUM_S    = TO_NUMBER(?),
       T.IN_WEIGHT_S = TO_NUMBER(?),
       T.WEIGTH_S_MIN =TO_NUMBER(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
               ]]>
	</query>

	<query id="ProducHelperBean.setOnloadLineA" desc="设置上料行">
             <![CDATA[ 
        UPDATE PLN_ORDER_DBK_S T
   SET T.IS_ONLOAD_LINE = NULL
 WHERE T.PLINE_CODE = ?
   AND T.IS_ONLOAD_LINE IS NOT NULL
               ]]>
	</query>

	<query id="ProducHelperBean.setOnloadLineB" desc="设置上料行">
             <![CDATA[ 
     UPDATE PLN_ORDER_DBK_S T
   SET T.IS_ONLOAD_LINE = ?
 WHERE T.PRO_PLAN_ID = ? 　AND T.GX_PLAN_NO = ?
               ]]>
	</query>

	<query id="ProducHelperBean.getDbkReadyById" 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,
       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_DBK_READY T
 WHERE
T.PRO_PLAN_ID = ?
AND T.GX_PLAN_NO = ?
               ]]>
	</query>

	<query id="ProducHelperBean.updatePlanEDById" desc="修改虚拟炉计划订单编号和排产序号">
             <![CDATA[ 
         UPDATE PLN_ZY_DBK_READY T
   SET T.GX_PLAN_NO = ?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
   AND T.READY_PLAN_NO = ?
               ]]>
	</query>

	<query id="ProducHelperBean.updatePlanERById" desc="修改实际炉计划订单编号和排产序号">
             <![CDATA[ 
         UPDATE PLN_ZY_DBK_M T
   SET T.GX_PLAN_NO = ?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
   AND T.READY_PLAN_NO = ?
               ]]>
	</query>

	<query id="ProducHelperBean.updateMatMData" desc="修改库存数据">
             <![CDATA[ 
        UPDATE MAT_ZC_M T
   SET 
       T.VRP_GX_PLAN_NO    = ?,
       T.VRP_PRO_ORDER_ID1 = T.VRP_PRO_ORDER_ID,
       T.VRP_GX_PLAN_NO1   = T.VRP_GX_PLAN_NO
 WHERE T.VRP_HEAT_PLAN_NO = ?
   AND T.VRP_PRO_ORDER_ID = ?
   AND T.VRP_GX_PLAN_NO = ?
               ]]>
	</query>

	<query id="ProducHelperBean.getDbkMById" desc="查询镦拔扩实际炉计划">
             <![CDATA[ 
      SELECT T.HEAT_PLAN_NO,
       T.ZY_BATCH_ID,
       T.PROD_INDEX,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.READY_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.ZG_HEAT_PLAN_NO,
       T.HEATNO_LAST,
       T.ZG_BATCH_NO,
       T.BATCH_GROUD_NO,
       DECODE(T.ISENDGX, '1', '是', '') ISENDGX,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.GRADECODE,
       T.GRADENAME,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.OUTDIAMETER_IN,
       T.WALLTHICK_IN,
       T.LENGTH_IN,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.LEN_CUTHEAD,
       T.LEN_CUTEND,
       T.INWL_ID,
       T.INWL_DESC,
       T.IN_WT,
       T.IN_NUM,
       DECODE(T.IF_WL_MATCHED, '1', '是', '') IF_WL_MATCHED,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       DECODE(T.IF_MONITOR_DBK, '1', '是', '') IF_MONITOR_DBK,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.CRAFT_FILE_NO,
       T.CRAFT_FILE_MAN,
       T.CRAFT_SEQ,
       T.SEC_CRAFT_FILE_NO,
       T.STATION_ROAD,
       T.PLANSTATUS,
       T.IN_WT_REAL,
       T.IN_NUM_REAL,
       T.OUT_WT_REAL,
       T.OUT_NUM_REAL,
       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.IN_JUDGE_STD
  FROM PLN_ZY_DBK_M T
 WHERE 1 = 1 
 AND T.PRO_PLAN_ID = ?
AND T.GX_PLAN_NO = ?
AND T.READY_PLAN_NO=?
               ]]>
	</query>

	<query id="ProducHelperBean.getCountBySeqSure" desc="查询序号之前未下发的排产行数">
             <![CDATA[ 
SELECT COUNT(1) COUNT
  FROM PLN_ORDER_DBK_S T
 WHERE TO_NUMBER(T.GX_PRO_SEQ) > 0
   AND TO_NUMBER(T.GX_PRO_SEQ) < ?
   AND T.PLINE_CODE=?
   AND (T.IF_STOVE_ISSUED != '1' OR T.If_Stove_Issued is null)
               ]]>
	</query>

	<query id="ProducHelperBean.getCountBySeqCancel" desc="查询序号之后已下发的排产行数">
             <![CDATA[ 
SELECT COUNT(1) COUNT
  FROM PLN_ORDER_DBK_S T
 WHERE  TO_NUMBER(T.GX_PRO_SEQ) > ?
   AND T.PLINE_CODE=?
   AND T.IF_STOVE_ISSUED = '1'
               ]]>
	</query>
	<query id="ProducHelperBean.selectPlnZgStatus" desc="查轧管排产状态">
             <![CDATA[ 
SELECT T.IF_STOVE_ISSUED, T.EXE_STATUS, T.IS_PLAN_OK
  FROM PLN_ORDER_ZG_S T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?

               ]]>
	</query>
	<query id="ProducHelperBean.selectCrop" desc="查询基础数据切头尾">
             <![CDATA[ 
SELECT M.CROP_HEAD, M.CROP_END
  FROM PLN_ORDER_ZG_S T
  LEFT JOIN SLM_BASE_MATERIAL_D_PL M
    ON M.PLINE_CODE = T.PLINE_CODE
   AND M.IN_MATERIAL_NO = T.INWL_ID
   AND M.OUT_MATERIAL_NO = T.OUTWL_ID
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
   AND T.PLINE_CODE = ?
               ]]>
	</query>
	<query id="ProducHelperBean.updateCrop" desc="修改切头尾数据">
             <![CDATA[ 
UPDATE PLN_ORDER_ZG_S
      SET LEN_CUTHEAD = TO_NUMBER(?), LEN_CUTEND = TO_NUMBER(?)
    WHERE PRO_PLAN_ID = ?
      AND GX_PLAN_NO = ?
               ]]>
	</query>
	<query id="ProducHelperBean.updateDimaM" desc="修改芯棒直径">
             <![CDATA[ 
UPDATE PLN_ORDER_ZG_S
      SET DIAMETER_MANDREL = TO_NUMBER(?)
    WHERE PRO_PLAN_ID = ?
      AND GX_PLAN_NO = ?
               ]]>
	</query>
	<query id="ProducHelperBean.updatePlanGxSeqD" desc="修改轧管生产顺序号">
             <![CDATA[  
             UPDATE PLN_ORDER_ZG_S
   SET GX_PRO_SEQ = NVL(TO_NUMBER(GX_PRO_SEQ), 0) + 1
 WHERE GX_PRO_SEQ > '#GX_PRO_SEQ#'
   AND PLINE_CODE = '#PLINE_CODE#'
              ]]>
	</query>
	<!--
		<query id="ProducHelperBean.queryPlinCodeGroup" desc="查询产线余与去向仓库分组">
		<![CDATA[ SELECT T3.* FROM (select T.* from COM_BASE_PLINE_R_GROUP t,
		COM_BASE_PLINE T1 WHERE T.PLINE_CODE_M = T1.PLINE_CODE AND
		T1.PROCESS_CODE = 'D' AND T1.VALIDFLAG='1') T3, COM_BASE_PLINE T2
		WHERE T3.PLINE_CODE_C = T2.PLINE_CODE AND T2.VALIDFLAG='1' ]]>
		</query>
	-->
	<query id="ProducHelperBean.queryPlinCodeGroup" desc="查询产线余与去向仓库分组">
             <![CDATA[  
SELECT * FROM COM_BASE_PLINE_R_GROUP T3
              ]]>
	</query>
	<query id="ProducHelperBean.updatePlanOrderDIss" desc="修改轧管排产确认状态，及下发状态">
             <![CDATA[
UPDATE PLN_ORDER_ZG_S T
   SET T.IS_PLAN_OK       = ?,
       T.ISSUED_MAN       = ?,
       T.ISSUED_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = ?,
       T.LAST_UNDOWN_TIME = TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
       T.IF_STOVE_ISSUED       = ?,
       T.STOVE_ISSUED_MAN       = ?,
       T.STOVE_ISSUED_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO =?    
                ]]>
	</query>
	<query id="ProducHelperBean.updatePlanOrderDIssRcl" desc="修改热处理排产确认状态，及下发状态">
             <![CDATA[
UPDATE PLN_ORDER_RCL_S T
   SET T.IS_PLAN_OK       = ?,
       T.ISSUED_MAN       = ?,
       T.ISSUED_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = ?,
       T.LAST_UNDOWN_TIME = TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
       T.IF_STOVE_ISSUED   = ?,
       T.STOVE_ISSUED_MAN   = ?,
       T.STOVE_ISSUED_TIME   = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO =?    
                ]]>
	</query>
	<query id="ProducHelperBean.updatePlanOrderDIssDbk" desc="修改镦拔扩排产确认状态，及下发状态">
             <![CDATA[
UPDATE PLN_ORDER_DBK_S T
   SET T.IS_PLAN_OK       = ?,
       T.ISSUED_MAN       = ?,
       T.ISSUED_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = ?,
       T.LAST_UNDOWN_TIME = TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
       T.IF_STOVE_ISSUED   = ?,
       T.STOVE_ISSUED_MAN   = ?,
       T.STOVE_ISSUED_TIME   = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO =?    
                ]]>
	</query>
	<query id="ProducHelperBean.updatePlanOrderDIssJgx" desc="修改加工线排产确认状态，及下发状态">
             <![CDATA[
UPDATE PLN_ORDER_JGX_S T
   SET T.IS_PLAN_OK       = ?,
       T.ISSUED_MAN       = ?,
       T.ISSUED_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = ?,
       T.LAST_UNDOWN_TIME = TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
       T.IF_STOVE_ISSUED   = ?,
       T.STOVE_ISSUED_MAN   = ?,
       T.STOVE_ISSUED_TIME   = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO =?    
                ]]>
	</query>
	<query id="ProducHelperBean.updatePlanOrderDIssJg" desc="修改接箍排产确认状态，及下发状态">
             <![CDATA[
UPDATE PLN_GX_JG_PROP_S T
   SET T.IS_PLAN_OK       = ?,
       T.ISSUED_MAN       = ?,
       T.ISSUED_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN  = ?,
       T.LAST_UNDOWN_TIME = TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),
       T.IS_STOVE_ISSUED   = ?,
       T.STOVE_ISSUED_MAN   = ?,
       T.STOVE_ISSUED_TIME   = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO =?    
                ]]>
	</query>
	<query id="ProducHelperBean.selectPlanZyBatchIf" desc="查询已下发的轧批号">
             <![CDATA[
        SELECT T.ZY_BATCH_ID
          FROM PLN_ORDER_ZG_S T
         WHERE 1 = 1
           AND T.EXE_STATUS IN ('0')
           AND T.PLINE_CODE = ?
           AND T.IF_STOVE_ISSUED = '1'
           AND TO_NUMBER(T.GX_PRO_SEQ) > 0      
              ]]>
	</query>
	<query id="ProducHelperBean.selectPlanZyBatchMax" desc="查询生产完成，关闭，生产中 年月最大的轧批号">
             <![CDATA[
       SELECT MAX(T.ZY_BATCH_ID) ZY_BATCH_ID
  FROM PLN_ORDER_ZG_S T
 WHERE T.EXE_STATUS IN ('1', '2', '3')
   AND T.PLINE_CODE =?
   --AND TRUNC(T.PLAN_TIME_B) = TO_DATE(?, 'YYYYMM') 
   AND T.ZY_BATCH_ID LIKE '%'||?||'%'     
                ]]>
	</query>
	<query id="ProducHelperBean.selectPlanGXplanSeqMin" desc="查询前面生产序号是否下发">
             <![CDATA[
     SELECT COUNT(*) COUNT
  FROM PLN_ORDER_ZG_S T
 WHERE (T.IF_STOVE_ISSUED = '0' OR T.IF_STOVE_ISSUED IS NULL)
   AND T.PLINE_CODE = ?
   AND T.GX_PRO_SEQ = TO_NUMBER(?) - 1          
                ]]>
	</query>
	<query id="ProducHelperBean.selectSystemTime" desc="查询数据库服务器当前时间">
             <![CDATA[
  SELECT TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS') DATIME FROM DUAL     
                ]]>
	</query>
	<query id="ProducHelper.doQueryActual" desc="查询轧管实际计划">
             <![CDATA[
             SELECT T2.*,(select GET_ZG_BUTTRESS(T2.JUDGE_STOVE_NO,T2.PRO_PLAN_ID1,T2.GX_PLAN_NO) from dual) Storage_No,
                (SELECT TO_CHAR(MIN(S.PLN_STARTTIME),'YYYY-MM-DD HH24:MI:SS')
          FROM PLN_STEELFORFURNACE S
         WHERE S.FURNACENO =
               (SELECT DISTINCT O.FURNACENO
                  FROM PLN_STEELFOR_ORD O
                 WHERE O.JUDGE_STOVE_NO = T2.JUDGE_STOVE_NO AND O.CCM_PLN_TYPE='00'
                 AND ROWNUM = 1)) PLN_TIME_STRAT
              FROM (SELECT T.HEAT_PLAN_NO,
       T.GX_PRO_SEQ,
       T3.ZY_BATCH_ID,
       CASE
         WHEN T.STOVE_NO IS NULL AND T.UPPER_PROCESS_CODE = 'B' 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 AND T.UPPER_PROCESS_CODE = 'B' 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 AND T.UPPER_PROCESS_CODE = 'B' 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,
       DECODE(T.PLANSTATUS,
              '00',
              '计划',
              '10',
              '下发',
              '20',
              '生产中',
              '30',
              '生产完成',
              '40',
              '关闭A') PLANSTATUS,
       T.UPPER_HEATPLAN_ID,
       T.PRO_PLAN_ID||'/'||T.GX_PLAN_NO PRO_PLAN_ID,
       T.PRO_PLAN_ID  PRO_PLAN_ID1,
       T.GX_PLAN_NO,
       T.CCM_PRO_PLAN_ID ||'/'||T.CCM_GX_PLAN_NO 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,
       DECODE(T.ISENDGX, '0', '/', '1', '是') ISENDGX,
      DECODE(T.IF_MATCH_ODD, '0', '/', '1', '前轧管利库','4','后轧管利库','6','本工序精整利库','炼钢利库') IF_MATCH_ODD,
       DECODE(T.IF_DO_HEAT_PLAN, '0', '/', '1', '是') IF_DO_HEAT_PLAN,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.ORDER_NO ||'/'||T.ORDER_SEQ ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.IF_EXPORT,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       T.PRO_MONTH,
       DECODE(T.IF_LEN_CONTROL, '0', '/', '1', '是') IF_LEN_CONTROL,
       DECODE(T.IF_MINUS_SIC_ROLL, '0', '/', '1', '是') IF_MINUS_SIC_ROLL,
       T.PROD_STANDARD,
       T.OUTPUT_STANDARD,
       T.DECISION,
       T.PROGY_MEMO,
       T.GOWHERE_CODE,
       T.GOWHERE_NAME,
       DECODE(T.OUTS_BILLET_FL, '1', '外购', '0', '自炼') OUTS_BILLET_FL,
       DECODE(T.GPTYPE, '1', '铸坯', '2', '锻坯') 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,
       NVL(T.PLN_INSINGLE_NUM,0) PLN_INSINGLE_NUM,
       NVL(T.PLN_INSINGLE_WT,0) PLN_INSINGLE_WT,
       NVL(T.PLN_OUTSINGLE_NUM,0) PLN_OUTSINGLE_NUM,
       NVL(T.PLN_OUTSINGLE_W,0) PLN_OUTSINGLE_W,
       NVL(T.REDUCED_WT,0) REDUCED_WT,
       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,
       DECODE(T.CUT_TYPE, '0', '被动', '1', '主动') CUT_TYPE,
       T3.LEN_CUTEND,
       T3.LEN_CUTHEAD,
       T3.DIAMETER_MANDREL,
       T3.PASS_CODE,
       T3.PASS_NAME,
       DECODE(T.IF_MONITOR, '0', '/', '1', '是') IF_MONITOR,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T3.BOM,
       T.WHOLE_BACKLOG,
       T3.WHOLE_BACKLOG_DESC,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T3.CRAFT_FILE_NO,
       T3.CRAFT_FILE_MAN,
       T3.CRAFT_SEQ,
       T.SEC_CRAFT_FILE_NO,
       T.STATION_ROAD,
       TO_CHAR(TO_DATE(T.PRO_DAY, 'YYYYMMDD'), 'YYYY-MM-DD') PRO_DAY,
       TO_CHAR(TO_DATE(T.BAL_YEAR_MONTH, 'YYYYMM'), 'YYYY-MM') 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.IS_LOAD, '0', '未上料', '1', '已上料') IS_LOAD,
       DECODE(T.PLN_TYPE, '0', '正常计划', '1', '试轧料') PLN_TYPE, 
       T.INDEX_SEQ,
       DECODE(T.JUDGE_STOVE_NO,'','未结炉','已结炉') steel_falg,
          DECODE(CASE
                WHEN T.PLANSTATUS = '00' THEN
                 0
                ELSE
                 (SELECT COUNT(*)
                    FROM PLN_ZY_ZG_C T1, MIL_FEED_PLAN F
                   WHERE T1.HEAT_PLAN_SQE = F.FEED_ROW_NO
                     AND T1.HEAT_PLAN_NO = T.HEAT_PLAN_NO)
              END,
              '0',
              '未生成上料行',
              '-1','','已生成上料行') FEED_ROW_NO,
               CASE
         WHEN T.UPPER_PROCESS_CODE = 'B' THEN
          (SELECT DECODE(O.STATUS,
                         '00',
                         '编制中',
                         '10',
                         '已下发',
                         '20',
                         '生产中',
                         '30',
                         '已生产',
                         '40',
                         '关闭')
             FROM PLN_STEELFOR_ORD O
            WHERE O.FURNACENO || '/' || O.SEQUENCENO = T.UPPER_HEATPLAN_ID)
         ELSE
          (SELECT DECODE(O.PLANSTATUS,
                         '00',
                         '编制中',
                         '10',
                         '已下发',
                         '20',
                         '生产中',
                         '30',
                         '已生产',
                         '40',
                         '关闭')
             FROM PLN_ZY_DZ_M O
            WHERE O.HEAT_PLAN_NO = T.UPPER_HEATPLAN_ID)
        END UPPER_STRAT,T.FEED_HEAT_NO,T.MEMO,T1.PLAN_INDOUBLE_NUM ACTUA_NUM,
        T1.PLAN_INDOUBLE_WT ACTUA_WT,
        T1.CUT_NUM_GP,
        T1.LENGTH_M,
        T1.LEN_GP_SINGLE LEN_GP_SINGLE_D,
        T1.REAL_INDOUBLE_NUM,
        T1.REAL_INDOUBLE_WT,
        NVL(CASE
         WHEN T.UPPER_PROCESS_CODE = 'B' THEN
          (SELECT O.TOT_MUM_M
             FROM PLN_STEELFOR_ORD O
            WHERE O.FURNACENO || '/' || O.SEQUENCENO = T.UPPER_HEATPLAN_ID)
         ELSE
          0
       END,0) TOT_MUM_M,
        NVL(CASE
         WHEN T.UPPER_PROCESS_CODE = 'B' THEN
          (SELECT O.TOT_WEIGHT_M
             FROM PLN_STEELFOR_ORD O
            WHERE O.FURNACENO || '/' || O.SEQUENCENO = T.UPPER_HEATPLAN_ID)
         ELSE
          0
       END,0) TOT_WEIGHT_M,T1.HEAT_PLAN_SQE,T1.CUT_TARGET,T1.CUT_LENGTH,T1.CUT_WEIGHT,
          (SELECT NVL(SUM(M.ACT_COUNT), 0)
          FROM MAT_GP_M M
         WHERE M.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO
           AND NVL(M.JUGDE_APPLY_CODE, '/') = NVL(T1.JUGDE_APPLY_CODE, '/')
           AND M.PRO_PLAN_ID_ZG = T1.PRO_PLAN_ID
           AND M.GX_PLAN_NO_ZG = T1.GX_PLAN_NO
           AND M.ACT_LEN = T1.LENGTH_M_OLD
           AND M.FIX_LEN = T1.LEN_GP_SINGLE_OLD
           AND M.FIX_NUM = T1.CUT_NUM_OLD
           AND M.MAT_STATUS = '80150103') ACT_COUNT,
    (SELECT APPLY_DESC FROM QCM_PROBLEM_HANDLING WHERE JUDGE_STOVE_NO = T.JUDGE_STOVE_NO AND PROCESS_CODE = 'D' AND ROWNUM = '1')APPLY_DESC
  FROM PLN_ZY_ZG_M T,PLN_ZY_ZG_C T1,PLN_ORDER_ZG_S T3
 WHERE T.HEAT_PLAN_NO=T1.HEAT_PLAN_NO(+)
 AND T.PRO_PLAN_ID=T3.PRO_PLAN_ID
 AND T.GX_PLAN_NO=T3.GX_PLAN_NO
 AND T.PRO_PLAN_ID=? AND T.GX_PLAN_NO=? ORDER BY T.PLANSTATUS ASC,T.GX_PRO_SEQ ASC )T2 
             ]]>
	</query>
	<query id="ProducHelper.doQueryActualM" desc="查询轧管虚拟计划">
             <![CDATA[
             SELECT T2.*,
       (SELECT GET_ZG_BUTTRESS(T2.JUDGE_STOVE_NO,
                               T2.PRO_PLAN_ID1,
                               T2.GX_PLAN_NO)
          FROM DUAL) STORAGE_NO,(SELECT TO_CHAR(MIN(S.PLN_STARTTIME),'YYYY-MM-DD HH24:MI:SS')
          FROM PLN_STEELFORFURNACE S
         WHERE S.FURNACENO =
               (SELECT DISTINCT O.FURNACENO
                  FROM PLN_STEELFOR_ORD O
                 WHERE O.JUDGE_STOVE_NO = T2.JUDGE_STOVE_NO AND O.CCM_PLN_TYPE='00')) PLN_TIME_STRAT
  FROM (SELECT T.HEAT_PLAN_NO,
               T.GX_PRO_SEQ,
               T3.ZY_BATCH_ID,
               CASE
                 WHEN T.STOVE_NO IS NULL AND T.UPPER_PROCESS_CODE = 'B' 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 AND T.UPPER_PROCESS_CODE = 'B' 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 AND T.UPPER_PROCESS_CODE = 'B' 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,
               DECODE(T.PLANSTATUS,
                      '00',
                      '计划',
                      '10',
                      '下发',
                      '20',
                      '生产中',
                      '30',
                      '生产完成',
                      '40',
                      '关闭A') PLANSTATUS,
               T.UPPER_HEATPLAN_ID,
               T.PRO_PLAN_ID || '/' || T.GX_PLAN_NO PRO_PLAN_ID,
               T.PRO_PLAN_ID PRO_PLAN_ID1,
               T.GX_PLAN_NO,
               T.CCM_PRO_PLAN_ID || '/' || T.CCM_GX_PLAN_NO 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,
               DECODE(T.ISENDGX, '0', '/', '1', '是') ISENDGX,
               DECODE(T.IF_MATCH_ODD, '0', '/', '1', '前轧管利库','4','后轧管利库', '6','本工序精整利库','炼钢利库') IF_MATCH_ODD,
               DECODE(T.IF_DO_HEAT_PLAN, '0', '/', '1', '是') IF_DO_HEAT_PLAN,
               T.ORDER_SOURCE,
               T.ORD_LN_DLY_PK,
               T.ORDER_NO || '/' || T.ORDER_SEQ ORDER_NO,
               T.ORDER_SEQ,
               T.DELIVERY_NO,
               T.REQ_BL_ID,
               T.IF_EXPORT,
               T.PRIORITY,
               T.PRIORITY_MEMO,
               T.PRO_MONTH,
               DECODE(T.IF_LEN_CONTROL, '0', '/', '1', '是') IF_LEN_CONTROL,
               DECODE(T.IF_MINUS_SIC_ROLL, '0', '/', '1', '是') IF_MINUS_SIC_ROLL,
               T.PROD_STANDARD,
               T.OUTPUT_STANDARD,
               T.DECISION,
               T.PROGY_MEMO,
               T.GOWHERE_CODE,
               T.GOWHERE_NAME,
               DECODE(T.OUTS_BILLET_FL, '1', '外购', '0', '自炼') OUTS_BILLET_FL,
               DECODE(T.GPTYPE, '1', '铸坯', '2', '锻坯') 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,
               NVL(T.REDUCED_WT,0) REDUCED_WT,
               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,
               DECODE(T.CUT_TYPE, '0', '被动', '1', '主动') CUT_TYPE,
               T3.LEN_CUTEND,
               T3.LEN_CUTHEAD,
               T3.DIAMETER_MANDREL,
               T3.PASS_CODE,
               T3.PASS_NAME,
               DECODE(T.IF_MONITOR, '0', '/', '1', '是') IF_MONITOR,
               T.PRDCR_NO,
               T.MONITOR_POINT,
               T3.BOM,
               T.WHOLE_BACKLOG,
               T3.WHOLE_BACKLOG_DESC,
               T.CIC,
               T.PIC,
               T.SIC,
               T.DIC,
               T3.CRAFT_FILE_NO,
               T3.CRAFT_FILE_MAN,
               T3.CRAFT_SEQ,
               T.SEC_CRAFT_FILE_NO,
               T.STATION_ROAD,
               TO_CHAR(TO_DATE(T.PRO_DAY, 'YYYYMMDD'), 'YYYY-MM-DD') PRO_DAY,
               TO_CHAR(TO_DATE(T.BAL_YEAR_MONTH, 'YYYYMM'), 'YYYY-MM') 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.IS_LOAD, '0', '未上料', '1', '已上料') IS_LOAD,
               DECODE(T.PLN_TYPE, '0', '正常计划', '1', '试轧料') PLN_TYPE,
               T.INDEX_SEQ,
               DECODE(T.JUDGE_STOVE_NO, '', '未结炉', '已结炉') STEEL_FALG,
               CASE
                 WHEN T.UPPER_PROCESS_CODE = 'B' THEN
                  (SELECT DECODE(O.STATUS,
                                 '00',
                                 '编制中',
                                 '10',
                                 '已下发',
                                 '20',
                                 '生产中',
                                 '30',
                                 '已生产',
                                 '40',
                                 '关闭')
                     FROM PLN_STEELFOR_ORD O
                    WHERE O.FURNACENO || '/' || O.SEQUENCENO =
                          T.UPPER_HEATPLAN_ID)
                 ELSE
                  (SELECT DECODE(O.PLANSTATUS,
                                 '00',
                                 '编制中',
                                 '10',
                                 '已下发',
                                 '20',
                                 '生产中',
                                 '30',
                                 '已生产',
                                 '40',
                                 '关闭')
                     FROM PLN_ZY_DZ_M O
                    WHERE O.HEAT_PLAN_NO = T.UPPER_HEATPLAN_ID)
               END UPPER_STRAT,
               T.FEED_HEAT_NO,
               T.MEMO,
               NVL(CASE
                     WHEN T.UPPER_PROCESS_CODE = 'B' THEN
                      (SELECT O.TOT_MUM_M
                         FROM PLN_STEELFOR_ORD O
                        WHERE O.FURNACENO || '/' || O.SEQUENCENO =
                              T.UPPER_HEATPLAN_ID)
                     ELSE
                      0
                   END,
                   0) TOT_MUM_M,
               NVL(CASE
                     WHEN T.UPPER_PROCESS_CODE = 'B' THEN
                      (SELECT O.TOT_WEIGHT_M
                         FROM PLN_STEELFOR_ORD O
                        WHERE O.FURNACENO || '/' || O.SEQUENCENO =
                              T.UPPER_HEATPLAN_ID)
                     ELSE
                      0
                   END,
                   0) TOT_WEIGHT_M
        
          FROM PLN_ZY_ZG_M T, PLN_ORDER_ZG_S T3
         WHERE T.PRO_PLAN_ID = T3.PRO_PLAN_ID
           AND T.GX_PLAN_NO = T3.GX_PLAN_NO
           AND T.PRO_PLAN_ID =?
           AND T.GX_PLAN_NO = ?
         ORDER BY T.PLANSTATUS ASC, T.GX_PRO_SEQ ASC) T2
             ]]>
	</query>
	<query id="ProducHelper.QueryPlanM" desc="查询轧管虚拟计划信息">
             <![CDATA[
SELECT T.HEAT_PLAN_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.FEED_HEAT_NO,
       CASE
         WHEN T.JUDGE_STOVE_NO IS NULL AND T.UPPER_PROCESS_CODE = 'B' 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,
       T.PLANSTATUS
  FROM PLN_ZY_ZG_M T
 WHERE T.HEAT_PLAN_NO = ?
              ]]>
	</query>
	<query id="ProducHelper.QueryPlnDbk" desc="查询镦拔扩订单状态，及是否有炉计划">
             <![CDATA[
             SELECT T.EXE_STATUS,T.PLINE_CODE,T.WHOLE_BACKLOG_DESC,
       DECODE(T.IF_STOVE_ISSUED, '1', '是', '/') IF_STOVE_ISSUED,
       (SELECT COUNT(*)
          FROM PLN_ZY_DBK_M T1
         WHERE T1.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND T1.GX_PLAN_NO = T.GX_PLAN_NO) COUNTZY,
           (SELECT DECODE(MAX(T1.PLANSTATUS),'','00',MAX(T1.PLANSTATUS))
          FROM PLN_ZY_DBK_M T1
         WHERE T1.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND T1.GX_PLAN_NO = T.GX_PLAN_NO) PLANSTATUS
  FROM PLN_ORDER_DBK_S T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
             ]]>
	</query>
	<query id="ProducHelper.QueryPlnRcl" desc="查询热处理订单状态，及是否有炉计划">
             <![CDATA[
             SELECT T.EXE_STATUS,T.PLINE_CODE,T.WHOLE_BACKLOG_DESC,
       DECODE(T.IF_STOVE_ISSUED, '1', '是', '/') IF_STOVE_ISSUED,
       (SELECT COUNT(*)
          FROM PLN_ZY_RCL_M T1
         WHERE T1.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND T1.GX_PLAN_NO = T.GX_PLAN_NO) COUNTZY,
          (SELECT DECODE(MAX(T1.PLANSTATUS),'','00',MAX(T1.PLANSTATUS))
          FROM PLN_ZY_RCL_M T1
         WHERE T1.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND T1.GX_PLAN_NO = T.GX_PLAN_NO) PLANSTATUS
  FROM PLN_ORDER_RCL_S T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
             ]]>
	</query>
	<query id="ProducHelper.QueryExeStatusDbk" desc="查询镦拔扩上工序订单状态">
             <![CDATA[
               SELECT (CASE WHEN T.WHOLE_BACKLOG_DESC LIKE '%轧制%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_ZG_S S3
                   WHERE S3.PRO_PLAN_ID= T.PREV_GXPLAN_ID)
                ELSE
                 '2'
              END)  BEFORE_STATE,
                T.GX_PRO_SEQ,
       (SELECT NVL(MAX(S.GX_PRO_SEQ), '0')
          FROM PLN_ORDER_DBK_S S
         WHERE S.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND S.PLINE_CODE = T.PLINE_CODE
           AND S.EXE_STATUS IN ('0', '1')) GX_PRO_SEQ_MAX,
       (SELECT NVL(Min(S.EXE_STATUS), '2')
          FROM PLN_ORDER_DBK_S S
         WHERE S.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND S.Gx_Plan_No != T.Gx_Plan_No) EXE_STATUS_DBK
  FROM PLN_ORDER_DBK_S T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
               ]]>
	</query>
	<query id="ProducHelper.QueryExeStatusRcl" desc="查询热处理上工序订单状态">
             <![CDATA[
               SELECT (CASE
               WHEN T.WHOLE_BACKLOG_DESC LIKE '%镦拔扩%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_DBK_S S3
                   WHERE S3.PRO_PLAN_ID= T.PREV_GXPLAN_ID)
                WHEN T.WHOLE_BACKLOG_DESC LIKE '%轧制%' THEN
                 (SELECT MIN(S3.EXE_STATUS)
                    FROM PLN_ORDER_ZG_S S3
                   WHERE S3.PRO_PLAN_ID= T.PREV_GXPLAN_ID)
                ELSE
                 '2'
              END) BEFORE_STATE,
              T.GX_PRO_SEQ,
       (SELECT NVL(MAX(S.GX_PRO_SEQ), '0')
          FROM PLN_ORDER_RCL_S S
         WHERE S.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND S.PLINE_CODE = T.PLINE_CODE
           AND S.EXE_STATUS IN ('0', '1')) GX_PRO_SEQ_MAX,
       (SELECT NVL(Min(S.EXE_STATUS), '2')
          FROM PLN_ORDER_RCL_S S
         WHERE S.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND S.Gx_Plan_No != T.Gx_Plan_No) EXE_STATUS_RCL
  FROM PLN_ORDER_RCL_S T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
               ]]>
	</query>
	<query id="ProducHelper.QueryExeStatusJgx" desc="查询加工线上工序订单状态">
             <![CDATA[
        SELECT (CASE
         WHEN T.WHOLE_BACKLOG_DESC LIKE '%热处理%' THEN
          (SELECT MIN(S3.EXE_STATUS)
             FROM PLN_ORDER_RCL_S S3
            WHERE S3.PRO_PLAN_ID = T.PREV_GXPLAN_ID)
         WHEN T.WHOLE_BACKLOG_DESC LIKE '%镦拔扩%' THEN
          (SELECT MIN(S3.EXE_STATUS)
             FROM PLN_ORDER_DBK_S S3
            WHERE S3.PRO_PLAN_ID = T.PREV_GXPLAN_ID)
         WHEN T.WHOLE_BACKLOG_DESC LIKE '%轧制%' THEN
          (SELECT MIN(S3.EXE_STATUS)
             FROM PLN_ORDER_ZG_S S3
            WHERE S3.PRO_PLAN_ID = T.PREV_GXPLAN_ID)
         ELSE
          '2'
       END) BEFORE_STATE,
       T.GX_PRO_SEQ,
       (SELECT NVL(MAX(S.GX_PRO_SEQ), '0')
          FROM PLN_ORDER_JGX_S S
         WHERE S.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND S.PLINE_CODE = T.PLINE_CODE
           AND S.EXE_STATUS IN ('0', '1')) GX_PRO_SEQ_MAX,
       (SELECT NVL(Min(S.EXE_STATUS), '2')
          FROM PLN_ORDER_JGX_S S
         WHERE S.PRO_PLAN_ID = T.PRO_PLAN_ID
           AND S.Gx_Plan_No != T.Gx_Plan_No) EXE_STATUS_JGX
  FROM PLN_ORDER_JGX_S T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?     
               ]]>
	</query>
	<query id="ProducHelper.QueryRemaZg" desc="查询是否有上料剩余计划支">
             <![CDATA[
             SELECT T.FEED_HEAT_NO,
       T.PLAN_INDOUBLE_NUM,
       NVL(T.REAL_INDOUBLE_NUM, 0) REAL_INDOUBLE_NUM,
       (SELECT NVL(SUM(M.ACT_COUNT),0)
          FROM MAT_GP_M M
         WHERE M.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND NVL(M.JUGDE_APPLY_CODE, '/') = NVL(T.JUGDE_APPLY_CODE, '/')
           AND M.PRO_PLAN_ID_ZG = T.PRO_PLAN_ID
           AND M.GX_PLAN_NO_ZG = T.GX_PLAN_NO
           AND M.ACT_LEN = T.LENGTH_M_OLD
           AND M.FIX_LEN = T.LEN_GP_SINGLE_OLD
           AND M.FIX_NUM = T.CUT_NUM_OLD
           AND M.MAT_STATUS = '80150103') ACT_COUNT
  FROM PLN_ZY_ZG_C T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?          
             ]]>
	</query>
	<query id="FrmPlanStoveD.QueryRemaDbk" desc="查询是否有上料剩余计划支">
             <![CDATA[
   SELECT T.FEED_HEAT_NO,
       T.JUDGE_STOVE_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       (SELECT NVL(SUM(M.ACT_COUNT), 0)
          FROM MAT_BC_M M
         WHERE M.JUDGE_STOVE_NO = T.FEED_HEAT_NO
           AND NVL(M.JUGDE_APPLY_CODE, '/') = NVL(T.JUGDE_APPLY_CODE, '/')
           AND M.PRO_PLAN_ID_NEXT = T.PRO_PLAN_ID
           AND M.GX_PLAN_NO_NEXT = T.GX_PLAN_NO
           AND M.BATCH_NO= T.BATCH_NO
           AND M.BATCH_GROUD_NO = T.BATCH_GROUD_NO
           AND M.MAT_STATUS = '80150103') ACT_COUNT
  FROM PLN_ZY_DBK_C T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?          
             ]]>
	</query>
	<query id="FrmPlanStoveD.QueryRemaRcl" desc="查询是否有上料剩余计划支">
             <![CDATA[
   SELECT T.JUDGE_STOVE_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       (SELECT NVL(SUM(M.ACT_COUNT), 0)
          FROM MAT_BC_M M
         WHERE M.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND NVL(M.JUGDE_APPLY_CODE, '/') = NVL(T.JUGDE_APPLY_CODE, '/')
           AND M.PRO_PLAN_ID_NEXT = T.PRO_PLAN_ID
           AND M.GX_PLAN_NO_NEXT = T.GX_PLAN_NO
           AND M.BATCH_NO= T.BATCH_NO
           AND M.BATCH_GROUD_NO = T.BATCH_GROUD_NO
           AND M.MAT_STATUS = '80150103') ACT_COUNT
  FROM PLN_ZY_RCL_C T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?          
             ]]>
	</query>
	<query id="FrmPlanStoveD.QueryRemaJgx" desc="查询是否有上料剩余计划支">
             <![CDATA[
   SELECT T.JUDGE_STOVE_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       (SELECT NVL(SUM(M.ACT_COUNT), 0)
          FROM MAT_BC_M M
         WHERE M.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND NVL(M.JUGDE_APPLY_CODE, '/') = NVL(T.JUGDE_APPLY_CODE, '/')
           AND M.PRO_PLAN_ID_NEXT = T.PRO_PLAN_ID
           AND M.GX_PLAN_NO_NEXT = T.GX_PLAN_NO
           AND M.BATCH_NO= T.BATCH_NO
           AND M.BATCH_GROUD_NO = T.BATCH_GROUD_NO
           AND M.MAT_STATUS = '80150103') ACT_COUNT
  FROM PLN_ZY_JGX_C T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?          
             ]]>
	</query>
	<query id="ProducHelper.QueryRemaJg" desc="查询是否有上料剩余计划支">
             <![CDATA[
   SELECT T.JUDGE_STOVE_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       (SELECT NVL(SUM(M.ACT_COUNT), 0)
          FROM MAT_BC_M M
         WHERE M.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND NVL(M.JUGDE_APPLY_CODE, '/') = NVL(T.JUGDE_APPLY_CODE, '/')
           AND M.PRO_PLAN_ID_NEXT = T.PRO_PLAN_ID
           AND M.GX_PLAN_NO_NEXT = T.GX_PLAN_NO
           AND M.BATCH_NO= T.BATCH_NO
           AND M.BATCH_GROUD_NO = T.BATCH_GROUD_NO
           AND M.MAT_STATUS = '80150103') ACT_COUNT
  FROM PLN_ZY_JG_C T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?          
             ]]>
	</query>
	<query id="ProducHelper.doQueryActualMDbk" desc="查询镦拔扩虚拟炉计划">
             <![CDATA[
             SELECT T.HEAT_PLAN_NO,
       T.GX_PRO_SEQ,
       T.ZY_BATCH_ID,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       DECODE(T.PLANSTATUS,
                      '00',
                      '计划',
                      '10',
                      '下发',
                      '20',
                      '生产中',
                      '30',
                      '生产完成',
                      '40',
                      '关闭A') PLANSTATUS,
       T.UPPER_HEATPLAN_ID,
       T.PRO_PLAN_ID,
       T.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.GOWHERE_CODE,
       T.GOWHERE_NAME,
       T.PROD_STANDARD,
       T.OUTPUT_STANDARD,
       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 ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.IF_EXPORT,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       T.PRO_MONTH,
       T.PRO_DAY,
       T.BAL_YEAR_MONTH,
       DECODE(T.IF_MONITOR,'1','是','/') IF_MONITOR,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.BOM,
       T.WHOLE_BACKLOG,
       T.WHOLE_BACKLOG_DESC,
       T.STATION_ROAD,
       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.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.OUTDIAMETER_IN,
       T.WALLTHICK_IN,
       T.LENGTH_IN,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       T.OUTNUM_CUT,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.AIMLENGTH_MAX,
       T.AIMLENGTH_MIN,
       T.LEN_CUTHEAD,
       T.LEN_CUTEND,
      NVL(T.PLN_INSINGLE_NUM,0) PLN_INSINGLE_NUM,
        NVL(T.PLN_INSINGLE_WT,0)PLN_INSINGLE_WT,
        NVL(T.PLN_INDOUBLE_NUM,0) PLN_INDOUBLE_NUM,
        NVL(T.PLN_INDOUBLE_WT,0) PLN_INDOUBLE_WT,
        NVL(T.PLN_OUTSINGLE_NUM,0) PLN_OUTSINGLE_NUM,
        NVL(T.PLN_OUTSINGLE_W,0) PLN_OUTSINGLE_W,
        NVL(T.PLN_OUTDOUBLE_NUM,0) PLN_OUTDOUBLE_NUM,
        NVL(T.PLN_OUTDOUBLE_W,0) PLN_OUTDOUBLE_W,
       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.INDEX_SEQ,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.FEED_HEAT_NO,
       T.MEMO,
       T.ZY_BATCH_ID_ZG,
       T.DECISION,
       T.PASS_CODE,
       T.PASS_NAME
  FROM PLN_ZY_DBK_M T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
             
               ]]>
	</query>
	<query id="ProducHelper.doQueryActualMRcl" desc="查询热处理虚拟炉计划">
             <![CDATA[
             SELECT T.HEAT_PLAN_NO,
       T.GX_PRO_SEQ,
       T.ZY_BATCH_ID,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
      DECODE(T.PLANSTATUS,
                      '00',
                      '计划',
                      '10',
                      '下发',
                      '20',
                      '生产中',
                      '30',
                      '生产完成',
                      '40',
                      '关闭A') PLANSTATUS,
       T.UPPER_HEATPLAN_ID,
       T.PRO_PLAN_ID,
       T.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.GOWHERE_CODE,
       T.GOWHERE_NAME,
       T.PROD_STANDARD,
       T.OUTPUT_STANDARD,
       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 ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.IF_EXPORT,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       T.PRO_MONTH,
       T.PRO_DAY,
       T.BAL_YEAR_MONTH,
      DECODE(T.IF_MONITOR,'1','是','/') IF_MONITOR,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.BOM,
       T.WHOLE_BACKLOG,
       T.WHOLE_BACKLOG_DESC,
       T.STATION_ROAD,
       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.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHMIN,
       T.LENGTHMAX,
       T.OUTDIAMETER_IN,
       T.WALLTHICK_IN,
       T.OUTNUM_CUT,
       T.LENGTH_IN,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       NVL(T.PLN_INSINGLE_NUM,0) PLN_INSINGLE_NUM,
        NVL(T.PLN_INSINGLE_WT,0)PLN_INSINGLE_WT,
        NVL(T.PLN_INDOUBLE_NUM,0) PLN_INDOUBLE_NUM,
        NVL(T.PLN_INDOUBLE_WT,0) PLN_INDOUBLE_WT,
        NVL(T.PLN_OUTSINGLE_NUM,0) PLN_OUTSINGLE_NUM,
        NVL(T.PLN_OUTSINGLE_W,0) PLN_OUTSINGLE_W,
        NVL(T.PLN_OUTDOUBLE_NUM,0) PLN_OUTDOUBLE_NUM,
        NVL(T.PLN_OUTDOUBLE_W,0) PLN_OUTDOUBLE_W,
       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.INDEX_SEQ,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.DECISION, T.PROCESS_SEQ
  FROM PLN_ZY_RCL_M T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
             
               ]]>
	</query>
	<query id="ProducHelper.doQueryActualMJgx" desc="查询加工线虚拟炉计划">
             <![CDATA[
              SELECT 
       T.HEAT_PLAN_NO,
       T.ZY_BATCH_ID,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       DECODE(T.PLANSTATUS,
                      '00',
                      '计划',
                      '10',
                      '下发',
                      '20',
                      '生产中',
                      '30',
                      '生产完成',
                      '40',
                      '关闭A') PLANSTATUS,
       T.UPPER_HEATPLAN_ID,
       T.PRO_PLAN_ID,
       T.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.GOWHERE_CODE,
       T.GOWHERE_NAME,
       T.PROD_STANDARD,
       T.OUTPUT_STANDARD,
       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 ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.IF_EXPORT,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       T.PRO_MONTH,
       T.PRO_DAY,
       T.BAL_YEAR_MONTH,
       DECODE(T.IF_MONITOR,'1','是','/') IF_MONITOR,
       T.PRDCR_NO,
       T.MONITOR_POINT,
       T.MONITOR_MENT,
       T.MONITOR_MAN,
       T.BOM,
       T.WHOLE_BACKLOG,
       T.WHOLE_BACKLOG_DESC,
       T.STATION_ROAD,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.WIC,
       T.GIC,
       T.CRAFT_FILE_NO,
       T.CRAFT_SEQ,
       T.CRAFT_FILE_MAN,
       T.SEC_CRAFT_FILE_NO,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHMIN,
       T.LENGTHMAX,
       T.OUTDIAMETER_IN,
       T.WALLTHICK_IN,
       T.OUTNUM_CUT,
       T.LENGTH_IN,
       T.LENGTHMAX_IN,
       T.LENGTHMIN_IN,
       NVL(T.PLN_INSINGLE_NUM,0) PLN_INSINGLE_NUM,
        NVL(T.PLN_INSINGLE_WT,0)PLN_INSINGLE_WT,
        NVL(T.PLN_INDOUBLE_NUM,0) PLN_INDOUBLE_NUM,
        NVL(T.PLN_INDOUBLE_WT,0) PLN_INDOUBLE_WT,
        NVL(T.PLN_OUTSINGLE_NUM,0) PLN_OUTSINGLE_NUM,
        NVL(T.PLN_OUTSINGLE_W,0) PLN_OUTSINGLE_W,
        NVL(T.PLN_OUTDOUBLE_NUM,0) PLN_OUTDOUBLE_NUM,
        NVL(T.PLN_OUTDOUBLE_W,0) PLN_OUTDOUBLE_W,
       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.INDEX_SEQ,
       T.GX_PRO_SEQ,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.DECISION
 FROM PLN_ZY_JGX_M T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?     
               ]]>
	</query>
	<query id="ProducHelper.doQueryActualMJg" desc="查询接箍虚拟炉计划">
             <![CDATA[
             SELECT T.HEAT_PLAN_NO,
       T.PRO_PLAN_ID,
       T.JG_GROUP_ID,
       T.GX_PLAN_NO,
       T.JUDGE_STOVE_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.CODE_JG_BL,
       T.BL_WL_ID,
       T.BL_WL_DESC,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.MIN_D,
       T.MIN_H,
       T.AIMLENGTH_BL,
       T.AIM_CUT_LEN,
       T.LENGTH_MIN,
       T.LENGTH_MAX,
       T.TAPER,
       T.CODE_JG,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.SPEC_JG,
       T.SPEC_JG_DESC,
       T.STYLE_JG,
       T.DIAMETER,
       T.CHECK_J_VAL,
       T.AIMLENGTH,
       T.SINGLEWEIGHT,
       T.COAT_TYPE,
       T.PLAN_JG_NUM,
       T.PLAN_BL_NUM,
       T.PLAN_BL_WT,
       T.MONITORDEMAND,
       DECODE(T.IF_MONITOR_JG, '1', '是', '/'),
       T.PRDCR_NO,
       T.CUT_MACH_GRP_NO,
       T.CUT_MACH_GRP_NM,
       T.DEMAND_COPPER,
       T.LATHE_GRP_NO,
       T.LATHE_GRP_NM,
       T.DEMAND_DETECTION,
       T.DEMAND_BLAST,
       T.DEMAND_BONDERIZING,
       DECODE(T.PLANSTATUS,
              '00',
              '计划',
              '10',
              '下发',
              '20',
              '生产中',
              '30',
              '生产完成',
              '40',
              '关闭') PLANSTATUS,
       T.MEMO,
       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.CUST_ALPHA_NO,
       T.ORDER_SPECIAL_DESC,
       T.ALPHA_CODE,
       T.CRAFT_FILE_NO,
       T.CRAFT_SEQ,
       T.ORD_LN_DLY_PK,
       T.SINGLE_CUT_NUN,
       DECODE(T.IF_MATCH_ODD, '1', '利库计划','2','组炉计划','3','精整利库','4','精整返线计划','6','本工序精整利库','正常计划') IF_MATCH_ODD,
       DECODE(T.IF_DO_HEAT_PLAN, '1', '是', '/') IF_DO_HEAT_PLAN,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.STOVE_NO,
       T.FLAG_STOVE_NO,
       T.GX_PRO_SEQ,
       T.PRO_DAY,
       T.BAL_YEAR_MONTH,
       T.PROD_STANDARD,
       T.OUTPUT_STANDARD,
       T.UPPER_HEATPLAN_ID,
       (SELECT MAX(DECODE(Z.PLANSTATUS,
                          '00',
                          '计划',
                          '10',
                          '下发',
                          '20',
                          '生产中',
                          '30',
                          '生产完成',
                          '40',
                          '关闭'))
          FROM PLN_ZY_RCL_M Z
         WHERE Z.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO) PLANSTATUS_GX,
       T.UPPER_PROCESS_CODE,T.STD_CODE,
       T.STD_NAME,T.STD_STYLE,T.STD_STYLE_DESC,
       T.PRODUCCODE_JG,T.PRODUCCODE_JG_DESC
  FROM PLN_ZY_JG_M T
   WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?     
               ]]>
	</query>
		<query id="ProducHelperBean.queryOrderBlReq" desc="查询备料需求与成品合同对应关系">
             <![CDATA[
             SELECT T.REQ_BL_ID,
       T.BLTYPE,
       T.ORDER_NO || '/' || T.ORDER_SEQ ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.JG_ORDERNO,
       T.STEELCODE,
       T.STEELNAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.AIMWALLTHICK,
       T.LENGTHMAX,
       T.LENGTHMIN,
       T.AIMLENGTH,
       T.CODE_DJ_BL,
       T.GETRATE_DJ,
       T.CODE_JG_BL,
       T.STD_CODE,
       T.STD_NAME,
       T.MSC,
       T.SINGLEWEIGHT,
       T.JGBL_REQ_WEIGHT,
       T.JGBL_REQ_NUM,
       T.MATCHWEIGHT,
       T.MATCHNUM,
       DECODE(T.PLANSTATUS,'0','待确认','1','已确认','2','已下发','3','生产中','4','生产完成') PLANSTATUS,
       T.JGCUTPLAN_WT,
       T.JGCUTPLAN_NUM,
       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,
       DECODE(T.SPEC_SAME_SALE,'0','不同','相同') SPEC_SAME_SALE,
       T.PRDCR_NO,
       T.PRO_PLAN_ID,
       T.ORD_LN_DLY_PK,
       T.PSC
  FROM PLN_PORDER_BL_REQ T
 WHERE 1 = 1
 AND T.BLTYPE='短节备料'
               ]]>
	</query>
	<query id = "ProducHelper.getPlnZgM" desc = "查询轧管炉计划主表">

	</query>
	<query id = "ProducHelperBean.selectOrderZs" desc = "查询订单状态">
		SELECT NVL(T.IF_STOVE_ISSUED,'0')IF_STOVE_ISSUED FROM PLN_ORDER_ZG_S T WHERE T.PRO_PLAN_ID = ? AND T.GX_PLAN_NO = ?
	</query>
	<query id = "ProducHelper.updateProgyMemo" desc = "修改工艺备注">
		UPDATE PLN_ORDER_RCL_S T SET T.PROGY_MEMO = '#PROGY_MEMO#'
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.updatePlanMemo" desc = "修改热处理计划备注">
		UPDATE PLN_ORDER_RCL_S T SET T.MEMO = '#MEMO#'
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<!-- TZH 24.11.6 ADD 新增修改加工计划备注-->
	<query id = "ProducHelper.updateJGXPlanMemo" desc = "修改加工计划备注">
		UPDATE PLN_ORDER_JGX_S T SET T.MEMO = '#MEMO#'
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.updateProgyMemoJgx" desc = "修改工艺备注">
		UPDATE PLN_ORDER_JGX_S T SET T.PROGY_MEMO = '#PROGY_MEMO#'
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.tabNoticeZg" desc = "修改轧管监制信息">
		UPDATE PLN_ORDER_ZG_S T
		SET T.IS_NOTICE_EP   = '#IS_NOTICE_EP#',
		T.IS_NOTICE_USER = '#IS_NOTICE_USER#',
		T.IS_NOTICE_TIME = TO_DATE('#IS_NOTICE_TIME#', 'YYYY-MM-DD HH24:MI:SS')
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>

	<query id = "ProducHelper.tabNoticeH" desc = "修改接箍监制信息">
		UPDATE PLN_GX_JG_PROP_S T
		SET T.IS_NOTICE_EP   = '#IS_NOTICE_EP#',
		T.IS_NOTICE_USER = '#IS_NOTICE_USER#',
		T.IS_NOTICE_TIME = TO_DATE('#IS_NOTICE_TIME#', 'YYYY-MM-DD HH24:MI:SS')
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.tabNoticeDbk" desc = "修改镦拔扩监制信息">
		UPDATE PLN_ORDER_DBK_S T
		SET T.IS_NOTICE_EP   = '#IS_NOTICE_EP#',
		T.IS_NOTICE_USER = '#IS_NOTICE_USER#',
		T.IS_NOTICE_TIME = TO_DATE('#IS_NOTICE_TIME#', 'YYYY-MM-DD HH24:MI:SS')
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.tabNoticeRcl" desc = "修改热处理监制信息">
		UPDATE PLN_ORDER_RCL_S T
		SET T.IS_NOTICE_EP   = '#IS_NOTICE_EP#',
		T.IS_NOTICE_USER = '#IS_NOTICE_USER#',
		T.IS_NOTICE_TIME = TO_DATE('#IS_NOTICE_TIME#', 'YYYY-MM-DD HH24:MI:SS')
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.tabNoticeJgx" desc = "修改加工监制信息">
		UPDATE PLN_ORDER_JGX_S T
		SET T.IS_NOTICE_EP   = '#IS_NOTICE_EP#',
		T.IS_NOTICE_USER = '#IS_NOTICE_USER#',
		T.IS_NOTICE_TIME = TO_DATE('#IS_NOTICE_TIME#', 'YYYY-MM-DD HH24:MI:SS')
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.selectNoticeZg" desc = "查询轧管订单信息">
		SELECT T.IF_MONITOR_ZG, T.IS_NOTICE_EP
		FROM PLN_ORDER_ZG_S T
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.selectNoticeH" desc = "查询接箍订单信息">
		SELECT T.IF_MONITOR_JG, T.IS_NOTICE_EP
		FROM PLN_GX_JG_PROP_S T
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.selectNoticeDbk" desc = "查询镦拔扩订单信息">
		SELECT T.IF_MONITOR_DBK, T.IS_NOTICE_EP
		FROM PLN_ORDER_DBK_S T
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.selectNoticeRcl" desc = "查询热处理订单信息">
		SELECT T.IF_MONITOR_RCL, T.IS_NOTICE_EP
		FROM PLN_ORDER_RCL_S T
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.selectNoticeJgx" desc = "查询加工订单信息">
		SELECT T.IF_MONITOR_JGX, T.IS_NOTICE_EP
		FROM PLN_ORDER_JGX_S T
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.getSuppUnitCodeRcl" desc = "查询热处理订单所在产线">
		SELECT S.SUPPLY_UNIT_CODE
		FROM PLN_ORDER_RCL_S T, PLN_SALEORD S
		WHERE T.ORD_LN_DLY_PK = S.ORD_LN_DLY_PK
		AND T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.getSuppUnitCodeJgx" desc = "查询热处理订单所在产线">
		SELECT S.SUPPLY_UNIT_CODE
		FROM PLN_ORDER_JGX_S T, PLN_SALEORD S
		WHERE T.ORD_LN_DLY_PK = S.ORD_LN_DLY_PK
		AND T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	<query id = "ProducHelper.getPlineSCode" desc = "查询产线所属供应商">
		SELECT T.SUPPLY_UNIT_CODE FROM COM_BASE_PLINE T WHERE T.PLINE_CODE = '#ORGL_PLINE_CODE#'
	</query>


	<query id = "ProducHelper.UpdateOrderTeamZg" desc = "修改轧管是否协同信息">
		UPDATE PLN_ORDER_ZG_S T
		SET T.ORDER_TEAM   = DECODE('#ORDER_TEAM#','','1','是','0','1')
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	
	<!-- TZH 24.10.31  -->
	<query id = "ProducHelper.UpdateOrderRollLen" desc = "轧管转移长度下限和上限">
		UPDATE PLN_ORDER_ZG_S T
    	SET T.LEN_ROLL_MIN   = '#LEN_ROLL_MIN#',
    	T.LEN_ROLL_MAX   = '#LEN_ROLL_MAX#'
   		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
    	AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>

	<query id = "ProducHelper.UpdateOrderTeamDbk" desc = "修改管加工是否协同信息">
		UPDATE PLN_ORDER_DBK_S T
		SET T.ORDER_TEAM   = DECODE('#ORDER_TEAM#','','1','是','0','1')
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>

	<query id = "ProducHelper.UpdateOrderTeamRcl" desc = "修改热处理是否协同信息">
		UPDATE PLN_ORDER_RCL_S T
		SET T.ORDER_TEAM   = DECODE('#ORDER_TEAM#','','1','是','0','1')
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>

	<query id = "ProducHelper.UpdateOrderTeamJgx" desc = "修改加工线是否协同信息">
		UPDATE PLN_ORDER_JGX_S T
		SET T.ORDER_TEAM   = DECODE('#ORDER_TEAM#','','1','是','0','1')
		WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
	</query>
	 

	
	<query id = "ProducHelperBean.doQueryPorderstatus" desc = "查询合同状态">
		select t.* from PLN_SALEORD t where T.ORD_LN_DLY_PK = ? AND T.ORDER_SEQ ='009' AND T.SUPPLY_UNIT_CODE = '120501'
	</query>
</queryMap>