<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="钢管盘盈管理">
	<query id="FrmPipeInventoryIn.getYdmZcStocktakingList" 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,
       T3.ORDER_NO,
       T3.ORDER_SEQ,
       T3.ORDER_SEQ_NO,
       to_char(to_date(t1.BAL_YEAR_MONTH,'YYYY-MM'),'yyyy-MM') as BAL_YEAR_MONTH,
       T1.SUPPLY_UNIT_CODE,
       T1.SUPPLY_UNIT
  FROM YDM_ZC_STOCKTAKINGLIST T1
  left join YDM_BS_STORAGE T2 on
  T1.STORAGE_NO=T2.STORAGE_NO
  left join mat_zc_m T3 on 
  T1.MAT_NO = T3.MAT_NO
 WHERE 
    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='800601'
		]]>
	</query>

  <query id="FrmPipeInventoryIn.getYdmZcStocktakingList1" 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,
       T1.PRO_ORDER_NO,
       TO_CHAR(MIN(T1.CREATE_TIME), 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T1.STORAGE_NO,
       T2.STORAGE_NAME,
       T3.ORDER_NO,
       T3.ORDER_SEQ,
       T3.ORDER_SEQ_NO,
       to_char(to_date(t1.BAL_YEAR_MONTH,'YYYY-MM'),'yyyy-MM') as BAL_YEAR_MONTH
  FROM YDM_BC_STOCKTAKINGLIST T1
  left join YDM_BS_STORAGE T2 on
  T1.STORAGE_NO=T2.STORAGE_NO
  left join mat_bc_m T3 on 
  T1.MAT_NO = T3.MAT_NO
 WHERE 
    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='800601'
		]]>
	</query>

	<query id="FrmPipeInventoryIn.getPsc" desc="查询产品码信息">
	<![CDATA[ 
	     SELECT PSC,
       PSC_DESC,
       PRODUCCODE,
       PRODUCNAME,
       STD_CODE,
       STD_NAME,
       STEELCODE,
       STEELNAME,
       STD_STYLE,
       STD_STYLE_DESC
  FROM COM_PSC T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.PSC_DESC, T.PRODUCNAME, T.STD_NAME, T.STEELNAME	     
	]]>
	</query>

	<query id="FrmPipeInventoryIn.getLocationNo" desc="查询料位号">
	<![CDATA[ 
	    SELECT LOCATION_NO,LOCATION_NAME
  FROM YDM_BS_LOCATION T
 WHERE T.STORAGE_NO = ?
   AND T.VALIDFLAG = '1' 
   ORDER BY T.LOCATION_NO 
	]]>
	</query>

	<query id="FrmPipeInventoryIn.getMaterial" desc="查询物料信息">
	<![CDATA[ 
	      SELECT MATERIAL_NO,
       MATERIAL_DESC,
       PRODUCCODE,
       PRODUCNAME,
       PRODUC_JX,
       PRODUC_ENG,
       STD_STYLE,
       STD_STYLE_DESC,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       DIMATER,
       HEIGHT,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC
  FROM SLM_BASE_MATERIAL T
 WHERE T.PRODUCCODE = ?
   AND T.STEELCODE = ?
   AND NVL(T.STD_STYLE, '/') = NVL(?, '/')
	]]>
	</query>

