<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="下拉框动态数据获取管理">
	<query id="FrmBoxMainTenance.Add" desc="新增">
		<![CDATA[
INSERT INTO COUPLING_APP_BOX_MAIN
  (KEP_NO,
   KEP_TYPE,
   KEP_WIDTH,
   KEP_HEIGHT,
   KEP_LEN,
   HL_MANAGEMENT_NO,
   HL_MANAGEMENT_NAME,
   MEMO,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  ((SELECT ? ||
          (LPAD((NVL(MAX(SUBSTR(KEP_NO, 2, 5)), '00000') + 1), 5, '0'))
     FROM COUPLING_APP_BOX_MAIN),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   SYSDATE)	 
		]]>
	</query>

	<query id="FrmBoxMainTenance.Query" desc="查询">
		<![CDATA[
       SELECT 
       T.KEP_NO,
       T.KEP_TYPE,
       T.KEP_WIDTH,
       DECODE(TRIM(VALIDFLAG),'1','有效','0','无效') VALIDFLAG,
       T.MEMO,
       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.HL_MANAGEMENT_NAME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.KEP_HEIGHT,
       T.KEP_LEN,
       T.HL_MANAGEMENT_NO
 FROM COUPLING_APP_BOX_MAIN T
      WHERE  DECODE(?,NULL,'1',HL_MANAGEMENT_NAME) = DECODE(?,NULL,'1',?)
      AND '&'||KEP_TYPE LIKE '&'||?
      AND VALIDFLAG IN('1',?)		 
		]]>
	</query>
	
		<query id="FrmBoxMainTenance.DoQuery" desc="查询">
		<![CDATA[
       SELECT 
       T.KEP_NO,
       T.KEP_TYPE,
       T.KEP_WIDTH,
       DECODE(TRIM(VALIDFLAG),'1','有效','0','无效') VALIDFLAG,
       T.MEMO,
       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.HL_MANAGEMENT_NAME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.KEP_HEIGHT,
       T.KEP_LEN,
       T.HL_MANAGEMENT_NO
 FROM COUPLING_APP_BOX_MAIN T
      WHERE VALIDFLAG =?	 
		]]>
	</query>

	<query id="FrmBoxMainTenance.Update" desc="修改">
		<![CDATA[
UPDATE COUPLING_APP_BOX_MAIN T
   SET T.KEP_TYPE           = ?,
       T.KEP_WIDTH          = ?,
       T.KEP_HEIGHT         = ?,
       T.KEP_LEN            = ?,
       T.HL_MANAGEMENT_NO   = ?,
       T.HL_MANAGEMENT_NAME = ?,     
       T.MEMO = ?,      
       T.UPDATE_NAME = ?,
       T.UPDATE_TIME = SYSDATE,
       T.KEP_NO            = ?
 WHERE T.KEP_NO = ?
   AND T.VALIDFLAG = '1'
		]]>
	</query>

	<query id="FrmBoxMainTenance.Delete" desc="作废">
		<![CDATA[
	    UPDATE COUPLING_APP_BOX_MAIN
        SET  
        DELETE_NAME        = ?,
        DELETE_TIME        = SYSDATE,
        VALIDFLAG          ='0'
       WHERE KEP_NO = ? AND VALIDFLAG='1'
 
		]]>
	</query>

	<query id="FrmBoxMainTenance.Resume" desc="恢复">
		<![CDATA[
	    UPDATE COUPLING_APP_BOX_MAIN
        SET  
        DELETE_NAME        = '',
        DELETE_TIME        = '',
        VALIDFLAG          ='1'
       WHERE KEP_NO = ? AND VALIDFLAG='0'
 
		]]>
	</query>

	<query id="FrmBoxMainTenance.doQueryData" desc="查询框号所属单位">
		SELECT
		T.DEPARTNAME,T.DEPARTID FROM CORE_APP_DEPARTMENT T WHERE T.DEPTTYPE =
		'2' and 1 = ?
	 </query>
	 
	<query id="FrmBoxMainTenance.getReferRack" desc="查询框号最新信息">
		SELECT
		VALIDFLAG
		FROM COUPLING_APP_BOX_MAIN T WHERE T.KEP_NO = ?
	 </query>
	 <query id="FrmBoxMainTenance.getRackType" desc="查询框号类型">
SELECT T.BASENAME,T.BASECODE FROM COM_BASE_INFO T WHERE T.SORTCODE='7012'
	 </query>
</queryMap>