<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "管材倒垛管理">
<query id = "FrmBcStow.doQueryData" desc = "查询库存信息">
SELECT T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       MAX(T.MATERIAL_NO) MATERIAL_NO,
       MAX(T.MATERIAL_NAME) MATERIAL_NAME,
       MAX(T.PRODUCCODE) PRODUCCODE,
       MAX(T.PRODUCNAME) PRODUCNAME,
       MAX(T.STEELCODE) STEELCODE,
       MAX(T.STEELNAME) STEELNAME,
       MAX(T.GRADECODE) GRADECODE,
       MAX(T.GRADENAME) GRADENAME,
       MAX(T.SPEC_CODE) SPEC_CODE,
       MAX(T.SPEC_NAME) SPEC_NAME,
       MAX(T.MODEL_CODE) MODEL_CODE,
       MAX(T.MODEL_DESC) MODEL_DESC,
       MAX(T.STD_CODE) STD_CODE,
       MAX(T.STD_NAME) STD_NAME,
       MAX(T.STD_STYLE) STD_STYLE,
       MAX(T.STD_STYLE_DESC) STD_STYLE_DESC,
       T.PLINE_CODE,
       T.PLINE_NAME,
       MAX(T.ACT_DIMATER) ACT_DIMATER,
       MAX(T.ACT_HEIGHT) ACT_HEIGHT,
       SUM(T.ACT_LEN)ACT_LEN,
       MAX(T.ACT_LEN_MIN) ACT_LEN_MIN,
       MAX(T.ACT_LEN_MAX) ACT_LEN_MAX,
       SUM(T.ACT_COUNT) ACT_COUNT,
       SUM(T.ACT_WEIGHT) ACT_WEIGHT,
       T.BELONG_CODE,
       T.BELONG_NAME,
       DECODE(T.QCM_STAUS, '00', '合格', '11', '待处理', '22', '废品') QCM_STAUS,
       S.STORAGE_NO,
       (SELECT S1.STORAGE_NAME
          FROM YDM_BS_STORAGE S1
         WHERE S1.STORAGE_NO = S.STORAGE_NO) STORAGE_NAME,
       '0' BAR_CODE
  FROM MAT_BC_M T, YDM_BC_BUTTRESS S
 WHERE T.MAT_NO = S.MAT_NO #INSTOCK_TIME# #JUDGE_STOVE_NO# #STORAGE_NO#
 GROUP BY T.LOT_NO,
          T.STOVE_NO,
          T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.BATCH_GROUD_NO,
          T.PLINE_CODE,
          T.PLINE_NAME,
          T.QCM_STAUS,
          T.BELONG_CODE,
          T.BELONG_NAME,
          S.STORAGE_NO
UNION ALL
SELECT 
T.LOT_NO,
 T.STOVE_NO,
 T.JUDGE_STOVE_NO,
 T.BATCH_NO,
 T.BATCH_GROUD_NO,
 MAX(T.MATERIAL_NO) MATERIAL_NO,
 MAX(T.MATERIAL_NAME) MATERIAL_NAME,
 MAX(T.PRODUCCODE) PRODUCCODE,
 MAX(T.PRODUCNAME) PRODUCNAME,
 MAX(T.STEELCODE) STEELCODE,
 MAX(T.STEELNAME) STEELNAME,
 MAX(T.GRADECODE) GRADECODE,
 MAX(T.GRADENAME) GRADENAME,
 MAX(T.SPEC_CODE) SPEC_CODE,
 MAX(T.SPEC_NAME) SPEC_NAME,
 MAX(T.MODEL_CODE) MODEL_CODE,
 MAX(T.MODEL_DESC) MODEL_DESC,
 MAX(T.STD_CODE) STD_CODE,
 MAX(T.STD_NAME) STD_NAME,
 MAX(T.STD_STYLE) STD_STYLE,
 MAX(T.STD_STYLE_DESC) STD_STYLE_DESC,
 T.PLINE_CODE,
 T.PLINE_NAME,
 MAX(T.ACT_DIMATER) ACT_DIMATER,
 MAX(T.ACT_HEIGHT) ACT_HEIGHT,
 SUM(T.ACT_LEN)ACT_LEN,
 MAX(T.ACT_LEN_MIN) ACT_LEN_MIN,
 MAX(T.ACT_LEN_MAX) ACT_LEN_MAX,
 SUM(T.ACT_COUNT) ACT_COUNT,
 SUM(T.ACT_WEIGHT) ACT_WEIGHT,
 T.BELONG_CODE,
 T.BELONG_NAME,
 '合格' QCM_STAUS,
 T.STORAGE_NO,
 T.STORAGE_NAME,
 '1' BAR_CODE
