<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc=" 组炉/组浇计划类">

	<query id="FrmSteelMakingPlanDesign.addFurnace" desc="新增炉信息">
             <![CDATA[
                  INSERT INTO PLN_STEELFORFURNACE(
        FURNACENO,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        WLID_IN,
        WLDESC_IN,
        STATUS,
        GRADECODE,
        GRADENAME,
        QUANTITY,
        WEIGHT,
        AIM_STEEL_QTY,
        CAST_NO,
        CAST_SEQ,
        STARTTIME,
        ENDTIME,
        BOF_STARTTIME,
        BOF_ENDTIME,
        CAS_STARTTIME,
        CAS_ENDTIME,
        VD_STARTTIME,
        VD_ENDTIME,
        RH_STARTTIME,
        RH_ENDTIME,
        LFS_STARTTIME,
        LFS_ENDTIME,
        CCM_STARTTIME,
        CCM_ENDTIME,
        CASTINGTYPE,
        CCMID,
        PLINE_CODE,
        PLINE_NAME,
        CIC,
        PIC,
        SIC,
        DIC,
        WIC,
        GIC,
        SURPLUSFLAG,
        IF_MONITOR_LG,
        PRDCR_NO,
        IF_BATCHED_ZG,
        PLANREMARK,
        REMARK,
        MAKEMAN,
        MAKETIME)
 VALUES( 
        '#FURNACENO#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#MATERIAL_NO#',
        '#MATERIAL_NAME#',
        '#WLID_IN#',
        '#WLDESC_IN#',
        '#STATUS#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#QUANTITY#',
        '#WEIGHT#',
        '#AIM_STEEL_QTY#',
        '#CAST_NO#',
        '#CAST_SEQ#',
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        '#CASTINGTYPE#',
        '#CCMID#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#CIC#',
        '#PIC#',
        '#SIC#',
        '#DIC#',
        '#WIC#',
        '#GIC#',
        '#SURPLUSFLAG#',
        '#IF_MONITOR_LG#',
        '#PRDCR_NO#',
        '#IF_BATCHED_ZG#',
        '#PLANREMARK#',
        '#REMARK#',
        '#MAKEMAN#',
        SYSDATE)
                 ]]>
	</query>

	<query id="FrmSteelMakingPlanDesign.addSteelForOrd" desc="新增炉计划信息">
             <![CDATA[
                  INSERT INTO PLN_STEELFOR_ORD(
        FURNACENO,
        SEQUENCENO,
        CAST_NO,
        SEQUENCEINCAST,
        STATUS,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        GPREQ_ID,
        MATERIAL_NO,
        MATERIAL_NAME,
        GRADECODE,
        GRADENAME,
        DIAMETER,
        LEN_GP_SINGLE,
        CUT_NUM_GP,
        LENGTH_M,
        WEIGHT_GP_ONE,
        WEIGHT_M,
        TOT_WEIGHT_M,
        TOT_MUM_M,
        GPTYPE,
        CASTINGTYPE,
        CUTTYPE,
        SURPLUSFLAG,
        SURPLUS_TYPE,
        REF_ORD_ZZ,
        REF_GPREQ_ID,
        IF_SURPLUS_ALLOTED,
        CIC,
        PIC,
        SIC,
        DIC,
        WIC,
        GIC,
        IF_BATCHED_ZG,
        BATCHED_NUM,
        MEMO,
        MAKEMAN,
        MAKETIME)
 VALUES( 
        '#FURNACENO#',
        '#SEQUENCENO#',
        '#CAST_NO#',
        '#SEQUENCEINCAST#',
        '#STATUS#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#GPREQ_ID#',
        '#MATERIAL_NO#',
        '#MATERIAL_NAME#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#DIAMETER#',
        '#LEN_GP_SINGLE#',
        '#CUT_NUM_GP#',
        '#LENGTH_M#',
        '#WEIGHT_GP_ONE#',
        '#WEIGHT_M#',
        '#TOT_WEIGHT_M#',
        '#TOT_MUM_M#',
        '#GPTYPE#',
        '#CASTINGTYPE#',
        '#CUTTYPE#',
        '#SURPLUSFLAG#',
        '#SURPLUS_TYPE#',
        '#REF_ORD_ZZ#',
        '#REF_GPREQ_ID#',
        '#IF_SURPLUS_ALLOTED#',
        '#CIC#',
        '#PIC#',
        '#SIC#',
        '#DIC#',
        '#WIC#',
        '#GIC#',
        '#IF_BATCHED_ZG#',
        '#BATCHED_NUM#',
        '#MEMO#',
        '#MAKEMAN#',
        SYSDATE)
                 ]]>
	</query>


	<query id="FrmSteelMakingPlanDesign.addSteelForOrd" desc="新增炉计划信息">
             <![CDATA[
            
                 ]]>
	</query>

	<query id="FrmSteelMakingPlanDesign.getMaxFurnaceNo" desc="查询最大炉号">
             <![CDATA[
            SELECT ? || LPAD(TO_NUMBER(SUBSTR(NVL(MAX(T.FURNACENO), '0000000000'), 7)) + 1,
                  4,
                  '0') as FURNACENO
  FROM PLN_STEELFORFURNACE T
 WHERE T.FURNACENO LIKE ? || '%'
                 ]]>
	</query>

	<query id="FrmSteelMakingPlanDesign.updateOrderCastAdd" desc="修改订单组炉信息">
             <![CDATA[
            UPDATE PLN_ORDER_CAST_S T
   SET T.PLANED_WT  = TO_NUMBER(?) + NVL(T.PLANED_WT, 0),
       T.PLANED_NUM = TO_NUMBER(?) + NVL(T.PLANED_NUM, 0)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
                 ]]>
	</query>

	<query id="FrmSteelMakingPlanDesign.updateOrderCastMove" desc="修改订单组炉信息">
             <![CDATA[
      UPDATE PLN_ORDER_CAST_S T
   SET T.PLANED_WT  = NVL(T.PLANED_WT, 0) - TO_NUMBER(?),
       T.PLANED_NUM = NVL(T.PLANED_NUM, 0) - TO_NUMBER(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
                 ]]>
	</query>

	<query id="FrmSteelMakingPlanDesign.getMaxCastno" desc="查询最大浇次号">
             <![CDATA[
            SELECT 'JC'||? || LPAD(TO_NUMBER(SUBSTR(NVL(MAX(T.CAST_NO), 'JC0000000000'), 9)) + 1,
                  4,
                  '0') as CAST_NO
  FROM pln_steelforcast T
 WHERE T.CAST_NO LIKE  'JC'||? || '%'
                 ]]>
	</query>

	<query id="FrmSteelMakingPlanDesign.addCastno" desc="新增浇次计划">
             <![CDATA[
 INSERT INTO PLN_STEELFORCAST(
        CAST_NO,
        STATUS,
        FURNACENUMBER,
        TOT_WT,
        TOT_NUM,
        STARTTIME,
        ENDTIME,
        START_GRADECODE,
        END_GRADECODE,
        CCMID,
        MAKEMAN,
        MAKETIME,
        MANFORTOL2,
        TIMEFORTOL2,
        MEMO,
        IF_CONNECT_GRADE,
        WATER_GROUP_CODE,
        ADD_WT_BEGIN,
        ADD_WT_END,
        ADD_WT_CONN_AHEAD,
        ADD_WT_CONN_NEXT)
 VALUES( 
        '#CAST_NO#',
        '#STATUS#',
        '#FURNACENUMBER#',
        '#TOT_WT#',
        '#TOT_NUM#',
        TO_DATE('#STARTTIME#','yyyy-mm-dd hh24:mi:ss'),
        TO_DATE('#ENDTIME#','yyyy-mm-dd hh24:mi:ss'),
        '#START_GRADECODE#',
        '#END_GRADECODE#',
        '#CCMID#',
        '#MAKEMAN#',
        SYSDATE,
        '#MANFORTOL2#',
         TO_DATE('#TIMEFORTOL2#','yyyy-mm-dd hh24:mi:ss'),
        '#MEMO#',
        '#IF_CONNECT_GRADE#',
        '#WATER_GROUP_CODE#',
        '#ADD_WT_BEGIN#',
        '#ADD_WT_END#',
        '#ADD_WT_CONN_AHEAD#',
        '#ADD_WT_CONN_NEXT#')
                 ]]>
	</query>

</queryMap>