<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "对基础信息实绩操作">
	<query id = "ComBaseProcesscostC.query" desc = "查询产线工序">
	<![CDATA[
 SELECT 
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.PROCESS_CODE,
       T.PROCESS_DESC,
       T.SCHEDULE_MIN,
       T.SCHEDULE_MAX,
       T.COST_PRICE,
       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_PROCESSCOST_C T
 WHERE 1=1 
	]]>
	</query>
	<query id = "ComBaseProcesscostC.queryPliao" desc = "获取产线工序信息">
	<![CDATA[
SELECT T.PLINE_CODE,T.PLINE_NAME,T.PROCESS_CODE,T.PROCESS_DESC 
FROM COM_BASE_PLINE T
	]]>
	</query>
	<query id = "ComBaseProcesscostC.queryNum" desc = "获取产线工序信息">
	<![CDATA[
	SELECT COUNT(*) FROM
(
SELECT * FROM COST_BASE_PROCESSCOST_C T WHERE T.PLINE_NAME = {0} AND T.SCHEDULE_MIN < {1} AND T.SCHEDULE_MAX > {1}  AND T.VALIDFLAG='1'
UNION ALL 
SELECT * FROM COST_BASE_PROCESSCOST_C T WHERE T.PLINE_NAME = {0} AND T.SCHEDULE_MIN < {2} AND T.SCHEDULE_MAX > {2}  AND T.VALIDFLAG='1'
UNION ALL 
SELECT * FROM COST_BASE_PROCESSCOST_C T WHERE T.PLINE_NAME = {0} AND T.SCHEDULE_MIN >= {1} AND T.SCHEDULE_MAX <= {2}  AND T.VALIDFLAG='1'
) A
	]]>
	</query>
	<query id = "ComBaseProcesscostC.queryshangxia" desc = "获取产线工序信息">
	<![CDATA[
SELECT A.PLINE_NAME,A.SCHEDULE_MIN,A.SCHEDULE_MAX FROM
(
SELECT * FROM COST_BASE_PROCESSCOST_C T WHERE T.PLINE_NAME = {0} AND T.SCHEDULE_MIN < {1} AND T.SCHEDULE_MAX > {1}  AND T.VALIDFLAG='1'
UNION ALL 
SELECT * FROM COST_BASE_PROCESSCOST_C T WHERE T.PLINE_NAME = {0} AND T.SCHEDULE_MIN < {2} AND T.SCHEDULE_MAX > {2}  AND T.VALIDFLAG='1'
UNION ALL 
SELECT * FROM COST_BASE_PROCESSCOST_C T WHERE T.PLINE_NAME = {0} AND T.SCHEDULE_MIN >= {1} AND T.SCHEDULE_MAX <= {2}  AND T.VALIDFLAG='1'
) A
	]]>
	</query>
	<query id = "ComBaseProcesscostC.isave" desc = "保存产线工序信息">
	<![CDATA[
  INSERT INTO COST_BASE_PROCESSCOST_C(
        PLINE_CODE,
        PLINE_NAME,
        PROCESS_CODE,
        PROCESS_DESC,
        SCHEDULE_MIN,
        SCHEDULE_MAX,
        COST_PRICE,
        CREATE_NAME,
        CREATE_TIME,
        MEMO)
 VALUES( 
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#PROCESS_CODE#',
        '#PROCESS_DESC#',
        '#SCHEDULE_MIN#',
        '#SCHEDULE_MAX#',
        '#COST_PRICE#',
        '#CREATE_NAME#',
        SYSDATE,
        '#MEMO#')
	]]>
	</query>
	
	<query id = "ComBaseProcesscostC.usave" desc = "保存产线工序信息">
	<![CDATA[
   UPDATE COST_BASE_PROCESSCOST_C T
   SET 
        T.PLINE_CODE = '#PLINE_CODE#',
        T.PLINE_NAME = '#PLINE_NAME#',
        T.PROCESS_CODE = '#PROCESS_CODE#',
        T.PROCESS_DESC = '#PROCESS_DESC#',
        T.SCHEDULE_MIN = '#SCHEDULE_MIN#',
        T.SCHEDULE_MAX = '#SCHEDULE_MAX#',
        T.COST_PRICE = '#COST_PRICE#',
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE,
        T.MEMO = '#MEMO#'
 WHERE 1=1
	]]>
	</query>
	<query id = "ComBaseProcesscostC.delete" desc = "作废产线工序信息">
	<![CDATA[
  UPDATE COST_BASE_PROCESSCOST_C 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.PLINE_CODE = '#PLINE_CODE#'
AND T.SCHEDULE_MIN = '#SCHEDULE_MIN#'
AND T.SCHEDULE_MAX = '#SCHEDULE_MAX#'
AND T.COST_PRICE = '#COST_PRICE#'
	]]>
	</query>
	<query id = "ComBaseProcesscostC.resume" desc = "恢复产线工序信息">
	<![CDATA[
   UPDATE COST_BASE_PROCESSCOST_C T
   SET 
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE,
        T.DELETE_NAME = '',
        T.DELETE_TIME = '',
        T.VALIDFLAG = '1'
 WHERE
T.PLINE_CODE = '#PLINE_CODE#'
AND T.SCHEDULE_MIN = '#SCHEDULE_MIN#'
AND T.SCHEDULE_MAX = '#SCHEDULE_MAX#'
AND T.COST_PRICE = '#COST_PRICE#'
	]]>
	</query>
</queryMap>