<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="权限功能表查询">

	<query id="CoreUpsettingDialExpansion.isOnlyAdd" desc="判断新增是否唯一">
		<![CDATA[
			SELECT 1
     FROM COM_MSC_ROLL_R_UPSET
     WHERE PLINE_CODE = ?
     AND MIN_D = ?
     AND MIN_H = ?
     AND MAX_D = ?
     AND MAX_H = ?

		]]>
	</query>

	<query id="CoreUpsettingDialExpansion.isOnlyUpdate" desc="判断修改是否唯一">
		<![CDATA[
		SELECT 1
     FROM COM_MSC_ROLL_R_UPSET
     WHERE PLINE_CODE = ?
     AND MIN_D = ?
     AND MIN_H = ?
     AND MAX_D = ?
     AND MAX_H = ?
     AND INDEX_SEQ != ?
		]]>
	</query>

	<query id="CoreUpsettingDialExpansion.GetMaxSeq" desc="获取序号最大值">
		<![CDATA[
			select max(INDEX_SEQ) from COM_MSC_ROLL_R_UPSET
		]]>
	</query>

	<query id="CoreUpsettingDialExpansion.GetGZType" desc="获取钢种代码和描述">
		<![CDATA[
			select GRADECODE,GRADENAME from COM_BASE_GRADE
			where  VALIDFLAG='1'
		]]>
	</query>


	<query id="CoreUpsettingDialExpansion.GetProLineInfo" desc="获取二级工序">
		<![CDATA[
			SELECT T.PROCESS_CDOE_C ,  
			T.PROCESS_DESC_C 
            FROM COM_BASE_PROCESS_C T
            WHERE T.PROCESS_CDOE = 'E'
            AND T.VALIDFLAG = '1'

		]]>
	</query>

	<query id="CoreUpsettingDialExpansion.QUERY" desc="权限功能">
		<![CDATA[
			SELECT  PLINE_CODE,
					PLINE_CODE PLINE_CODE_OLD,
				    PLINE_NAME,
				    INDEX_SEQ,
					GRADECODE,
					GRADENAME,
					MIN_D,
					MIN_H,
					MAX_D,
					MAX_H,
					CREATE_NAME,
					TO_CHAR(CREATE_TIME,'yyyy-mm-dd hh24:mi:ss') CREATE_TIME,
					UPDATE_NAME,
					TO_CHAR(UPDATE_TIME,'yyyy-mm-dd hh24:mi:ss') UPDATE_TIME,
					DELETE_NAME,
					TO_CHAR(DELETE_TIME,'yyyy-mm-dd hh24:mi:ss') DELETE_TIME,
					VALIDFLAG,
					decode(VALIDFLAG,'1','有效','无效') VALIDFLAGNAME,
					MEMO
				FROM COM_MSC_ROLL_R_UPSET
				   WHERE VALIDFLAG in ('1' , '#VALIDFLAG#')
				   AND lower(PLINE_NAME)||'&' LIKE '%' || lower('#PLINE_NAME#') || '%' 
				   AND DECODE('#GRADECODE#', NULL, '1', GRADECODE) = DECODE('#GRADECODE#', NULL, '1', '#GRADECODE#')
				   AND DECODE('#DIMATER#', NULL, '1', MAX_D) = DECODE('#DIMATER#', NULL, '1', TO_NUMBER('#DIMATER#'))
				   AND DECODE('#HEIGHT#', NULL, '1', MAX_H) = DECODE('#HEIGHT#', NULL, '1', TO_NUMBER('#HEIGHT#'))
				    ORDER BY PLINE_CODE
		]]>
	</query>
	<query id="CoreUpsettingDialExpansion.ADD" desc="新增">
		<![CDATA[
			 INSERT INTO COM_MSC_ROLL_R_UPSET
							(PLINE_CODE,
					        PLINE_NAME,
					        INDEX_SEQ,
					        MIN_D,
					        MIN_H,
							MAX_D,
							MAX_H,
					        CREATE_NAME,
					        CREATE_TIME,
					        VALIDFLAG,
					        MEMO)
							VALUES(?,?,?,?,?,?,?,
							?,SYSDATE,
							'1',?)
							
			  
		]]>
	</query>
	<query id="CoreUpsettingDialExpansion.MODIFY" desc="修改">
		<![CDATA[
			 UPDATE COM_MSC_ROLL_R_UPSET set
			 				PLINE_CODE=?,
							PLINE_NAME=?,
							MIN_D=?,
							MIN_H=?,
							MAX_D=?,
							MAX_H=?,
							UPDATE_NAME=?, 
							UPDATE_TIME=SYSDATE,
							MEMO=? 
							WHERE INDEX_SEQ=?
							AND PLINE_CODE = ?
		]]>
	</query>
	<query id="CoreUpsettingDialExpansion.DELETE" desc="作废">
		<![CDATA[
			 UPDATE COM_MSC_ROLL_R_UPSET T
			   SET T.DELETE_NAME = ?, T.DELETE_TIME = SYSDATE, T.VALIDFLAG = '0'
			 WHERE T.INDEX_SEQ = ?
		]]>
	</query>

	<query id="CoreUpsettingDialExpansion.RESUME" desc="恢复">
		<![CDATA[
			UPDATE COM_MSC_ROLL_R_UPSET T
               SET T.DELETE_NAME = '', T.DELETE_TIME = '', T.VALIDFLAG = '1'
             WHERE T.INDEX_SEQ = ?
		]]>
	</query>

	<query id="CoreUpsettingDialExpansion.isExistSpec" desc="是否存在规格">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_BASE_SPEC T
 WHERE T.DIMATER = TO_NUMBER('#DIMATER#')
   AND T.HEIGHT = TO_NUMBER('#HEIGHT#')
   AND T.VALIDFLAG = '1'
		]]>
	</query>

	<query id="CoreUpsettingDialExpansion.getSpec" desc="初始化规格">
		<![CDATA[
SELECT T.SPEC_CODE, T.SPEC_NAME, T.DIMATER, T.HEIGHT
  FROM COM_BASE_SPEC T
 WHERE T.MSC_STYLE = 'A'
   AND T.VALIDFLAG = '1'
 ORDER BY TO_NUMBER(T.DIMATER)
		]]>
	</query>
</queryMap>