<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="自动生成镦拔扩炉计划类">

	<query id="GeneratePlanStoveE.getQcmZgJugdeApply" desc="查询钢管申请判定表">
            <![CDATA[
         SELECT 
       T.JUGDE_APPLY_CODE,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.PROCESS_CODE,
       T.PLINE_CODE,
       T.ACT_COUNT,
       T.ACT_WEIGHT,
       T.ACT_THEORY_WEIGHT,
       T.PRO_ORDER_ID,
       T.FACE_RESULT_CODE,
       T.SPEC_RESULT_CODE,
       T.CHEM_RESULT_CODE,
       T.PHY_RESULT_CODE,
       T.DETECT_RESULT_CODE,
       T.WPRESSURE_RESULT_CODE,
       T.PROCESS_RESULT_CODE,
       T.FACE_RESULT_PATH,
       T.SPEC_RESULT_PATH,
       T.CHEM_RESULT_PATH,
       T.PHY_RESULT_PATH,
       T.DETECT_RESULT_PATH,
       T.WPRESSURE_RESULT_PATH,
       T.PROCESS_RESULT_PATH,
       T.VALIDFLAG,
       T.APPLY_NAME,
       TO_CHAR(T.APPLY_TIME, 'YYYY-MM-DD HH24:MI:SS') APPLY_TIME,
       T.MEMO,
       T.QUALITY_GROUP,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.CRAF_NO,
       T.LOT_NO,
       T.PLINE_NAME,
       T.PRO_ORDER_NO,
       T.TARGET,
       T.PROCESS_STATUS,
       T.MAT_GOWHERE_CODE,
       T.MAT_GOWHERE_NAME,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       T.JUDGE_RESULT_CODE,
       T.JUDGE_RESULT,
       TO_CHAR(T.JUDGE_RESULT_TIME, 'YYYY-MM-DD HH24:MI:SS') JUDGE_RESULT_TIME,
       T.JUDGE_MAKER,
       T.IF_SET_ZY_PLAN
 FROM QCM_ZG_JUGDE_APPLY T
 WHERE 1=1
              ]]>
	</query>

	<query id="GeneratePlanStoveE.getPlnOrderDbkSEntity" desc="查询镦拔扩排产">
            <![CDATA[
          SELECT 
       T.PRO_ORDER_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLAN_GROUP_ID,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.PLN_DIVIDE_ID,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.REQ_BL_ID,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.INWL_ID,
       T.INWL_DESC,
       T.OUTWL_ID,
       T.OUTWL_DESC,
       T.WEIGTH_S,
       T.NUM_S,
       T.GX_PRO_SEQ,
       T.PLAN_USETIME,
       TO_CHAR(T.PLAN_TIME_B, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_B,
       TO_CHAR(T.PLAN_TIME_E, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_E,
       T.EXE_STATUS,
       T.IS_REPAIR_PLN,
       T.REPAIR_TYPE,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTHDISC,
       T.AIMOUTDIAMETER,
       T.AIMWALLTHICK,
       T.AIMLENGTH,
       T.OUTDIAMETER_IN,
       T.WALLTHICK_IN,
       T.LENGTH_IN,
       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
 FROM PLN_ORDER_DBK_S T
 WHERE
T.PRO_PLAN_ID  in (SELECT T1.PRO_PLAN_ID
                          FROM PLN_ORDER_DBK T1,PLN_ORDER_ZG T2
                         WHERE T1.PLAN_GROUP_ID=T2.Plan_Group_Id AND T2.PRO_PLAN_ID=? )
 ORDER BY T.PLAN_TIME_B  
              ]]>
	</query>

	<query id="GeneratePlanStoveE.getPlnZyDbkReadyEntity" 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 1=1
              ]]>
	</query>
	<query id="GeneratePlanStoveE.addPlnZyDbkReadyEntity" desc="新增作业计划">
            <![CDATA[
            INSERT INTO PLN_ZY_DBK_M
  (HEAT_PLAN_NO,
   ZY_BATCH_ID,
   PROD_INDEX,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   READY_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   ZG_HEAT_PLAN_NO,
   HEATNO_LAST,
   ZG_BATCH_NO,
   BATCH_GROUD_NO,
   ISENDGX,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   GRADECODE,
   GRADENAME,
   AIMOUTDIAMETER,
   AIMWALLTHICK,
   AIMLENGTH,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   LEN_CUTHEAD,
   LEN_CUTEND,
   INWL_ID,
   INWL_DESC,
   IN_WT,
   IN_NUM,
   IF_WL_MATCHED,
   OUTWL_ID,
   OUTWL_DESC,
   IF_MONITOR_DBK,
   PRDCR_NO,
   MONITOR_POINT,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   SEC_CRAFT_FILE_NO,
   STATION_ROAD,
   PLANSTATUS,
   IN_WT_REAL,
   IN_NUM_REAL,
   OUT_WT_REAL,
   OUT_NUM_REAL,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   JUGDE_APPLY_CODE,
   QUALITY_GROUP,
   MAT_GOWHERE_CODE,
   STORAGE_NO1,
   STORAGE_NAME1)
VALUES
  ('#HEAT_PLAN_NO#',
   '#ZY_BATCH_ID#',
   '#PROD_INDEX#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#READY_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#ZG_HEAT_PLAN_NO#',
   '#HEATNO_LAST#',
   '#ZG_BATCH_NO#',
   '#BATCH_GROUD_NO#',
   '#ISENDGX#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#AIMOUTDIAMETER#',
   '#AIMWALLTHICK#',
   '#AIMLENGTH#',
   '#OUTDIAMETER_IN#',
   '#WALLTHICK_IN#',
   '#LENGTH_IN#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#LEN_CUTHEAD#',
   '#LEN_CUTEND#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#IN_WT#',
   '#IN_NUM#',
   '#IF_WL_MATCHED#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#IF_MONITOR_DBK#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_FILE_MAN#',
   '#CRAFT_SEQ#',
   '#SEC_CRAFT_FILE_NO#',
   '#STATION_ROAD#',
   '#PLANSTATUS#',
   '#IN_WT_REAL#',
   '#IN_NUM_REAL#',
   '#OUT_WT_REAL#',
   '#OUT_NUM_REAL#',
   '#CREATE_NAME#',
   SYSDATE,
   '#UPDATE_NAME#',
   NULL,
   '#JUGDE_APPLY_CODE#',
   '#QUALITY_GROUP#',
   '#MAT_GOWHERE_CODE#',
   '#STORAGE_NO1#',
   '#STORAGE_NAME1#')
              ]]>
	</query>

	<query id="GeneratePlanStoveE.updatePlnZyDbkReady" desc="修改镦拔扩虚拟炉计划">
            <![CDATA[
                UPDATE PLN_ZY_DBK_READY T
   SET T.REAL_ALLOT_NUM = NVL(T.REAL_ALLOT_NUM, 0) + TO_NUMBER(?),
       T.REAL_ALLOT_WT  = NVL(T.REAL_ALLOT_WT, 0) + TO_NUMBER(?),
       T.IF_DO_HEAT_PLAN='1'
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
   AND T.READY_PLAN_NO = ?
                
              ]]>
	</query>

	<query id="GeneratePlanStoveE.updateMatZcM" desc="修改库存数据">
            <![CDATA[
            update MAT_ZC_M T
   SET T.MAT_STATUS        = ?,
       T.VRP_HEAT_PLAN_NO  = ?,
       T.VRP_PRO_ORDER_ID  = ?,
       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.MAT_NO=?    
              ]]>
	</query>

	<query id="GeneratePlanStoveE.queryMatZcMNo" desc="查询库存数据ID">
            <![CDATA[
           SELECT T.MAT_NO
  FROM MAT_ZC_M T
 WHERE T.JUGDE_APPLY_CODE = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
   AND T.QUALITY_GROUP_ZG = ?
   AND T.MAT_GOWHERE_CODE=?
 ORDER BY T.MAT_NO
              ]]>
	</query>


	<query id="GeneratePlanStoveE.updateQcmZgJugdeApply" desc="修改钢管申请判定表">
            <![CDATA[
   UPDATE QCM_ZG_JUGDE_APPLY T
   SET T.IF_SET_ZY_PLAN = '1'
 WHERE T.JUGDE_APPLY_CODE = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
   AND T.QUALITY_GROUP = ?
              ]]>
	</query>

	<query id="GeneratePlanStoveE.updatePlnOrderDbkSRealBatch" desc="修改排产实际挂料">
            <![CDATA[
UPDATE PLN_ORDER_DBK_S T
   SET T.REAL_BATCH_NUM = NVL(TO_NUMBER(T.REAL_BATCH_NUM), 0) + TO_NUMBER(?),
       T.REAL_BATCH_WT  = NVL(TO_NUMBER(T.REAL_BATCH_WT), 0) + TO_NUMBER(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>

	<query id="GeneratePlanStoveE.getStorageNo" desc="查询仓库号">
            <![CDATA[
SELECT T1.STORAGE_NO,
       (SELECT T2.STORAGE_NAME
          FROM YDM_BS_STORAGE T2
         WHERE T2.STORAGE_NO = T1.STORAGE_NO) STORAGE_NAME
  FROM MAT_ZC_M T, YDM_ZC_BUTTRESS T1
 WHERE T.MAT_NO = T1.MAT_NO
   AND T.JUGDE_APPLY_CODE = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
   AND T.QUALITY_GROUP_ZG = ?
   AND T.MAT_GOWHERE_CODE = ?
 GROUP BY T1.STORAGE_NO
              ]]>
	</query>


</queryMap>