<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="钢管倒库出库管理">
	<query id="FrmPipeInventoryOut.getMangement" desc="库存实绩查询">
	<![CDATA[
 SELECT T1.BELONG_CODE,
       T1.BELONG_NAME,
       T1.JUDGE_STOVE_NO,
       T1.BATCH_NO,
       T1.BATCH_GROUD_NO,
       T1.PRODUCT_FLAG,
       --(SELECT T3.BASENAME
         -- FROM COM_BASE_INFO T3
        -- WHERE T3.BASECODE = T1.PRODUCT_FLAG) PRODUCT_FLAG,
      -- (SELECT T3.BASENAME
       --   FROM COM_BASE_INFO T3
       --  WHERE T3.BASECODE = T1.MAT_STATUS) MAT_STATUS,
       T1.MAT_STATUS,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
       T1.ACT_DIMATER,
       T1.ACT_HEIGHT,
       T1.ACT_LEN_MIN,
       T1.ACT_LEN_MAX,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.MATERIAL_NO,
       T1.MATERIAL_NAME,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.ORDER_NO,
       T1.ORDER_SEQ,
       T1.ORDER_SEQ_NO,
       T1.ORD_PK,
       T1.ORD_LN_PK,
       T1.ORD_LN_DLY_PK,
       T1.PRO_ORDER_NO,
       T1.PRO_ORDER_ID,
       TO_CHAR(MIN(T1.INSTOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') INSTOCK_TIME,
       (SELECT T4.STORAGE_NAME
          FROM YDM_BS_STORAGE T4
         WHERE T4.STORAGE_NO = T2.STORAGE_NO) STORAGE_NAME,
       T2.STORAGE_NO,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       T1.STD_STYLE,
       T1.STD_STYLE_DESC,
       T1.MEMO,
       T1.JUDGE_RESULT_CODE,
       T1.JUDGE_RESULT,
       --T1.LOCK_FLAG,
       SUM(NVL(T1.ACT_LEN, 0)) AS ACT_LEN,
       SUM(NVL(T1.ACT_COUNT, 0)) AS ACT_COUNT,
       SUM(NVL(T1.ACT_WEIGHT, 0)) AS ACT_WEIGHT,
       SUM(NVL(T1.ACT_THEORY_WEIGHT, 0)) AS ACT_THEORY_WEIGHT,
       T1.SUPPLY_UNIT_CODE,
       T1.SUPPLY_UNIT
  FROM MAT_ZC_M T1, YDM_ZC_BUTTRESS T2
 WHERE T1.MAT_NO = T2.MAT_NO
   AND T1.MAT_STATUS <>'80150302'
	]]>

	</query>
	<query id="FrmPipeInventoryOut.getOut" desc="查询出库实绩">
	<![CDATA[
     SELECT T1.STOCKTAKING_DOC,
       T1.STOCKTAKING_TYPE_CODE,
       T1.STOCKTAKING_TYPE_NAME,
       T1.STOCKTAKING_RSN_CODE,
       T1.STOCKTAKING_RSN_NAME,
       T1.LOT_NO,
       T1.STOVE_NO,
       T1.JUDGE_STOVE_NO,
       T1.BATCH_NO,
       T1.BATCH_GROUD_NO,
       T1.MATERIAL_NO,
       T1.MATERIAL_NAME,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.GRADECODE,
       T1.GRADENAME,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.STD_STYLE,
       T1.STD_STYLE_DESC,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       T1.PLINE_CODE,
       T1.PLINE_NAME,
       T1.ACT_DIMATER,
       T1.ACT_HEIGHT,
       T1.ACT_LEN,
       TO_CHAR(T1.ACT_LEN_MIN,'FM9990.000') ACT_LEN_MIN,
       TO_CHAR(T1.ACT_LEN_MAX,'FM9990.000') ACT_LEN_MAX,
       NVL(SUM(T1.ACT_COUNT), 0) ACT_COUNT,
       TO_CHAR(NVL(SUM(T1.ACT_WEIGHT), 0),'FM9990.000') ACT_WEIGHT,
       NVL(SUM(T1.ACT_THEORY_WEIGHT), 0) ACT_THEORY_WEIGHT,
       T1.BELONG_CODE,
       T1.BELONG_NAME,
       T1.LOCATION_NO,
       T1.STORAGE_ATTR,
       T1.STORAGE_ATTR_NAME,
       T1.STORAGE_TYPE_NO,
       T1.STORAGE_TYPE_NAME,
       T1.APPROVAL_FLAG,
       T1.MEMO,
       T1.CREATE_NAME,
       TO_CHAR(MIN(T1.CREATE_TIME), 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T1.STORAGE_NO,
       T2.STORAGE_NAME,
       to_char(to_date(T1.BAL_YEAR_MONTH,'YYYY-MM'),'yyyy-MM') as BAL_YEAR_MONTH
  FROM YDM_ZC_STOCKTAKINGLIST T1,YDM_BS_STORAGE T2
 WHERE T1.STORAGE_NO=T2.STORAGE_NO(+)
   AND T1.CREATE_TIME BETWEEN TO_DATE( ?, 'YYYY-MM-DD HH24:MI:SS') AND
       TO_DATE( ?, 'YYYY-MM-DD HH24:MI:SS')
   AND UPPER(T1.JUDGE_STOVE_NO) || '&' LIKE UPPER('%' || ? || '%')
   AND UPPER(T1.STORAGE_NO) || '&' LIKE UPPER('%' || ? || '%')
   AND UPPER(T1.LOCATION_NO) || '&' LIKE UPPER('%' || ? || '%')
   AND T1.STOCKTAKING_TYPE_CODE='800602'
	]]>
	</query>

	<query id="FrmPipeInventoryOut.getMatZcMByInfo" desc="查询库存信息">
	<![CDATA[
	 SELECT T1.MAT_NO,
       T1.PRODUCT_FLAG,
       T1.MAT_STATUS,
       T1.LOT_NO,
       T1.STOVE_NO,
       T1.JUDGE_STOVE_NO,
       T1.BATCH_NO,
       T1.BATCH_GROUD_NO,
       T1.MAT_SQE_NO,
       T1.SAMPLE_FLAG,
       T1.CUTTING_FLAG,
       T1.ORIGIN_MAT_NO,
       T1.MATERIAL_NO,
       T1.MATERIAL_NAME,
       T1.INPUT_MATERIAL_NAME,
       T1.INPUT_MATERIAL_NO,
       T1.INPUT_ORIGIN_CODE,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.GRADECODE,
       T1.GRADENAME,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.STD_STYLE,
       T1.STD_STYLE_DESC,
       T1.PRO_ORDER_NO,
       T1.PRO_ORDER_NO1,
       T1.PRO_ORDER_ID,
       T1.PRO_ORDER_ID1,
       T1.ORDER_NO,
       T1.ORDER_SEQ,
       T1.ORDER_SEQ_NO,
       T1.CRAF_NO,
       T1.PROCESS_CDOE,
       T1.PROCESS_DESC,
       T1.NEXT_PROCESS_CDOE,
       T1.NEXT_PROCESS_DESC,
       T1.PLINE_CODE,
       T1.PLINE_NAME,
       T1.MAT_ORIGIN_CODE,
       T1.MAT_ORIGIN_NAME,
       T1.DIMATER,
       T1.HEIGHT,
       T1.LEN_NO,
       T1.LEN_DESC,
       T1.LEN_UNIT,
       T1.LEN_MIN,
       T1.LEN_MAX,
       T1.TARG_DIMATER,
       T1.TARG_HEIGHT,
       T1.TARG_LEN_MIN,
       T1.TARG_LEN_MAX,
       T1.ACT_DIMATER,
       T1.ACT_HEIGHT,
       T1.ACT_LEN,
       T1.ACT_LEN_MIN,
       T1.ACT_LEN_MAX,
       T1.ACT_COUNT,
       T1.ACT_WEIGHT,
       T1.ACT_THEORY_WEIGHT,
       T1.MEASURE_FLAG,
       T1.BELONG_CODE,
       T1.BELONG_NAME,
       T1.PACK_FLAG,
       T1.PACK_TYPE_CODE,
       T1.PACK_TYPE_NAME,
       T1.PACK_NO,
       T1.PACK_TIME,
       T1.PACK_MAT_WT,
       T1.MAT_GROSS_WT,
       T1.MAT_GOWHERE_CODE,
       T1.MAT_GOWHERE_NAME,
       T1.COOL_HOT_FLAG,
       T1.MAT_RETURN_FLAG,
       T1.HEAT_TREAT_NO,
       T1.POST_FLAG,
       T1.LOCK_FLAG,
       T1.MNG_LOCK_RSN_CODE,
       T1.MNG_LOCK_TIME,
       T1.MNG_LOCK_MAKER,
       T1.MNG_LOCK_REMARK,
       T1.LOCK_RSN_CODE,
       T1.LOCK_TIME,
       T1.LOCK_MAKER,
       T1.LOCK_REMARK,
       T1.UNLOCK_TIME,
       T1.UNLOCK_MAKER,
       T1.UNLOCK_REMARK,
       T1.OLD_ORDER_NO,
       T1.OLD_ORDER_SEQ,
       T1.OLD_ORDER_SEQ_NO,
       T1.OLD_MATERIAL_NO,
       T1.OLD_MATERIAL_NAME,
       T1.REMAIN_RSN_CODE,
       T1.REMAIN_JUGDE_TIME,
       T1.REMAIN_JUGDE_MAKER,
       T1.REMAIN_JUGDE_CODE,
       T1.REMAIN_REMARK,
       T1.JUGDE_APPLY_FLAG,
       T1.JUGDE_APPLY_CODE,
       T1.JUGDE_APPLY_TIME,
       T1.JUGDE_SCAN_TIME,
       T1.FACE_RESULT_CODE,
       T1.FACE_RESULT_TIME,
       T1.FACE_MAKER,
       T1.SPEC_RESULT_CODE,
       T1.SPEC_RESULT_TIME,
       T1.SPEC_MAKER,
       T1.CHEM_RESULT_CODE,
       T1.CHEM_RESULT_TIME,
       T1.CHEM_MAKER,
       T1.PHY_RESULT_CODE,
       T1.PHY_RESULT_TIME,
       T1.PHY_MAKER,
       T1.DETECT_REPORT_NO,
       T1.DETECT_RESULT_CODE,
       T1.WPRESSURE_REPORT_NO,
       T1.WPRESSURE_RESULT_CODE,
       T1.JUDGE_RESULT_CODE,
       T1.JUDGE_RESULT,
       T1.JUDGE_RESULT_TIME,
       T1.JUDGE_MAKER,
       T1.BUG_NO,
       T1.BUG_DEAL,
       T1.REPAIR_FLAG,
       T1.REPAIR_REMARK,
       T1.SAMPLING_FLAG,
       T1.SAMPLING_TYPE,
       T1.SAMPLING_NO,
       T1.CHECKOUT_NO,
       T1.CHEM_STCHECK_NO,
       T1.CHEM_PROCHECK_NO,
       T1.SH_CHECK_NO,
       T1.COME_PROC_FLAG,
       T1.CONFM_FLAG,
       T1.INSTOCK_FLAG,
       T1.INSTOCK_TIME,
       T1.OUTSTOCK_TIME,
       T1.PRO_BC,
       T1. PRO_BZ,
       T1.RPO_TIME,
       T1.BAR_CODE,
       T1.BEGINNING_FLAG,
       T1.MEMO,
       T1.CREATE_NAME,
       T1.CREATE_TIME,
       T1.UPDATE_NAME,
       T1.UPDATE_TIME,
       T1.REQ_BL_ID,
       T1.IF_BATCHED_JG,
       T1.COUPCUT_BATCH_ID,
       T1.ORD_PK,
       T1.ORD_LN_PK,
       T1.ORD_LN_DLY_PK,
       T1.OLD_ORD_PK,
       T1.OLD_ORD_LN_PK,
       T1.OLD_ORD_LN_DLY_PK,
       T2.STORAGE_NO,
       T2.LOCATION_NO,
       T2.STORAGE_ATTR,
       T2.STORAGE_ATTR_NAME,
       T2.STORAGE_TYPE_NO,
       T2.STORAGE_TYPE_NAME,
       T1.IS_DEALER
  FROM MAT_ZC_M T1, YDM_ZC_BUTTRESS T2
 WHERE T1.MAT_NO = T2.MAT_NO
   AND T1.BELONG_CODE = '#BELONG_CODE#'
   AND T1.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
   AND T1.BATCH_NO = '#BATCH_NO#'
   AND T1.BATCH_GROUD_NO = '#BATCH_GROUD_NO#'
   AND T1.SPEC_CODE = '#SPEC_CODE#'
   AND T1.ACT_DIMATER = '#ACT_DIMATER#'
   AND T1.ACT_HEIGHT = '#ACT_HEIGHT#'
   AND T1.ACT_LEN_MIN = '#ACT_LEN_MIN#'
   AND T1.ACT_LEN_MAX = '#ACT_LEN_MAX#'
   AND T1.PRODUCCODE = '#PRODUCCODE#'
   AND T1.STEELCODE = '#STEELCODE#'
   AND NVL(T1.STD_CODE,'/') = NVL('#STD_CODE#','/')
   AND T2.STORAGE_NO = '#STORAGE_NO#'
   AND T1.MODEL_CODE='#MODEL_CODE#'
   AND NVL(T1.STD_STYLE,'/')=NVL('#STD_STYLE#','/')
   AND NVL(T1.MEMO,'/')=NVL('#MEMO#','/')
   AND NVL(T1.JUDGE_RESULT_CODE,'/')=NVL('#JUDGE_RESULT_CODE#','/')
   AND T1.ORD_LN_PK IS NULL
   ORDER BY T1.MAT_NO DESC
	]]>
	</query>

	<query id="FrmPipeInventoryOut.getMageStatusByMononer" desc="查询物料信息状态">
	<![CDATA[
      
SELECT T1.MAT_NO,
       T1.PRODUCT_FLAG,
       T1.MAT_STATUS,
       T1.LOT_NO,
       T1.STOVE_NO,
       T1.JUDGE_STOVE_NO,
       T1.BATCH_NO,
       T1.BATCH_GROUD_NO,
       T1.MAT_SQE_NO,
       T1.SAMPLE_FLAG,
       T1.CUTTING_FLAG,
       T1.ORIGIN_MAT_NO,
       T1.MATERIAL_NO,
       T1.MATERIAL_NAME,
       T1.INPUT_MATERIAL_NAME,
       T1.INPUT_MATERIAL_NO,
       T1.INPUT_ORIGIN_CODE,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.GRADECODE,
       T1.GRADENAME,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.STD_STYLE,
       T1.STD_STYLE_DESC,
       T1.PRO_ORDER_NO,
       T1.PRO_ORDER_NO1,
       T1.PRO_ORDER_ID,
       T1.PRO_ORDER_ID1,
       T1.ORDER_NO,
       T1.ORDER_SEQ,
       T1.ORDER_SEQ_NO,
       T1.CRAF_NO,
       T1.PROCESS_CDOE,
       T1.PROCESS_DESC,
       T1.NEXT_PROCESS_CDOE,
       T1.NEXT_PROCESS_DESC,
       T1.PLINE_CODE,
       T1.PLINE_NAME,
       T1.MAT_ORIGIN_CODE,
       T1.MAT_ORIGIN_NAME,
       T1.DIMATER,
       T1.HEIGHT,
       T1.LEN_NO,
       T1.LEN_DESC,
       T1.LEN_UNIT,
       T1.LEN_MIN,
       T1.LEN_MAX,
       T1.TARG_DIMATER,
       T1.TARG_HEIGHT,
       T1.TARG_LEN_MIN,
       T1.TARG_LEN_MAX,
       T1.ACT_DIMATER,
       T1.ACT_HEIGHT,
       T1.ACT_LEN,
       T1.ACT_LEN_MIN,
       T1.ACT_LEN_MAX,
       T1.ACT_COUNT,
       T1.ACT_WEIGHT,
       T1.ACT_THEORY_WEIGHT,
       T1.MEASURE_FLAG,
       T1.BELONG_CODE,
       T1.BELONG_NAME,
       T1.PACK_FLAG,
       T1.PACK_TYPE_CODE,
       T1.PACK_TYPE_NAME,
       T1.PACK_NO,
       T1.PACK_TIME,
       T1.PACK_MAT_WT,
       T1.MAT_GROSS_WT,
       T1.MAT_GOWHERE_CODE,
       T1.MAT_GOWHERE_NAME,
       T1.COOL_HOT_FLAG,
       T1.MAT_RETURN_FLAG,
       T1.HEAT_TREAT_NO,
       T1.POST_FLAG,
       T1.LOCK_FLAG,
       T1.MNG_LOCK_RSN_CODE,
       T1.MNG_LOCK_TIME,
       T1.MNG_LOCK_MAKER,
       T1.MNG_LOCK_REMARK,
       T1.LOCK_RSN_CODE,
       T1.LOCK_TIME,
       T1.LOCK_MAKER,
       T1.LOCK_REMARK,
       T1.UNLOCK_TIME,
       T1.UNLOCK_MAKER,
       T1.UNLOCK_REMARK,
       T1.OLD_ORDER_NO,
       T1.OLD_ORDER_SEQ,
       T1.OLD_ORDER_SEQ_NO,
       T1.OLD_MATERIAL_NO,
       T1.OLD_MATERIAL_NAME,
       T1.REMAIN_RSN_CODE,
       T1.REMAIN_JUGDE_TIME,
       T1.REMAIN_JUGDE_MAKER,
       T1.REMAIN_JUGDE_CODE,
       T1.REMAIN_REMARK,
       T1.JUGDE_APPLY_FLAG,
       T1.JUGDE_APPLY_CODE,
       T1.JUGDE_APPLY_TIME,
       T1.JUGDE_SCAN_TIME,
       T1.FACE_RESULT_CODE,
       T1.FACE_RESULT_TIME,
       T1.FACE_MAKER,
       T1.SPEC_RESULT_CODE,
       T1.SPEC_RESULT_TIME,
       T1.SPEC_MAKER,
       T1.CHEM_RESULT_CODE,
       T1.CHEM_RESULT_TIME,
       T1.CHEM_MAKER,
       T1.PHY_RESULT_CODE,
       T1.PHY_RESULT_TIME,
       T1.PHY_MAKER,
       T1.DETECT_REPORT_NO,
       T1.DETECT_RESULT_CODE,
       T1.WPRESSURE_REPORT_NO,
       T1.WPRESSURE_RESULT_CODE,
       T1.JUDGE_RESULT_CODE,
       T1.JUDGE_RESULT,
       T1.JUDGE_RESULT_TIME,
       T1.JUDGE_MAKER,
       T1.BUG_NO,
       T1.BUG_DEAL,
       T1.REPAIR_FLAG,
       T1.REPAIR_REMARK,
       T1.SAMPLING_FLAG,
       T1.SAMPLING_TYPE,
       T1.SAMPLING_NO,
       T1.CHECKOUT_NO,
       T1.CHEM_STCHECK_NO,
       T1.CHEM_PROCHECK_NO,
       T1.SH_CHECK_NO,
       T1.COME_PROC_FLAG,
       T1.CONFM_FLAG,
       T1.INSTOCK_FLAG,
       T1.INSTOCK_TIME,
       T1.OUTSTOCK_TIME,
       T1.PRO_BC,
       T1. PRO_BZ,
       T1.RPO_TIME,
       T1.BAR_CODE,
       T1.BEGINNING_FLAG,
       T1.MEMO,
       T1.CREATE_NAME,
       T1.CREATE_TIME,
       T1.UPDATE_NAME,
       T1.UPDATE_TIME,
       T1.REQ_BL_ID,
       T1.IF_BATCHED_JG,
       T1.COUPCUT_BATCH_ID,
       T1.ORD_PK,
       T1.ORD_LN_PK,
       T1.ORD_LN_DLY_PK,
       T1.OLD_ORD_PK,
       T1.OLD_ORD_LN_PK,
       T1.OLD_ORD_LN_DLY_PK,
       T2.STORAGE_NO,
       T2.LOCATION_NO,
       T2.STORAGE_ATTR,
       T2.STORAGE_ATTR_NAME,
       T2.STORAGE_TYPE_NO,
       T2.STORAGE_TYPE_NAME
  FROM MAT_ZC_M T1, YDM_ZC_BUTTRESS T2
 WHERE T1.MAT_NO = T2.MAT_NO
   AND T1.BELONG_CODE = '#BELONG_CODE#'
   AND T1.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
   AND T1.BATCH_NO = '#BATCH_NO#'
   AND T1.BATCH_GROUD_NO = '#BATCH_GROUD_NO#'
   AND T1.SPEC_CODE = '#SPEC_CODE#'
   AND T1.ACT_DIMATER = '#ACT_DIMATER#'
   AND T1.ACT_HEIGHT = '#ACT_HEIGHT#'
   AND T1.ACT_LEN_MIN = '#ACT_LEN_MIN#'
   AND T1.ACT_LEN_MAX = '#ACT_LEN_MAX#'
   AND T1.PRODUCCODE = '#PRODUCCODE#'
   AND T1.STEELCODE = '#STEELCODE#'
   AND NVL(T1.STD_CODE,'/') = NVL('#STD_CODE#','/')
   AND T1.ORDER_NO = '#ORDER_NO#'
   AND T1.ORDER_SEQ = '#ORDER_SEQ#'
   AND T1.ORDER_SEQ_NO = '#ORDER_SEQ_NO#'
   AND T1.ORD_PK = '#ORD_PK#'
   AND T1.ORD_LN_PK = '#ORD_LN_PK#'
   AND T1.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#'
   AND T2.STORAGE_NO = '#STORAGE_NO#'
   AND T1.MODEL_CODE='#MODEL_CODE#'
   AND NVL(T1.STD_STYLE,'/')=NVL('#STD_STYLE#','/')
   AND NVL(T1.MEMO,'/')=NVL('#MEMO#','/')
   AND NVL(T1.JUDGE_RESULT_CODE,'/')=NVL('#JUDGE_RESULT_CODE#','/')
   AND T1.MAT_STATUS = '#MAT_STATUS#'
   ORDER BY T1.MAT_NO DESC
	]]>
	</query>

	<query id="FrmPipeInventoryOut.deleteMatZcMByMatNo" desc="根据材料号删除库存信息">
	<![CDATA[
	DELETE FROM MAT_ZC_M T WHERE T.MAT_NO = ?
	]]>
	</query>


	<query id="FrmPipeInventoryOut.deleteYdmZcButtress" desc="根据材料号删除位置信息">
    <![CDATA[
	 DELETE FROM YDM_ZC_BUTTRESS T WHERE T.MAT_NO = ?
     ]]>
	</query>


	<query id="FrmPipeInventoryOut.addYdmZcOutlit" desc="新增出库实绩记录">
	<![CDATA[
	  INSERT INTO YDM_ZC_OUTLIST(
        ORDER_NO,
        ORDER_SEQ,
        DELIVERY_NO,
        ORD_PK,
        ORD_LN_PK,
        ORD_LN_DLY_PK,
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        TAR_DEPARTMENT_CODE,
        TAR_DEPARTMENT_DESC,
        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_STORAGE_NO,
        TAR_LOCATION_NO,
        TAR_LARY_NO,
        TAR_LOC_NO,
        TAR_STORAGE_ATTR,
        TAR_STORAGE_ATTR_NAME,
        TAR_STORAGE_TYPE_NO,
        TAR_STORAGE_TYPE_NAME,
        TAR_MANAGEMENT_NO,
        TAR_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,
        UPDATE_NAME,
        UPDATE_TIME,
        DELETE_NAME,
        DELETE_TIME,
        BAL_YEAR_MONTH,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT,
        IS_DEALER,
        PROCESS_CDOE,
        PROCESS_DESC)
 VALUES( 
        '#ORDER_NO#',
        '#ORDER_SEQ#',
        '#DELIVERY_NO#',
        '#ORD_PK#',
        '#ORD_LN_PK#',
        '#ORD_LN_DLY_PK#',
        '#DEPARTMENT_CODE#',
        '#DEPARTMENT_DESC#',
        '#TAR_DEPARTMENT_CODE#',
        '#TAR_DEPARTMENT_DESC#',
        '#OUTSTOCK_SQE#',
        '',
        '#OUTSTOCK_DOC#',
        '#OUTSTOCK_TYPE_CODE#',
        '#OUTSTOCK_TYPE_NAME#',
        '',
        '',
        '#MAT_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#',
        '',
        '#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#',
        '',
        '',
        '',
        '',
        '',
        '',
        '',
        '',
        '',
        '',
        '',
        '',
        '0',
        NULL,
        '',
        '',
        NULL,
        '#IN_BC#',
        '#IN_BZ#',
        SYSDATE,
        '',
        '',
        '#MEMO#',
        '0',
        '1',
        '#CREATE_NAME#',
        SYSDATE,
        '#UPDATE_NAME#',
        NULL,
        '#DELETE_NAME#',
        NULL,
        '#BAL_YEAR_MONTH#',
        '#SUPPLY_UNIT_CODE#',
        '#SUPPLY_UNIT#',
        '#IS_DEALER#',
        '#PROCESS_CDOE#',
        '#PROCESS_DESC#')
	]]>
	</query>

	<query id="FrmPipeInventoryOut.getMaxStockTakingDoc" desc="查询最大出库单号">
	<![CDATA[ 
	       SELECT 'TC' ||
       TO_CHAR(TO_NUMBER(NVL(SUBSTR(MAX(T.STOCKTAKING_DOC), 3),
                             TO_CHAR(SYSDATE, 'YYMMDD') || '00000')) + 1) INDEX_SEQ
  FROM YDM_ZC_STOCKTAKINGLIST T
	]]>
	</query>

	<query id="FrmPipeInventoryOut.addStocktakingDoc" desc="新增盘盈实绩">
	<![CDATA[
	 INSERT INTO YDM_ZC_STOCKTAKINGLIST(
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        STOCKTAKING_SQE,
        STOCKTAKING_DOC,
        STOCKTAKING_TYPE_CODE,
        STOCKTAKING_TYPE_NAME,
        STOCKTAKING_RSN_CODE,
        STOCKTAKING_RSN_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,
        RPO_TIME,
        PRO_BC,
        PRO_BZ,
        STOCKTAKING_TIME,
        STOCKTAKING_BC,
        STOCKTAKING_BZ,
        STORAGE_NO,
        LOCATION_NO,
        LARY_NO,
        LOC_NO,
        STORAGE_ATTR,
        STORAGE_ATTR_NAME,
        STORAGE_TYPE_NO,
        STORAGE_TYPE_NAME,
        MANAGEMENT_NO,
        MANAGEMENT_NAME,
        APPROVAL_FLAG,
        MEMO,
        VALIDFLAG,
        CREATE_NAME,
        CREATE_TIME,
        UPDATE_NAME,
        UPDATE_TIME,
        DELETE_NAME,
        DELETE_TIME,
        BAL_YEAR_MONTH,
        SUPPLY_UNIT_CODE,
        SUPPLY_UNIT
        )
 VALUES( 
        '',
        '',
        '#STOCKTAKING_SQE#',
        '#STOCKTAKING_DOC#',
        '#STOCKTAKING_TYPE_CODE#',
        '#STOCKTAKING_TYPE_NAME#',
        '#STOCKTAKING_RSN_CODE#',
        '#STOCKTAKING_RSN_NAME#',
        '#MAT_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#',
        '',
        '#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#',
        NULL,
        '',
        '',
        to_date('#STOCKTAKING_TIME#','yyyy-MM-dd HH24:mi:ss'),
        '',
        '',
        '#STORAGE_NO#',
        '#LOCATION_NO#',
        '',
        '',
        '#STORAGE_ATTR#',
        '#STORAGE_ATTR_NAME#',
        '#STORAGE_TYPE_NO#',
        '#STORAGE_TYPE_NAME#',
        '',
        '',
        '',
        '#MEMO#',
        '1',
        '#CREATE_NAME#',
        SYSDATE,
        '',
        NULL,
        '',
        NULL,
        '#BAL_YEAR_MONTH#',
        '#SUPPLY_UNIT_CODE#',
        '#SUPPLY_UNIT#'
        )
	]]>
	</query>
	<query id = "CorePipeInTemp.queryMatZc" desc = "查询盘亏支数重量长度">
	<![CDATA[
	SELECT SUM(T.ACT_COUNT) ACT_COUNT,
          SUM(T.ACT_WEIGHT) ACT_WEIGHT,
          SUM(T.ACT_LEN) ACT_LEN
     FROM MAT_ZC_M T
    WHERE T.ORD_LN_DLY_PK = ?
      AND ROWNUM < ? order by T.MAT_NO desc
      ]]>
	</query>
<query id = "FrmPipeInventoryOut.updateProcessOut" desc = "盘亏修改进程表">
UPDATE PROCESS_ORDER_M T
   SET T.ONV_NUM = TO_NUMBER(NVL(T.ONV_NUM,0)) + TO_NUMBER(?),
       T.ONV_WGT = TO_NUMBER(NVL(T.ONV_WGT,0)) + TO_NUMBER(?),
       T.ONV_LEN = TO_NUMBER(NVL(T.ONV_LEN,0)) + TO_NUMBER(?)
   WHERE ORD_LN_DLY_PK = ?
</query>
<query id = "FrmPipeInventoryOut.updateYear" desc = "修改结转年月">
<![CDATA[
UPDATE YDM_ZC_STOCKTAKINGLIST T SET T.BAL_YEAR_MONTH = ?,T.STOCKTAKING_TIME = to_date(?,'yyyy-MM-dd HH24:mi:ss') WHERE T.STOCKTAKING_DOC = ?
]]>
</query>
</queryMap>