FROM(
SELECT
 T.LOT_NO,
 T.STOVE_NO,
 T.JUDGE_STOVE_NO,
 T.BATCH_NO,
 T.BATCH_GROUD_NO,
 MAX(T.MATERIAL_NO) MATERIAL_NO,
 MAX(T.MATERIAL_NAME) MATERIAL_NAME,
 MAX(T.PRODUCCODE) PRODUCCODE,
 MAX(T.PRODUCNAME) PRODUCNAME,
 MAX(T.STEELCODE) STEELCODE,
 MAX(T.STEELNAME) STEELNAME,
 MAX(T.GRADECODE) GRADECODE,
 MAX(T.GRADENAME) GRADENAME,
 MAX(T.SPEC_CODE) SPEC_CODE,
 MAX(T.SPEC_NAME) SPEC_NAME,
 MAX(T.MODEL_CODE) MODEL_CODE,
 MAX(T.MODEL_DESC) MODEL_DESC,
 MAX(T.STD_CODE) STD_CODE,
 MAX(T.STD_NAME) STD_NAME,
 MAX(T.STD_STYLE) STD_STYLE,
 MAX(T.STD_STYLE_DESC) STD_STYLE_DESC,
 T.PLINE_CODE,
 T.PLINE_NAME,
 MAX(T.ACT_DIMATER) ACT_DIMATER,
 MAX(T.ACT_HEIGHT) ACT_HEIGHT,
 SUM(T.ACT_LEN)ACT_LEN,
 MAX(T.ACT_LEN_MIN) ACT_LEN_MIN,
 MAX(T.ACT_LEN_MAX) ACT_LEN_MAX,
 SUM(T.ACT_COUNT) ACT_COUNT,
 SUM(T.ACT_WEIGHT) ACT_WEIGHT,
 T.BELONG_CODE,
 T.BELONG_NAME,
 '合格' QCM_STAUS,
 S.STORAGE_NO,
 (SELECT S1.STORAGE_NAME
    FROM YDM_BS_STORAGE S1
   WHERE S1.STORAGE_NO = S.STORAGE_NO) STORAGE_NAME,
 '1' BAR_CODE
  FROM MAT_ZC_M T, YDM_ZC_BUTTRESS S
 WHERE T.MAT_NO = S.MAT_NO
   AND T.PRODUCT_FLAG = '801402'
   AND T.BELONG_CODE IN ('100101', '100102', '100103') #INSTOCK_TIME#
 #JUDGE_STOVE_NO# #STORAGE_NO#
 GROUP BY T.LOT_NO,
          T.STOVE_NO,
          T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.BATCH_GROUD_NO,
          T.PLINE_CODE,
          T.PLINE_NAME,
          T.QCM_STAUS,
          T.BELONG_CODE,
          T.BELONG_NAME,
          S.STORAGE_NO
          UNION ALL
SELECT
 T.LOT_NO,
 T.STOVE_NO,
 T.JUDGE_STOVE_NO,
 T.BATCH_NO,
 T.BATCH_GROUD_NO,
 MAX(T.MATERIAL_NO) MATERIAL_NO,
 MAX(T.MATERIAL_NAME) MATERIAL_NAME,
 MAX(T.PRODUCCODE) PRODUCCODE,
 MAX(T.PRODUCNAME) PRODUCNAME,
 MAX(T.STEELCODE) STEELCODE,
 MAX(T.STEELNAME) STEELNAME,
 MAX(T.GRADECODE) GRADECODE,
 MAX(T.GRADENAME) GRADENAME,
 MAX(T.SPEC_CODE) SPEC_CODE,
 MAX(T.SPEC_NAME) SPEC_NAME,
 MAX(T.MODEL_CODE) MODEL_CODE,
 MAX(T.MODEL_DESC) MODEL_DESC,
 MAX(T.STD_CODE) STD_CODE,
 MAX(T.STD_NAME) STD_NAME,
 MAX(T.STD_STYLE) STD_STYLE,
 MAX(T.STD_STYLE_DESC) STD_STYLE_DESC,
 T.PLINE_CODE,
 T.PLINE_NAME,
 MAX(T.ACT_DIMATER) ACT_DIMATER,
 MAX(T.ACT_HEIGHT) ACT_HEIGHT,
 SUM(T.ACT_LEN)ACT_LEN,
 MAX(T.ACT_LEN_MIN) ACT_LEN_MIN,
 MAX(T.ACT_LEN_MAX) ACT_LEN_MAX,
 SUM(T.ACT_COUNT) ACT_COUNT,
 SUM(T.ACT_WEIGHT) ACT_WEIGHT,
 T.BELONG_CODE,
 T.BELONG_NAME,
 '合格' QCM_STAUS,
 S.STORAGE_NO,
 (SELECT S1.STORAGE_NAME
    FROM YDM_BS_STORAGE S1
   WHERE S1.STORAGE_NO = S.STORAGE_NO) STORAGE_NAME,
 '1' BAR_CODE
  FROM MAT_ZC_M T, YDM_ZC_BUTTRESS S
 WHERE T.MAT_NO = S.MAT_NO
   AND T.PRODUCT_FLAG = '801403'
   AND T.BELONG_CODE IN ('100101', '100102', '100103') #INSTOCK_TIME#
 #JUDGE_STOVE_NO# #STORAGE_NO#
 GROUP BY T.LOT_NO,
          T.STOVE_NO,
          T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.BATCH_GROUD_NO,
          T.PLINE_CODE,
          T.PLINE_NAME,
          T.QCM_STAUS,
          T.BELONG_CODE,
          T.BELONG_NAME,
          S.STORAGE_NO)T
          GROUP BY T.LOT_NO,
          T.STOVE_NO,
          T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.BATCH_GROUD_NO,
          T.PLINE_CODE,
          T.PLINE_NAME,
          T.QCM_STAUS,
          T.BELONG_CODE,
          T.BELONG_NAME,
          T.STORAGE_NO,
          T.STORAGE_NAME
