<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="权限功能表查询">
	<query id="ComBaseWellPline.QUERY" desc="权限功能">
		<![CDATA[
		SELECT 
		    T.PLINE_CODE,
			   T.PLINE_NAME,
			   T.DEPARTMENT_CODE,
			   T.DEPARTMENT_DESC,
			   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(WELL_VALIDFLAG,'1','有效','无效') VALIDFLAG,
			   T.MEMO,
			   T.PROCESS_CODE,
			   T.PROCESS_DESC,
			   T.PLINE_CODE_OLD,
			   T.LENGTH_MIN,
			   T.LENGTH_MAX,
			   T.LENGTH_COLDBED,
			   T.LENGTH_MAX_RING,
			   T.LENGTH_MIN_RING,
			   T.LENGTH_MIN_TUBE,
			   T.LENGTH_MAX_TUBE,
			   T.BURNOUT_RATE,
			   T.GROUP_PLAN,
			   T.GROUP_PAY,
			   T.TOLERANCE_ZONE,
			   T.DEPARTMENT_CODE_P,
			   T.DEPARTMENT_DESC_P,
			   T.SCHEDULE_CODE,
			   T.SPLINE_DESC,
			   T.IN_MATERIAL_LEN_MIN,
			   T.IN_MATERIAL_LEN_MAX,
			   T.SAM_FCODE,
			   T.BATCH_INTERVAL,
			   T.CHECK_NO_SHORT,
			   T.FACTORY_CODE,
			   T.CHECK_STATION,
			   T.IN_REPOSITORY,
			   T.OUT_REPOSITORY,
			   T.VELOCITY_FLOW,
			   T.SUPPLY_UNIT_CODE,
			   T.SUPPLY_UNIT,
			   T.ACCOUNTING_CENTER,
			   T.ZBS_COMPANY,
			   T.ZBS_ADDRESS,
			   T.ZBS_FLAG,
			   T.SPEC_NAME
        FROM COM_BASE_PLINE t
        WHERE T.WELL_VALIDFLAG in ('1' , ?)
        ORDER BY T.PLINE_CODE
		]]>
	</query>
<query id="ComBaseWellPline.ADD" desc="权限功能">
		<![CDATA[
			INSERT INTO COM_BASE_PLINE
			(
			PLINE_CODE,
            PLINE_NAME,
            WEIGHT,
            CREATE_NAME,
            CREATE_TIME,
            VALIDFLAG,
            MEMO,
            PROCESS_CDOE,
            PROCESS_DESC
            )
			VALUES
			(?,?,?,?,SYSDATE,'1',?, ?, ?)	
		]]>
	</query>
	<query id="ComBaseWellPline.UPDATE" desc="权限功能">
		<![CDATA[
			UPDATE COM_BASE_PLINE C
			SET C.SPEC_NAME=?
			WHERE C.PLINE_CODE=?
		]]>
	</query>
<query id="ComBaseWellPline.DELETE" desc="权限功能">
		<![CDATA[
			UPDATE COM_BASE_WELL_PLINE C
			SET C.WELL_VALIDFLAG='0',C.DELETE_NAME=?,C.DELETE_TIME=SYSDATE
			WHERE C.PLINE_CODE=?
		]]>
	</query>
<query id="ComBaseWellPline.RESUME" desc="权限功能">
		<![CDATA[
			UPDATE COM_BASE_WELL_PLINE C
			SET C.WELL_VALIDFLAG='1',C.DELETE_NAME='',C.DELETE_TIME=NULL
			WHERE C.PLINE_CODE=?
		]]>
	</query>
