<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "出库红冲">
<query id = "FrmOutListRead.doQueryOutList" desc = "查询出库实绩">
SELECT 
       T.OUTSTOCK_PLAN_NO,
       T.OUTSTOCK_DOC,
       T.OUTSTOCK_TYPE_CODE,
       T.OUTSTOCK_TYPE_NAME,
       T.LOT_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STD_CODE,
       T.STD_NAME,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.PRO_ORDER_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       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,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.PRODUCT_FLAG,
       T.MAT_STATUS,
       T.JUDGE_STD_NAME,
       T.JUDGE_STD_CODE,
       T.STORAGE_NO,
       S.STORAGE_NAME,
       MAX(T.OUTSTOCK_TIME)OUTSTOCK_TIME
 FROM YDM_ZC_OUTLIST T LEFT JOIN  YDM_BS_STORAGE S ON T.STORAGE_NO = S.STORAGE_NO
 WHERE T.OUTSTOCK_TYPE_CODE = '800809'
</query>
<query id = "FrmOutListRead.doQueryOutListRead" desc = "查询出库红冲实绩">
SELECT 
       T.OUTSTOCK_PLAN_NO,
       T.OUTSTOCK_DOC,
       T.OUTSTOCK_TYPE_CODE,
       T.OUTSTOCK_TYPE_NAME,
       T.LOT_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STD_CODE,
       T.STD_NAME,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.PRO_ORDER_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       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,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.PRODUCT_FLAG,
       T.MAT_STATUS,
       T.JUDGE_STD_NAME,
       T.JUDGE_STD_CODE,
       T.STORAGE_NO,
       S.STORAGE_NAME,
       to_char(to_date(T.BAL_YEAR_MONTH,'YYYY-MM'),'yyyy-MM') as BAL_YEAR_MONTH,
       MAX(T.OUTSTOCK_TIME)OUTSTOCK_TIME
 FROM YDM_ZC_OUTLIST T LEFT JOIN  YDM_BS_STORAGE S ON T.STORAGE_NO = S.STORAGE_NO
 WHERE T.OUTSTOCK_TYPE_CODE = '800806'