<query id="FrmPipeInventoryIn.getMaterial1" desc="查询物料信息">
	<![CDATA[ 
	      SELECT MATERIAL_NO,
       MATERIAL_DESC,
       PRODUCCODE,
       PRODUCNAME,
       PRODUC_JX,
       PRODUC_ENG,
       STD_STYLE,
       STD_STYLE_DESC,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       DIMATER,
       HEIGHT,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC
  FROM SLM_BASE_MATERIAL T
	]]>
	</query>

	<query id="FrmPipeInventoryIn.getPline" desc="查询产线">
	<![CDATA[ 
SELECT PLINE_CODE, PLINE_NAME
  FROM COM_BASE_PLINE T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.PLINE_CODE ASC
	]]>
	</query>
	<query id="FrmPipeInventoryIn.getPline1" desc="查询产线">
		<![CDATA[
SELECT PLINE_CODE, PLINE_NAME
  FROM COM_BASE_PLINE T
 WHERE T.VALIDFLAG = '1'
 AND T.SUPPLY_UNIT_CODE = ?
 ORDER BY T.PLINE_CODE ASC
	]]>
	</query>

	<query id="FrmPipeInventoryIn.getmagStatus" desc="查询材料状态">
	<![CDATA[ 
	   SELECT T.BASECODE, T.BASENAME
  FROM COM_BASE_INFO T
 WHERE T.SORTCODE = ?
   AND T.VALIDFLAG = '1'
   ORDER BY T.BASECODE
	]]>
	</query>


	<query id="FrmPipeInventoryIn.getSourse" desc="查询材料来源">
	<![CDATA[ 
	   SELECT T.BASECODE, T.BASENAME
  FROM COM_BASE_INFO T
 WHERE T.SORTCODE = ?
   AND T.VALIDFLAG = '1'
   ORDER BY T.BASECODE
	]]>
	</query>


	<query id="FrmPipeInventoryIn.getBelongCode" desc="查询属权单位">
	<![CDATA[ 
	SELECT T.DEPARTID, T.DEPARTNAME
  FROM CORE.CORE_APP_DEPARTMENT T
 WHERE T.DEPTTYPE = '1'
    OR T.DEPTTYPE = '2'
   AND T.DEPARTID != '002001019'
   AND T.DEPARTID != '002'
   AND T.DEPARTID != '002001'
   AND T.DEPARTID != '001'
   AND T.DEPARTID IN ('002023005', '002001001')
    OR T.DEPTTYPE = '3'
   AND T.DEPARTID = '002023005'
	]]>
	</query>
	<query id="FrmPipeInventoryIn.addMatZcM" desc="新增物料信息">
	<![CDATA[ 
	    INSERT INTO MAT_ZC_M
  (STD_CODE,
   STD_NAME,
   STD_STYLE,
   STD_STYLE_DESC,
   PRO_ORDER_NO,
   PRO_ORDER_NO1,
   PRO_ORDER_ID,
   PRO_ORDER_ID1,
   ORDER_NO,
   ORDER_SEQ,
   ORDER_SEQ_NO,
   CRAF_NO,
   PROCESS_CDOE,
   PROCESS_DESC,
   NEXT_PROCESS_CDOE,
   NEXT_PROCESS_DESC,
   PLINE_CODE,
   PLINE_NAME,
   MAT_ORIGIN_CODE,
   MAT_ORIGIN_NAME,
   DIMATER,
   HEIGHT,
   LEN_NO,
   LEN_DESC,
   LEN_UNIT,
   LEN_MIN,
   LEN_MAX,
   TARG_DIMATER,
   TARG_HEIGHT,
   TARG_LEN_MIN,
   TARG_LEN_MAX,
   ACT_DIMATER,
   ACT_HEIGHT,
   ACT_LEN,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   ACT_COUNT,
   ACT_WEIGHT,
   ACT_THEORY_WEIGHT,
   MEASURE_FLAG,
   BELONG_CODE,
   BELONG_NAME,
   PACK_FLAG,
   PACK_TYPE_CODE,
   PACK_TYPE_NAME,
   PACK_NO,
   PACK_TIME,
   PACK_MAT_WT,
   MAT_GROSS_WT,
   MAT_GOWHERE_CODE,
   MAT_GOWHERE_NAME,
   COOL_HOT_FLAG,
   MAT_RETURN_FLAG,
   HEAT_TREAT_NO,
   POST_FLAG,
   LOCK_FLAG,
   MNG_LOCK_RSN_CODE,
   MNG_LOCK_TIME,
   MNG_LOCK_MAKER,
   MNG_LOCK_REMARK,
   LOCK_RSN_CODE,
   LOCK_TIME,
   LOCK_MAKER,
   LOCK_REMARK,
   UNLOCK_TIME,
   UNLOCK_MAKER,
   UNLOCK_REMARK,
   OLD_ORDER_NO,
   OLD_ORDER_SEQ,
   OLD_ORDER_SEQ_NO,
   OLD_MATERIAL_NO,
   OLD_MATERIAL_NAME,
   REMAIN_RSN_CODE,
   REMAIN_JUGDE_TIME,
   REMAIN_JUGDE_MAKER,
   REMAIN_JUGDE_CODE,
   REMAIN_REMARK,
   JUGDE_APPLY_FLAG,
   JUGDE_APPLY_CODE,
   JUGDE_APPLY_TIME,
   JUGDE_SCAN_TIME,
   FACE_RESULT_CODE,
   FACE_RESULT_TIME,
   FACE_MAKER,
   SPEC_RESULT_CODE,
   SPEC_RESULT_TIME,
   SPEC_MAKER,
   CHEM_RESULT_CODE,
   CHEM_RESULT_TIME,
   CHEM_MAKER,
   PHY_RESULT_CODE,
   PHY_RESULT_TIME,
   PHY_MAKER,
   DETECT_REPORT_NO,
   DETECT_RESULT_CODE,
   WPRESSURE_REPORT_NO,
   WPRESSURE_RESULT_CODE,
   JUDGE_RESULT_CODE,
   JUDGE_RESULT,
   JUDGE_RESULT_TIME,
   JUDGE_MAKER,
   BUG_NO,
   BUG_DEAL,
   REPAIR_FLAG,
   REPAIR_REMARK,
   SAMPLING_FLAG,
   SAMPLING_TYPE,
   SAMPLING_NO,
   CHECKOUT_NO,
   CHEM_STCHECK_NO,
   CHEM_PROCHECK_NO,
   SH_CHECK_NO,
   COME_PROC_FLAG,
   CONFM_FLAG,
   INSTOCK_FLAG,
   INSTOCK_TIME,
   MAT_NO,
   PRODUCT_FLAG,
   MAT_STATUS,
   LOT_NO,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   MAT_SQE_NO,
   SAMPLE_FLAG,
   CUTTING_FLAG,
   ORIGIN_MAT_NO,
   MATERIAL_NO,
   MATERIAL_NAME,
   INPUT_MATERIAL_NAME,
   INPUT_MATERIAL_NO,
   INPUT_ORIGIN_CODE,
   PRODUCCODE,
   PRODUCNAME,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   SPEC_CODE,
   SPEC_NAME,
   MODEL_CODE,
   MODEL_DESC,
   ORD_PK,
   ORD_LN_PK,
   ORD_LN_DLY_PK,
   OLD_ORD_PK,
   OLD_ORD_LN_PK,
   OLD_ORD_LN_DLY_PK,
   OUTSTOCK_TIME,
   PRO_BC,
   PRO_BZ,
   RPO_TIME,
   BAR_CODE,
   BEGINNING_FLAG,
   MEMO,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   REQ_BL_ID,
   IF_BATCHED_JG,
   COUPCUT_BATCH_ID,
   BAL_YEAR_MONTH,
   SOURE_CODE,
   SOURE_NAME,
   SUPPLY_UNIT_CODE,
   SUPPLY_UNIT,
   IS_DEALER,
   PROCESS_CDOE,
   PROCESS_DESC
   )
VALUES
  ('#STD_CODE#',
   '#STD_NAME#',
   '#STD_STYLE#',
   '#STD_STYLE_DESC#',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#MAT_ORIGIN_CODE#',
   '#MAT_ORIGIN_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,
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   NULL,
   '',
   '',
   '',
   NULL,
   '',
   '',
   NULL,
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   NULL,
   '',
   '',
   '',
   '',
   '',
   NULL,
   NULL,
   '',
   NULL,
   '',
   '',
   NULL,
   '',
   '',
   NULL,
   '',
   '',
   NULL,
   '',
   '',
   '',
   '',
   '',
   '#JUDGE_RESULT_CODE#',
   '#JUDGE_RESULT#',
   NULL,
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   '',
   SYSDATE,
   '#MAT_NO#',
   '#PRODUCT_FLAG#',
   '#MAT_STATUS#',
   '',
   '',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#BATCH_GROUD_NO#',
   '',
   '',
   '',
   '',
   '#MATERIAL_NO#',
   '#MATERIAL_NAME#',
   '',
   '',
   '',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#SPEC_CODE#',
   '#SPEC_NAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '',
   '',
   '',
   '',
   '',
   '',
   NULL,
   '',
   '',
   NULL,
   '',
   '',
   '#MEMO#',
   '#CREATE_NAME#',
   NULL,
   '',
   NULL,
   '',
   '',
   '',
   '#BAL_YEAR_MONTH#',
   '#SOURE_CODE#',
   '#SOURE_NAME#',
   '#SUPPLY_UNIT_CODE#',
   '#SUPPLY_UNIT#',
   '0',
   '#PROCESS_CDOE#',
   '#PROCESS_DESC#'
   )
	]]>
	</query>

   <query id="FrmPipeInventoryIn.addMatZcM1" desc="新增物料信息">
	<![CDATA[ 
	    INSERT INTO MAT_BC_M
  (STD_CODE,
   STD_NAME,
   STD_STYLE,
   STD_STYLE_DESC,
   PLINE_CODE,
   PLINE_NAME,
   MAT_ORIGIN_CODE,
   MAT_ORIGIN_NAME,
   
   ACT_DIMATER,
   ACT_HEIGHT,
   ACT_LEN,
   ACT_LEN_MIN,
   ACT_LEN_MAX,
   ACT_COUNT,
   ACT_WEIGHT,
   ACT_THEORY_WEIGHT,
   MEASURE_FLAG,
   BELONG_CODE,
   BELONG_NAME,
   
   
   
   
   
   JUDGE_RESULT_CODE,
   JUDGE_RESULT,
   JUDGE_RESULT_TIME,
   JUDGE_MAKER,

   INSTOCK_TIME,
   MAT_NO,
   PRODUCT_FLAG,
   MAT_STATUS,
   LOT_NO,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   SAMPLE_FLAG,
   MATERIAL_NO,
   MATERIAL_NAME,
   INPUT_MATERIAL_NAME,
   INPUT_MATERIAL_NO,
   PRODUCCODE,
   PRODUCNAME,
   STEELCODE,
   STEELNAME,
   GRADECODE,
   GRADENAME,
   SPEC_CODE,
   SPEC_NAME,
   MODEL_CODE,
   MODEL_DESC,
   ORD_PK,
   ORD_LN_PK,
   ORD_LN_DLY_PK,
   BAR_CODE,
   MEMO,
   CREATE_NAME,
   CREATE_TIME,
   BAL_YEAR_MONTH,
   SOURE_CODE,
   SOURE_NAME,
   QCM_STAUS,
   PROCESS_CDOE,
   PROCESS_DESC,
   PRO_ORDER_NO,
   FLAG_STOVE_NO_ZG,
   INSTOCK_FLAG,
   TARGET
   )
VALUES
  ('#STD_CODE#',
   '#STD_NAME#',
   '#STD_STYLE#',
   '#STD_STYLE_DESC#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#MAT_ORIGIN_CODE#',
   '#MAT_ORIGIN_NAME#',
   '#ACT_DIMATER#',
   '#ACT_HEIGHT#',
   '#ACT_LEN#',
   '#ACT_LEN_MIN#',
   '#ACT_LEN_MAX#',
   '#ACT_COUNT#',
   '#ACT_WEIGHT#',
   '#ACT_THEORY_WEIGHT#',
   '',
   '#BELONG_CODE#',
   '#BELONG_NAME#',
   '#JUDGE_RESULT_CODE#',
   '#JUDGE_RESULT#',
   NULL,
   '',
   TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'),
   '#MAT_NO#',
   '#PRODUCT_FLAG#',
   '#MAT_STATUS#',
   '',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#BATCH_GROUD_NO#',
   '0',
   '#MATERIAL_NO#',
   '#MATERIAL_NAME#',
   '',
   '',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#GRADECODE#',
   '#GRADENAME#',
   '#SPEC_CODE#',
   '#SPEC_NAME#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '',
   '',
   '',
   '',
   '#MEMO#',
   '#CREATE_NAME#',
   TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'),
   '#BAL_YEAR_MONTH#',
   '#SOURE_CODE#',
   '#SOURE_NAME#',
   '00',
   '#PROCESS_CDOE#',
   '#PROCESS_DESC#',
   '#PRO_ORDER_NO#',
   '#JUDGE_STOVE_NO#',
   '1',
   '#TARGET#')
	]]>
	</query>

	<query id="FrmPipeInventoryIn.addYdmZcButtress" desc="新增物料位置">
		<![CDATA[
	      INSERT INTO YDM_ZC_BUTTRESS
  (
   MAT_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   STORAGE_NO,
   LOCATION_NO,
   STORAGE_ATTR,
   STORAGE_ATTR_NAME,
   STORAGE_TYPE_NO,
   STORAGE_TYPE_NAME,
   MEMO,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,  SYSDATE)
		]]>
	</query>

