<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "对基础信息实绩操作">
	<query id = "ComBasePrice.query" desc = "查询基础信息">
	<![CDATA[
 SELECT 
       T.ITEM_CODE,
       T.ITEM_NAME,
       T.ARC_CODE,
       T.ARC_ITEM,
       C.YEAR,
       C.MONTH_1,
       C.MONTH_2,
       C.MONTH_3,
       C.MONTH_4,
       C.MONTH_5,
       C.MONTH_6,
       C.MONTH_7,
       C.MONTH_8,
       C.MONTH_9,
       C.MONTH_10,
       C.MONTH_11,
       C.MONTH_12,
       C.CREATE_NAME,
       TO_CHAR(C.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       C.UPDATE_NAME,
       TO_CHAR(C.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       C.DELETE_NAME,
       TO_CHAR(C.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       DECODE(C.VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
       C.MEMO
 FROM COST_BASE_METAL_TYPE T
 LEFT JOIN COST_BASE_PRICE C 
 ON T.ITEM_CODE = C.ITEM_CODE
	]]>
	</query>
	<query id = "ComBasePrice.queryPliao" desc = "获取物料分类信息">
	<![CDATA[
SELECT T.BASECODE,T.BASENAME 
FROM PUR_BASE_INFO T 
WHERE T.SORTCODE ='1110'
	]]>
	</query>
	
	<query id = "ComBasePrice.queryNum" desc = "获取物料分类成本信息">
	<![CDATA[
	SELECT COUNT(*) 
  	FROM COST_BASE_PRICE
  	WHERE 1 = 1
	]]>
	</query>
	<query id = "ComBasePrice.isave" desc = "新增物料成本价格信息">
	<![CDATA[
 INSERT INTO COST_BASE_PRICE(
        ITEM_CODE,
        ITEM_NAME,
        ARC_CODE,
        ARC_ITEM,
        YEAR,
        MONTH_1,
        MONTH_2,
        MONTH_3,
        MONTH_4,
        MONTH_5,
        MONTH_6,
        MONTH_7,
        MONTH_8,
        MONTH_9,
        MONTH_10,
        MONTH_11,
        MONTH_12,
        CREATE_NAME,
        CREATE_TIME,
        MEMO)
 VALUES( 
        '#ITEM_CODE#',
        '#ITEM_NAME#',
        '#ARC_CODE#',
        '#ARC_ITEM#',
        '#YEAR#',
        '#MONTH1#',
        '#MONTH2#',
        '#MONTH3#',
        '#MONTH4#',
        '#MONTH5#',
        '#MONTH6#',
        '#MONTH7#',
        '#MONTH8#',
        '#MONTH9#',
        '#MONTH10#',
        '#MONTH11#',
        '#MONTH12#',
        '#CREATE_NAME#',
        SYSDATE,
        '#MEMO#')
	]]>
	</query>
	<query id = "ComBasePrice.usave" desc = "修改物料成本价格信息">
	<![CDATA[
 UPDATE COST_BASE_PRICE T
   SET 
        T.ITEM_CODE = '#ITEM_CODE#',
        T.ITEM_NAME = '#ITEM_NAME#',
        T.ARC_CODE = '#ARC_CODE#',
        T.ARC_ITEM = '#ARC_ITEM#',
        T.YEAR = '#YEAR#',
        T.MONTH_1 = '#MONTH1#',
        T.MONTH_2 = '#MONTH2#',
        T.MONTH_3 = '#MONTH3#',
        T.MONTH_4 = '#MONTH4#',
        T.MONTH_5 = '#MONTH5#',
        T.MONTH_6 = '#MONTH6#',
        T.MONTH_7 = '#MONTH7#',
        T.MONTH_8 = '#MONTH8#',
        T.MONTH_9 = '#MONTH9#',
        T.MONTH_10 = '#MONTH10#',
        T.MONTH_11 = '#MONTH11#',
        T.MONTH_12 = '#MONTH12#',
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE,
        T.MEMO = '#MEMO#'
 WHERE
T.ITEM_CODE = '#ITEM_CODE#'
	]]>
	</query>
	<query id = "ComBasePrice.delete" desc = "删除物料成本价格信息">
	<![CDATA[
UPDATE COST_BASE_PRICE T
   SET 
   		T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE,
        T.DELETE_NAME = '#DELETE_NAME#',
        T.DELETE_TIME = SYSDATE,
        T.VALIDFLAG = '0'
 WHERE T.ITEM_CODE = '#ITEM_CODE#'
AND T.YEAR = '#YEAR#'
	]]>
	</query>
	<query id = "ComBasePrice.resume" desc = "恢复物料成本价格信息">
	<![CDATA[
UPDATE COST_BASE_PRICE T
   SET 
   		T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE,
        T.DELETE_NAME = '',
        T.DELETE_TIME = '',
        T.VALIDFLAG = '1'
 WHERE T.ITEM_CODE = '#ITEM_CODE#'
AND T.YEAR = '#YEAR#'
	]]>
	</query>
</queryMap>