</query>
<query id = "FrmOutListRead.SelectInListCount" desc = "查询出库支数">
<![CDATA[
SELECT COUNT(1) ACT_COUNT
  FROM YDM_ZC_OUTLIST T
 WHERE NVL(T.LOT_NO, '/') = NVL('#LOT_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.PRO_ORDER_NO = '#PRO_ORDER_NO#'
   AND T.ACT_LEN = '#ACT_LEN#'
   AND T.STORAGE_NO = '#STORAGE_NO#'
   AND T.BELONG_CODE || '&' LIKE ('%' || upper(?) || '%')
   ]]>
</query>
<query id = "FrmOutListRead.doPipeRedDased" desc = "出库红冲">
<![CDATA[
DECLARE
  V_OUTSTOCK_DOC YDM_ZC_OUTLIST.OUTSTOCK_DOC%TYPE := NULL;
  V_OUTSTOCK_SQE YDM_ZC_OUTLIST.OUTSTOCK_SQE%TYPE := NULL;
  V_MAT_NO       MAT_ZC_M.MAT_NO%TYPE := NULL;
  V_ICOUNT       NUMBER := 1;
  V_MCOUNT       NUMBER := 1;
  V_TIME         MAT_ZC_M.JUDGE_RESULT_TIME%TYPE := SYSDATE;
  V_DATE         YDM_ZC_OUTLIST.BAL_YEAR_MONTH%TYPE := TO_CHAR(SYSDATE,
                                                               'YYYYMM');

BEGIN

  SELECT ? || TO_CHAR(SYSDATE, 'YYMMDD') ||
         LPAD(NVL(MAX(SUBSTR(T.OUTSTOCK_DOC, LENGTH(T.OUTSTOCK_DOC) - 4)),
                  0) + 1,
              5,
              0) OUTSTOCK_DOC
    INTO V_OUTSTOCK_DOC
    FROM YDM_ZC_OUTLIST T
   WHERE TRUNC(T.CREATE_TIME) = TRUNC(SYSDATE)
     AND T.OUTSTOCK_TYPE_CODE = ?;
  FOR MYROW IN (SELECT T1.*
                  FROM (SELECT T.*,
                               S.HEAT_PLAN_NO,
                               S.ZG_STOVE_SQE,
                               S.PRO_ORDER_ID,
                               S.MAT_GOWHERE_CODE,
                               S.MAT_GOWHERE_NAME,
                               S.TARGET,
                               S.PROCESS_STATUS,
                               S.FIXTYPE_CODE,
                               S.FLAG_STOVE_NO_ZG,
                               S.CRAF_NO,
                               S.PACK_FLAG,
                               S.MAT_RETURN_FLAG,
                               S.CHEM_RESULT_CODE,
                               S.PHY_RESULT_CODE,
                               S.TESTING_TYPE1,
                               S.TESTING_GRADE1,
                               S.ZG_PLINE_CODE,
                               S.ZG_PLINE_NAME,
                               S.ZG_MAT_NO
                          FROM YDM_ZC_OUTLIST T
                          LEFT JOIN MAT_ZC_M S ON T.MAT_NO = S.MAT_NO
                         WHERE T.LOT_NO = '#LOT_NO#'
                           AND T.PRO_ORDER_NO = '#PRO_ORDER_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.ACT_LEN = '#ACT_LEN#'
                           AND T.MAT_STATUS = '#MAT_STATUS#'
                           AND T.STORAGE_NO = '#STORAGE_NO#'
                           AND T.BELONG_CODE || '&' LIKE (upper(?) || '%')
                         ORDER BY T.MAT_NO DESC) T1
                 WHERE ROWNUM <= #ACT_COUNT#) LOOP
    --生成材料号
    SELECT '#JUDGE_STOVE_NO#' || '#BATCH_NO#' ||
           LPAD(NVL(MAX(SUBSTR(T.MAT_NO, LENGTH(T.MAT_NO) - 3)), 0) + 1,
                4,
                0) MAT_NO
      INTO V_MAT_NO
      FROM (SELECT MAX(T1.MAT_NO) MAT_NO
              FROM MAT_ZC_M T1
             WHERE T1.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
               AND T1.BATCH_NO = '#BATCH_NO#'
            UNION ALL
            SELECT MAX(T3.MAT_NO) MAT_NO
              FROM MAT_ZC_BACKUP T3
             WHERE T3.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
               AND T3.BATCH_NO = '#BATCH_NO#') T;
    V_OUTSTOCK_SQE := V_OUTSTOCK_DOC || LPAD(V_ICOUNT, 4, 0);
    INSERT INTO YDM_ZC_OUTLIST
      (OUTSTOCK_SQE,
       OUTSTOCK_DOC,
       OUTSTOCK_TYPE_CODE,
       OUTSTOCK_TYPE_NAME,
       ICCAR_NO,
       VEHICLE_NO,
       MAT_NO,
       LOT_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,
       STORAGE_ATTR,
       STORAGE_ATTR_NAME,
       STORAGE_TYPE_NO,
       STORAGE_TYPE_NAME,
       management_no,
       management_name,
       TAR_STORAGE_NO,
       TAR_LOCATION_NO,
       INSTOCK_TIME,
       OUTSTOCK_TIME,
       MEMO,
       CREATE_NAME,
       CREATE_TIME,
       PRODUCT_FLAG,
       MAT_STATUS,
       JUDGE_STD_NAME,
       JUDGE_STD_CODE,
       PONDER_GROSS_WT,
       BAL_YEAR_MONTH,
       TAR_REC_FLAG,
       ORDER_NO,
       ORDER_SEQ,
       DELIVERY_NO,
       ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK)
    VALUES
      (V_OUTSTOCK_SQE,
       V_OUTSTOCK_DOC,
       '800806',
       '出库红冲',
       '',
       '',
       V_MAT_NO,
       MYROW.LOT_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.BELONG_CODE,
       MYROW.BELONG_NAME,
       MYROW.MAT_GOWHERE_CODE,
       MYROW.MAT_GOWHERE_CODE || '10101',
       '',
       '',
       '',
       '',
       MYROW.MANAGEMENT_NO,
       MYROW.MANAGEMENT_NAME,
       '',
       '',
       MYROW.INSTOCK_TIME,
       V_TIME,
       MYROW.MEMO,
       '',
       V_TIME,
       MYROW.PRODUCT_FLAG,
       MYROW.MAT_STATUS,
       MYROW.JUDGE_STD_NAME,
       MYROW.JUDGE_STD_CODE,
       MYROW.PONDER_GROSS_WT,
       V_DATE,
       '1',
       MYROW.ORDER_NO,
       MYROW.ORDER_SEQ,
       MYROW.DELIVERY_NO,
       MYROW.ORD_PK,
       MYROW.ORD_LN_PK,
       MYROW.ORD_LN_DLY_PK);
       
       INSERT INTO YDM_ZC_OUTLIST_XS
      (OUTSTOCK_SQE,
       OUTSTOCK_DOC,
       OUTSTOCK_TYPE_CODE,
       OUTSTOCK_TYPE_NAME,
       ICCAR_NO,
       VEHICLE_NO,
       MAT_NO,
       LOT_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,
       STORAGE_ATTR,
       STORAGE_ATTR_NAME,
       STORAGE_TYPE_NO,
       STORAGE_TYPE_NAME,
       management_no,
       management_name,
       TAR_STORAGE_NO,
       TAR_LOCATION_NO,
       INSTOCK_TIME,
       OUTSTOCK_TIME,
       MEMO,
       CREATE_NAME,
       CREATE_TIME,
       PRODUCT_FLAG,
       MAT_STATUS,
       JUDGE_STD_NAME,
       JUDGE_STD_CODE,
       PONDER_GROSS_WT,
       BAL_YEAR_MONTH,
       TAR_REC_FLAG,
       ORDER_NO,
       ORDER_SEQ,
       DELIVERY_NO,
       ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK)
    VALUES
      (V_OUTSTOCK_SQE,
       V_OUTSTOCK_DOC,
       '800806',
       '出库红冲',
       '',
       '',
       V_MAT_NO,
       MYROW.LOT_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.BELONG_CODE,
       MYROW.BELONG_NAME,
       MYROW.MAT_GOWHERE_CODE,
       MYROW.MAT_GOWHERE_CODE || '10101',
       '',
       '',
       '',
       '',
       MYROW.MANAGEMENT_NO,
       MYROW.MANAGEMENT_NAME,
       '',
       '',
       MYROW.INSTOCK_TIME,
       V_TIME,
       MYROW.MEMO,
       '',
       V_TIME,
       MYROW.PRODUCT_FLAG,
       MYROW.MAT_STATUS,
       MYROW.JUDGE_STD_NAME,
       MYROW.JUDGE_STD_CODE,
       MYROW.PONDER_GROSS_WT,
       V_DATE,
       '1',
       MYROW.ORDER_NO,
       MYROW.ORDER_SEQ,
       MYROW.DELIVERY_NO,
       MYROW.ORD_PK,
       MYROW.ORD_LN_PK,
       MYROW.ORD_LN_DLY_PK);
  
    INSERT INTO YDM_ZC_BUTTRESS
      (JUDGE_STOVE_NO,
       BATCH_NO,
       BATCH_GROUD_NO,
       STORAGE_NO,
       LOCATION_NO,
       STORAGE_TYPE_NO,
       STORAGE_TYPE_NAME,
       CREATE_NAME,
       MAT_NO,
       CREATE_TIME,
       MANAGEMENT_NO,
       MANAGEMENT_NAME,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC)
    VALUES
      (MYROW.JUDGE_STOVE_NO,
       MYROW.BATCH_NO,
       MYROW.BATCH_GROUD_NO,
       MYROW.STORAGE_NO,
       MYROW.STORAGE_NO || '100101',
       '',
       '',
       ?,
       V_MAT_NO,
       V_TIME,
       ?,
       ?,
       ?,
       ?);
    INSERT INTO MAT_ZC_M
      (JUDGE_STOVE_NO,
       BATCH_NO,
       BATCH_GROUD_NO,
       PRODUCCODE,
       PRODUCNAME,
       STEELCODE,
       STEELNAME,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       BELONG_CODE,
       BELONG_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       ORDER_NO,
       ORDER_SEQ,
       ORDER_SEQ_NO,
       ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK,
       ACT_DIMATER,
       ACT_HEIGHT,
       LEN_NO,
       LEN_DESC,
       LEN_UNIT,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       CREATE_NAME,
       ACT_COUNT,
       ACT_WEIGHT,
       CREATE_TIME,
       INSTOCK_TIME,
       MAT_NO,
       MEMO,
       JUGDE_APPLY_FLAG,
       INSTOCK_FLAG,
       PRODUCT_FLAG,
       MAT_STATUS,
       ACT_LEN,
       JUDGE_STD_NAME,
       BAL_YEAR_MONTH,
       PLINE_CODE,
       PLINE_NAME,
       GRADECODE,
       GRADENAME,
       PIPMEMO,
       OLD_ORDER_NO,
       JUDGE_RESULT_TIME,
       MAT_ORIGIN_CODE,
       MAT_ORIGIN_NAME,
       SOURE_CODE,
       SOURE_NAME,
       MATERIAL_NO,
       MATERIAL_NAME,
       PLN_GRADECODE,
       PLN_GRADENAME,
       PLN_STEELCODE,
       PLN_STEELNAME,
       PRO_ORDER_NO,
       DETECT_RESULT_CODE,
       FACE_RESULT_CODE,
       QCM_STAUS,
       SAMPLE_FLAG,
       HEAT_PLAN_NO,
       ZG_STOVE_SQE,
       PRO_ORDER_ID,
       ZG_MAT_NO,
       MAT_GOWHERE_CODE,
       MAT_GOWHERE_NAME,
       TARGET,
       PROCESS_STATUS,
       PROCESS_CDOE,
       PROCESS_DESC,
       LOT_NO,
       FIXTYPE_CODE,
       FLAG_STOVE_NO_ZG,
       CRAF_NO,
       PACK_FLAG,
       MAT_RETURN_FLAG,
       CHEM_RESULT_CODE,
       PHY_RESULT_CODE,
       TESTING_TYPE1,
       TESTING_GRADE1,
       ZG_PLINE_CODE,
       ZG_PLINE_NAME)
    VALUES
      (MYROW.JUDGE_STOVE_NO,
       MYROW.BATCH_NO,
       MYROW.BATCH_GROUD_NO,
       MYROW.PRODUCCODE,
       MYROW.PRODUCNAME,
       MYROW.STEELCODE,
       MYROW.STEELNAME,
       MYROW.SPEC_CODE,
       MYROW.SPEC_NAME,
       MYROW.MODEL_CODE,
       MYROW.MODEL_DESC,
       MYROW.STD_CODE,
       MYROW.STD_NAME,
       MYROW.BELONG_CODE,
       MYROW.BELONG_NAME,
       MYROW.STD_STYLE,
       MYROW.STD_STYLE_DESC,
       MYROW.ORDER_NO,
       MYROW.ORDER_SEQ,
       MYROW.DELIVERY_NO,
       MYROW.ORD_PK,
       MYROW.ORD_LN_PK,
       MYROW.ORD_LN_DLY_PK,
       MYROW.ACT_DIMATER,
       MYROW.ACT_HEIGHT,
       '',
       '',
       '',
       MYROW.ACT_LEN_MIN,
       MYROW.ACT_LEN_MAX,
       ?,
       MYROW.ACT_COUNT,
       MYROW.ACT_WEIGHT,
       V_TIME,
       V_TIME,
       V_MAT_NO,
       '',
       '1',
       '1',
       MYROW.PRODUCT_FLAG,
       MYROW.MAT_STATUS,
       MYROW.ACT_LEN,
       MYROW.JUDGE_STD_NAME,
       V_DATE,
       MYROW.PLINE_CODE,
       MYROW.PLINE_NAME,
       MYROW.GRADECODE,
       MYROW.GRADENAME,
       MYROW.MEMO,
       '',
       '',
       '801302',
       '机组',
       MYROW.PLINE_CODE,
       MYROW.PLINE_NAME,
       MYROW.MATERIAL_NO,
       MYROW.MATERIAL_NAME,
       MYROW.GRADECODE,
       MYROW.GRADENAME,
       MYROW.STEELCODE,
       MYROW.STEELNAME,
       MYROW.PRO_ORDER_NO,
       '40740401',
       '40740601',
       '00',
       '0',
       MYROW.HEAT_PLAN_NO,
       MYROW.ZG_STOVE_SQE,
       MYROW.PRO_ORDER_ID,
       MYROW.ZG_MAT_NO,
       MYROW.MAT_GOWHERE_CODE,
       MYROW.MAT_GOWHERE_NAME,
       MYROW.TARGET,
       MYROW.PROCESS_STATUS,
       'D',
       '轧制',
       MYROW.LOT_NO,
       MYROW.FIXTYPE_CODE,
       MYROW.FLAG_STOVE_NO_ZG,
       MYROW.CRAF_NO,
       MYROW.PACK_FLAG,
       MYROW.MAT_RETURN_FLAG,
       MYROW.CHEM_RESULT_CODE,
       MYROW.PHY_RESULT_CODE,
       MYROW.TESTING_TYPE1,
       MYROW.TESTING_GRADE1,
       MYROW.ZG_PLINE_CODE,
       MYROW.ZG_PLINE_NAME);
       
       INSERT INTO MAT_ZC_M_XS
      (JUDGE_STOVE_NO,
       BATCH_NO,
       BATCH_GROUD_NO,
       PRODUCCODE,
       PRODUCNAME,
       STEELCODE,
       STEELNAME,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       BELONG_CODE,
       BELONG_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       ORDER_NO,
       ORDER_SEQ,
       ORDER_SEQ_NO,
       ORD_PK,
       ORD_LN_PK,
       ORD_LN_DLY_PK,
       ACT_DIMATER,
       ACT_HEIGHT,
       LEN_NO,
       LEN_DESC,
       LEN_UNIT,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       CREATE_NAME,
       ACT_COUNT,
       ACT_WEIGHT,
       CREATE_TIME,
       INSTOCK_TIME,
       MAT_NO,
       MEMO,
       JUGDE_APPLY_FLAG,
       INSTOCK_FLAG,
       PRODUCT_FLAG,
       MAT_STATUS,
       ACT_LEN,
       JUDGE_STD_NAME,
       BAL_YEAR_MONTH,
       PLINE_CODE,
       PLINE_NAME,
       GRADECODE,
       GRADENAME,
       PIPMEMO,
       OLD_ORDER_NO,
       JUDGE_RESULT_TIME,
       MAT_ORIGIN_CODE,
       MAT_ORIGIN_NAME,
       SOURE_CODE,
       SOURE_NAME,
       MATERIAL_NO,
       MATERIAL_NAME,
       PLN_GRADECODE,
       PLN_GRADENAME,
       PLN_STEELCODE,
       PLN_STEELNAME,
       PRO_ORDER_NO,
       DETECT_RESULT_CODE,
       FACE_RESULT_CODE,
       QCM_STAUS,
       SAMPLE_FLAG,
       HEAT_PLAN_NO,
       ZG_STOVE_SQE,
       PRO_ORDER_ID,
       ZG_MAT_NO,
       MAT_GOWHERE_CODE,
       MAT_GOWHERE_NAME,
       TARGET,
       PROCESS_STATUS,
       PROCESS_CDOE,
       PROCESS_DESC,
       LOT_NO,
       FIXTYPE_CODE,
       FLAG_STOVE_NO_ZG,
       CRAF_NO,
       PACK_FLAG,
       MAT_RETURN_FLAG,
       CHEM_RESULT_CODE,
       PHY_RESULT_CODE,
       TESTING_TYPE1,
       TESTING_GRADE1,
       ZG_PLINE_CODE,
       ZG_PLINE_NAME)
    VALUES
      (MYROW.JUDGE_STOVE_NO,
       MYROW.BATCH_NO,
       MYROW.BATCH_GROUD_NO,
       MYROW.PRODUCCODE,
       MYROW.PRODUCNAME,
       MYROW.STEELCODE,
       MYROW.STEELNAME,
       MYROW.SPEC_CODE,
       MYROW.SPEC_NAME,
       MYROW.MODEL_CODE,
       MYROW.MODEL_DESC,
       MYROW.STD_CODE,
       MYROW.STD_NAME,
       MYROW.BELONG_CODE,
       MYROW.BELONG_NAME,
       MYROW.STD_STYLE,
       MYROW.STD_STYLE_DESC,
       MYROW.ORDER_NO,
       MYROW.ORDER_SEQ,
       MYROW.DELIVERY_NO,
       MYROW.ORD_PK,
       MYROW.ORD_LN_PK,
       MYROW.ORD_LN_DLY_PK,
       MYROW.ACT_DIMATER,
       MYROW.ACT_HEIGHT,
       '',
       '',
       '',
       MYROW.ACT_LEN_MIN,
       MYROW.ACT_LEN_MAX,
       ?,
       MYROW.ACT_COUNT,
       MYROW.ACT_WEIGHT,
       V_TIME,
       V_TIME,
       V_MAT_NO,
       '',
       '1',
       '1',
       MYROW.PRODUCT_FLAG,
       MYROW.MAT_STATUS,
       MYROW.ACT_LEN,
       MYROW.JUDGE_STD_NAME,
       V_DATE,
       MYROW.PLINE_CODE,
       MYROW.PLINE_NAME,
       MYROW.GRADECODE,
       MYROW.GRADENAME,
       MYROW.MEMO,
       '',
       '',
       '801302',
       '机组',
       MYROW.PLINE_CODE,
       MYROW.PLINE_NAME,
       MYROW.MATERIAL_NO,
       MYROW.MATERIAL_NAME,
       MYROW.GRADECODE,
       MYROW.GRADENAME,
       MYROW.STEELCODE,
       MYROW.STEELNAME,
       MYROW.PRO_ORDER_NO,
       '40740401',
       '40740601',
       '00',
       '0',
       MYROW.HEAT_PLAN_NO,
       MYROW.ZG_STOVE_SQE,
       MYROW.PRO_ORDER_ID,
       MYROW.ZG_MAT_NO,
       MYROW.MAT_GOWHERE_CODE,
       MYROW.MAT_GOWHERE_NAME,
       MYROW.TARGET,
       MYROW.PROCESS_STATUS,
       'D',
       '轧制',
       MYROW.LOT_NO,
       MYROW.FIXTYPE_CODE,
       MYROW.FLAG_STOVE_NO_ZG,
       MYROW.CRAF_NO,
       MYROW.PACK_FLAG,
       MYROW.MAT_RETURN_FLAG,
       MYROW.CHEM_RESULT_CODE,
       MYROW.PHY_RESULT_CODE,
       MYROW.TESTING_TYPE1,
       MYROW.TESTING_GRADE1,
       MYROW.ZG_PLINE_CODE,
       MYROW.ZG_PLINE_NAME);
       
    V_ICOUNT := V_ICOUNT + 1;
  END LOOP;
END;
]]>
</query>
<query id = "FrmOutListRead.cancelDoPipeRedDased" desc = "撤销红冲">
<![CDATA[
DECLARE
BEGIN
  FOR MYROW IN (SELECT T1.*
                  FROM (SELECT T.*
                          FROM YDM_ZC_OUTLIST T
                         WHERE T.LOT_NO = '#LOT_NO#'
                           AND T.PRO_ORDER_NO = '#PRO_ORDER_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.OUTSTOCK_DOC = '#OUTSTOCK_DOC#'
                           AND T.OUTSTOCK_TYPE_CODE = '800806'
                           AND T.BELONG_CODE || '&' LIKE (upper(?) || '%')
                         ORDER BY T.MAT_NO DESC) T1
                 WHERE ROWNUM <= ABS(#ACT_COUNT#)) LOOP
       DELETE FROM MAT_ZC_M T WHERE T.MAT_NO = MYROW.MAT_NO;
       DELETE FROM MAT_ZC_M_XS T WHERE T.MAT_NO = MYROW.MAT_NO;
       DELETE FROM YDM_ZC_BUTTRESS S WHERE S.MAT_NO = MYROW.MAT_NO;
       DELETE FROM YDM_ZC_OUTLIST T WHERE T.MAT_NO = MYROW.MAT_NO AND T.OUTSTOCK_TYPE_CODE = '800806';
       DELETE FROM YDM_ZC_OUTLIST_XS T WHERE T.MAT_NO = MYROW.MAT_NO AND T.OUTSTOCK_TYPE_CODE = '800806';
       
  END LOOP;
END;
]]>
</query>
<query id = "FrmOutListRead.adjustBalYearMoth" desc = "调整结转年月">
UPDATE YDM_ZC_OUTLIST T
   SET T.BAL_YEAR_MONTH = ?,
       T.OUTSTOCK_TIME   = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
 WHERE T.OUTSTOCK_DOC = ?
</query>
</queryMap>