<query id="FrmPipeInventoryIn.addYdmZcButtress1" desc="新增物料位置">
		<![CDATA[
	      INSERT INTO YDM_BC_BUTTRESS
  (
   MAT_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   BATCH_GROUD_NO,
   STORAGE_NO,
   LOCATION_NO,
   LARY_NO,
   STORAGE_ATTR,
   STORAGE_ATTR_NAME,
   STORAGE_TYPE_NO,
   STORAGE_TYPE_NAME,
   MEMO,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  (?, ?, ?, ?, ?, ?,'1', ?, ?, ?, ?, ?, ?,  SYSDATE)
		]]>
	</query>

	<query id="FrmPipeInventoryIn.getStorgeInfo" desc="查询仓库信息">
	 <![CDATA[
	     SELECT STORAGE_NO,
       STORAGE_NAME,
       STORAGE_ATTR,
       STORAGE_ADDR_NO,
       STORAGE_ADDR_NAME,
       STORAGE_TYPE_NO,
       STORAGE_TYPE_NAME,
       X_COORDINATE,
       Y_COORDINATE,
       MANAGEMENT_NO,
       MANAGEMENT_NAME,
       HL_MANAGEMENT_NO,
       HL_MANAGEMENT_NAME,
       DUMMY_FLAG,
       MEMO,
       VALIDFLAG,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       STORAGE_ATTR_NAME,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC
  FROM YDM_BS_STORAGE T
 WHERE T.STORAGE_NO = ?
	     
	 ]]>
	</query>


	<query id="FrmPipeInventoryIn.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,
        '',
        '',
        NULL,
        '',
        '',
        '#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="FrmPipeInventoryIn.addStocktakingDoc1" desc="新增盘盈实绩">
	<![CDATA[
	 INSERT INTO YDM_BC_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)
 VALUES( 
        '',
        '',
        '#STOCKTAKING_SQE#',
        '#STOCKTAKING_DOC#',
        '#STOCKTAKING_TYPE_CODE#',
        '#STOCKTAKING_TYPE_NAME#',
        '#STOCKTAKING_RSN_CODE#',
        '#STOCKTAKING_RSN_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#',
        '#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#',
        NULL,
        '',
        '',
        NULL,
        '',
        '',
        '#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#')
	]]>
	</query>


	<query id="FrmPipeInventoryIn.addYdmZcInlist" desc="新增入库信息">
		<![CDATA[
	   INSERT INTO YDM_ZC_INLIST
  (ORD_PK,
   ORD_LN_PK,
   ORD_LN_DLY_PK,
   DEPARTMENT_CODE,
   DEPARTMENT_DESC,
   INSTOCK_SQE,
   INSTOCK_DOC,
   INSTOCK_TYPE_CODE,
   INSTOCK_TYPE_NAME,
   INSTOCK_BAR_CODE,
   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,
   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,
   PRO_BC,
   PRO_BZ,
   INSTOCK_TIME,
   IN_BC,
   IN_BZ,
   BAR_CODE,
   HAND_FLAG,
   MEMO,
   VALIDFLAG,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   DELETE_NAME,
   DELETE_TIME,
   BAL_YEAR_MONTH,
   SOURE_CODE,
   SOURE_NAME,
   SUPPLY_UNIT_CODE,
   SUPPLY_UNIT,
   IS_DEALER,
   PROCESS_CDOE,
   PROCESS_DESC)
VALUES
  ('',
   '',
   '',
   '',
   '',
   '#INSTOCK_SQE#',
   '#INSTOCK_DOC#',
   '#INSTOCK_TYPE_CODE#',
   '#INSTOCK_TYPE_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#',
   '#STORAGE_NO#',
   '#LOCATION_NO#',
   '',
   '',
   '#STORAGE_ATTR#',
   '#STORAGE_ATTR_NAME#',
   '#STORAGE_TYPE_NO#',
   '#STORAGE_TYPE_NAME#',
   '#MANAGEMENT_NO#',
   '#MANAGEMENT_NAME#',
   NULL,
   '',
   '',
   NULL,
   '',
   '',
   '',
   '',
   '#MEMO#',
   '1',
   '#CREATE_NAME#',
   SYSDATE,
   '',
   NULL,
   '',
   NULL,
   '#BAL_YEAR_MONTH#',
   '#SOURE_CODE#',
   '#SOURE_NAME#',
   '#SUPPLY_UNIT_CODE#',
   '#SUPPLY_UNIT#',
   '0',
   '#PROCESS_CDOE#',
   '#PROCESS_DESC#')
		]]>
	</query>