</query>
<query id = "FrmBcStow.doQueryStow" desc = "查询倒垛实绩">
SELECT 
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
    MAX(T.FLAG_STOVE_NO_ZG) FLAG_STOVE_NO_ZG,
       MAX(T.MATERIAL_NO) MATERIAL_NO,
       MAX(T.MATERIAL_NAME) MATERIAL_NAME,
       MAX(T.PRODUCCODE) PRODUCCODE,
       MAX(T.PRODUCNAME) PRODUCNAME,
       MAX(T.STEELCODE) STEELCODE,
       MAX(T.STEELNAME) STEELNAME,
       MAX(T.GRADECODE) GRADECODE,
       MAX(T.GRADENAME) GRADENAME,
       MAX(T.SPEC_CODE) SPEC_CODE,
       MAX(T.SPEC_NAME) SPEC_NAME,
       MAX(T.MODEL_CODE) MODEL_CODE,
       MAX(T.MODEL_DESC) MODEL_DESC,
       MAX(T.STD_CODE) STD_CODE,
       MAX(T.STD_NAME) STD_NAME,
       MAX(T.STD_STYLE) STD_STYLE,
       MAX(T.STD_STYLE_DESC) STD_STYLE_DESC,
       MAX(T.PRO_ORDER_NO) PRO_ORDER_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       MAX(T.ACT_DIMATER) ACT_DIMATER,
       MAX(T.ACT_HEIGHT) 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,
       T.BELONG_CODE,
       T.BELONG_NAME,
       TO_CHAR(T.STOW_TIME, 'YYYY-MM-DD HH24:MI:SS') STOW_TIME,
       T.LOCATION_NO,
       (SELECT T2.LOCATION_NAME FROM YDM_BS_LOCATION T2 WHERE T2.LOCATION_NO = T.LOCATION_NO)LOCATION_NAME,
       T.LARY_NO,
       T.OLD_LOCATION_NO,
       (SELECT T3.LOCATION_NAME FROM YDM_BS_LOCATION T3 WHERE T3.LOCATION_NO = T.OLD_LOCATION_NO)OLD_LOCATION_NAME,
       T.OLD_LARY_NO,
       T.STORAGE_NO,
       (SELECT T1.STORAGE_NAME FROM YDM_BS_STORAGE T1 WHERE T1.STORAGE_NO = T.STORAGE_NO)STORAGE_NAME,
       (SELECT T4.BASENAME FROM COM_BASE_INFO T4 WHERE T4.BASECODE = T.STOW_REASON)STOW_REASON 
 FROM YDM_BC_STOWLIST T
 WHERE 1 = 1
