<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="精整利库">
	<query id="FrmEndLibrary.queryMaterial" desc="查询半成品库存管坯物料">
            <![CDATA[
SELECT T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.STOVE_NO,
       T.PRO_ORDER_ID || '/' || T.GX_PLAN_NO ON_PRO_ORDER_ID,
       T.HEAT_PLAN_NO,
       CASE
         WHEN T.PRO_PLAN_ID_NEXT IS NULL THEN
          ''
         ELSE
          T.PRO_PLAN_ID_NEXT || '/' || T.GX_PLAN_NO_NEXT
       END UND_PRO_ORDER_ID,
       T.PRODUCNAME,
       T.GRADENAME,
       T.GRADECODE,
       T.JUDGE_ID,
       T.STEELNAME,
       T.SPEC_NAME,
       T.MODEL_DESC,
       T.STD_NAME,
       T.STD_STYLE_DESC,
       T.NEXT_PROCESS_CDOE,
       T.PLINE_NAME,
       T.PLINE_CODE,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       SUM(T.ACT_LEN) ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       SUM(T.ACT_COUNT) ACT_COUNT,
       SUM(T.ACT_WEIGHT) ACT_WEIGHT,
       SUM(T.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       (SELECT I.BASENAME
          FROM COM_BASE_INFO I
         WHERE I.BASECODE = T.PRODUCT_FLAG) PRODUCT_FLAG,
       (SELECT I.BASENAME
          FROM COM_BASE_INFO I
         WHERE I.BASECODE = T.MAT_STATUS) MAT_STATUS,
       SUM(T.ACT_COUNT) TAKE_COUNT,
       SUM(T.ACT_WEIGHT) TAKE_WEIGHT,
       T.BELONG_NAME,
       T.ORDER_NO || '/' || T.ORDER_SEQ ORDER_SEQ_NO,
       T.PRO_ORDER_NO,
       T.ORD_LN_DLY_PK,
       T.CIC,
       T.PROCESS_CDOE,
       T.JUGDE_APPLY_CODE,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = T.JUDGE_RESULT_CODE) JUDGE_TOLRESULT_CODE,
       T.BELONG_NAME,
       T.HEAT_PLAN_NO_NEXT,T.HEAT_PLAN_NO_OLD,T.ORDER_SEQ_NO  JHH    
  FROM MAT_BC_M T
 WHERE  T.QCM_STAUS = '00'
 -- AND T.LOCK_FLAG='0' AND T.MNG_LOCK_FLAG='0'
   AND (T.JUGDE_APPLY_CODE IS NULL AND T.MAT_STATUS in ('80150101','80150201') OR
       T.JUGDE_APPLY_CODE IS NOT NULL AND T.MAT_STATUS in ('80150102','80150202') --AND
       --T.JUDGE_RESULT_CODE IN ('40740704')
       )
 
              ]]>
	</query>
	<query id="FrmEndLibrary.queryMaterial1" desc="查询半成品库存管坯物料">
            <![CDATA[
SELECT T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.STOVE_NO,
       T.PRO_ORDER_ID || '/' || T.GX_PLAN_NO ON_PRO_ORDER_ID,
       T.HEAT_PLAN_NO,
       CASE
         WHEN T.PRO_PLAN_ID_NEXT IS NULL THEN
          ''
         ELSE
          T.PRO_PLAN_ID_NEXT || '/' || T.GX_PLAN_NO_NEXT
       END UND_PRO_ORDER_ID,
       T.PRODUCNAME,
       T.GRADENAME,
       T.GRADECODE,
       T.JUDGE_ID,
       T.STEELNAME,
       T.SPEC_NAME,
       T.MODEL_DESC,
       T.STD_NAME,
       T.STD_STYLE_DESC,
       T.NEXT_PROCESS_CDOE,
       T.PLINE_NAME,
       T.PLINE_CODE,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
        T.ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       SUM(T.ACT_COUNT) ACT_COUNT,
       SUM(T.ACT_WEIGHT) ACT_WEIGHT,
       SUM(T.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       (SELECT I.BASENAME
          FROM COM_BASE_INFO I
         WHERE I.BASECODE = T.PRODUCT_FLAG) PRODUCT_FLAG,
       (SELECT I.BASENAME
          FROM COM_BASE_INFO I
         WHERE I.BASECODE = T.MAT_STATUS) MAT_STATUS,
       SUM(T.ACT_COUNT) TAKE_COUNT,
       SUM(T.ACT_WEIGHT) TAKE_WEIGHT,
       T.BELONG_NAME,
       T.ORDER_NO || '/' || T.ORDER_SEQ ORDER_SEQ_NO,
       T.PRO_ORDER_NO,
       T.ORD_LN_DLY_PK,
       T.CIC,
       T.PROCESS_CDOE,
       T.JUGDE_APPLY_CODE,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = T.JUDGE_RESULT_CODE) JUDGE_TOLRESULT_CODE,
       T.BELONG_NAME,
       T.HEAT_PLAN_NO_NEXT,T.HEAT_PLAN_NO_OLD,T.ORDER_SEQ_NO  JHH   
  FROM MAT_BC_M T
 WHERE  T.QCM_STAUS = '00'
   --AND T.LOCK_FLAG='0' AND T.MNG_LOCK_FLAG='0'
   AND (T.JUGDE_APPLY_CODE IS NULL AND T.MAT_STATUS in ('80150101','80150201') OR
       T.JUGDE_APPLY_CODE IS NOT NULL AND T.MAT_STATUS in ('80150102','80150202') AND
       T.JUDGE_RESULT_CODE IN ('40740704'))
 
              ]]>
	</query>
	<query id="FrmEndLibrary.UpdateMatGp" desc="修改坯子库存信息">
             <![CDATA[     
    UPDATE MAT_BC_M T
   SET T.MAT_STATUS     = ?,
       T.PRO_PLAN_ID_NEXT = ?,
       T.GX_PLAN_NO_NEXT = ?,
       T.HANGING_FLAG=?,
       T.LOCK_LIKU=?,
       T.NEXT_PROCESS_CDOE=?,
       T.NEXT_PROCESS_DESC=?,
       T.HEAT_PLAN_NO_NEXT=''
             ]]>
	</query>
	<query id="FrmEndLibrary.UpdateMatGpLibrary" desc="精整利库修改库存信息">
             <![CDATA[     
  UPDATE MAT_BC_M T
   SET T.MAT_STATUS        = ?,
       T.PRO_ORDER_ID      = ?,
       T.GX_PLAN_NO        = ?,
       T.LOCK_LIKU         = '2',
       T.NEXT_PROCESS_CDOE = ?,
       T.NEXT_PROCESS_DESC = ?,
       T.PRO_ORDER_NO     = ?,
       T.CIC     = ?,
       T.JUDGE_STD_DES=?,
       T.CRAF_NO=?,T.CRAFT_SEQ=?,T.TARGET=? ,T.PRODUCT_FLAG=?,
           T.ORD_PK = ?,T.ORD_LN_PK = ?,T.ORD_LN_DLY_PK = ?,T.ORDER_NO = ?,T.ORDER_SEQ =?,T.ORDER_SEQ_NO = ?
             ]]>
	</query>
	<query id="FrmEndLibrary.QueryMatGp" desc="查询管坯物料状态">
             <![CDATA[ 
Select *
  from (SELECT T.* ,T1.STORAGE_ATTR,
               T1.STORAGE_ATTR_NAME,
               T1.STORAGE_TYPE_NO,
               T1.STORAGE_TYPE_NAME,
               T1.STORAGE_NO,
               T1.LOCATION_NO,
               T1.LARY_NO,
               T1.LOC_NO,
               T1.MANAGEMENT_NO,
               T1.MANAGEMENT_NAME
          FROM MAT_BC_M T, YDM_BC_BUTTRESS T1
         WHERE T.MAT_NO = T1.MAT_NO
           AND T.QCM_STAUS = '00'    
           --AND T.LOCK_FLAG='0' AND T.MNG_LOCK_FLAG='0' 
           AND T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?
           AND T.BATCH_GROUD_NO = ?
           AND T.MAT_STATUS IN('80150101','80150201')
      
              ]]>
	</query>
	<query id="FrmEndLibrary.QueryMatGpPay" desc="查询管坯物料状态">
		<![CDATA[
SELECT T.* ,T1.STORAGE_ATTR,
               T1.STORAGE_ATTR_NAME,
               T1.STORAGE_TYPE_NO,
               T1.STORAGE_TYPE_NAME,
               T1.STORAGE_NO,
               T1.LOCATION_NO,
               T1.LARY_NO,
               T1.LOC_NO,
               T1.MANAGEMENT_NO,
               T1.MANAGEMENT_NAME
          FROM MAT_BC_M T, YDM_BC_BUTTRESS T1
         WHERE T.MAT_NO = T1.MAT_NO
           AND T.QCM_STAUS = '00'
           --AND T.LOCK_FLAG='0' AND T.MNG_LOCK_FLAG='0'
           AND T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?
           AND T.BATCH_GROUD_NO = ?
           AND T.MAT_STATUS IN('80150101','80150201')


              ]]>
	</query>
	<query id="FrmEndLibrary.getQureyMatTrack" desc="查询管坯物料赋值履历表">
             <![CDATA[
             SELECT T.PRODUCT_FLAG,
       T.MAT_STATUS,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STEELCODE,
       T.STEELNAME,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       --T.ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       SUM(T.ACT_COUNT) ACT_COUNT,
       SUM(T.ACT_WEIGHT) ACT_WEIGHT,
       SUM(T.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       T.PRO_ORDER_NO,
       T.PRO_ORDER_ID,
       T.ORD_PK        OLD_ORD_PK,
       T.ORD_LN_PK     OLD_ORD_LN_PK,
       T.ORD_LN_DLY_PK OLD_ORD_LN_DLY_PK,
       T.ORDER_NO      OLD_ORDER_NO,
       T.ORDER_SEQ     OLD_ORDER_SEQ,
       T.ORDER_SEQ_NO  OLD_ORDER_SEQ_NO,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.PROCESS_CDOE,
       T.GRADECODE,
       T.GRADENAME,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       T.HEAT_PLAN_NO,
       T.GX_PLAN_NO,
       T.PRO_ORDER_ID,
       T.CIC,
       T.HEAT_PLAN_NO_OLD,
       T.TARGET,
       S.STORAGE_NO,
         (SELECT S2.OUT_REPOSITORY FROM COM_BASE_PLINE S2 WHERE S2.PLINE_CODE = T.PLINE_CODE)OUT_REPOSITORY
  FROM MAT_BC_M T
  LEFT JOIN YDM_BC_BUTTRESS S
    ON T.MAT_NO = S.MAT_NO
 WHERE T.QCM_STAUS = '00'
   AND T.JUDGE_STOVE_NO = ?
   AND T.BATCH_NO = ?
   AND T.BATCH_GROUD_NO = ?
              ]]>
	</query>
	<query id="FrmEndLibrary.addMatBcTrack" desc="新增利库，脱单日志表">
             <![CDATA[  
               INSERT INTO MAT_BC_TRACK(
        RESUME_SEQ,
        EVENT_ID,
        EVENT_DESC,
        FORM_NAME,
        CALL_FUNC_CODING,
        KEYVALUE_1,
        KEYVALUE_1_DESC,
        KEYVALUE_2,
        KEYVALUE_2_DESC2,
        KEYVALUE_3,
        KEYVALUE_3_DESC3,
        KEYVALUE_4,
        KEYVALUE_4_DESC4,
        KEYVALUE_5,
        KEYVALUE_5_DESC5,
        KEYVALUE_6,
        KEYVALUE_6_DESC6,
        KEYVALUE_7,
        KEYVALUE_7_DESC7,
        MAT_NO,
        PRODUCT_FLAG,
        MAT_STATUS,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STEELCODE,
        STEELNAME,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        ACT_THEORY_WEIGHT,
        PRO_ORDER_NO,
        PRO_ORDER_ID,
        PRO_ORDER_NO1,
        PRO_ORDER_ID1,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        ORDER_NO,
        ORDER_SEQ,
        ORDER_SEQ_NO,
        OLD_ORD_PK,
        OLD_ORD_LN_PK,
        OLD_ORD_LN_DLY_PK,
        OLD_ORDER_NO,
        OLD_ORDER_SEQ,
        OLD_ORDER_SEQ_NO,
        BELONG_CODE,
        BELONG_NAME,
        MEMO,
        CREATE_NAME,
        CREATE_TIME,
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        MANAGEMENT_NO,
        MANAGEMENT_NAME,
        PROCESS_CDOE,
        GRADECODE,
        GRADENAME)
 VALUES( 
        '#RESUME_SEQ#',
        '#EVENT_ID#',
        '#EVENT_DESC#',
        '#FORM_NAME#',
        '#CALL_FUNC_CODING#',
        '#KEYVALUE1#',
        '#KEYVALUE1_DESC#',
        '#KEYVALUE2#',
        '#KEYVALUE2_DESC2#',
        '#KEYVALUE3#',
        '#KEYVALUE3_DESC3#',
        '#KEYVALUE4#',
        '#KEYVALUE4_DESC4#',
        '#KEYVALUE5#',
        '#KEYVALUE5_DESC5#',
        '#KEYVALUE6#',
        '#KEYVALUE6_DESC6#',
        '#KEYVALUE7#',
        '#KEYVALUE7_DESC7#',
        '#MAT_NO#',
        '#PRODUCT_FLAG#',
        '#MAT_STATUS#',
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#MATERIAL_NO#',
        '#MATERIAL_NAME#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#',
        '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#ACT_LEN#',
        '#ACT_LEN_MIN#',
        '#ACT_LEN_MAX#',
        '#ACT_COUNT#',
        '#ACT_WEIGHT#',
        '#ACT_THEORY_WEIGHT#',
        '#PRO_ORDER_NO#',
        '#PRO_ORDER_ID#',
        '#PRO_ORDER_NO1#',
        '#PRO_ORDER_ID1#',
        '#ORD_PK#',
        '#ORD_LN_PK#',
        '#ORD_LN_DLY_PK#',
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#ORDER_SEQ_NO#',
        '#OLD_ORD_PK#',
        '#OLD_ORD_LN_PK#',
        '#OLD_ORD_LN_DLY_PK#',
        '#OLD_ORDER_NO#',
        '#OLD_ORDER_SEQ#',
        '#OLD_ORDER_SEQ_NO#',
        '#BELONG_CODE#',
        '#BELONG_NAME#',
        '#MEMO#',
        '#CREATE_NAME#',
        TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'),
        '#DEPARTMENT_CODE#',
        '#DEPARTMENT_DESC#',
        '#MANAGEMENT_NO#',
        '#MANAGEMENT_NAME#',
        '#PROCESS_CDOE#',
        '#GRADECODE#',
        '#GRADENAME#')
              ]]>
	</query>
	
	<query id = "FrmEndLibrary.addZgOrderCic" desc = "新增扎管订单关联表">
	 <![CDATA[
	 INTO ZG_ORD_STD_CIC
     (STOVE_NO, PRO_ORDER_NO)
       VALUES
      (?, ?)
	 ]]>
	</query>
	<query id="FrmEndLibrary.queryPlanOrderD" desc="查询轧管排产(界面)">
             <![CDATA[
   SELECT * FROM (SELECT 
      (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,
                        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
         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) GRADE_ALL,
       D.TRANSIT_TYP,
       D.DELVRY_ADDR,
       D.VALIDFLAG,
       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,
       NVL(T.LEN_CUTHEAD,0) LEN_CUTHEAD,
       NVL(T.LEN_CUTEND,0) 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,
       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,
       T1.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,
       NVL((SELECT SUM(M.PREDICT_TON)
             FROM MIL_PLAN M
            WHERE M.PRO_PLAN_ID = T.PRO_PLAN_ID
              AND M.GX_PLAN_NO = T.GX_PLAN_NO
              AND SUBSTR(M.JUDGE_STOVE_NO, -2) = '01'),
           0) EXPECT_WT,
       NVL((SELECT SUM(M.PREDICT_PIECE)
             FROM MIL_PLAN M
            WHERE M.PRO_PLAN_ID = T.PRO_PLAN_ID
              AND M.GX_PLAN_NO = T.GX_PLAN_NO
              AND SUBSTR(M.JUDGE_STOVE_NO, -2) = '01'),
           0) EXPECT_NUM,
           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_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_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_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
  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,
               Q4.ABRVITION 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,
               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     
          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,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 T.IS_PLAN_OK='1'
   AND T.EXE_STATUS='0'
   AND T.GPREQ_ID IS NULL
               ]]>
	</query>
	<query id="FrmEndLibrary.queryMatWeigth" desc="查询库存吨数">
		<![CDATA[
		SELECT NVL(SUM(T1.ACT_WEIGHT), 0) ACT_WEIGHT
  FROM (SELECT T.ACT_WEIGHT
          FROM MAT_BC_M T
          WHERE T.MAT_STATUS = '80150102'
           AND T.HANGING_FLAG = '0'
           AND T.QCM_STAUS = '00'
           AND T.JUDGE_STOVE_NO = ?
           AND T.BATCH_NO = ?
           AND T.BATCH_GROUD_NO = ?
           AND T.MATERIAL_NO = ?
           --AND T.LOCK_FLAG='0' AND T.MNG_LOCK_FLAG='0'
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM <= ?
		]]>
	</query>
	<query id="FrmEndLibrary.queryBaseMaterialEPl" desc="查询Bom投入物料镦拔扩">
		<![CDATA[
		 SELECT T.E_IN_MATERIAL_DESC IN_MATERIAL_DESC,
		 T.E_OUT_MATERIAL_DESC OUT_MATERIAL_DESC,
		 T.E_OUT_MATERIAL_NO OUT_MATERIAL_NO,
		 T.MATERIAL_NO,
		 T.MATERIAL_DESC,T.SPEC_CODE_C,
		 T.SPEC_NAME_C,T.BOM,T.E_IN_MATERIAL_NO IN_MATERIAL_NO,
		 T.WHOLE_BACKLOG,T.GRADENAME
   FROM SLM_ORD_DESIGN_BOM T,
        CRAFT_ORD_LINE_BOM T1,
        CRAFT_ORD_DESIGN   T2,
        PLN_SALEORD        T3
  WHERE T.BOM = T1.BOM
    AND T1.DESGIN_KEY = T2.DESGIN_KEY
    AND T2.ORD_LN_PK = T3.ORD_LN_PK
    AND T2.VALIDFLAG != '0'
    AND T3.ORD_LN_DLY_PK = ?
    AND T.MSC_PLINE=?
    AND T2.CRAFT_SEQ=?
		]]>
	</query>
	<query id="FrmEndLibrary.queryBaseMaterialFPl" desc="查询Bom投入物料热处理">
		<![CDATA[
		 SELECT T.F_IN_MATERIAL_DESC IN_MATERIAL_DESC,
		 T.F_OUT_MATERIAL_DESC OUT_MATERIAL_DESC,
		 T.F_OUT_MATERIAL_NO OUT_MATERIAL_NO,
		 T.MATERIAL_NO,
		 T.MATERIAL_DESC,T.SPEC_CODE_C,
		 T.SPEC_NAME_C,T.BOM,T.F_IN_MATERIAL_NO IN_MATERIAL_NO,
		 T.WHOLE_BACKLOG,T.GRADENAME
   FROM SLM_ORD_DESIGN_BOM T,
        CRAFT_ORD_LINE_BOM T1,
        CRAFT_ORD_DESIGN   T2,
        PLN_SALEORD        T3
  WHERE T.BOM = T1.BOM
    AND T1.DESGIN_KEY = T2.DESGIN_KEY
    AND T2.ORD_LN_PK = T3.ORD_LN_PK
    AND T2.VALIDFLAG != '0'
    AND T3.ORD_LN_DLY_PK = ?
    AND T.MSC_PLINE=?
    AND T2.CRAFT_SEQ=?
		]]>
	</query>
	<query id="FrmEndLibrary.queryBaseMaterialGPl" desc="查询Bom投入物料加工线">
		<![CDATA[
		 SELECT T.I_IN_MATERIAL_DESC IN_MATERIAL_DESC,
		 T.I_OUT_MATERIAL_DESC OUT_MATERIAL_DESC,
		 T.I_OUT_MATERIAL_NO OUT_MATERIAL_NO,
		 T.MATERIAL_NO,
		 T.MATERIAL_DESC,T.SPEC_CODE_C,
		 T.SPEC_NAME_C,T.BOM,T.I_IN_MATERIAL_NO IN_MATERIAL_NO,
		 T.WHOLE_BACKLOG,T.GRADENAME
   FROM SLM_ORD_DESIGN_BOM T,
        CRAFT_ORD_LINE_BOM T1,
        CRAFT_ORD_DESIGN   T2,
        PLN_SALEORD        T3
  WHERE T.BOM = T1.BOM
    AND T1.DESGIN_KEY = T2.DESGIN_KEY
    AND T2.ORD_LN_PK = T3.ORD_LN_PK
     AND T2.VALIDFLAG != '0'
    AND T3.ORD_LN_DLY_PK = ?
    AND T.MSC_PLINE=?
    AND T2.CRAFT_SEQ=?
		]]>
	</query>
	<query id="FrmEndLibrary.queryBaseMaterialDPl" desc="查询Bom投入物料轧管">
		<![CDATA[
		 SELECT T.D_IN_MATERIAL_DESC IN_MATERIAL_DESC,
		 T.D_OUT_MATERIAL_DESC OUT_MATERIAL_DESC,
		 T.D_OUT_MATERIAL_NO OUT_MATERIAL_NO,
		 T.MATERIAL_NO,
		 T.MATERIAL_DESC,T.SPEC_CODE_R SPEC_CODE_C,
		 T.SPEC_NAME_R SPEC_NAME_C,T.BOM,T.D_IN_MATERIAL_NO IN_MATERIAL_NO,
		 T.WHOLE_BACKLOG,T.GRADENAME
   FROM SLM_ORD_DESIGN_BOM T,
        CRAFT_ORD_LINE_BOM T1,
        CRAFT_ORD_DESIGN   T2,
        PLN_SALEORD        T3
  WHERE T.BOM = T1.BOM
    AND T1.DESGIN_KEY = T2.DESGIN_KEY
    AND T2.ORD_LN_PK = T3.ORD_LN_PK
    AND T2.VALIDFLAG != '0'
    AND T3.ORD_LN_DLY_PK = ?
    AND T.MSC_PLINE=?
    AND T2.CRAFT_SEQ=?
		]]>
	</query>
	<query id="FrmEndLibrary.updateNext" desc="修改库存下工序订单,炉计划Id">
		<![CDATA[
		DECLARE
BEGIN
  FOR MYROW IN (SELECT MAT_NO
                  FROM (SELECT T.MAT_NO
                          FROM MAT_BC_M T
                         WHERE T.JUDGE_STOVE_NO = ?
                           AND T.BATCH_NO = ?
                           AND T.BATCH_GROUD_NO = ?
                           AND T.HEAT_PLAN_NO_NEXT IS NULL
                           AND T.NEXT_PROCESS_CDOE = ?
                           AND T.QCM_STAUS = '00'
                           --AND T.LOCK_FLAG='0' AND T.MNG_LOCK_FLAG='0'
                         ORDER BY T.MAT_NO ASC)
                 WHERE ROWNUM <= ?) LOOP
    UPDATE MAT_BC_M T
       SET T.PRO_PLAN_ID_NEXT  = ?,
           T.GX_PLAN_NO_NEXT   = ?,
           T.HEAT_PLAN_NO_NEXT = ?
     WHERE T.MAT_NO = MYROW.MAT_NO;
  END LOOP;
END;
		]]>
	</query>
	<query id="FrmEndLibrary.queryPlanOrderE" desc="查询镦拔扩排产(界面)">
             <![CDATA[  
        SELECT CASE
         WHEN TO_NUMBER(NVL(DBK.WEIGTH_S, 0)) -
              TO_NUMBER(NVL(DBK.BATCHED_WT, 0)) < 0 THEN
          0
         ELSE
          TO_NUMBER(NVL(DBK.WEIGTH_S, 0)) - TO_NUMBER(NVL(DBK.BATCHED_WT, 0))
       END REALL_WT,
       DBK.*
  FROM (SELECT 
                   (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,
                                               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
                                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) GRADE_ALL,
       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,
       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.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,
      (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 AND M.IF_FLAG='0') 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 AND M.IF_FLAG='0') BATCHED_NUM,
      (SELECT SUM(NVL(M.PLAN_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_Batch_Wt,
      (SELECT SUM(NVL(M.PLAN_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_Batch_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
      
  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,
       PLN_SALEORD S
 WHERE T.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK(+)
   AND T.ORD_LN_DLY_PK = S.ORD_LN_DLY_PK
   AND (T.IS_REPAIR_PLN IS NULL OR T.IS_REPAIR_PLN = '0')
   AND T.EXE_STATUS='0'
               ]]>
	</query>
	<query id = "FrmEndLibrary.queryelments" desc ="根据炉号查询成分信息">
	<![CDATA[  
	select assayno, stove_no, judge_stove_no, batch_no, assaytype, flag, c, si, mn,
      p, s, ni, cr, cu, asn, ti, v, mo, b, w, al, zn, pb, sn, ca, la, sb, ce, se, 
      mg, nb, cd, bi, n, h, o, fe, alt, als, alins, bs, bn, mgo, sio2, al2o3, tfeo, 
      fe2o3, h2o, caf2, p2o5, tfe, cr2o3, tio2, mno, v2o5, feo, cao, sample_id, xh, 
      machine, create_name, create_time, update_name, update_time, delete_name, delete_time, 
      validflag, memo, sample_no, pline_code, judge_flag, zr, lg_judge_flag, co, sample_type, mat_no, head_mat_no, bar_code, 
      ta from qcm_jhy_elements where stove_no = ?  and assaytype = 'A'
	]]>
	<query id = "FrmEndLibrary.queryeStdCic" desc = "根据和同行主键查询成分标准">
	<![CDATA[
		 SELECT C.*
	   FROM CRAFT_ORD_DESIGN T
	   LEFT JOIN CRAFT_ORD_DESIGN_APPOINT M1
	     ON M1.ORD_LN_PK = T.ORD_LN_PK
	   LEFT JOIN CRAFT_ORD_DESIGN_STS_TKLG K
	     ON K.DESGIN_KEY = T.DESGIN_KEY
	   LEFT JOIN   Craft_Ord_Design_Std_Cic C
	   ON T.DESGIN_KEY = C.DESGIN_KEY
	    AND K.VALIDFLAG = '1'
	  WHERE T.DESGIN_KEY IS NOT NULL
	    AND T.VALIDFLAG != '0'
	    AND K.DESIGN_STS = 'S'
	    AND T.ORD_LN_PK = ?
	]]>
	</query>
	</query>
	<query id="FrmEndLibrary.queryPlanOrderG" desc="查询加工线排产(界面)">
             <![CDATA[  
   SELECT CASE
         WHEN TO_NUMBER(NVL(JGX.WEIGTH_S, 0)) -
              TO_NUMBER(NVL(JGX.BATCHED_WT, 0)) < 0 THEN
          0
         ELSE
          TO_NUMBER(NVL(JGX.WEIGTH_S, 0)) - TO_NUMBER(NVL(JGX.BATCHED_WT, 0))
       END REALL_WT,
       JGX.*
  FROM (SELECT 
                 (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,
                                               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
                                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) GRADE_ALL,
       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.PRDCR_ADVC_DAY,
       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.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,
       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,
       T1.GROUP_JGX,
       T.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, -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, -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.DECISION,
       M1.BATCHED_WT,
       M1.BATCHED_NUM,
       M3.FINISHWEIGHT,
       M3.FINISHNUM,
       m2.Real_Batch_Wt,
       m2.Real_Batch_Num,
       m3.Real_Indouble_Wt,
       m3.Real_Indouble_Num,
       (SELECT SP.ORDER_NO||'/'||SP.ORDER_SEQ FROM PLN_PORDER_BL_REQ BL,PLN_SALEORD_PROC SP WHERE BL.REQ_BL_ID=T.ORD_LN_DLY_PK AND SP.ORD_LN_DLY_PK=BL.ORD_LN_DLY_PK) ORDER_SEQ_CP
  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,(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'
         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
 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.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.EXE_STATUS='0'
               ]]>
	</query>
	<query id="FrmEndLibrary.queryPlanOrderF" desc="查询热处理排产(界面)">
             <![CDATA[  
    SELECT CASE
         WHEN TO_NUMBER(NVL(RCL.WEIGTH_S, 0)) -
              TO_NUMBER(NVL(RCL.BATCHED_WT, 0)) < 0 THEN
          0
         ELSE
          TO_NUMBER(NVL(RCL.WEIGTH_S, 0)) - TO_NUMBER(NVL(RCL.BATCHED_WT, 0))
       END REALL_WT,
       RCL.*
  FROM (SELECT 
                   (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,
                                               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
                                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) GRADE_ALL,
       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,
       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,
       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,
       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,
       T3.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,
       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,
       T.PRIORITY_MEMO,
          T.DECISION,t.WEIGTH_S_MIN,
       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
  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
          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,
       PLN_GX_RCL_M T3,(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.IS_REPAIR_PLN IS NULL OR T.IS_REPAIR_PLN='0')  
   AND T.EXE_STATUS='0'
    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="FrmEndLibrary.UpdateZgLk" 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(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?          
              ]]>
	</query>
	<query id="FrmEndLibrary.UpdateDbkLk" desc="修改镦拔扩利库量">
             <![CDATA[  
     UPDATE PLN_ORDER_DBK_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(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?        
              ]]>
	</query>
	<query id="FrmEndLibrary.UpdateRclLk" desc="修改热处理利库量">
             <![CDATA[      
UPDATE PLN_ORDER_RCL_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(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?      
              ]]>
	</query>
	<query id="FrmEndLibrary.UpdateJgxLk" desc="修改加工线利库量">
             <![CDATA[  
         UPDATE PLN_ORDER_JGX_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(?)
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?    
              ]]>
	</query>
	<query id="FrmEndLibrary.UpdateSentence" desc="改判修改库存信息">
             <![CDATA[   
           UPDATE MAT_BC_M T
   SET T.MATERIAL_NO    = ?,
       T.MATERIAL_NAME  = ?,
       T.PRODUCCODE     = ?,
       T.PRODUCNAME     = ?,
       T.STEELCODE      = ?,
       T.STEELNAME      = ?,
       T.SPEC_CODE      = ?,
       T.SPEC_NAME      = ?,
       T.MODEL_CODE     = ?,
       T.MODEL_DESC     = ?,
       T.STD_STYLE      = ?,
       T.STD_STYLE_DESC = ?,
       T.JUDGE_ID       = ?,t.ACT_DIMATER=?,t.ACT_HEIGHT=?,
       T.STD_CODE = ?,
       T.STD_NAME = ?
 WHERE T.MAT_NO = ?  AND T.PROCESS_CDOE=?  
             ]]>
	</query>
	<query id="FrmEndLibrary.AddSentence" desc="新增改判记录表">
             <![CDATA[   
           INSERT INTO QCM_BC_JUDGE_CHANGE
  (JUDGE_ID,
   JUDGE_STOVE_NO_OLD,
   BATCH_NO_OLD,
   BATCH_GROUD_NO_OLD,
   ACT_COUNT,
   ACT_WEIGHT,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   MATERIAL_NO_OLD,
   MATERIAL_NAME_OLD,
   PRODUCCODE_OLD,
   PRODUCNAME_OLD,
   STEELCODE_OLD,
   STEELNAME_OLD,
   SPEC_CODE_OLD,
   SPEC_NAME_OLD,
   MODEL_CODE_OLD,
   MODEL_DESC_OLD,
   STD_STYLE_OLD,
   STD_STYLE_DESC_OLD,
   MATERIAL_NO,
   MATERIAL_NAME,
   PRODUCCODE,
   PRODUCNAME,
   STEELCODE,
   STEELNAME,
   SPEC_CODE,
   SPEC_NAME,
   MODEL_CODE,
   MODEL_DESC,
   STD_STYLE,
   STD_STYLE_DESC,
   CREATE_NAME,
   CREATE_TIME,
   AGREE_FLAG,
   CREATE_MEMO,
   BELONG_CODE,
   BELONG_NAME,
   PROCESS_CDOE)
VALUES
  ('#JUDGE_ID#',
   '#JUDGE_STOVE_NO_OLD#',
   '#BATCH_NO_OLD#',
   '#BATCH_GROUD_NO_OLD#',
   '#ACT_COUNT#',
   '#ACT_WEIGHT#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#BATCH_GROUD_NO#',
   '#MATERIAL_NO_OLD#',
   '#MATERIAL_NAME_OLD#',
   '#PRODUCCODE_OLD#',
   '#PRODUCNAME_OLD#',
   '#STEELCODE_OLD#',
   '#STEELNAME_OLD#',
   '#SPEC_CODE_OLD#',
   '#SPEC_NAME_OLD#',
   '#MODEL_CODE_OLD#',
   '#MODEL_DESC_OLD#',
   '#STD_STYLE_OLD#',
   '#STD_STYLE_DESC_OLD#',
   '#MATERIAL_NO#',
   '#MATERIAL_NAME#',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#SPEC_CODE#',
   '#SPEC_NAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#STD_STYLE#',
   '#STD_STYLE_DESC#',
   '#CREATE_NAME#',
   SYSDATE,
   '2',
   '#CREATE_MEMO#',
   '#BELONG_CODE#',
   '#BELONG_NAME#',
   '#PROCESS_CDOE#')           
              ]]>
	</query>

	<query id="FrmEndLibrary.QueryMaxId" desc="查询最大改判ID">
             <![CDATA[   
          SELECT ? || LPAD(SUBSTR(NVL(MAX(T.JUDGE_ID), '00000'), -5, 5) + 1, 5, '0') AS JUDGE_ID
  FROM QCM_BC_JUDGE_CHANGE T
 WHERE TO_CHAR(T.CREATE_TIME, 'YYYYMMDD') = ?
             
              ]]>
	</query>
	<query id="FrmEndLibrary.queryOutList" desc="查询出库单号">
	<![CDATA[
       SELECT (SELECT S.MEMO FROM COM_BASE_INFO S WHERE S.BASECODE = ?) ||
       OUTSTOCK_DOC OUTSTOCK_DOC
  FROM (SELECT TO_CHAR(SYSDATE, 'YYMMDD') ||
               LPAD(NVL(MAX(SUBSTR(T.OUTSTOCK_DOC, 9)), 0) + 1, 5, 0) OUTSTOCK_DOC
          FROM YDM_BC_OUTLIST T
         WHERE OUTSTOCK_SQE LIKE
               (SELECT S.MEMO FROM COM_BASE_INFO S WHERE S.BASECODE = ?) ||
               TO_CHAR(SYSDATE, 'YYMMDD') || '%')
	]]>
	</query>
	<query id="FrmEndLibrary.queryOut" desc="查询出库流水号">
	<![CDATA[
          SELECT ? ||
         LPAD(SUBSTR(NVL(MAX(T.OUTSTOCK_SQE), '0000'), -4, 4) + 1, 4, '0') AS OUTSTOCK_SQE
    FROM YDM_BC_OUTLIST T
   WHERE TO_CHAR(T.CREATE_TIME,'YYYY-MM-DD') = TO_CHAR(SYSDATE, 'YYYY-MM-DD')
     AND T.OUTSTOCK_DOC = ?
	]]>
	</query>
	<query id="FrmEndLibrary.AddOutList" desc="新增出库记录">
		<![CDATA[
 INSERT INTO YDM_BC_OUTLIST(
        OUTSTOCK_SQE,
        OUTSTOCK_PLAN_NO,
        OUTSTOCK_DOC,
        OUTSTOCK_TYPE_CODE,
        OUTSTOCK_TYPE_NAME,
        ICCAR_NO,
        VEHICLE_NO,
        MAT_NO,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        STD_CODE,
        STD_NAME,
        GRADECODE,
        GRADENAME,
        STEELCODE,
        STEELNAME,
        STD_STYLE,
        STD_STYLE_DESC,
        SPEC_CODE,
        SPEC_NAME,
        MODEL_CODE,
        MODEL_DESC,
        PRO_ORDER_NO,
        PLINE_CODE,
        PLINE_NAME,
        ACT_DIMATER,
        ACT_HEIGHT,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_COUNT,
        ACT_WEIGHT,
        ACT_THEORY_WEIGHT,
        BELONG_CODE,
        BELONG_NAME,
        BAR_CODE,
        STORAGE_NO,
        LOCATION_NO,
        LARY_NO,
        LOC_NO,
        STORAGE_ATTR,
        STORAGE_ATTR_NAME,
        STORAGE_TYPE_NO,
        STORAGE_TYPE_NAME,
        MANAGEMENT_NO,
        MANAGEMENT_NAME,  
        TAR_REC_FLAG,
        RPO_TIME,
        PRO_BC,
        PRO_BZ,
        INSTOCK_TIME,
        IN_BC,
        IN_BZ,
        OUTSTOCK_TIME,
        OUT_BC,
        OUT_BZ,
        MEMO,
        HAND_FLAG,
        VALIDFLAG,
        CREATE_NAME,
        CREATE_TIME,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        ORDER_NO,
        ORDER_SEQ,
        DELIVERY_NO,
        PRODUCT_FLAG,
        MAT_STATUS,
        JUDGE_STD_NAME,
        JUDGE_STD_CODE,
        PONDER_NO,
        PONDER_GROSS_WT,
        BAL_YEAR_MONTH,
        LOAD_PLINE_CODE,
        LOAD_PLINE_NAME)
 VALUES( 
        '#OUTSTOCK_SQE#',
        '#OUTSTOCK_PLAN_NO#',
        '#OUTSTOCK_DOC#',
        '#OUTSTOCK_TYPE_CODE#',
        '#OUTSTOCK_TYPE_NAME#',
        '#ICCAR_NO#',
        '#VEHICLE_NO#',
        '#MAT_NO#',
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#MATERIAL_NO#',
        '#MATERIAL_NAME#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#',
        '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#PRO_ORDER_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#ACT_DIMATER#',
        '#ACT_HEIGHT#',
        '#ACT_LEN#',
        '#ACT_LEN_MIN#',
        '#ACT_LEN_MAX#',
        '#ACT_COUNT#',
        '#ACT_WEIGHT#',
        '#ACT_THEORY_WEIGHT#',
        '#BELONG_CODE#',
        '#BELONG_NAME#',
        '#BAR_CODE#',
        '#STORAGE_NO#',
        '#LOCATION_NO#',
        '#LARY_NO#',
        '#LOC_NO#',
        '#STORAGE_ATTR#',
        '#STORAGE_ATTR_NAME#',
        '#STORAGE_TYPE_NO#',
        '#STORAGE_TYPE_NAME#',
        '#MANAGEMENT_NO#',
        '#MANAGEMENT_NAME#',
        '1',
        TO_DATE('#RPO_TIME#','YYYY-MM-DD HH24:MI:SS'),
        '#PRO_BC#',
        '#PRO_BZ#',
        TO_DATE('#INSTOCK_TIME#','YYYY-MM-DD HH24:MI:SS'),
        '#IN_BC#',
        '#IN_BZ#',
        TO_DATE('#OUTSTOCK_TIME#','YYYY-MM-DD HH24:MI:SS'),
        '#OUT_BC#',
        '#OUT_BZ#',
        '#MEMO#',
        '0',
        '1',
        '#CREATE_NAME#',
        TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'), 
        '#ORD_PK#',
        '#ORD_LN_PK#',
        '#ORD_LN_DLY_PK#',
        '#DEPARTMENT_CODE#',
        '#DEPARTMENT_DESC#',
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#DELIVERY_NO#',
        '#PRODUCT_FLAG#',
        '#MAT_STATUS#',
        '#JUDGE_STD_NAME#',
        '#JUDGE_STD_CODE#',
        '#PONDER_NO#',
        '#PONDER_GROSS_WT#',
        TO_CHAR(SYSDATE,'YYYYMM'),
        '#LOAD_PLINE_CODE#',
        '#LOAD_PLINE_NAME#')
		]]>
	</query>
	<query id="FrmEndLibrary.AddInList" desc="新增入库记录">
		<![CDATA[
		DECLARE
  V_INSTOCK_DOC YDM_BC_INLIST.INSTOCK_DOC%TYPE := NULL; --入库单号
  V_INSTOCK_SQE YDM_BC_INLIST.INSTOCK_SQE%TYPE := NULL; --入库流水
  V_MEMO   COM_BASE_INFO.MEMO%TYPE := NULL;
  V_OCOUNT NUMBER := 1;
  V_TIME   YDM_BC_INLIST.CREATE_TIME%TYPE := SYSDATE;
BEGIN
  --生成入库单号
  SELECT MEMO INTO V_MEMO FROM COM_BASE_INFO WHERE BASECODE = '800706';
  SELECT V_MEMO || TO_CHAR(SYSDATE, 'YYMMDD') ||
         LPAD(NVL(MAX(SUBSTR(INSTOCK_DOC, 9)), 0) + 1, 5, 0) INSTOCK_DOC
    INTO V_INSTOCK_DOC
    FROM YDM_BC_INLIST T
   WHERE T.INSTOCK_TYPE_CODE = '800706'
     AND TRUNC(T.CREATE_TIME) = TRUNC(SYSDATE);
  FOR MYROW IN (SELECT T.*,
                       S.STORAGE_NO,
                       S.LOCATION_NO,
                       S.STORAGE_ATTR,
                       S.STORAGE_ATTR_NAME,
                       S.STORAGE_TYPE_NO,
                       S.STORAGE_TYPE_NAME,
                       S.LARY_NO,
                       S.LOC_NO,
                       S.MANAGEMENT_NO,
                       S.MANAGEMENT_NAME,
                       S.DEPARTMENT_CODE,
                       S.DEPARTMENT_DESC
                  FROM MAT_BC_M T, YDM_BC_BUTTRESS S
                 WHERE T.MAT_NO = S.MAT_NO
                   AND T.JUDGE_ID = ?) LOOP
    V_INSTOCK_SQE := V_INSTOCK_DOC || LPAD(V_OCOUNT, 4, 0);
    INSERT INTO YDM_BC_INLIST
      (INSTOCK_SQE,
       INSTOCK_DOC,
       INSTOCK_TYPE_CODE,
       INSTOCK_TYPE_NAME,
       MAT_NO,
       LOT_NO,
       STOVE_NO,
       JUDGE_STOVE_NO,
       BATCH_NO,
       BATCH_GROUD_NO,
       MATERIAL_NO,
       MATERIAL_NAME,
       PRODUCCODE,
       PRODUCNAME,
       STD_CODE,
       STD_NAME,
       GRADECODE,
       GRADENAME,
       STEELCODE,
       STEELNAME,
       STD_STYLE,
       STD_STYLE_DESC,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC,
       PRO_ORDER_NO,
       PLINE_CODE,
       PLINE_NAME,
       ACT_DIMATER,
       ACT_HEIGHT,
       ACT_LEN,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       ACT_COUNT,
       ACT_WEIGHT,
       ACT_THEORY_WEIGHT,
       BELONG_CODE,
       BELONG_NAME,
       STORAGE_NO,
       LOCATION_NO,
       LARY_NO,
       LOC_NO,
       STORAGE_ATTR,
       STORAGE_ATTR_NAME,
       STORAGE_TYPE_NO,
       STORAGE_TYPE_NAME,
       MANAGEMENT_NO,
       MANAGEMENT_NAME,
       RPO_TIME,
       INSTOCK_TIME,
       HAND_FLAG,
       VALIDFLAG,
       CREATE_NAME,
       CREATE_TIME,
       PRODUCT_FLAG,
       MAT_STATUS,
       JUDGE_STD_NAME,
       JUDGE_STD_CODE,
       IN_TIME_F,
       SOURE_CODE,
       SOURE_NAME,
       MAT_ORIGIN_CODE,
       MAT_ORIGIN_NAME,
       AFFIRM_LOG,
       QCM_STAUS,
       PRO_PLAN_ID,
       GX_PLAN_NO)
    VALUES
      (V_INSTOCK_SQE,
       V_INSTOCK_DOC,
       '800706',
       '改判入库',
       MYROW.MAT_NO,
       MYROW.LOT_NO,
       MYROW.STOVE_NO,
       MYROW.JUDGE_STOVE_NO,
       MYROW.BATCH_NO,
       MYROW.BATCH_GROUD_NO,
       MYROW.MATERIAL_NO,
       MYROW.MATERIAL_NAME,
       MYROW.PRODUCCODE,
       MYROW.PRODUCNAME,
       MYROW.STD_CODE,
       MYROW.STD_NAME,
       MYROW.GRADECODE,
       MYROW.GRADENAME,
       MYROW.STEELCODE,
       MYROW.STEELNAME,
       MYROW.STD_STYLE,
       MYROW.STD_STYLE_DESC,
       MYROW.SPEC_CODE,
       MYROW.SPEC_NAME,
       MYROW.MODEL_CODE,
       MYROW.MODEL_DESC,
       MYROW.PRO_ORDER_NO,
       MYROW.PLINE_CODE,
       MYROW.PLINE_NAME,
       MYROW.ACT_DIMATER,
       MYROW.ACT_HEIGHT,
       MYROW.ACT_LEN,
       MYROW.ACT_LEN_MIN,
       MYROW.ACT_LEN_MAX,
       MYROW.ACT_COUNT,
       MYROW.ACT_WEIGHT,
       MYROW.ACT_THEORY_WEIGHT,
       MYROW.BELONG_CODE,
       MYROW.BELONG_NAME,
       MYROW.STORAGE_NO,
       MYROW.LOCATION_NO,
       MYROW.LARY_NO,
       MYROW.LOC_NO,
       MYROW.STORAGE_ATTR,
       MYROW.STORAGE_ATTR_NAME,
       MYROW.STORAGE_TYPE_NO,
       MYROW.STORAGE_TYPE_NAME,
       MYROW.MANAGEMENT_NO,
       MYROW.MANAGEMENT_NAME,
       V_TIME,
        V_TIME,
       '0',
       '1',
       ?,
       V_TIME,
       MYROW.PRODUCT_FLAG,
       MYROW.MAT_STATUS,
       MYROW.JUDGE_STD_NAME,
      '',
       V_TIME,
       MYROW.SOURE_CODE,
       MYROW.SOURE_NAME,
       MYROW.MAT_ORIGIN_CODE,
       MYROW.MAT_RETURN_FLAG,
       '1',
       '00',
       MYROW.PRO_ORDER_ID,
       MYROW.GX_PLAN_NO);
    V_OCOUNT := V_OCOUNT + 1;
  END LOOP;
END;
			]]>
	</query>
	<query id="FrmEndLibrary.queryMatGpTrack" desc="查询脱单利库记录">
            <![CDATA[
 SELECT 
       T.EVENT_ID,
       T.EVENT_DESC,
       T.FORM_NAME,
       T.CALL_FUNC_CODING,
       T.KEYVALUE_1,
       T.KEYVALUE_1_DESC,
       T.KEYVALUE_2,
       T.KEYVALUE_2_DESC2,
       T.KEYVALUE_3,
       T.KEYVALUE_3_DESC3,
       T.KEYVALUE_4,
       T.KEYVALUE_4_DESC4,
       T.KEYVALUE_5,
       T.KEYVALUE_5_DESC5,
       T.KEYVALUE_6,
       T.KEYVALUE_6_DESC6,
       T.KEYVALUE_7,
       T.KEYVALUE_7_DESC7,
       (SELECT I.BASENAME
          FROM COM_BASE_INFO I
         WHERE I.BASECODE = T.PRODUCT_FLAG) PRODUCT_FLAG,
       (SELECT I.BASENAME
          FROM COM_BASE_INFO I
         WHERE I.BASECODE = T.MAT_STATUS) MAT_STATUS,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STEELCODE,
       T.STEELNAME,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       T.ACT_COUNT,
       T.ACT_WEIGHT,
       T.ACT_THEORY_WEIGHT,
       T.PRO_ORDER_NO,
       T.PRO_ORDER_ID,
       T.PRO_ORDER_NO1,
       T.PRO_ORDER_ID1,
       T.ORD_PK,
       T.ORD_LN_PK,
       T.ORD_LN_DLY_PK,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.ORDER_SEQ_NO,
       T.OLD_ORD_PK,
       T.OLD_ORD_LN_PK,
       T.OLD_ORD_LN_DLY_PK,
       T.OLD_ORDER_NO,
       T.OLD_ORDER_SEQ,
       T.OLD_ORDER_SEQ_NO,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.MEMO,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.DEPARTMENT_CODE,
       T.DEPARTMENT_DESC,
       T.MANAGEMENT_NO,
       T.MANAGEMENT_NAME,
       T.PROCESS_CDOE,
       T.GRADECODE,
       T.GRADENAME
 FROM MAT_BC_TRACK T
 WHERE 1=1
             ]]>
	</query>
	<query id="FrmEndLibrary.queryQcmBcJude" desc="查询改判记录">
            <![CDATA[
            SELECT T.JUDGE_ID,
       T.JUDGE_STOVE_NO_OLD,
       T.BATCH_NO_OLD,
       T.BATCH_GROUD_NO_OLD,
       T.ACT_COUNT,
       T.ACT_WEIGHT,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.MATERIAL_NO_OLD,
       T.MATERIAL_NAME_OLD,
       T.PRODUCCODE_OLD,
       T.PRODUCNAME_OLD,
       T.STEELCODE_OLD,
       T.STEELNAME_OLD,
       T.SPEC_CODE_OLD,
       T.SPEC_NAME_OLD,
       T.MODEL_CODE_OLD,
       T.MODEL_DESC_OLD,
       T.STD_STYLE_OLD,
       T.STD_STYLE_DESC_OLD,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STEELCODE,
       T.STEELNAME,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.SUBMIT_NAME,
       TO_CHAR(T.SUBMIT_TIME, 'YYYY-MM-DD HH24:MI:SS') SUBMIT_TIME,
       T.AGREE_NAME,
       TO_CHAR(T.AGREE_TIME, 'YYYY-MM-DD HH24:MI:SS') AGREE_TIME,
       DECODE(T.AGREE_FLAG,
              '0',
              '未提交审批 ',
              '1',
              '提交审批',
              '2',
              '审批通过',
              '3',
              '审批不通过') AGREE_FLAG,
       T.CREATE_MEMO,
       T.SUBMIT_MEMO,
       T.AGREE_MEMO,
       DECODE(T.VALID_FLAG, '1', '有效', '无效') VALID_FLAG,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.PROCESS_CDOE
  FROM QCM_BC_JUDGE_CHANGE T
 WHERE  1=1       
            ]]>
	</query>
	<query id="FrmEndLibrary.addHttSamp" desc="新增管号队列表">
             <![CDATA[  
             INSERT INTO PORT_HTT_BATCH_SAMPLE_RESULT
  (HEAT_PLAN_NO,
   MAT_NO,
   M_MAT_NO,
   M_M_MAT_NO,
   LOT_NO,
   LOT_NO_SQE,
   PLINE_CODE,
   PLINE_NAME,
   JUDGE_STOVE_NO,
   BATCH_NO,
   GROUP_NO,
   STOVE_NO,
   FLAG_STOVE_NO,
   ACT_DIMATER,
   ACT_HEIGHT,
   ACT_LEN,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   ACT_COUNT,
   ACT_WEIGHT,
   ACT_THEORY_WEIGHT,
   IS_SAMPLE_PIPE,
   SAMPLE_PIPE_LEN,
   GET_SAMPLE_SHIFT,
   GET_SAMPLE_CLASS,
   GET_SAMPLE_NAME,
   GET_SAMPLE_TIME,
   OLD_JUDGE_STOVE_NO,
   GROUP_FLAG,
   OP_PROCESS,
   MAT_STATUS,
   LEVE_LOG,
   INSTORE_FLAG,
   VM_INSTORE_FLAG,
   PRC_TECHNOLOGY_PATH,
   RETURN_PROCESS,
   PHY_BATCH_NO,
   PRO_YEAR_MONTH_DAY,
   BAL_YEAR_MONTH,
   JUGDE_APPLY,
   PRO_USER,
   PRO_SHIFT,
   PRO_GROUP,
   PRO_TIME,
   REMARK,
   SAMPLE_PIPE_LEN_A,
   SAMPLE_PIPE_LEN_B,
   CHEM_RESULT_CODE,
   PHY_RESULT_CODE,
   HEAT_PLAN_SQE,
   PHY_CODE_GROUP,
   PHY_CODE_GROUPB,
   TR_FLAG,
   FEED_HEAT_NO,
   PROCESS_SEQ,
   RESULT_NO,
   IS_BATCH,
   SAMPLE_PIPE_LEN_C,
   SAMPLE_PIPE_LEN_D,
   PHY_CODE_GROUPC,
   PHY_CODE_GROUPD,
   CHECK_NO,
   SAMPLE_PIPE_LEN_M,
   PHY_CODE_GROUPM,
   MAT_NO_OLD,
   SAMPLE_PIPE_LEN_E,
   PHY_CODE_GROUPE,
   SAMPLE_PIPE_LEN_F,
   PHY_CODE_GROUPF,
   SAMPLE_PIPE_LEN_P,
   PHY_CODE_GROUPP,
   SAMPLE_PIPE_LEN_Q,
   PHY_CODE_GROUPQ,
   CRAFT_SOURCE,
   BAR_CODE,
   RE_GET_SAMPLE_NAME,
   RE_GET_SAMPLE_TIME,
   RE_GET_SAMPLE_STATUS,
   RESAMPLE_PIPE_LEN_A,
   RESAMPLE_PIPE_LEN_B,
   RESAMPLE_PIPE_LEN_C,
   RESAMPLE_PIPE_LEN_D,
   RESAMPLE_PIPE_LEN_E,
   RESAMPLE_PIPE_LEN_F,
   RESAMPLE_PIPE_LEN_P,
   RESAMPLE_PIPE_LEN_Q,
   RESAMPLE_PIPE_LEN_M,
   RE_CHECK_NO)
  SELECT ?,
         MAT_NO,
         M_MAT_NO,
         M_M_MAT_NO,
         ?,
         LOT_NO_SQE,
         ?,
         ?,
         JUDGE_STOVE_NO,
         BATCH_NO,
         GROUP_NO,
         STOVE_NO,
         FLAG_STOVE_NO,
         ACT_DIMATER,
         ACT_HEIGHT,
         ACT_LEN,
         ACT_LEN_MIN,
         ACT_LEN_MAX,
         ACT_COUNT,
         ACT_WEIGHT,
         ACT_THEORY_WEIGHT,
         IS_SAMPLE_PIPE,
         SAMPLE_PIPE_LEN,
         GET_SAMPLE_SHIFT,
         GET_SAMPLE_CLASS,
         GET_SAMPLE_NAME,
         GET_SAMPLE_TIME,
         '',
         '0',
         '600201',
         '00',
         '00',
         '0',
         '0',
         '',
         ?,
         ?,
         PRO_YEAR_MONTH_DAY,
         BAL_YEAR_MONTH,
         '0',
         ?,
         ?,
         ?,
         TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
         REMARK,
         SAMPLE_PIPE_LEN_A,
         SAMPLE_PIPE_LEN_B,
         CHEM_RESULT_CODE,
         PHY_RESULT_CODE,
         ?,
         PHY_CODE_GROUP,
         PHY_CODE_GROUPB,
         TR_FLAG,
         FEED_HEAT_NO,
         PROCESS_SEQ,
         RESULT_NO,
         IS_BATCH,
         SAMPLE_PIPE_LEN_C,
         SAMPLE_PIPE_LEN_D,
         PHY_CODE_GROUPC,
         PHY_CODE_GROUPD,
         CHECK_NO,
         SAMPLE_PIPE_LEN_M,
         PHY_CODE_GROUPM,
         MAT_NO_OLD,
         SAMPLE_PIPE_LEN_E,
         PHY_CODE_GROUPE,
         SAMPLE_PIPE_LEN_F,
         PHY_CODE_GROUPF,
         SAMPLE_PIPE_LEN_P,
         PHY_CODE_GROUPP,
         SAMPLE_PIPE_LEN_Q,
         PHY_CODE_GROUPQ,
         CRAFT_SOURCE,
         BAR_CODE,
         RE_GET_SAMPLE_NAME,
         RE_GET_SAMPLE_TIME,
         RE_GET_SAMPLE_STATUS,
         RESAMPLE_PIPE_LEN_A,
         RESAMPLE_PIPE_LEN_B,
         RESAMPLE_PIPE_LEN_C,
         RESAMPLE_PIPE_LEN_D,
         RESAMPLE_PIPE_LEN_E,
         RESAMPLE_PIPE_LEN_F,
         RESAMPLE_PIPE_LEN_P,
         RESAMPLE_PIPE_LEN_Q,
         RESAMPLE_PIPE_LEN_M,
         RE_CHECK_NO
    FROM PORT_HTT_BATCH_SAMPLE_RESULT
   WHERE HEAT_PLAN_NO = ?
     AND MAT_NO = ?
     AND PROCESS_SEQ='1'
              ]]>
	</query>
	<query id="FrmEndLibrary.addPlnZyZgM" desc="新增轧管虚拟炉计划信息">
             <![CDATA[ INSERT INTO PLN_ZY_ZG_M(
        HEAT_PLAN_NO,
        GX_PRO_SEQ,
        ZY_BATCH_ID,
        STOVE_NO,
        JUDGE_STOVE_NO,
        PLANSTATUS,
        UPPER_HEATPLAN_ID,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        CCM_PRO_PLAN_ID,
        CCM_GX_PLAN_NO,
        PLINE_CODE,
        PLINE_NAME,
        PROCESS_CODE_C,
        PROCESS_DESC_C,
        UPPER_PROCESS_CODE,
        NEXT_PROCESS_CODE,
        ISENDGX,
        IF_MATCH_ODD,
        IF_DO_HEAT_PLAN,
        ORDER_SOURCE,
        ORD_LN_DLY_PK,
        ORDER_NO,
        ORDER_SEQ,
        DELIVERY_NO,
        REQ_BL_ID,
        IF_EXPORT,
        PRIORITY,
        PRIORITY_MEMO,
        PRO_MONTH,
        IF_LEN_CONTROL,
        IF_MINUS_SIC_ROLL,
        PROD_STANDARD,
        OUTPUT_STANDARD,
        DECISION,
        PROGY_MEMO,
        GOWHERE_CODE,
        GOWHERE_NAME,
        OUTS_BILLET_FL,
        GPTYPE,
        INWL_ID,
        INWL_DESC,
        OUTWL_ID,
        OUTWL_DESC,
        GRADECODE,
        GRADENAME,
        STEELCODE,
        STEELNAME,
        PRODUCCODE,
        PRODUCNAME,
        MODEL_CODE,
        MODEL_DESC,
        DIAMETER,
        LEN_GP_SINGLE,
        WT_GP_SINGLE,
        PLN_INSINGLE_NUM,
        PLN_INSINGLE_WT,
        PLN_OUTSINGLE_NUM,
        PLN_OUTSINGLE_W,
        OUTDIAMETER,
        WALLTHICK,
        OUTDIAMETER_ZG,
        WALLTHICK_ZG,
        AIMOUTDIAMETER,
        AIMWALLTHICK,
        THICKNESS_WALL,
        LEN_ROLL_MAX,
        LEN_ROLL_MIN,
        AIMLENGTH,
        ROLL_LENGTH,
        OUTNUM_CUT,
        CUT_TYPE,
        LEN_CUTEND,
        LEN_CUTHEAD,
        DIAMETER_MANDREL,
        PASS_CODE,
        PASS_NAME,
        IF_MONITOR,
        PRDCR_NO,
        MONITOR_POINT,
        BOM,
        WHOLE_BACKLOG,
        WHOLE_BACKLOG_DESC,
        CIC,
        PIC,
        SIC,
        DIC,
        CRAFT_FILE_NO,
        CRAFT_FILE_MAN,
        CRAFT_SEQ,
        SEC_CRAFT_FILE_NO,
        STATION_ROAD,
        PRO_DAY,
        BAL_YEAR_MONTH,
        CREATE_NAME,
        CREATE_TIME,
        FLAG_STOVE_NO,
        INDEX_SEQ,PLN_TYPE,REDUCED_WT,IF_FLAG,HEAT_PLAN_NO_OLD,FEED_HEAT_NO)
 VALUES( 
        '#HEAT_PLAN_NO#',
        '#GX_PRO_SEQ#',
        '#ZY_BATCH_ID#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#PLANSTATUS#',
        '#UPPER_HEATPLAN_ID#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#CCM_PRO_PLAN_ID#',
        '#CCM_GX_PLAN_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#PROCESS_CODE_C#',
        '#PROCESS_DESC_C#',
        '#UPPER_PROCESS_CODE#',
        '#NEXT_PROCESS_CODE#',
        '#ISENDGX#',
        '#IF_MATCH_ODD#',
        '#IF_DO_HEAT_PLAN#',
        '#ORDER_SOURCE#',
        '#ORD_LN_DLY_PK#',
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#DELIVERY_NO#',
        '#REQ_BL_ID#',
        '#IF_EXPORT#',
        '#PRIORITY#',
        '#PRIORITY_MEMO#',
        '#PRO_MONTH#',
        '#IF_LEN_CONTROL#',
        '#IF_MINUS_SIC_ROLL#',
        '#PROD_STANDARD#',
        '#OUTPUT_STANDARD#',
        '#DECISION#',
        '#PROGY_MEMO#',
        '#GOWHERE_CODE#',
        '#GOWHERE_NAME#',
        '#OUTS_BILLET_FL#',
        '#GPTYPE#',
        '#INWL_ID#',
        '#INWL_DESC#',
        '#OUTWL_ID#',
        '#OUTWL_DESC#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#DIAMETER#',
        '#LEN_GP_SINGLE#',
        '#WT_GP_SINGLE#',
        '#PLN_INSINGLE_NUM#',
        '#PLN_INSINGLE_WT#',
        '#PLN_OUTSINGLE_NUM#',
        '#PLN_OUTSINGLE_W#',
        '#OUTDIAMETER#',
        '#WALLTHICK#',
        '#OUTDIAMETER_ZG#',
        '#WALLTHICK_ZG#',
        '#AIMOUTDIAMETER#',
        '#AIMWALLTHICK#',
        '#THICKNESS_WALL#',
        '#LEN_ROLL_MAX#',
        '#LEN_ROLL_MIN#',
        '#AIMLENGTH#',
        '#ROLL_LENGTH#',
        '#OUTNUM_CUT#',
        '#CUT_TYPE#',
        '#LEN_CUTEND#',
        '#LEN_CUTHEAD#',
        '#DIAMETER_MANDREL#',
        '#PASS_CODE#',
        '#PASS_NAME#',
        '#IF_MONITOR#',
        '#PRDCR_NO#',
        '#MONITOR_POINT#',
        '#BOM#',
        '#WHOLE_BACKLOG#',
        '#WHOLE_BACKLOG_DESC#',
        '#CIC#',
        '#PIC#',
        '#SIC#',
        '#DIC#',
        '#CRAFT_FILE_NO#',
        '#CRAFT_FILE_MAN#',
        '#CRAFT_SEQ#',
        '#SEC_CRAFT_FILE_NO#',
        '#STATION_ROAD#',
        '#PRO_DAY#',
        '#BAL_YEAR_MONTH#',
        '#CREATE_NAME#',
        TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'), 
        '#FLAG_STOVE_NO#',
        '#INDEX_SEQ#','#PLN_TYPE#','#REDUCED_WT#','1','#HEAT_PLAN_NO_OLD#','#FEED_HEAT_NO#')
             ]]>
	</query>
	<query id="FrmEndLibrary.addPlnZyZgC" desc="新增轧管实际炉计划">
             <![CDATA[  
              INSERT INTO PLN_ZY_ZG_C(
        HEAT_PLAN_NO,
        HEAT_PLAN_SQE,
        JUGDE_APPLY_CODE,
        ZY_BATCH_ID,
        STOVE_NO,
        JUDGE_STOVE_NO,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        PLINE_CODE,
        PLINE_NAME,
        DIAMETER,
        LEN_GP_SINGLE,
        WT_GP_SINGLE,
        CUT_NUM_GP,
        LENGTH_M,
        WEIGHT_M,
        PLAN_INDOUBLE_NUM,
        PLAN_INDOUBLE_WT,
        REAL_INDOUBLE_NUM,
        REAL_INDOUBLE_WT,
        FLAG_STOVE_NO,
        CREATE_NAME,
        CREATE_TIME,CUT_TARGET,CUT_LENGTH,CUT_WEIGHT,CUT_NUM_OLD,LEN_GP_SINGLE_OLD,LENGTH_M_OLD,PLAN_WEIGTH,IF_FLAG)
 VALUES( 
        '#HEAT_PLAN_NO#',
        '#HEAT_PLAN_SQE#',
        '#JUGDE_APPLY_CODE#',
        '#ZY_BATCH_ID#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#DIAMETER#',
        '#LEN_GP_SINGLE#',
        '#WT_GP_SINGLE#',
        '#CUT_NUM_GP#',
        '#LENGTH_M#',
        '#WEIGHT_M#',
        '#PLAN_INDOUBLE_NUM#',
        '#PLAN_INDOUBLE_WT#',
        '#REAL_INDOUBLE_NUM#',
        '#REAL_INDOUBLE_WT#',
        '#FLAG_STOVE_NO#',
        '#CREATE_NAME#',
        TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'),'#CUT_TARGET#','#CUT_LENGTH#',
        '#CUT_WEIGHT#','#CUT_NUM_OLD#','#LEN_GP_SINGLE_OLD#','#LENGTH_M_OLD#','#PLAN_WEIGTH#','1')
              ]]>
	</query>
		<query id="FrmEndLibrary.updatePressBgx" desc="修改库存本工序炉计划Id">
		<![CDATA[
UPDATE MAT_BC_M T
   SET T.HEAT_PLAN_NO = ?

		]]>
	</query>
	<query id="FrmEndLibrary.addPlnZyDbkC" desc="查询镦拔扩实际炉计划">
      <![CDATA[
       INSERT INTO PLN_ZY_DBK_C(
        HEAT_PLAN_NO,
        HEAT_PLAN_SQE,
        JUGDE_APPLY_CODE,
        ZY_BATCH_ID,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        PLINE_CODE,
        PLINE_NAME,
        OUTDIAMETER_IN,
        WALLTHICK_IN,
        LENGTH_IN,
        LENGTHMAX_IN,
        LENGTHMIN_IN,
        PLAN_INDOUBLE_NUM,
        PLAN_INDOUBLE_WT,FEED_HEAT_NO,FLAG_STOVE_NO,OUTNUM_CUT,IF_FLAG)
 VALUES( 
        '#HEAT_PLAN_NO#',
        '#HEAT_PLAN_SQE#',
        '#JUGDE_APPLY_CODE#',
        '#ZY_BATCH_ID#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#OUTDIAMETER_IN#',
        '#WALLTHICK_IN#',
        '#LENGTH_IN#',
        '#LENGTHMAX_IN#',
        '#LENGTHMIN_IN#',
        '#PLAN_INDOUBLE_NUM#',
        '#PLAN_INDOUBLE_WT#','#FEED_HEAT_NO#','#FLAG_STOVE_NO#','#OUTNUM_CUT#','1')
       ]]>
	</query>
	<query id="FrmEndLibrary.addPlnZyDbkZB" desc="新增镦拔扩虚拟炉计划">
      <![CDATA[
      INSERT INTO PLN_ZY_DBK_M
  (HEAT_PLAN_NO,
   GX_PRO_SEQ,
   ZY_BATCH_ID,
   STOVE_NO,
   FEED_HEAT_NO,
   BATCH_NO,
   PLANSTATUS,
   UPPER_HEATPLAN_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   UPPER_PROCESS_CODE,
   NEXT_PROCESS_CODE,
   GOWHERE_CODE,
   GOWHERE_NAME,
   PROD_STANDARD,
   OUTPUT_STANDARD,
   ISENDGX,
   IF_MATCH_ODD,
   IF_DO_HEAT_PLAN,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   IF_EXPORT,
   PRIORITY,
   PRIORITY_MEMO,
   PRO_MONTH,
   PRO_DAY,
   BAL_YEAR_MONTH,
   IF_MONITOR,
   PRDCR_NO,
   MONITOR_POINT,
   BOM,
   WHOLE_BACKLOG,
   WHOLE_BACKLOG_DESC,
   STATION_ROAD,
   CIC,
   PIC,
   SIC,
   DIC,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   SEC_CRAFT_FILE_NO,
   GRADECODE,
   GRADENAME,
   STEELCODE,
   STEELNAME,
   PRODUCCODE,
   PRODUCNAME,
   MODEL_CODE,
   MODEL_DESC,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   AIMOUTDIAMETER,
   AIMWALLTHICK,
   AIMLENGTH,
   AIMLENGTH_MAX,
   AIMLENGTH_MIN,
   LEN_CUTHEAD,
   LEN_CUTEND,
   PLN_INSINGLE_NUM,
   PLN_INSINGLE_WT,
   PLN_INDOUBLE_NUM,
   PLN_INDOUBLE_WT,
   PLN_OUTSINGLE_NUM,
   PLN_OUTSINGLE_W,
   PLN_OUTDOUBLE_NUM,
   PLN_OUTDOUBLE_W,
   CREATE_NAME,
   CREATE_TIME,
   INDEX_SEQ,SPEC_CODE,
        SPEC_NAME,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,JUDGE_STOVE_NO,DECISION,ZY_BATCH_ID_ZG,PASS_CODE,PASS_NAME,FLAG_STOVE_NO,IF_FLAG,HEAT_PLAN_NO_OLD)
VALUES
  ('#HEAT_PLAN_NO#',
   '#GX_PRO_SEQ#',
   '#ZY_BATCH_ID#',
   '#STOVE_NO#',
   '#FEED_HEAT_NO#',
   '#BATCH_NO#',
   '#PLANSTATUS#',
   '#UPPER_HEATPLAN_ID#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   '#UPPER_PROCESS_CODE#',
   '#NEXT_PROCESS_CODE#',
   '#GOWHERE_CODE#',
   '#GOWHERE_NAME#',
   '#PROD_STANDARD#',
   '#OUTPUT_STANDARD#',
   '#ISENDGX#',
   '#IF_MATCH_ODD#',
   '#IF_DO_HEAT_PLAN#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#IF_EXPORT#',
   '#PRIORITY#',
   '#PRIORITY_MEMO#',
   '#PRO_MONTH#',
   '#PRO_DAY#',
   '#BAL_YEAR_MONTH#',
   '#IF_MONITOR#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#BOM#',
   '#WHOLE_BACKLOG#',
   '#WHOLE_BACKLOG_DESC#',
   '#STATION_ROAD#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_FILE_MAN#',
   '#CRAFT_SEQ#',
   '#SEC_CRAFT_FILE_NO#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#OUTDIAMETER_IN#',
   '#WALLTHICK_IN#',
   '#LENGTH_IN#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#AIMOUTDIAMETER#',
   '#AIMWALLTHICK#',
   '#AIMLENGTH#',
   '#AIMLENGTH_MAX#',
   '#AIMLENGTH_MIN#',
   '#LEN_CUTHEAD#',
   '#LEN_CUTEND#',
   '#PLN_INSINGLE_NUM#',
   '#PLN_INSINGLE_WT#',
   '#PLN_INDOUBLE_NUM#',
   '#PLN_INDOUBLE_WT#',
   '#PLN_OUTSINGLE_NUM#',
   '#PLN_OUTSINGLE_W#',
   '#PLN_OUTDOUBLE_NUM#',
   '#PLN_OUTDOUBLE_W#',
   '#CREATE_NAME#',
   TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#INDEX_SEQ#', '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#','#JUDGE_STOVE_NO#','#DECISION#','#ZY_BATCH_ID_ZG#','#PASS_CODE#','#PASS_NAME#','#FLAG_STOVE_NO#','1','#HEAT_PLAN_NO_OLD#')
      ]]>
	</query>
	<query id="FrmEndLibrary.addPlnZyRclC" desc="查询热处理实际炉计划">
      <![CDATA[
       INSERT INTO PLN_ZY_RCL_C(
        HEAT_PLAN_NO,
        HEAT_PLAN_SQE,
        JUGDE_APPLY_CODE,
        ZY_BATCH_ID,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        PLINE_CODE,
        PLINE_NAME,
        OUTDIAMETER_IN,
        WALLTHICK_IN,
        LENGTH_IN,
        LENGTHMAX_IN,
        LENGTHMIN_IN,
        PLAN_INDOUBLE_NUM,
        PLAN_INDOUBLE_WT,FEED_HEAT_NO,FLAG_STOVE_NO,IF_FLAG)
 VALUES( 
        '#HEAT_PLAN_NO#',
        '#HEAT_PLAN_SQE#',
        '#JUGDE_APPLY_CODE#',
        '#ZY_BATCH_ID#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#OUTDIAMETER_IN#',
        '#WALLTHICK_IN#',
        '#LENGTH_IN#',
        '#LENGTHMAX_IN#',
        '#LENGTHMIN_IN#',
        '#PLAN_INDOUBLE_NUM#',
        '#PLAN_INDOUBLE_WT#','#FEED_HEAT_NO#','#FLAG_STOVE_NO#','1')
       ]]>
	</query>
	<query id="FrmEndLibrary.addPlnZyRclBGX" desc="新增热处理虚拟炉计划">
      <![CDATA[
      INSERT INTO PLN_ZY_RCL_M
  (HEAT_PLAN_NO,
   GX_PRO_SEQ,
   ZY_BATCH_ID,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   PLANSTATUS,
   PER_STATUS,
   BESIDE_STATUS,
   UPPER_HEATPLAN_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   UPPER_PROCESS_CODE,
   NEXT_PROCESS_CODE,
   GOWHERE_CODE,
   GOWHERE_NAME,
   PROD_STANDARD,
   OUTPUT_STANDARD,
   ISENDGX,
   IF_MATCH_ODD,
   IF_DO_HEAT_PLAN,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   IF_EXPORT,
   PRIORITY,
   PRIORITY_MEMO,
   PRO_MONTH,
   PRO_DAY,
   BAL_YEAR_MONTH,
   IF_MONITOR,
   PRDCR_NO,
   MONITOR_POINT,
   BOM,
   WHOLE_BACKLOG,
   WHOLE_BACKLOG_DESC,
   STATION_ROAD,
   CIC,
   PIC,
   SIC,
   DIC,
   CRAFT_FILE_NO,
   CRAFT_FILE_MAN,
   CRAFT_SEQ,
   SEC_CRAFT_FILE_NO,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   PRODUCCODE,
   PRODUCNAME,
   MODEL_CODE,
   MODEL_DESC,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   OUTDIAMETER,
   WALLTHICK,
   LENGTHMIN,
   LENGTHMAX,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   PLN_INSINGLE_NUM,
   PLN_INSINGLE_WT,
   PLN_INDOUBLE_NUM,
   PLN_INDOUBLE_WT,
   PLN_OUTSINGLE_NUM,
   PLN_OUTSINGLE_W,
   PLN_OUTDOUBLE_NUM,
   PLN_OUTDOUBLE_W,
   CREATE_NAME,
   CREATE_TIME,
   INDEX_SEQ,SPEC_CODE,
        SPEC_NAME,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,DECISION,PROCESS_SEQ,FLAG_STOVE_NO,FEED_HEAT_NO,ZY_BATCH_ID_ZG,LOT_NO_SQE,IF_PRODUCT,IF_FLAG,HEAT_PLAN_NO_OLD,REAL_PROCESS_SEQ)
VALUES
  ('#HEAT_PLAN_NO#',
   '#GX_PRO_SEQ#',
   '#ZY_BATCH_ID#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#PLANSTATUS#',
   '#PER_STATUS#',
   '#BESIDE_STATUS#',
   '#UPPER_HEATPLAN_ID#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   '#UPPER_PROCESS_CODE#',
   '#NEXT_PROCESS_CODE#',
   '#GOWHERE_CODE#',
   '#GOWHERE_NAME#',
   '#PROD_STANDARD#',
   '#OUTPUT_STANDARD#',
   '#ISENDGX#',
   '#IF_MATCH_ODD#',
   '#IF_DO_HEAT_PLAN#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#IF_EXPORT#',
   '#PRIORITY#',
   '#PRIORITY_MEMO#',
   '#PRO_MONTH#',
   '#PRO_DAY#',
   '#BAL_YEAR_MONTH#',
   '#IF_MONITOR#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#BOM#',
   '#WHOLE_BACKLOG#',
   '#WHOLE_BACKLOG_DESC#',
   '#STATION_ROAD#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_FILE_MAN#',
   '#CRAFT_SEQ#',
   '#SEC_CRAFT_FILE_NO#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#OUTDIAMETER#',
   '#WALLTHICK#',
   '#LENGTHMIN#',
   '#LENGTHMAX#',
   '#OUTDIAMETER_IN#',
   '#WALLTHICK_IN#',
   '#LENGTH_IN#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#PLN_INSINGLE_NUM#',
   '#PLN_INSINGLE_WT#',
   '#PLN_INDOUBLE_NUM#',
   '#PLN_INDOUBLE_WT#',
   '#PLN_OUTSINGLE_NUM#',
   '#PLN_OUTSINGLE_W#',
   '#PLN_OUTDOUBLE_NUM#',
   '#PLN_OUTDOUBLE_W#',
   '#CREATE_NAME#',
   TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'),
   '#INDEX_SEQ#', '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#','#DECISION#','#PROCESS_SEQ#','#FLAG_STOVE_NO#','#FEED_HEAT_NO#',
        '#ZY_BATCH_ID_ZG#','#LOT_NO_SQE#','#IF_PRODUCT#','1','#HEAT_PLAN_NO_OLD#','#REAL_PROCESS_SEQ#')
         ]]>
	</query>
	<query id="FrmEndLibrary.addPlnZyJgxC" desc="查询加工线实际炉计划">
      <![CDATA[
       INSERT INTO PLN_ZY_JGX_C(
        HEAT_PLAN_NO,
        HEAT_PLAN_SQE,
        JUGDE_APPLY_CODE,
        ZY_BATCH_ID,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        BATCH_GROUD_NO,
        PRO_PLAN_ID,
        GX_PLAN_NO,
        PLINE_CODE,
        PLINE_NAME,
        OUTDIAMETER_IN,
        WALLTHICK_IN,
        LENGTH_IN,
        LENGTHMAX_IN,
        LENGTHMIN_IN,
        PLAN_INDOUBLE_NUM,
        PLAN_INDOUBLE_WT,OUTNUM_CUT,FEED_HEAT_NO,FLAG_STOVE_NO,IF_FLAG,PER_STATUS,BESIDE_STATUS)
 VALUES( 
        '#HEAT_PLAN_NO#',
        '#HEAT_PLAN_SQE#',
        '#JUGDE_APPLY_CODE#',
        '#ZY_BATCH_ID#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#BATCH_GROUD_NO#',
        '#PRO_PLAN_ID#',
        '#GX_PLAN_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#OUTDIAMETER_IN#',
        '#WALLTHICK_IN#',
        '#LENGTH_IN#',
        '#LENGTHMAX_IN#',
        '#LENGTHMIN_IN#',
        '#PLAN_INDOUBLE_NUM#',
        '#PLAN_INDOUBLE_WT#','#OUTNUM_CUT#','#FEED_HEAT_NO#','#FLAG_STOVE_NO#','1','00','00')
       ]]>
	</query>
	<query id="FrmEndLibrary.addPlnZyJgxbGX" desc="新增加工线虚拟炉计划">
      <![CDATA[
      INSERT INTO PLN_ZY_JGX_M
  (HEAT_PLAN_NO,
   GX_PRO_SEQ,
   ZY_BATCH_ID,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   PLANSTATUS,
   PER_STATUS,
   BESIDE_STATUS,
   UPPER_HEATPLAN_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   UPPER_PROCESS_CODE,
   NEXT_PROCESS_CODE,
   GOWHERE_CODE,
   GOWHERE_NAME,
   PROD_STANDARD,
   OUTPUT_STANDARD,
   ISENDGX,
   IF_MATCH_ODD,
   IF_DO_HEAT_PLAN,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   IF_EXPORT,
   PRIORITY,
   PRIORITY_MEMO,
   PRO_MONTH,
   PRO_DAY,
   BAL_YEAR_MONTH,
   IF_MONITOR,
   PRDCR_NO,
   MONITOR_POINT,
   MONITOR_MENT,
   MONITOR_MAN,
   BOM,
   WHOLE_BACKLOG,
   WHOLE_BACKLOG_DESC,
   STATION_ROAD,
   CIC,
   PIC,
   SIC,
   DIC,
   WIC,
   GIC,
   CRAFT_FILE_NO,
   CRAFT_SEQ,
   CRAFT_FILE_MAN,
   SEC_CRAFT_FILE_NO,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   PRODUCCODE,
   PRODUCNAME,
   MODEL_CODE,
   MODEL_DESC,
   OUTDIAMETER,
   WALLTHICK,
   LENGTHMIN,
   LENGTHMAX,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   PLN_INSINGLE_NUM,
   PLN_INSINGLE_WT,
   PLN_INDOUBLE_NUM,
   PLN_INDOUBLE_WT,
   PLN_OUTSINGLE_NUM,
   PLN_OUTSINGLE_W,
   PLN_OUTDOUBLE_NUM,
   PLN_OUTDOUBLE_W,
   CREATE_NAME,
   CREATE_TIME,
   INDEX_SEQ,SPEC_CODE,
        SPEC_NAME,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,OUTNUM_CUT,DECISION,FLAG_STOVE_NO,
        FEED_HEAT_NO,ZY_BATCH_ID_ZG,LOT_NO_SQE,IF_FLAG,HEAT_PLAN_NO_OLD,ZZB_FLAG)
VALUES
  ('#HEAT_PLAN_NO#',
   '#GX_PRO_SEQ#',
   '#ZY_BATCH_ID#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#PLANSTATUS#',
   '#PER_STATUS#',
   '#BESIDE_STATUS#',
   '#UPPER_HEATPLAN_ID#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   '#UPPER_PROCESS_CODE#',
   '#NEXT_PROCESS_CODE#',
   '#GOWHERE_CODE#',
   '#GOWHERE_NAME#',
   '#PROD_STANDARD#',
   '#OUTPUT_STANDARD#',
   '#ISENDGX#',
   '#IF_MATCH_ODD#',
   '#IF_DO_HEAT_PLAN#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#IF_EXPORT#',
   '#PRIORITY#',
   '#PRIORITY_MEMO#',
   '#PRO_MONTH#',
   '#PRO_DAY#',
   '#BAL_YEAR_MONTH#',
   '#IF_MONITOR#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#MONITOR_MENT#',
   '#MONITOR_MAN#',
   '#BOM#',
   '#WHOLE_BACKLOG#',
   '#WHOLE_BACKLOG_DESC#',
   '#STATION_ROAD#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#WIC#',
   '#GIC#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_SEQ#',
   '#CRAFT_FILE_MAN#',
   '#SEC_CRAFT_FILE_NO#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#OUTDIAMETER#',
   '#WALLTHICK#',
   '#LENGTHMIN#',
   '#LENGTHMAX#',
   '#OUTDIAMETER_IN#',
   '#WALLTHICK_IN#',
   '#LENGTH_IN#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#PLN_INSINGLE_NUM#',
   '#PLN_INSINGLE_WT#',
   '#PLN_INDOUBLE_NUM#',
   '#PLN_INDOUBLE_WT#',
   '#PLN_OUTSINGLE_NUM#',
   '#PLN_OUTSINGLE_W#',
   '#PLN_OUTDOUBLE_NUM#',
   '#PLN_OUTDOUBLE_W#',
   '#CREATE_NAME#',   
   TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#INDEX_SEQ#', '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#','#OUTNUM_CUT#','#DECISION#','#FLAG_STOVE_NO#',
        '#FEED_HEAT_NO#','#ZY_BATCH_ID_ZG#','#LOT_NO_SQE#','1','#HEAT_PLAN_NO_OLD#','#ZZB_FLAG#')
      
         ]]>
	</query>
	
	<query id="FrmEndLibrary.addPlnZyDbkC" desc="查询镦拔扩实际炉计划">
      <![CDATA[
       INSERT INTO PLN_ZY_DBK_C
  (HEAT_PLAN_NO,
   HEAT_PLAN_SQE,
   JUGDE_APPLY_CODE,
   ZY_BATCH_ID,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   PLAN_INDOUBLE_NUM,
   PLAN_INDOUBLE_WT,
   OUTNUM_CUT,
   FEED_HEAT_NO,
   FLAG_STOVE_NO,
   IF_FLAG,
   PER_STATUS,
   BESIDE_STATUS)
VALUES
  ('#HEAT_PLAN_NO#',
   '#HEAT_PLAN_SQE#',
   '#JUGDE_APPLY_CODE#',
   '#ZY_BATCH_ID#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#BATCH_GROUD_NO#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#OUTDIAMETER_IN#',
   '#WALLTHICK_IN#',
   '#LENGTH_IN#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#PLAN_INDOUBLE_NUM#',
   '#PLAN_INDOUBLE_WT#',
   '#OUTNUM_CUT#',
   '#FEED_HEAT_NO#',
   '#FLAG_STOVE_NO#',
   '1',
   '00',
   '00')
       ]]>
	</query>
	
	<query id="FrmEndLibrary.addPlnZyDbkbGX" desc="新增镦拔扩虚拟炉计划">
      <![CDATA[
      INSERT INTO PLN_ZY_DBK_M
  (HEAT_PLAN_NO,
   GX_PRO_SEQ,
   ZY_BATCH_ID,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   PLANSTATUS,
   PER_STATUS,
   BESIDE_STATUS,
   UPPER_HEATPLAN_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   UPPER_PROCESS_CODE,
   NEXT_PROCESS_CODE,
   GOWHERE_CODE,
   GOWHERE_NAME,
   PROD_STANDARD,
   OUTPUT_STANDARD,
   ISENDGX,
   IF_MATCH_ODD,
   IF_DO_HEAT_PLAN,
   ORDER_SOURCE,
   ORD_LN_DLY_PK,
   ORDER_NO,
   ORDER_SEQ,
   DELIVERY_NO,
   REQ_BL_ID,
   IF_EXPORT,
   PRIORITY,
   PRIORITY_MEMO,
   PRO_MONTH,
   PRO_DAY,
   BAL_YEAR_MONTH,
   IF_MONITOR,
   PRDCR_NO,
   MONITOR_POINT,
   MONITOR_MENT,
   MONITOR_MAN,
   BOM,
   WHOLE_BACKLOG,
   WHOLE_BACKLOG_DESC,
   STATION_ROAD,
   CIC,
   PIC,
   SIC,
   DIC,
   WIC,
   GIC,
   CRAFT_FILE_NO,
   CRAFT_SEQ,
   CRAFT_FILE_MAN,
   SEC_CRAFT_FILE_NO,
   INWL_ID,
   INWL_DESC,
   OUTWL_ID,
   OUTWL_DESC,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   PRODUCCODE,
   PRODUCNAME,
   MODEL_CODE,
   MODEL_DESC,
   OUTDIAMETER,
   WALLTHICK,
   LENGTHMIN,
   LENGTHMAX,
   OUTDIAMETER_IN,
   WALLTHICK_IN,
   LENGTH_IN,
   LENGTHMAX_IN,
   LENGTHMIN_IN,
   PLN_INSINGLE_NUM,
   PLN_INSINGLE_WT,
   PLN_INDOUBLE_NUM,
   PLN_INDOUBLE_WT,
   PLN_OUTSINGLE_NUM,
   PLN_OUTSINGLE_W,
   PLN_OUTDOUBLE_NUM,
   PLN_OUTDOUBLE_W,
   CREATE_NAME,
   CREATE_TIME,
   INDEX_SEQ,
   SPEC_CODE,
   SPEC_NAME,
   STD_CODE,
   STD_NAME,
   STD_STYLE,
   STD_STYLE_DESC,
   OUTNUM_CUT,
   DECISION,
   FLAG_STOVE_NO,
   FEED_HEAT_NO,
   ZY_BATCH_ID_ZG,
   LOT_NO_SQE,
   IF_FLAG,
   HEAT_PLAN_NO_OLD)
VALUES
  ('#HEAT_PLAN_NO#',
   '#GX_PRO_SEQ#',
   '#ZY_BATCH_ID#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#PLANSTATUS#',
   '#PER_STATUS#',
   '#BESIDE_STATUS#',
   '#UPPER_HEATPLAN_ID#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#PROCESS_CODE_C#',
   '#PROCESS_DESC_C#',
   '#UPPER_PROCESS_CODE#',
   '#NEXT_PROCESS_CODE#',
   '#GOWHERE_CODE#',
   '#GOWHERE_NAME#',
   '#PROD_STANDARD#',
   '#OUTPUT_STANDARD#',
   '#ISENDGX#',
   '#IF_MATCH_ODD#',
   '#IF_DO_HEAT_PLAN#',
   '#ORDER_SOURCE#',
   '#ORD_LN_DLY_PK#',
   '#ORDER_NO#',
   '#ORDER_SEQ#',
   '#DELIVERY_NO#',
   '#REQ_BL_ID#',
   '#IF_EXPORT#',
   '#PRIORITY#',
   '#PRIORITY_MEMO#',
   '#PRO_MONTH#',
   '#PRO_DAY#',
   '#BAL_YEAR_MONTH#',
   '#IF_MONITOR#',
   '#PRDCR_NO#',
   '#MONITOR_POINT#',
   '#MONITOR_MENT#',
   '#MONITOR_MAN#',
   '#BOM#',
   '#WHOLE_BACKLOG#',
   '#WHOLE_BACKLOG_DESC#',
   '#STATION_ROAD#',
   '#CIC#',
   '#PIC#',
   '#SIC#',
   '#DIC#',
   '#WIC#',
   '#GIC#',
   '#CRAFT_FILE_NO#',
   '#CRAFT_SEQ#',
   '#CRAFT_FILE_MAN#',
   '#SEC_CRAFT_FILE_NO#',
   '#INWL_ID#',
   '#INWL_DESC#',
   '#OUTWL_ID#',
   '#OUTWL_DESC#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#OUTDIAMETER#',
   '#WALLTHICK#',
   '#LENGTHMIN#',
   '#LENGTHMAX#',
   '#OUTDIAMETER_IN#',
   '#WALLTHICK_IN#',
   '#LENGTH_IN#',
   '#LENGTHMAX_IN#',
   '#LENGTHMIN_IN#',
   '#PLN_INSINGLE_NUM#',
   '#PLN_INSINGLE_WT#',
   '#PLN_INDOUBLE_NUM#',
   '#PLN_INDOUBLE_WT#',
   '#PLN_OUTSINGLE_NUM#',
   '#PLN_OUTSINGLE_W#',
   '#PLN_OUTDOUBLE_NUM#',
   '#PLN_OUTDOUBLE_W#',
   '#CREATE_NAME#',
   TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
   '#INDEX_SEQ#',
   '#SPEC_CODE#',
   '#SPEC_NAME#',
   '#STD_CODE#',
   '#STD_NAME#',
   '#STD_STYLE#',
   '#STD_STYLE_DESC#',
   '#OUTNUM_CUT#',
   '#DECISION#',
   '#FLAG_STOVE_NO#',
   '#FEED_HEAT_NO#',
   '#ZY_BATCH_ID_ZG#',
   '#LOT_NO_SQE#',
   '1',
   '#HEAT_PLAN_NO_OLD#')
         ]]>
	</query>
	
		<query id="FrmEndLibrary.updateMOldE" desc="关闭原炉计划">
      <![CDATA[
      UPDATE PLN_ZY_DBK_M M
   SET PLANSTATUS = '40'
 WHERE NOT EXISTS (SELECT 1
          FROM PORT_VRP_BATCH_SAMPLE_RESULT T
         WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND (T.MAT_STATUS = '20' OR
               (T.MAT_STATUS = '00' AND T.INSTORE_FLAG = '0')))
   AND (SELECT SUM(ACT_COUNT)
          FROM QCM_ZG_JUGDE_APPLY
         WHERE HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND JUDGE_RESULT_CODE IS NOT NULL
           AND VALIDFLAG <> '50') >=
       (SELECT COUNT(1)
          FROM MAT_BC_M
         WHERE HEAT_PLAN_NO_OLD = M.HEAT_PLAN_NO
           AND QCM_STAUS = '00') +
       (SELECT COUNT(1)
          FROM MAT_BC_BACKUP
         WHERE HEAT_PLAN_NO_OLD = M.HEAT_PLAN_NO
           AND QCM_STAUS = '00')
   AND HEAT_PLAN_NO = ?
      
         ]]>
	</query>
		<query id="FrmEndLibrary.updateMOldF" desc="关闭原炉计划">
      <![CDATA[
      UPDATE PLN_ZY_RCL_M M
   SET PLANSTATUS = '40'
 WHERE NOT EXISTS (SELECT 1
          FROM PORT_HTT_BATCH_SAMPLE_RESULT T
         WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND (T.MAT_STATUS = '20' OR
               (T.MAT_STATUS = '00' AND T.INSTORE_FLAG = '0')))
   AND (SELECT SUM(ACT_COUNT)
          FROM QCM_ZG_JUGDE_APPLY
         WHERE HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND JUDGE_RESULT_CODE IS NOT NULL
           AND VALIDFLAG <> '50') >=
       (SELECT COUNT(1)
          FROM MAT_BC_M
         WHERE HEAT_PLAN_NO_OLD = M.HEAT_PLAN_NO
           AND QCM_STAUS = '00') +
       (SELECT COUNT(1)
          FROM MAT_BC_BACKUP
         WHERE HEAT_PLAN_NO_OLD = M.HEAT_PLAN_NO
           AND QCM_STAUS = '00')
   AND HEAT_PLAN_NO =?   
         ]]>
	</query>
		<query id="FrmEndLibrary.updateMOldG" desc="关闭原炉计划">
      <![CDATA[
      UPDATE PLN_ZY_JGX_M M
   SET PLANSTATUS = '40'
 WHERE NOT EXISTS (SELECT 1
          FROM PORT_MCH_BATCH_SAMPLE_RESULT T
         WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND (T.MAT_STATUS = '20' OR
               (T.MAT_STATUS = '00' AND T.INSTORE_FLAG = '0')))
   AND (SELECT SUM(ACT_COUNT)
          FROM QCM_ZG_JUGDE_APPLY
         WHERE HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND JUDGE_RESULT_CODE IS NOT NULL
           AND VALIDFLAG <> '50') >=
       (SELECT COUNT(1)
          FROM MAT_BC_M
         WHERE HEAT_PLAN_NO_OLD = M.HEAT_PLAN_NO
           AND QCM_STAUS = '00') +
       (SELECT COUNT(1)
          FROM MAT_BC_BACKUP
         WHERE HEAT_PLAN_NO_OLD = M.HEAT_PLAN_NO
           AND QCM_STAUS = '00')
   AND HEAT_PLAN_NO = ?
      
         ]]>
	</query>
	<query id="FrmEndLibrary.AddMilPlan" desc="新增轧管炉计划接收表">
            <![CDATA[
            INSERT INTO MIL_PLAN
  (ID,
   SEQ,
   STOVE_NO,
   JUDGE_STOVE_NO,
   LOT_NO,
   CONTRACT_NO,
   IMP_PROCESS,
   PLINE_CODE,
   PRODUCER,
   PROCESS_STATUS,
   DB_LENGTH,
   DB_HEIGHT,
   ROLL_LENGTH,
   SAW_NUM,
   TARGET_LENGTH,
   FINISH_USER,
   TARGET_LIABRARY,
   VARIETIES,
   VARIETIES_CODE,
   PIPE_SIZE,
   PIPE_SIZE_CODE,
   BUCKLE_TYPE,
   BUCKLE_TYPE_CODE,
   LENGTH_RANGE,
   ROLL_STANDRAD,
   PIPE_SECTION,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   STEEL_STANDRAD,
   TARGET,
   BRANCH,
   TON,
   DB_NUM,
   TOM,
   CUT_HEAD_LENGTHP,
   CUT_TRAIL_LENGTHP,
   CONTROL_THICKP,
   PRODUCE_STANDRAD,
   FEED_SEQ,
   LOT_SEQ,
   FEED_HEAT_NO,
   LENGTHCP,
   CODE_SAMPLE_FLAG,
   ROLL_STANDRAD_CODE,
   STD_STYLE,
   STD_STYLE_DESC,
   CHECK_NO,
   ORD_LN_DLY_PK,
   PRT_FLAG,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   TUBE_TYPE,
   TUBE_SUORCE,
   TYPE,
   NODE_STATUS,
   CRAFT_SEQ,CIC,
   INDEX_SEQ,
   PIC,IF_PRODUCT,PRDCR_NO,IF_MONITOR,BACK_SLAB_FLAG,STATUS,IS_LOAD)
VALUES
  ('#ID#',
   '#SEQ#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#LOT_NO#',
   '#CONTRACT_NO#',
   '#IMP_PROCESS#',
   '#PLINE_CODE#',
   '#PRODUCER#',
   '#PROCESS_STATUS#',
   '#DB_LENGTH#',
   '#DB_HEIGHT#',
   '#ROLL_LENGTH#',
   '#SAW_NUM#',
   '#TARGET_LENGTH#',
   '#FINISH_USER#',
   '#TARGET_LIABRARY#',
   '#VARIETIES#',
   '#VARIETIES_CODE#',
   '#PIPE_SIZE#',
   '#PIPE_SIZE_CODE#',
   '#BUCKLE_TYPE#',
   '#BUCKLE_TYPE_CODE#',
   '#LENGTH_RANGE#',
   '#ROLL_STANDRAD#',
   '#PIPE_SECTION#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#STEEL_STANDRAD#',
   '#TARGET#',
   '#BRANCH#',
   '#TON#',
   '#DB_NUM#',
   TO_DATE('#TOM#','YYYY-MM-DD HH24:MI:SS'),
   '#CUT_HEAD_LENGTHP#',
   '#CUT_TRAIL_LENGTHP#',
   '#CONTROL_THICKP#',
   '#PRODUCE_STANDRAD#',
   '#FEED_SEQ#',
   '#LOT_SEQ#',
   '#FEED_HEAT_NO#',
   '#LENGTHCP#',
   '#CODE_SAMPLE_FLAG#',
   '#ROLL_STANDRAD_CODE#',
   '#STD_STYLE#',
   '#STD_STYLE_DESC#',
   '#CHECK_NO#',
   '#ORD_LN_DLY_PK#',
   '#PRT_FLAG#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#TUBE_TYPE#',
   '#TUBE_SUORCE#',
   '#TYPE#','#NODE_STATUS#','#CRAFT_SEQ#','#CIC#','#INDEX_SEQ#','#PIC#','#IF_PRODUCT#','#PRDCR_NO#','#IF_MONITOR#','#BACK_SLAB_FLAG#',
   '#STATUS#','#IS_LOAD#')]]>
	</query>
	<query id = "FrmEndLibrary.UpdatePortMch" desc = "标记管好队列">
		UPDATE PORT_MCH_BATCH_SAMPLE_RESULT T SET T.TR_FLAG = '1'WHERE T.HEAT_PLAN_NO = ? AND T.MAT_NO = ?
	</query>
	<query id = "FrmEndLibrary.UpdatePortMchCancel" desc = "标记管好队列">
		UPDATE PORT_MCH_BATCH_SAMPLE_RESULT T SET T.TR_FLAG = '0'WHERE T.HEAT_PLAN_NO = ? AND T.MAT_NO = ?
	</query>
	<query id = "FrmEndLibrary.getBcMatNo" desc = "查询BC队列">
		SELECT T.*
		FROM MAT_BC_M T, YDM_BC_BUTTRESS S
		WHERE T.MAT_NO = S.MAT_NO
		AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		AND T.BATCH_NO = '#BATCH_NO#'
		AND T.BATCH_GROUD_NO = '#BATCH_GROUD_NO#'
		AND T.QCM_STAUS = '00'
		AND T.PLINE_CODE = '#PLINE_CODE#'
		AND NVL(T.PRO_ORDER_NO,'/') = NVL('#PRO_ORDER_NO#','/')
		AND NVL(T.STD_NAME,'/') = NVL('#STD_NAME#','/')
		ORDER BY TO_NUMBER(T.MEASURING_SEQ) ASC
	</query>
	<query id = "FrmEndLibrary.doFrim" desc = "修改库存信息">
		<![CDATA[
		DECLARE
		BEGIN
		FOR MYROW IN (SELECT *
		FROM (SELECT T.MAT_NO
		FROM MAT_BC_M T
		WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
		AND T.BATCH_NO = '#BATCH_NO#'
		AND T.BATCH_GROUD_NO = '#BATCH_GROUD_NO#'
		AND NVL(T.MATERIAL_NAME,'/') = NVL('#MATERIAL_NAME#','/')
		AND T.PRODUCNAME = '#PRODUCNAME#'
		AND NVL(T.STEELNAME,'/') = NVL('#STEELNAME#','/')
		AND T.SPEC_NAME = '#SPEC_NAME#'
		AND NVL(T.MODEL_DESC,'/') = NVL('#MODEL_DESC#','/')
		AND T.QCM_STAUS = '00'
		AND T.MAT_STATUS IN ('80150101', '80150201')
		ORDER BY T.MAT_NO ASC)
		WHERE ROWNUM <= #ACT_COUNT#) LOOP
		UPDATE MAT_BC_M T
		SET T.MATERIAL_NO    = '#MATERIAL_NO#',
		T.MATERIAL_NAME  = '#MATERIAL_NAMENEW#',
		T.PRODUCCODE     = '#PRODUCCODE#',
		T.PRODUCNAME     = '#PRODUCNAMENEW#',
		T.STEELCODE      = '#STEELCODE#',
		T.STEELNAME      = '#STEELNAMENEW#',
		T.SPEC_CODE      = '#SPEC_CODE#',
		T.SPEC_NAME      = '#SPEC_NAMENEW#',
		T.MODEL_CODE     = '#MODEL_CODE#',
		T.MODEL_DESC     = '#MODEL_DESCNEW#',
		T.STD_STYLE      = '#STD_STYLE#',
		T.STD_STYLE_DESC = '#STD_STYLE_DESCNEW#',
		T.ACT_DIMATER = SUBSTR('#SPEC_NAMENEW#',0,INSTR('#SPEC_NAMENEW#','x')-1),
        T.ACT_HEIGHT = SUBSTR('#SPEC_NAMENEW#',INSTR('#SPEC_NAMENEW#','x')+1)
		WHERE T.MAT_NO = MYROW.MAT_NO;
		END LOOP;
		END;
		]]>
	</query>
	<query id = "FrmEndLibrary.updatePortMch" desc = "修改管号队列炉计划ID">
		UPDATE PORT_MCH_BATCH_SAMPLE_RESULT T SET T.HEAT_PLAN_NO = ? WHERE T.HEAT_PLAN_NO = ? AND T.MAT_NO = ?
	</query>
	<query id = "FrmEndLibrary.updatePortHtt" desc = "修改管号队列炉计划ID">
		UPDATE PORT_HTT_BATCH_SAMPLE_RESULT T SET T.HEAT_PLAN_NO = ? WHERE T.HEAT_PLAN_NO = ? AND T.MAT_NO = ?
		AND  PROCESS_SEQ = ?
	</query>
</queryMap>