<query id="FrmPipeInventoryIn.addYdmZcInlist1" desc="新增入库信息">
		<![CDATA[
	   INSERT INTO YDM_BC_INLIST
  (ORD_PK,
   ORD_LN_PK,
   ORD_LN_DLY_PK,
   DEPARTMENT_CODE,
   DEPARTMENT_DESC,
   INSTOCK_SQE,
   INSTOCK_DOC,
   INSTOCK_TYPE_CODE,
   INSTOCK_TYPE_NAME,
   INSTOCK_BAR_CODE,
   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,
   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,
   PRO_BC,
   PRO_BZ,
   INSTOCK_TIME,
   IN_BC,
   IN_BZ,
   BAR_CODE,
   HAND_FLAG,
   MEMO,
   VALIDFLAG,
   CREATE_NAME,
   CREATE_TIME,
   BAL_YEAR_MONTH,
   SOURE_CODE,
   SOURE_NAME,
   IN_TIME_F,
   PROCESS_CDOE,
   PROCESS_DESC)
VALUES
  ('',
   '',
   '',
   '',
   '',
   '#INSTOCK_SQE#',
   '#INSTOCK_DOC#',
   '#INSTOCK_TYPE_CODE#',
   '#INSTOCK_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#',
   '#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#',
   NULL,
   '',
   '',
   TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'),
   '',
   '',
   '',
   '',
   '#MEMO#',
   '1',
   '#CREATE_NAME#',
   TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'),
   '#BAL_YEAR_MONTH#',
   '#SOURE_CODE#',
   '#SOURE_NAME#',
   TO_DATE('#CREATE_TIME#','YYYY-MM-DD HH24:MI:SS'),
   '#PROCESS_CDOE#',
   '#PROCESS_DESC#')
		]]>
	</query>
	<query id="FrmPipeInventoryIn.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="FrmPipeInventoryIn.getMaxStockTakingDoc1" 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_BC_STOCKTAKINGLIST T
	]]>
	</query>

	<query id="FrmPipeInventoryIn.getMaxMatNo" desc="查询最大物料编号">
	<![CDATA[ 
	     SELECT TO_NUMBER(SUBSTR(NVL(MAX(T.MAT_NO), '000000000000'),
                        LENGTH(NVL(MAX(T.MAT_NO), '000000000000')) - 3)) MAX_SEQ
  FROM (SELECT MAX(T1.MAT_NO)MAT_NO
          FROM MAT_ZC_M T1
         WHERE T1.JUDGE_STOVE_NO = ?
           AND T1.BATCH_NO = ?
         UNION ALL
         SELECT MAX(T3.MAT_NO)MAT_NO
         FROM MAT_ZC_BACKUP T3
         WHERE T3.JUDGE_STOVE_NO = ?
         AND T3.BATCH_NO = ?)T
	]]>
	</query>
	
	<query id="FrmPipeInventoryIn.getMaxMatNo1" desc="查询最大物料编号">
	<![CDATA[ 
	     SELECT TO_NUMBER(SUBSTR(NVL(MAX(T.MAT_NO), '000000000000'),
                        LENGTH(NVL(MAX(T.MAT_NO), '000000000000')) - 3)) MAX_SEQ
  FROM (SELECT MAX(T1.MAT_NO)MAT_NO
          FROM MAT_BC_M T1
         WHERE T1.JUDGE_STOVE_NO = ?
           AND T1.BATCH_NO = ?
         UNION ALL
         SELECT MAX(T3.MAT_NO)MAT_NO
         FROM MAT_BC_BACKUP T3
         WHERE T3.JUDGE_STOVE_NO = ?
         AND T3.BATCH_NO = ?)T
	]]>
	</query>