</query>
<query id = "FrmBcStow.queryBcStow" desc = "查询半成品库位">
SELECT a.flag_stove_no_zg,
       T.LOCATION_NO,
       (SELECT T1.LOCATION_NAME FROM YDM_BS_LOCATION T1 WHERE T1.LOCATION_NO = T.LOCATION_NO)LOCATION_NAME,
       T.LARY_NO,
       SUM(A.ACT_COUNT) AS ACT_COUNT
  FROM YDM_BC_BUTTRESS T, MAT_BC_M A
 WHERE T.MAT_NO = A.MAT_NO
   AND A.JUDGE_STOVE_NO = ?
   AND A.BATCH_NO = ?
   AND A.BATCH_GROUD_NO = ?
   AND T.STORAGE_NO = ?
   AND A.PLINE_CODE = ?
 GROUP BY T.LOCATION_NO,a.flag_stove_no_zg,T.LARY_NO
 ORDER BY T.LOCATION_NO ASC
</query>
<query id = "FrmBcStow.queryZcStow" desc = "查询成品库位">
SELECT 
       T.LOCATION_NO,
       (SELECT T1.LOCATION_NAME FROM YDM_BS_LOCATION T1 WHERE T1.LOCATION_NO = T.LOCATION_NO)LOCATION_NAME,
       T.LARY_NO,
       SUM(A.ACT_COUNT) AS ACT_COUNT
  FROM YDM_ZC_BUTTRESS T, MAT_ZC_M A
 WHERE T.MAT_NO = A.MAT_NO
   AND A.JUDGE_STOVE_NO = ?
   AND A.BATCH_NO = ?
   AND A.BATCH_GROUD_NO = ?
   AND T.STORAGE_NO = ?
   AND A.PLINE_CODE = ?
 GROUP BY T.LOCATION_NO,T.LARY_NO
 ORDER BY T.LOCATION_NO ASC
