<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "对基础信息实绩操作">
	<query id = "ComBaseMetalGrade.query" desc = "查询钢种">
	<![CDATA[
SELECT GRADECODE ,GRADENAME,(select count(*) from COST_BASE_METAL_R_GRADE v where v.gradecode =t.gradecode and v.validflag = '1' ) batchingname
FROM COM_BASE_GRADE  t
 WHERE 1 = 1
	]]>
	</query>
	
	<query id = "ComBaseMetalGrade.rightquery" desc = "查询合金料投入量">
	<![CDATA[
  	 SELECT 
       T.GRADECODE,
       T.ITEM_CODE,
       T.ITEM_NAME,
       T.INPUT_AMOUNT,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       DECODE(T.VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
       T.MEMO
 FROM COST_BASE_METAL_R_GRADE T
 WHERE 1 = 1
	]]>
	</query>
	<query id = "ComBaseMetalGrade.queryNum" desc = "查询钢种与合金料投入量">
	<![CDATA[
  	SELECT COUNT(*) 
  	FROM COST_BASE_METAL_R_GRADE
  	WHERE 1 = 1
	]]>
	</query>
	
	<query id = "ComBaseMetalGrade.insert" desc = "新增钢种与合金料投入量">
	<![CDATA[
 INSERT INTO COST_BASE_METAL_R_GRADE(
        GRADECODE,
        ITEM_CODE,
        ITEM_NAME,
        INPUT_AMOUNT,
        CREATE_NAME,
        CREATE_TIME,
        MEMO)
 VALUES( 
        '#GRADECODE#',
        '#ITEM_CODE#',
        '#ITEM_NAME#',
        '#INPUT_AMOUNT#',
        '#CREATE_NAME#',
        SYSDATE,
        '#MEMO#')
	]]>
	</query>
	<query id = "ComBaseMetalGrade.queryPline" desc = "获取合金物料信息">
	<![CDATA[
SELECT ITEM_CODE,ITEM_DESC
 FROM PUR_MAT
	]]>
	</query>
	<query id = "ComBaseMetalGrade.queryGang" desc = "查询所有钢种">
	<![CDATA[
SELECT GRADECODE ,GRADENAME 
FROM COM_BASE_GRADE 
	]]>
	</query>
	<query id = "ComBaseMetalGrade.queryHejin" desc = "查询所有合金信息">
	<![CDATA[
SELECT T.BASECODE,T.BASENAME,T.PARENTCODE 
FROM PUR_MAT_CLASS T 
WHERE T.VALIDFLAG='1'
	]]>
	</query>
	<query id = "ComBaseMetalGrade.queryPur" desc = "查询所有物料信息">
	<![CDATA[
 SELECT 
       T.ITEM_CODE,
       T.ITEM_DESC,
       T.ITEM_NAME,
       T.WEIGHT_UNIT,
       T.ARC_CODE,
       DECODE(T.VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
 FROM PUR_MAT T
 WHERE 1 = 1
	]]>
	</query>
	<query id = "ComBaseMetalGrade.update" desc = "修改钢种与合金料投入量">
	<![CDATA[
UPDATE COST_BASE_METAL_R_GRADE T
   SET 
        T.GRADECODE = '#GRADECODE#',
        T.ITEM_CODE = '#ITEM_CODE#',
        T.ITEM_NAME = '#ITEM_NAME#',
        T.INPUT_AMOUNT ='#INPUT_AMOUNT#',
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE,
        T.MEMO = '#MEMO#'
 WHERE T.GRADECODE = '#GRADECODE#' 
	]]>
	</query>
	<query id = "ComBaseMetalGrade.delete" desc = "删除钢种与合金料投入量">
	<![CDATA[
UPDATE COST_BASE_METAL_R_GRADE 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.GRADECODE = '#GRADECODE#' AND T.ITEM_CODE = '#ITEM_CODE#'
	]]>
	</query>
	<query id = "ComBaseMetalGrade.resume" desc = "恢复钢种与合金料投入量">
	<![CDATA[
UPDATE COST_BASE_METAL_R_GRADE T
   SET 
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE,
        T.DELETE_NAME = '',
        T.DELETE_TIME = '',
        T.VALIDFLAG = '1'
 WHERE T.GRADECODE = '#GRADECODE#' AND T.ITEM_CODE = '#ITEM_CODE#'
	]]>
	</query>
</queryMap>