<query id = "FrmPipeInventoryIn.updateProcessIn" desc = "盘盈修改进程表">
UPDATE PROCESS_ORDER_M T
   SET T.INV_NUM = TO_NUMBER(NVL(T.INV_NUM,0)) + TO_NUMBER(?),
       T.INV_WGT = TO_NUMBER(NVL(T.INV_WGT,0)) + TO_NUMBER(?),
       T.INV_LEN = TO_NUMBER(NVL(T.INV_LEN,0)) + TO_NUMBER(?)
   WHERE ORD_LN_DLY_PK = ?
</query>
<query id = "FrmPipeInventoryIn.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>
	<query id="FrmPipeInventoryIn.queryMaterialSTyle" desc="查询材料类别信息">
	<![CDATA[
         SELECT T.BASECODE, T.BASENAME
  FROM COM_BASE_INFO T
 WHERE T.SORTCODE = '8014'
   AND T.VALIDFLAG = '1'
   AND T.BASECODE = '801402'
 ORDER BY T.BASECODE

	]]>
	</query>
	<query id="FrmPipeInventoryIn.queryMaterialSTyle1" desc="查询材料类别信息">
	<![CDATA[
         SELECT T.BASECODE, T.BASENAME
  FROM COM_BASE_INFO T
 WHERE T.SORTCODE = '8014'
   AND T.VALIDFLAG = '1'
   AND T.BASECODE = '801401'
 ORDER BY T.BASECODE

	]]>
	</query>
	<query id = "FrmPipeInventoryIn.getProcess" desc = "查询工序点">
	SELECT S.PROCESS_CODE,S.PROCESS_DESC FROM COM_BASE_PLINE S WHERE S.PLINE_CODE = ?
	</query>
	<query id = "FrmPipeInventoryIn.getSpec" desc = "获取规格">
	SELECT T.SPEC_CODE BASECODE, T.SPEC_NAME BASENAME
  FROM COM_BASE_SPEC T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.SPEC_CODE ASC
	</query>
	<query id = "FrmPipeInventoryIn.getProcduce" desc = "获取品名">