</query>
<query id = "FrmBcStow.getLocationNo" desc = "获取料位">
SELECT T.LOCATION_NAME,T.LOCATION_NO FROM YDM_BS_LOCATION T WHERE T.STORAGE_NO = ?
</query>
<query id = "FrmBcStow.doAddLocationNo" desc = "倒垛">
<![CDATA[
DECLARE
  V_STOW_SQE YDM_GP_STOWLIST.STOW_SQE%TYPE := NULL; --倒垛流水
  V_TIME     YDM_GP_STOWLIST.CREATE_TIME%TYPE := SYSDATE;
BEGIN
  IF(#BAR_CODE# = 0)THEN
  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
                  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.FLAG_STOVE_NO_ZG='#FLAG_STOVE_NO_ZG#'
                   AND T.BATCH_GROUD_NO = '#BATCH_GROUD_NO#'
                   AND T.PLINE_CODE = '#PLINE_CODE#'
                   AND S.STORAGE_NO = '#STORAGE_NO#'
                   AND NVL(S.LOCATION_NO,'/')= NVL('#OLD_LOCATION_NO#','/')
                   AND NVL(S.LARY_NO,'1') = NVL('#OLD_LARY_NO#','1')
                   AND ROWNUM <= #ACT_COUNT#
                 ORDER BY T.MAT_NO DESC) LOOP
    SELECT MYROW.MAT_NO ||
           LPAD(NVL(MAX(SUBSTR(STOW_SQE, LENGTH(STOW_SQE) - 3)), 0) + 1,
                4,
                0) STOW_SQE
      INTO V_STOW_SQE
      FROM YDM_BC_STOWLIST T
     WHERE MAT_NO = MYROW.MAT_NO;
     INSERT INTO YDM_BC_STOWLIST(
     FLAG_STOVE_NO_ZG,
        STOW_SQE,
        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,
        STOW_TIME,
        STOW_BC,
        STOW_BZ,
        LOCATION_NO,
        LARY_NO,
        LOC_NO,
        OLD_LOCATION_NO,
        OLD_LARY_NO,
        OLD_LOC_NO,
        MANAGEMENT_NO,
        MANAGEMENT_NAME,
        CREATE_NAME,
        CREATE_TIME,
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        STORAGE_NO,
        STOW_REASON)
 VALUES(
       '#FLAG_STOVE_NO_ZG#',
        V_STOW_SQE,
        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,
        V_TIME,
        '#STOW_BC#',
        '#STOW_BZ#',
        '#LOCATION_NO#',
        '#LARY_NO#',
        '#LOC_NO#',
        MYROW.LOCATION_NO,
        MYROW.LARY_NO,
        MYROW.LOC_NO,
        '#MANAGEMENT_NO#',
        '#MANAGEMENT_NAME#',
        '#CREATE_NAME#',
        V_TIME,
        '#DEPARTMENT_CODE#',
        '#DEPARTMENT_DESC#',
        MYROW.STORAGE_NO,
        '#STOW_REASON#');
    UPDATE YDM_BC_BUTTRESS T
       SET T.LOCATION_NO = '#LOCATION_NO#', T.LARY_NO = '#LARY_NO#'
     WHERE T.MAT_NO = MYROW.MAT_NO;
  END LOOP;
  ELSE
  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
                  FROM MAT_ZC_M T, YDM_ZC_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.PLINE_CODE = '#PLINE_CODE#'
                   AND S.STORAGE_NO = '#STORAGE_NO#'
                   AND NVL(S.LOCATION_NO,'/')= NVL('#OLD_LOCATION_NO#','/')
                   AND NVL(S.LARY_NO,'1') = NVL('#OLD_LARY_NO#','1')
                   AND ROWNUM <= #ACT_COUNT#
                 ORDER BY T.MAT_NO DESC) LOOP
    SELECT MYROW.MAT_NO ||
           LPAD(NVL(MAX(SUBSTR(STOW_SQE, LENGTH(STOW_SQE) - 3)), 0) + 1,
                4,
                0) STOW_SQE
      INTO V_STOW_SQE
      FROM YDM_BC_STOWLIST T
     WHERE MAT_NO = MYROW.MAT_NO;
     INSERT INTO YDM_BC_STOWLIST(
     FLAG_STOVE_NO_ZG,
        STOW_SQE,
        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,
        STOW_TIME,
        STOW_BC,
        STOW_BZ,
        LOCATION_NO,
        LARY_NO,
        LOC_NO,
        OLD_LOCATION_NO,
        OLD_LARY_NO,
        OLD_LOC_NO,
        MANAGEMENT_NO,
        MANAGEMENT_NAME,
        CREATE_NAME,
        CREATE_TIME,
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        STORAGE_NO,
        STOW_REASON)
 VALUES(
 '#FLAG_STOVE_NO_ZG#',
        V_STOW_SQE,
        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,
        V_TIME,
        '#STOW_BC#',
        '#STOW_BZ#',
        '#LOCATION_NO#',
        '#LARY_NO#',
        '#LOC_NO#',
        MYROW.LOCATION_NO,
        MYROW.LARY_NO,
        MYROW.LOC_NO,
        '#MANAGEMENT_NO#',
        '#MANAGEMENT_NAME#',
        '#CREATE_NAME#',
        V_TIME,
        '#DEPARTMENT_CODE#',
        '#DEPARTMENT_DESC#',
        MYROW.STORAGE_NO,
        '#STOW_REASON#');
    UPDATE YDM_ZC_BUTTRESS T
       SET T.LOCATION_NO = '#LOCATION_NO#', T.LARY_NO = '#LARY_NO#'
     WHERE T.MAT_NO = MYROW.MAT_NO;
     UPDATE YDM_ZC_LOADVEHICLE_MAT T
       SET T.LOCATION_NO = '#LOCATION_NO#'
     WHERE T.MAT_NO = MYROW.MAT_NO;
     UPDATE YDM_ZC_BILL_C T
       SET T.LOCATION_NO = '#LOCATION_NO#'
     WHERE T.MAT_NO = MYROW.MAT_NO;
     UPDATE YDM_ZC_TALLYSHEET_C T
       SET T.LOCATION_NO = '#LOCATION_NO#'
     WHERE T.MAT_NO = MYROW.MAT_NO;
  END LOOP;
  END IF;
END;
]]>
</query>
<query id = "FrmBcStow.doQueryStowReson" desc = "查询倒垛原因">
SELECT T.BASENAME,T.BASECODE FROM COM_BASE_INFO T WHERE T.SORTCODE = '8020'
ORDER BY T.BASECODE ASC
</query>
</queryMap>