<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="炉次订单余材利库">

	<query id="FrmSteelPlnZg.selectPlnReqinfGp" desc="查询管坯需求号">
             <![CDATA[
SELECT T.GRADECODE,
       T.GRADENAME,
       T.LEN_GP_SINGLE,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.CIC,
       T.PIC,
       T.SIC,
       T.IF_MONITOR_LG,2
       T.IFBUYPLAN,
       T.WHOLE_BACKLOG_DESC,
       T.DIAMETER_GP,
       T.STATION_ROAD_LG　FROM PLN_REQINF_GP T WHERE T.GPREQ_ID = ?
                 ]]>
	</query>
	<query id="FrmSteelPlnZg.selectPlnOrderZgS" desc="查询轧管订单">
             <![CDATA[
          SELECT ZG.* FROM(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) ORDER_NO_SEQ,
       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,
       NVL(T.WEIGTH_S,0) WEIGTH_S,
       NVL(T.NUM_S,0) NUM_S,
       NVL(T.MATCH_WT_IN,0) MATCH_WT_IN,
       NVL(T.MATCH_NUM_IN,0) MATCH_NUM_IN,
       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_PLAN_OK, '1', '是', '/') IS_PLAN_OK,
       DECODE(T.GPREQ_IF_OK, '1', '是', '/') GPREQ_IF_OK,
       DECODE(T.GPREQ_IF_DZ, '1', '是', '/') GPREQ_IF_DZ,
       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.TUBE_END_RATIO,
       T.GPREQ_NUM,
       T.GPREQ_WEIGHT,
       NVL(T.GPREQ_WEIGHT_MIN,0) GPREQ_WEIGHT_MIN,
       T.PLANS_NUM,
       T.WEIGTH_S_MIN,
       T.PRIORITY,
       T.PRIORITY_MEMO,
       DECODE(T.OUTS_BILLET_FL, '0', '自炼', '1', '外购') OUTS_BILLET_FL,
       T.WHOLE_BACKLOG_DESC,
       T.PLINE_NAME_ZZ,
       T.OUTDIAMETER_ZG,
       T.WALLTHICK_ZG,
       T2.GRADECODE_ALL,
       (SELECT C.ABRVITION
          FROM SLM_BASE_CUSTOMER C
         WHERE C.CUSTOMER_NO = T1.FINAL_USER) FINAL_USER_DESC,
       T3.STATION_DESC STATION_ROAD_LG,
       DECODE((SELECT TO_CHAR(WM_CONCAT(PRL.STATION_CODE))
                FROM SLM_ORDER_LINE_PRDCR_LST PRL, SLM_ORDER_LINE_PRDCR PR
               WHERE PRL.PRDCR_NO = PR.PRDCR_NO
                 AND PRL.PRDCR_INDEX = PR.PRDCR_INDEX
                 AND PRL.PROCESS_CODE = 'A'
                 AND PR.PRDCR_NO = T.PRDCR_NO
                 AND PR.CODE_JG IS NULL
                 AND PR.CODE_BL IS NULL
                 AND PR.MSC_PLINE = T2.INDEX_SEQ),
              NULL,
              '否',
              '是') IF_MONITOR_LG,
       T1.PRODUCNAME,
       Q1.CRAFT_PATH,
       DECODE(T.STATE_SINGLE, '0', '正常', '1', '利库', '2', '脱单') STATE_SINGLE,
       T.GRADECODE_LK,
       T.GRADENAME_LK,
       T.CIC_GROUP_LK,
       (SELECT GET_GP_MAT_WT_ZL(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) FURNAWEIGHT,
       (SELECT GET_GP_MAT_NUM_ZL(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) FURNANUM,
       (SELECT GET_GP_PLNZGM_NUM(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) LJNUM,
       (SELECT GET_GP_PLNZGM_WT(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) LJWEIGHT,
       (SELECT GET_GP_WT_CK(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) OUT_WT,
       (SELECT GET_GP_NUM_CK(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) OUT_NUM,
       (SELECT GET_ZG_REDUCED_WT(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) REDUCED_WT,
       (SELECT LISTAGG(C1.GRADECODE, ',') WITHIN GROUP(ORDER BY C1.PRIORITY ASC, C1.GRADECODE)
          FROM (SELECT DISTINCT B.GRADENAME,
                                B.GRADECODE,
                                B.PRIORITY,
                                C.CRAFT_SEQ,
                                B.MSC_PLINE,
                                S.ORD_LN_DLY_PK
                  FROM CRAFT_ORD_DESIGN_MSC_PL_GZ B,
                       CRAFT_ORD_DESIGN_MSC_PL    B1,
                       PLN_SALEORD                S,
                       CRAFT_ORD_DESIGN           C
                 WHERE B.DESGIN_KEY = B1.DESGIN_KEY
                   AND B.MSC_PLINE = B1.MSC_PLINE
                   AND C.ORD_LN_PK = S.ORD_LN_PK
                   AND B.DESGIN_KEY = C.DESGIN_KEY
                   AND B.PRIORITY<'100'
                 ORDER BY B.PRIORITY ASC, B.GRADECODE ASC) C1
         WHERE C1.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
           AND C1.CRAFT_SEQ = T.CRAFT_SEQ
           AND C1.MSC_PLINE = T.INDEX_SEQ) GRADE_ALL,
           T.INDEX_SEQ
  FROM PLN_ORDER_ZG_S T,
       PLN_SALEORD T1,
       PLN_SALEORD_PROC T2,
       CRAFT_ORD_DESIGN Q1,
       (SELECT LISTAGG(STATION_DESC, '') WITHIN GROUP(ORDER BY STATION_CODE) STATION_DESC,
               PRO_PLAN_ID,
               GX_PLAN_NO
          FROM (SELECT DISTINCT CASE
                                  WHEN S.STATION_DESC = '电炉' THEN
                                   'E'
                                  WHEN S.STATION_DESC = '炉外精炼' THEN
                                   'L'
                                  WHEN S.STATION_DESC = '真空处理' THEN
                                   'V'
                                  WHEN S.STATION_DESC = '熔炼成分' THEN
                                   'C'
                                  ELSE
                                   ''
                                END STATION_DESC,
                                S.STATION_CODE,
                                T4.PRO_PLAN_ID,
                                T4.GX_PLAN_NO
                  FROM CRAFT_ORD_DESIGN_MSC_PL_STI S,
                       CRAFT_ORD_DESIGN            C,
                       CRAFT_ORD_DESIGN_MSC_PL_PRC C1,
                       PLN_SALEORD                 T1,
                       PLN_ORDER_ZG_S              T4
                 WHERE T1.ORD_LN_DLY_PK = T4.ORD_LN_DLY_PK
                   AND S.DESGIN_KEY = C1.DESGIN_KEY
                   AND S.MSC_PLINE = C1.MSC_PLINE
                   AND S.PROCESS_CODE = C1.PROCESS_CODE
                   AND C.ORD_LN_PK = T1.ORD_LN_PK
                   AND C.CRAFT_SEQ = T4.CRAFT_SEQ
                   AND C1.DESGIN_KEY = C.DESGIN_KEY
                   AND C1.MSC_PLINE = T4.INDEX_SEQ
                   AND C1.PROCESS_CODE IN ('A')
                 GROUP BY T4.PRO_PLAN_ID,
                          S.STATION_DESC,
                          S.STATION_CODE,
                          T4.GX_PLAN_NO)
         GROUP BY PRO_PLAN_ID, GX_PLAN_NO) T3
 WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK
   AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
   AND T.PLN_DIVIDE_ID = T2.PLN_DIVIDE_ID
   AND T1.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
   AND Q1.ORD_LN_PK = T1.ORD_LN_PK
   AND Q1.CRAFT_SEQ = T.CRAFT_SEQ
   AND T.PRO_PLAN_ID = T3.PRO_PLAN_ID(+)
   AND T.GX_PLAN_NO = T3.GX_PLAN_NO(+)             
                 ]]>
	</query>
	<query id="FrmSteelPlnZg.QueryPlnOrderZgS" desc="查询轧管订单">
             <![CDATA[  
SELECT TO_NUMBER(NVL(T.GPREQ_NUM, 0)) - TO_NUMBER(NVL(T.MATCH_NUM_IN, 0)) MATCH_NUM,
       TO_NUMBER(NVL(T.GPREQ_WEIGHT, 0)) - TO_NUMBER(NVL(T.MATCH_WT_IN, 0)) MATCH_WEIGHT,
       NVL(T.GPREQ_NUM, 0) GPREQ_NUM,
       NVL(T.GPREQ_WEIGHT, 0) GPREQ_WEIGHT,
       NVL(T.MATCH_NUM_IN, 0) MATCH_NUM_IN,
       NVL(T.MATCH_WT_IN, 0) MATCH_WT_IN,
       T.EXE_STATUS,
       T.IS_PLAN_OK,
       T.GPREQ_ID,
       T.STATE_SINGLE,
       T.ORDER_NO || '/' || T.ORDER_SEQ ORDER_NO,
       T.STEELCODE,
       T.STEELNAME,
       T2.PRODUCCODE,
       T2.PRODUCNAME,
       C.ABRVITION FINAL_USER_DESC,
       T.PLINE_CODE,
       T.PLINE_NAME,
       DECODE((SELECT TO_CHAR(WM_CONCAT(PRL.STATION_CODE))
                FROM SLM_ORDER_LINE_PRDCR_LST PRL, SLM_ORDER_LINE_PRDCR PR
               WHERE PRL.PRDCR_NO = PR.PRDCR_NO
                 AND PRL.PRDCR_INDEX = PR.PRDCR_INDEX
                 AND PRL.PROCESS_CODE = 'A'
                 AND PR.PRDCR_NO = T.PRDCR_NO
                 AND PR.CODE_JG IS NULL
                 AND PR.CODE_BL IS NULL
                 AND PR.MSC_PLINE = T.INDEX_SEQ),
              NULL,
              '0',
              '1') IF_MONITOR_LG,
       T.PRDCR_NO,
       T.CIC_GP,T.LEN_GP_SINGLE,T.CRAFT_SEQ,T.INDEX_SEQ,T.ORD_LN_DLY_PK,T.CIC_GROUP_GP
  FROM PLN_ORDER_ZG_S T, PLN_SALEORD T2, SLM_BASE_CUSTOMER C
 WHERE T2.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
   AND C.CUSTOMER_NO = T2.FINAL_USER
   AND C.VALIDFLAG = '1'
   AND T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>
	<query id="FrmSteelPlnZg.updarePlnOrderZgS" desc="查询轧管订单">
             <![CDATA[  
             UPDATE PLN_ORDER_ZG_S T
   SET T.MATCH_WT_IN  = TO_NUMBER(NVL(T.MATCH_WT_IN, 0))+ TO_NUMBER(?),
       T.MATCH_NUM_IN = TO_NUMBER(NVL(T.MATCH_NUM_IN, 0))+ TO_NUMBER(?),
       T.STATE_SINGLE = ?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
             
                ]]>
	</query>
	<query id="FrmSteelPlnZg.QueryPlnSteOrdDD" desc="查询余材是否有相同的订单材信息">
             <![CDATA[  
             SELECT T.FURNACENO, T.SEQUENCENO
  FROM PLN_STEELFOR_ORD T
 WHERE T.ACT_MUM_M = '0'
   AND T.LEN_GP_SINGLE = '#LEN_GP_SINGLE#'
   AND T.CIC = '#CIC#'
   AND T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
   AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
   AND T.GPTYPE = '#GPTYPE#'
   AND T.MATERIAL_NO = 'MATERIAL_NO'
   AND T.WLID_IN = '#WLID_IN#'
   AND T.PLINE_CODE = '#WLID_IN#'
   AND T.CASTINGTYPE = '#CASTINGTYPE#'
   AND T.FURNACENO='#FURNACENO#'
   AND T.CCM_PLN_TYPE ='00'
                ]]>
	</query>
	<query id="FrmSteelPlnZg.QueryFurnacaen" desc="查询炉次订单余材信息">
             <![CDATA[  
             SELECT T.* ,T1.IF_CONFIRM FROM PLN_STEELFOR_ORD T,PLN_STEELFORCAST T1
 WHERE T1.CAST_NO=T.CAST_NO AND T.FURNACENO=?  AND T.CCM_PLN_TYPE ='00'
              ]]>
	</query>
	<query id="FrmSteelPlnZg.DeleteFurnOrd" desc="删除炉次订单余材信息">
             <![CDATA[  
DELETE PLN_STEELFOR_ORD T WHERE T.FURNACENO=? AND T.SEQUENCENO=?
              ]]>
	</query>
	<query id="FrmSteelPlnZg.UpdateFurnOrd" desc="修改炉次订单重量">
             <![CDATA[  
UPDATE PLN_STEELFOR_ORD T
   SET T.TOT_MUM_M = TO_NUMBER(NVL(T.TOT_MUM_M, 0) + TO_NUMBER(?), 
       T.TOT_WEIGHT_M = TO_NUMBER(NVL(T.TOT_WEIGHT_M, 0) + TO_NUMBER(?)
    WHERE T.FURNACENO = ? AND T.SEQUENCENO = ?
              ]]>
	</query>
	<query id="FrmSteelPlnZg.AddFurnOrd" desc="新增炉次订单重量">
             <![CDATA[  
 
INSERT INTO PLN_STEELFOR_ORD(
        FURNACENO,
        SEQUENCENO,
        FURNACENO_SEQ,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        CAST_NO,
        CAST_SEQ,
        CAST_STOVE_SEQ,
        CCM_SEQ,
        STOVE_NO,
        JUDGE_STOVE_NO,
        JUDGE_STOVE_NO_SEQ,
        FLAG_STOVE_NO,
        STATUS,
        CCM_STATE,
        CCM_PLN_TYPE,
        GPTYPE,
        CASTINGTYPE,
        PLINE_CODE,
        PLINE_NAME,
        CCMID,
        FLOWNO,
        EF_PLINE_CODE,
        EF_PLINE_NAME,
        WLID_IN,
        WLDESC_IN,
        MATERIAL_NO,
        MATERIAL_NAME,
        GRADECODE,
        GRADENAME,
        DIAMETER,
        LEN_GP_SINGLE,
        CUT_NUM_GP,
        LENGTH_M,
        WEIGHT_GP_ONE,
        WEIGHT_M,
        TOT_MUM_M,
        TOT_WEIGHT_M,
        ACT_WEIGHT_M,
        ACT_MUM_M,
        SURPLUSFLAG,
        EXCESS_WT,
        EXCESS_NUM,
        SURPLUS_TYPE,
        IF_SURPLUS_ALLOTED,
        CIC,
        PIC,
        SIC,
        DIC,
        CHEM_JUDGE_ID,
        PHY_JUDGE_ID,
        COLLIGATE_JUDGE_ID,
        MEMO,
        MAKEMAN,
        MAKETIME,
        DOWNMAN,
        DOWNTIME,
        PRO_MONTH,
        ORDER_NO,
        FINAL_USER_DESC,
        STEELCODE,
        STEELNAME,
        PRODUCCODE,
        PRODUCNAME,
        GOWHERE_CODE,
        GOWHERE_NAME,
        ISENDGX,
        STATE_LK,
        IF_MONITOR_LG,
        PRDCR_NO,CUT_NUM)
 VALUES( 
        '#FURNACENO#',
        '#SEQUENCENO#',
        '#FURNACENO_SEQ#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#CAST_NO#',
        '#CAST_SEQ#',
        '#CAST_STOVE_SEQ#',
        '#CCM_SEQ#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#JUDGE_STOVE_NO_SEQ#',
        '#FLAG_STOVE_NO#',
        '#STATUS#',
        '#CCM_STATE#',
        '#CCM_PLN_TYPE#',
        '#GPTYPE#',
        '#CASTINGTYPE#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#CCMID#',
        '#FLOWNO#',
        '#EF_PLINE_CODE#',
        '#EF_PLINE_NAME#',
        '#WLID_IN#',
        '#WLDESC_IN#',
        '#MATERIAL_NO#',
        '#MATERIAL_NAME#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#DIAMETER#',
        '#LEN_GP_SINGLE#',
        '#CUT_NUM_GP#',
        '#LENGTH_M#',
        '#WEIGHT_GP_ONE#',
        '#WEIGHT_M#',
        '#TOT_MUM_M#',
        '#TOT_WEIGHT_M#',
        '#ACT_WEIGHT_M#',
        '#ACT_MUM_M#',
        '#SURPLUSFLAG#',
        '#EXCESS_WT#',
        '#EXCESS_NUM#',
        '#SURPLUS_TYPE#',
        '#IF_SURPLUS_ALLOTED#',
        '#CIC#',
        '#PIC#',
        '#SIC#',
        '#DIC#',
        '#CHEM_JUDGE_ID#',
        '#PHY_JUDGE_ID#',
        '#COLLIGATE_JUDGE_ID#',
        '#MEMO#',
        '#MAKEMAN#',
        SYSDATE,
        '#DOWNMAN#',
        SYSDATE,
        '#PRO_MONTH#',
        '#ORDER_NO#',
        '#FINAL_USER_DESC#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#GOWHERE_CODE#',
        '#GOWHERE_NAME#',
        '#ISENDGX#',
        '1',
        '#IF_MONITOR_LG#',
        '#PRDCR_NO#','#CUT_NUM#') 
              ]]>
	</query>
	<query id="FrmSteelPlnZg.QueryLk" desc="根据炉次，订单号，排产序号查询利库记录">
             <![CDATA[  
             SELECT SUM(NVL(T.MATCH_WT_IN, 0)) MATCH_WT_IN,
       SUM(NVL(T.MATCH_NUM_IN, 0)) MATCH_NUM_IN,
       SUM(NVL(T.TOT_MUM_M, 0)) TOT_MUM_M,
       SUM(NVL(T.TOT_WEIGHT_M, 0)) TOT_WEIGHT_M,T.CIC
  FROM PLN_STEELFOR_ORD_LK T
 WHERE T.FURNACENO = ?
   AND T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO=?
   GROUP BY T.CIC
              ]]>
	</query>
	<query id="FrmSteelPlnZg.doPlnZgQuery" 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) ORDER_NO_SEQ,
			       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,
			       NVL(T.MATCH_WT_IN,0) MATCH_WT_IN,
			       NVL(T.MATCH_NUM_IN,0) MATCH_NUM_IN,
			       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', '完成') EXE_STATUS,
			       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.TUBE_END_RATIO,
			       T.GPREQ_NUM,
			       T.GPREQ_WEIGHT,
			       T.PLANS_NUM,
			       T.WEIGTH_S_MIN,
			       T.PRIORITY,
                   T.PRIORITY_MEMO,
			       DECODE(T.OUTS_BILLET_FL,'0','自炼','1','外购') OUTS_BILLET_FL,
                  T.WHOLE_BACKLOG_DESC,
       T2.GRADECODE_ALL,
       (SELECT C.ABRVITION FROM SLM_BASE_CUSTOMER C WHERE C.CUSTOMER_NO=T1.FINAL_USER )FINAL_USER_DESC,
        (SELECT LISTAGG(S.STATION_DESC, ',') WITHIN GROUP(ORDER BY S.STATION_CODE)
          FROM CRAFT_ORD_DESIGN_MSC_PL_STI S,
               CRAFT_ORD_DESIGN            C,
               CRAFT_ORD_DESIGN_MSC_PL_PRC C1
         WHERE S.DESGIN_KEY = C1.DESGIN_KEY
           AND S.MSC_PLINE = C1.MSC_PLINE
           AND S.PROCESS_CODE = C1.PROCESS_CODE
           AND C.ORD_LN_PK = T1.ORD_LN_PK
           AND C.CRAFT_SEQ = T2.CRAFT_SEQ
           AND C1.DESGIN_KEY = C.DESGIN_KEY
           AND C1.MSC_PLINE = T2.INDEX_SEQ
           AND C1.PROCESS_CODE IN ('A','B','C')) STATION_ROAD_LG,
       DECODE((SELECT TO_CHAR(WM_CONCAT(PRL.STATION_CODE))
                FROM SLM_ORDER_LINE_PRDCR_LST PRL, SLM_ORDER_LINE_PRDCR PR
               WHERE PRL.PRDCR_NO = PR.PRDCR_NO
                 AND PRL.PRDCR_INDEX = PR.PRDCR_INDEX
                 AND PRL.PROCESS_CODE < 'D'
                 AND PR.PRDCR_NO = T.PRDCR_NO
                 AND PR.CODE_JG IS NULL
                 AND PR.CODE_BL IS NULL
                 AND PR.MSC_PLINE = T2.INDEX_SEQ),
              NULL,
              '否',
              '是') IF_MONITOR_LG,
              T1.PRODUCNAME,Q1.CRAFT_PATH,T.PLINE_CODE_ZZ,T.PLINE_NAME_ZZ,
            (SELECT GET_GP_MAT_NUM_ZL(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) FurnNum,
       (SELECT GET_GP_MAT_WT_ZL(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) FurnWt,
       (SELECT GET_GP_PLNZGM_NUM(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) LjNum,
       (SELECT GET_GP_PLNZGM_WT(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) LjWeight,
       (SELECT GET_GP_WT_CK(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) OUT_WT,
       (SELECT GET_GP_NUM_CK(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) OUT_NUM,
       (SELECT GET_ZG_REDUCED_WT(T.PRO_PLAN_ID, T.GX_PLAN_NO) FROM DUAL) REDUCED_WT
  FROM PLN_ORDER_ZG_S T, PLN_SALEORD T1, PLN_SALEORD_PROC T2,CRAFT_ORD_DESIGN Q1
 WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK
   AND T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
   AND T.PLN_DIVIDE_ID = T2.PLN_DIVIDE_ID
   AND T1.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
   AND Q1.ORD_LN_PK=T1.ORD_LN_PK
   AND Q1.CRAFT_SEQ=T.CRAFT_SEQ
   AND T.GPREQ_ID=?
		]]>
	</query>
	<query id="FrmSteelPlnZg.doPlnZgQueryStrat" desc="通过管坯需求查询轧管最小状态">
		<![CDATA[
		SELECT MIN(T.EXE_STATUS) EXE_STATUS,COUNT(*) COUNT FROM PLN_ORDER_ZG_S T WHERE T.GPREQ_ID=?
		]]>
	</query>
	<query id="FrmSteelPlnZg.updatePlnOrderCast" desc="手动设置生产关闭">
             <![CDATA[
   UPDATE PLN_ORDER_CAST_S T
    SET T.GX_PRO_SEQ = '#GX_PRO_SEQ#',
        T.EXE_STATUS = '#EXE_STATUS#',
        T.MEMO       = '#MEMO#'
  WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
    AND T.GX_PLAN_NO = '#GX_PLAN_NO#'
               ]]>
	</query>
	<query id="FrmSteelPlnZg.selectPlanRouteCic" desc="通过管坯需求查询轧管最小状态">
		<![CDATA[
		SELECT  T.CIC,T.PLAN_ROUTE FROM PLN_STEELFORFURNACE T WHERE T.FURNACENO=?
		]]>
	</query>
	<query id="FrmSteelPlnZg.QueryCicALLFurnOed" desc="通过管坯需求查询轧管最小状态">
		<![CDATA[
		SELECT LISTAGG(CIC, ',') WITHIN GROUP(ORDER BY CIC) CIC
  FROM (SELECT DISTINCT T.CIC
          FROM PLN_STEELFOR_ORD T
         WHERE T.FURNACENO = ?
         AND T.CCM_PLN_TYPE ='00'
         ORDER BY T.CIC)
		]]>
	</query>
	<query id="FrmSteelPlnZg.QueryZgCic" desc="通过管坯需求查询轧管最小状态">
		<![CDATA[
		SELECT DISTINCT C.CIC, D.GRADENAME
  FROM PLN_SALEORD              T1,
       CRAFT_ORD_DESIGN         M,
       CRAFT_ORD_DESIGN_STD_CIC C,
       COM_MSC_STD_CIC          D
 WHERE M.ORD_LN_PK = T1.ORD_LN_PK
   AND C.DESGIN_KEY = M.DESGIN_KEY
   AND C.PROCESS_CODE IN ('A')
   AND C.CIC = D.CIC
   AND M.CRAFT_SEQ = ?
   AND T1.ORD_LN_DLY_PK = ?
   AND C.MSC_PLINE = ?
   AND D.GRADECODE=?
		]]>
	</query>
</queryMap>