SELECT T.PRODUCCODE BASECODE, T.PRODUC_JX BASENAME
  FROM COM_BASE_PRODUCT T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.PRODUCCODE ASC
	</query>
	<query id = "FrmPipeInventoryIn.getModel" desc = "获取扣型">
	SELECT T.MODEL_CODE BASECODE, T.MODEL_DESC BASENAME
  FROM COM_BASE_MODEL T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.MODEL_CODE ASC
	</query>
	<query id = "FrmPipeInventoryIn.getStdCode" desc = "获取标准">
	SELECT T.STD_CODE BASECODE, T.STD_NAME BASENAME
  FROM COM_BASE_STD T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.STD_CODE ASC
	</query>
	<query id = "FrmPipeInventoryIn.getSteel" desc = "获取钢级">
	SELECT T.STEELCODE BASECODE, T.STEELNAME BASENAME
  FROM COM_BASE_STEEL T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.STEELCODE ASC
	</query>
	<query id = "FrmPipeInventoryIn.getGrade" desc = "获取钢种">
	SELECT T.GRADECODE BASECODE, T.GRADENAME BASENAME
  FROM COM_BASE_GRADE T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.GRADECODE ASC
	</query>
	<query id = "FrmPipeInventoryIn.SelectOutCount" desc = "查询是否出库">
	SELECT NVL(SUM(T1.ACT_COUNT),0)ACOUNT
  FROM YDM_BC_STOCKTAKINGLIST T, YDM_BC_OUTLIST T1
 WHERE T.MAT_NO = T1.MAT_NO
   AND T.STOCKTAKING_DOC = '#STOCKTAKING_DOC#'
   AND T1.OUTSTOCK_TYPE_CODE = '800801'
	</query>
	<query id = "FrmPipeInventoryIn.SelectCount" desc = "查询支数">
	SELECT NVL(SUM(T1.ACT_COUNT),0)ACOUNT
  FROM YDM_BC_STOCKTAKINGLIST T, MAT_BC_M T1
 WHERE T.MAT_NO = T1.MAT_NO
   AND T.STOCKTAKING_DOC = '#STOCKTAKING_DOC#'
   AND T1.PRO_PLAN_ID_NEXT IS NOT NULL
	</query>
	<query id = "FrmPipeInventoryIn.doDelete" desc = "撤销">
	DECLARE
BEGIN
  FOR MYROW IN (SELECT T.MAT_NO, T.PLINE_CODE, T.STOCKTAKING_SQE
                  FROM YDM_BC_STOCKTAKINGLIST T
                 WHERE T.STOCKTAKING_DOC = '#STOCKTAKING_DOC#'
                 ORDER BY T.MAT_NO DESC) LOOP
    DELETE FROM MAT_BC_M T
     WHERE T.MAT_NO = MYROW.MAT_NO
       AND T.PLINE_CODE = MYROW.PLINE_CODE;
    DELETE FROM YDM_BC_BUTTRESS T WHERE T.MAT_NO = MYROW.MAT_NO;
    DELETE FROM YDM_BC_INLIST T
     WHERE T.MAT_NO = MYROW.MAT_NO
       AND T.INSTOCK_TYPE_CODE = '800702';
    DELETE FROM YDM_BC_STOCKTAKINGLIST T
     WHERE T.STOCKTAKING_SQE = MYROW.STOCKTAKING_SQE;
  END LOOP;
END;
	</query>
</queryMap>