<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="浇次控件类">

	<query id="ControlCastPlan.getCast" desc="查询浇次计划">
             <![CDATA[
            SELECT T.CAST_NO,
       T.CAST_SEQ,
       T.CCMID,
       DECODE(T.STATUS,
              '00',
              '编制中',
              '10',
              '已下发',
              '20',
              '生产中',
              '30',
              '已生产',
              '40',
              '关闭',
              '') STATUS,
       T.FURNACENUMBER,
       T.TOT_NUM,
       T.TOT_WT,
       DECODE(T.IF_CONNECT_GRADE, '1', '是', '/') IF_CONNECT_GRADE,
       T.WATER_GROUP_CODE,
       T.ADD_WT_BEGIN,
       T.ADD_WT_END,
       T.ADD_WT_CONN_AHEAD,
       T.ADD_WT_CONN_NEXT,
       T.START_GRADECODE,
       T.END_GRADECODE,
       TO_CHAR(T.STARTTIME, 'YYYY-MM-DD HH24:MI:SS') STARTTIME,
       TO_CHAR(T.ENDTIME, 'YYYY-MM-DD HH24:MI:SS') ENDTIME,
       T.MAKEMAN,
       TO_CHAR(T.MAKETIME, 'YYYY-MM-DD HH24:MI:SS') MAKETIME,
       T.MANFORTOL2,
       TO_CHAR(T.TIMEFORTOL2, 'YYYY-MM-DD HH24:MI:SS') TIMEFORTOL2,
       T.MEMO,
       T.PLINE_CODE,
       T.PLINE_NAME,T.FLOWNUMBER,T.PRO_MONTH,T.AIM_STEEL_QTY,T.DIAMETER,T.AVERAGE_QTY, 
       DECODE(T.IF_CONFIRM, '1', '是', '/') IF_CONFIRM
  FROM PLN_STEELFORCAST T
 WHERE 1 = 1

                 ]]>
	</query>

	<query id="ControlCastPlan.getCastByCastno" desc="查询浇次计划">
             <![CDATA[
   SELECT 
       T.CAST_NO,
       T.CAST_SEQ,
       T.CCMID,
       T.STATUS,
       T.FURNACENUMBER,
       T.TOT_NUM,
       T.TOT_WT,
       T.IF_CONNECT_GRADE,
       T.WATER_GROUP_CODE,
       T.ADD_WT_BEGIN,
       T.ADD_WT_END,
       T.ADD_WT_CONN_AHEAD,
       T.ADD_WT_CONN_NEXT,
       T.START_GRADECODE,
       T.END_GRADECODE,
       TO_CHAR(T.STARTTIME, 'YYYY-MM-DD HH24:MI:SS') STARTTIME,
       TO_CHAR(T.ENDTIME, 'YYYY-MM-DD HH24:MI:SS') ENDTIME,
       T.MAKEMAN,
       TO_CHAR(T.MAKETIME, 'YYYY-MM-DD HH24:MI:SS') MAKETIME,
       T.MANFORTOL2,
       TO_CHAR(T.TIMEFORTOL2, 'YYYY-MM-DD HH24:MI:SS') TIMEFORTOL2,
       T.MEMO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.IF_CONFIRM
 FROM PLN_STEELFORCAST T
 WHERE  T.CAST_NO =?
                 ]]>
	</query>
	<query id="ControlCastPlan.getSteelOrdById" desc="查询炉次订单">
             <![CDATA[
            SELECT 
       T.FURNACENO,
       T.SEQUENCENO,
       T.FURNACENO_SEQ,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.CAST_NO,
       T.CAST_SEQ,
       T.CAST_STOVE_SEQ,
       T.CCM_SEQ,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.JUDGE_STOVE_NO_SEQ,
       T.FLAG_STOVE_NO,
       T.STATUS,
       T.CCM_STATE,
       T.CCM_PLN_TYPE,
       T.GPTYPE,
       T.CASTINGTYPE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.CCMID,
       T.FLOWNO,
       T.EF_PLINE_CODE,
       T.EF_PLINE_NAME,
       T.WLID_IN,
       T.WLDESC_IN,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.GRADECODE,
       T.GRADENAME,
       T.DIAMETER,
       T.LEN_GP_SINGLE,
       T.CUT_NUM_GP,
       T.LENGTH_M,
       T.WEIGHT_GP_ONE,
       T.WEIGHT_M,
       T.TOT_MUM_M,
       T.TOT_WEIGHT_M,
       T.ACT_WEIGHT_M,
       T.ACT_MUM_M,
       T.SURPLUSFLAG,
       T.EXCESS_WT,
       T.EXCESS_NUM,
       T.SURPLUS_TYPE,
       T.IF_SURPLUS_ALLOTED,
       T.CIC,
       T.PIC,
       T.SIC,
       T.DIC,
       T.CHEM_JUDGE_ID,
       T.PHY_JUDGE_ID,
       T.COLLIGATE_JUDGE_ID,
       T.MEMO,
       T.MAKEMAN,
       TO_CHAR(T.MAKETIME, 'YYYY-MM-DD HH24:MI:SS') MAKETIME,
       T.DOWNMAN,
       TO_CHAR(T.DOWNTIME, 'YYYY-MM-DD HH24:MI:SS') DOWNTIME,
       T.PRO_MONTH,
       T.ORDER_NO,
       T.FINAL_USER_DESC,
       T.STEELCODE,
       T.STEELNAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.GOWHERE_CODE,
       T.GOWHERE_NAME,
       T.ISENDGX,
       T.STATE_LK,
       T.IF_MONITOR_LG,
       T.PRDCR_NO,T.MERGE_NO,T.CUT_NUM
 FROM PLN_STEELFOR_ORD T
 WHERE T.CAST_NO= ?
 AND T.CCM_PLN_TYPE ='00'
               ]]>
	</query>
	<query id="ControlCastPlan.getSteelFurnById" desc="查询炉次信息">
             <![CDATA[
            SELECT 
       T.FURNACENO,
       T.FURNACENO_SEQ,
       T.CAST_NO,
       T.CAST_SEQ,
       T.CAST_STOVE_SEQ,
       T.STOVE_NO,
       T.BOF_TYPE,
       T.STATUS,
       T.HEAT_STATE,
       T.CASTINGTYPE,
       T.EF_PLINE_CODE,
       T.EF_PLINE_NAME,
       T.EF_AGE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.CCMID,
       T.WLID_IN,
       T.WLDESC_IN,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.GRADECODE,
       T.GRADENAME,
       T.CIC,
       TO_CHAR(T.PLN_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') PLN_STARTTIME,
       TO_CHAR(T.PLN_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') PLN_ENDTIME,
       T.AIM_STEEL_QTY,
       T.QUANTITY,
       T.WEIGHT,
       T.OLD_FURNACENO,
       T.OLD_STOVE_NO,
       T.PLAN_ROUTE,
       T.FACT_ROUTE,
       TO_CHAR(T.STARTTIME, 'YYYY-MM-DD HH24:MI:SS') STARTTIME,
       TO_CHAR(T.ENDTIME, 'YYYY-MM-DD HH24:MI:SS') ENDTIME,
       TO_CHAR(T.BOF_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') BOF_STARTTIME,
       TO_CHAR(T.BOF_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') BOF_ENDTIME,
       TO_CHAR(T.CAS_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') CAS_STARTTIME,
       TO_CHAR(T.CAS_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') CAS_ENDTIME,
       TO_CHAR(T.VD_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') VD_STARTTIME,
       TO_CHAR(T.VD_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') VD_ENDTIME,
       TO_CHAR(T.RH_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') RH_STARTTIME,
       TO_CHAR(T.RH_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') RH_ENDTIME,
       TO_CHAR(T.LFS_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') LFS_STARTTIME,
       TO_CHAR(T.LFS_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') LFS_ENDTIME,
       TO_CHAR(T.CCM_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') CCM_STARTTIME,
       TO_CHAR(T.CCM_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') CCM_ENDTIME,
       T.SURPLUSFLAG,
       T.IF_MONITOR_LG,
       T.PRDCR_NO,
       T.CHEM_JUDGE_ID,
       T.PLANREMARK,
       T.REMARK,
       T.MAKEMAN,
       TO_CHAR(T.MAKETIME, 'YYYY-MM-DD HH24:MI:SS') MAKETIME,
       T.DOWNMAN,
       TO_CHAR(T.DOWNTIME, 'YYYY-MM-DD HH24:MI:SS') DOWNTIME,
       T.PRO_MONTH,
       T.CLOSEMAN,
       TO_CHAR(T.CLOSETIME, 'YYYY-MM-DD HH24:MI:SS') CLOSETIME,
       T.CRAFT_NO,
       T.CRAFT_PATH,
       T.IF_CONFIRM,
       T.BATCHING_CODE,
       T.BATCHING_NAME,
       T.HOTMETAL_NUM,
       T.IRON_NUM,
       T.STEELSCRAP_NUM,
       T.JUDGE_FLAG
 FROM PLN_STEELFORFURNACE T
 WHERE T.CAST_NO = ?   
               ]]>
	</query>
		<query id="ControlCastPlan.QueryFurnCastNo" desc="查询浇次对应订单炉数，电炉产线">
             <![CDATA[
            SELECT COUNT(*) COUNT,
       T.PLINE_CODE,
       T.PLINE_NAME,
       Min(T.FURNACENO_SEQ) FURNACENO_SEQ,
       MIN(TO_CHAR(T.PLN_STARTTIME,'YYYY-MM-DD HH24:MI:SS')) PLN_STARTTIME,
       T.EF_PLINE_CODE,
       T.WLID_IN,
       T.MATERIAL_NO,
       T2.MATERIAL_NO_ZZ
  FROM PLN_STEELFORFURNACE T,
       (SELECT DISTINCT C.MATERIAL_NO MATERIAL_NO_ZZ
          FROM PLN_STEELFOR_ORD T1, PLN_ORDER_CAST_S C
         WHERE T1.PRO_PLAN_ID = C.PRO_PLAN_ID
           AND T1.GX_PLAN_NO = C.GX_PLAN_NO
           AND T1.CAST_NO = ?
           AND T1.CCM_PLN_TYPE ='00') T2
 WHERE T.CAST_NO = ?
 GROUP BY T.PLINE_CODE,
          T.PLINE_NAME,
          T.EF_PLINE_CODE,
          T.WLID_IN,
          T.MATERIAL_NO,
          T2.MATERIAL_NO_ZZ
  
               ]]>
	</query>
	<query id="ControlCastPlan.getSteelFurnSeq" desc="查询炉次订单">
             <![CDATA[
             SELECT T.FURNACENO,
       T.FURNACENO_SEQ,
       T.CAST_NO,
       T.CAST_SEQ,
       T.CAST_STOVE_SEQ,
       T.STOVE_NO,
       T.BOF_TYPE,
       T.STATUS,
       T.HEAT_STATE,
       T.CASTINGTYPE,
       T.EF_PLINE_CODE,
       T.EF_PLINE_NAME,
       T.EF_AGE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.CCMID,
       T.WLID_IN,
       T.WLDESC_IN,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.GRADECODE,
       T.GRADENAME,
       T.CIC,
       TO_CHAR(T.PLN_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') PLN_STARTTIME,
       TO_CHAR(T.PLN_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') PLN_ENDTIME,
       T.AIM_STEEL_QTY,
       T.QUANTITY,
       T.WEIGHT,
       T.OLD_FURNACENO,
       T.OLD_STOVE_NO,
       T.PLAN_ROUTE,
       T.FACT_ROUTE,
       TO_CHAR(T.STARTTIME, 'YYYY-MM-DD HH24:MI:SS') STARTTIME,
       TO_CHAR(T.ENDTIME, 'YYYY-MM-DD HH24:MI:SS') ENDTIME,
       TO_CHAR(T.BOF_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') BOF_STARTTIME,
       TO_CHAR(T.BOF_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') BOF_ENDTIME,
       TO_CHAR(T.CAS_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') CAS_STARTTIME,
       TO_CHAR(T.CAS_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') CAS_ENDTIME,
       TO_CHAR(T.VD_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') VD_STARTTIME,
       TO_CHAR(T.VD_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') VD_ENDTIME,
       TO_CHAR(T.RH_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') RH_STARTTIME,
       TO_CHAR(T.RH_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') RH_ENDTIME,
       TO_CHAR(T.LFS_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') LFS_STARTTIME,
       TO_CHAR(T.LFS_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') LFS_ENDTIME,
       TO_CHAR(T.CCM_STARTTIME, 'YYYY-MM-DD HH24:MI:SS') CCM_STARTTIME,
       TO_CHAR(T.CCM_ENDTIME, 'YYYY-MM-DD HH24:MI:SS') CCM_ENDTIME,
       T.SURPLUSFLAG,
       T.IF_MONITOR_LG,
       T.PRDCR_NO,
       T.CHEM_JUDGE_ID,
       T.PLANREMARK,
       T.REMARK,
       T.MAKEMAN,
       TO_CHAR(T.MAKETIME, 'YYYY-MM-DD HH24:MI:SS') MAKETIME,
       T.DOWNMAN,
       TO_CHAR(T.DOWNTIME, 'YYYY-MM-DD HH24:MI:SS') DOWNTIME,
       T.PRO_MONTH,
       T.CLOSEMAN,
       TO_CHAR(T.CLOSETIME, 'YYYY-MM-DD HH24:MI:SS') CLOSETIME,
       T.CRAFT_NO,
       T.CRAFT_PATH,
       T.IF_CONFIRM,
       T.BATCHING_CODE,
       T.BATCHING_NAME,
       T.HOTMETAL_NUM,
       T.IRON_NUM,
       T.STEELSCRAP_NUM,
       T.JUDGE_FLAG,
       T1.TO_EXCEL
  FROM PLN_STEELFORFURNACE T, PLN_STEELFORCAST T1
 WHERE T.CAST_NO = T1.CAST_NO
   AND T.FURNACENO = ?
   AND T.CAST_STOVE_SEQ = ?
               ]]>
	</query>
</queryMap>