<query id="ComBaseWellPline.CHECK" desc="权限功能">
		<![CDATA[
			SELECT PLINE_CODE,
            PLINE_NAME,
            WEIGHT,
            CREATE_NAME,
            CREATE_TIME,
            UPDATE_NAME,
            UPDATE_TIME,
            DELETE_NAME,
            DELETE_TIME,
            DECODE(WELL_VALIDFLAG,'1','有效','无效') VALIDFLAGNAME,
            MEMO FROM COM_BASE_PLINE
			WHERE PLINE_NAME=?
		]]>
	</query>
	
	<query id="ComBaseWellPline.CHECKUpdate" desc="权限功能">
		<![CDATA[
			SELECT  1
            FROM COM_BASE_PLINE
			WHERE PLINE_NAME=? AND PLINE_CODE !=?
		]]>
	</query>
	
	<query id="ComBaseWellPline.CHECKYear" desc="权限功能">
		<![CDATA[
			SELECT  1
            FROM COM_BASE_WELL_MONTH_PLINE
			WHERE PLINE_CODE=? AND YEAR =TO_NUMBER(?)
		]]>
	</query>
	

	<query id="ComBaseWellPline.QUERYMonth" desc="权限功能">
		<![CDATA[
	   SELECT PLINE_CODE,
       PLINE_NAME,
       YEAR,
       YEAR AS YEAR_OLD,
       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,
       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,
       DECODE(VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
       MEMO,
       HALT_HOUR_1,
		HALT_HOUR_2,
		HALT_HOUR_3,
		HALT_HOUR_4,
		HALT_HOUR_5,
		HALT_HOUR_6,
		HALT_HOUR_7,
		HALT_HOUR_8,
		HALT_HOUR_9,
		HALT_HOUR_10,
		HALT_HOUR_11,
		HALT_HOUR_12

   FROM COM_BASE_WELL_MONTH_PLINE
   WHERE  PLINE_CODE=?
			 
		]]>
	</query>
	
	<query id="ComBaseWellPline.ADDMonth" desc="权限功能">
		<![CDATA[
	  INSERT INTO COM_BASE_WELL_MONTH_PLINE
  (PLINE_CODE,
   PLINE_NAME,
   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,
   VALIDFLAG,
   MEMO,
   HALT_HOUR_1,
	HALT_HOUR_2,
	HALT_HOUR_3,
	HALT_HOUR_4,
	HALT_HOUR_5,
	HALT_HOUR_6,
	HALT_HOUR_7,
	HALT_HOUR_8,
	HALT_HOUR_9,
	HALT_HOUR_10,
	HALT_HOUR_11,
	HALT_HOUR_12)
   VALUES
  (?,  ?,  ?, ?,  ?, ?,?, ?,?, ?,?,?, ?,  ?, ?, ?,  SYSDATE,'1',  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?)
	  	 
		]]>
	</query>

    <query id="ComBaseWellPline.UpDateMonth" desc="权限功能">
		<![CDATA[
        UPDATE COM_BASE_WELL_MONTH_PLINE
        SET 
        
        PLINE_NAME = ?,
        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 = ?,
        UPDATE_NAME = ?,
        UPDATE_TIME = SYSDATE,
        MEMO = ?,
        HALT_HOUR_1 = ?,
        HALT_HOUR_2 = ?,
        HALT_HOUR_3 = ?,
        HALT_HOUR_4 = ?,
        HALT_HOUR_5 = ?,
        HALT_HOUR_6 = ?,
        HALT_HOUR_7 = ?,
        HALT_HOUR_8 = ?,
        HALT_HOUR_9 = ?,
        HALT_HOUR_10 = ?,
        HALT_HOUR_11 = ?,
        HALT_HOUR_12 = ?
        WHERE PLINE_CODE = ? AND  YEAR = ?
			 
		]]>
	</query>
	
		<query id="CoreBaseWellPline.checkWellDelete" desc="权限功能">
		<![CDATA[
         
        SELECT COUNT(1) AS COUM FROM COM_BASE_WELL_MONTH_PLINE
        WHERE PLINE_CODE=? AND VALIDFLAG='1'

		]]>
	</query>
	
		<query id="CoreBaseWellPline.queryWellMax" desc="权限功能">
		<![CDATA[
         
         SELECT PLINE_CODE
        FROM (SELECT MAX(PLINE_CODE) AS PLINE_CODE FROM COM_BASE_PLINE)
        WHERE PLINE_CODE IS NOT NULL

		]]>
	</query>
	
	<query id="CoreBaseWellPline.checkFromResume" desc="标准名称 检验标准代码是否已经恢复">
		<![CDATA[
			SELECT 1
              FROM COM_BASE_PLINE S
             WHERE S.PLINE_CODE = ?
               AND S.WELL_VALIDFLAG = 0
		]]>
	</query>
	
	
	<query id="CoreBaseWellPline.deleteWell" desc="标准基础 作废">
		<![CDATA[
			UPDATE COM_BASE_PLINE
               SET WELL_VALIDFLAG = '0'
             WHERE PLINE_CODE = ?
		]]>
	</query>
	
	<query id="CoreBaseWellPline.resumeWell" desc="标准基础 恢复">
		<![CDATA[
			UPDATE COM_BASE_PLINE
               SET WELL_VALIDFLAG = '1'
             WHERE PLINE_CODE = ?
		]]>
    </query>
	
	<query id="CoreBaseWellPline.deleteMonthWell" desc="产品规范 作废">
		<![CDATA[
			UPDATE COM_BASE_WELL_MONTH_PLINE
               SET DELETE_NAME = ?, DELETE_TIME = SYSDATE, VALIDFLAG = '0'
             WHERE PLINE_CODE=? AND YEAR=?
		]]>
	</query>
	
	<query id="CoreBaseWellPline.resumeMonthWell" desc="产品规范 恢复">
		<![CDATA[
			UPDATE COM_BASE_WELL_MONTH_PLINE
               SET DELETE_NAME = ?, DELETE_TIME = NULL, VALIDFLAG = '1'
             WHERE PLINE_CODE=? AND YEAR=?		
		]]>
	</query>
	
</queryMap>