<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="权限功能表查询">
	<query id="CoreProcessBasics.QUERY" desc="权限功能">
		<![CDATA[
			SELECT  PROCESS_CODE,
				    PROCESS_DESC,
				    STYLE,
				    DECODE(STYLE, 'A', '一级工序', 'B', '二级工序', '未定义') STYLE_NAME,
					PROCESS_ID,
					TO_CHAR(COST, 'FM99999990.00') COST,
					TO_CHAR(MINUTE_PRODUCT, 'FM99999990.00') MINUTE_PRODUCT,
					TO_CHAR(MINUTE_WAITE, 'FM99999990.00') MINUTE_WAITE,
					ICOUNT,
					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,
					TO_CHAR(MINUTE_PRODUCT_OUT,'FM99999990.00') MINUTE_PRODUCT_OUT,
                    TO_CHAR(MINUTE_WAITE_OUT,'FM99999990.00') MINUTE_WAITE_OUT,
                    TO_CHAR(BATCH_WAITE,'FM99999990.00') BATCH_WAITE,
                    TO_CHAR(BATCH_WAITE_OUT,'FM99999990.00') BATCH_WAITE_OUT
					
				FROM COM_BASE_PROCESS
				   WHERE VALIDFLAG in ('1' , ?)
				   AND lower(PROCESS_DESC)||'&' LIKE '%' || lower(?) || '%'  ORDER BY PROCESS_CODE
		]]>
	</query>
	
	<query id="CoreProcessBasics.ADD" desc="新增">
		<![CDATA[
			 INSERT INTO COM_BASE_PROCESS
						(
							PROCESS_CODE,
					        PROCESS_DESC,
					        STYLE,
					        PROCESS_ID,
					        COST,
					        MINUTE_PRODUCT,
					        MINUTE_WAITE,
					        ICOUNT,
					        CREATE_NAME,
					        CREATE_TIME,
					        VALIDFLAG,
					        MEMO,
					        MINUTE_PRODUCT_OUT,
                            MINUTE_WAITE_OUT,
                            BATCH_WAITE,
                            BATCH_WAITE_OUT
					        )
							VALUES(?,?,?,?,
							?,?,?,?,?,SYSDATE,
							'1',?,?,?,?,?)
							
			  
		]]>
	</query>
	<query id="CoreProcessBasics.MODIFY" desc="修改">
		<![CDATA[
			 UPDATE COM_BASE_PROCESS set
							PROCESS_DESC=?, 
							STYLE=?,
							PROCESS_ID=?, 
							COST=?,
							MINUTE_PRODUCT=?,
							MINUTE_WAITE=?,
							ICOUNT=?,
							UPDATE_NAME=?, 
							UPDATE_TIME=SYSDATE,
							MEMO=? ,
							MINUTE_PRODUCT_OUT = ?,
                            MINUTE_WAITE_OUT  = ?,
                            BATCH_WAITE       = ?,
                            BATCH_WAITE_OUT  = ?
							
							WHERE PROCESS_CODE=?
		]]>
	</query>
	<query id="CoreProcessBasics.DELETE" desc="作废">
		<![CDATA[
			 UPDATE COM_BASE_PROCESS T
			   SET T.DELETE_NAME = ?, T.DELETE_TIME = SYSDATE, T.VALIDFLAG = '0'
			 WHERE T.PROCESS_CODE = ?
		]]>
	</query>
	
	<query id="CoreProcessBasics.RESUME" desc="恢复">
		<![CDATA[
			UPDATE COM_BASE_PROCESS T
               SET T.DELETE_NAME = '', T.DELETE_TIME = '', T.VALIDFLAG = '1'
             WHERE T.PROCESS_CODE = ?
		]]>
	</query>
	
	<query id="CoreProcessBasics.getMaxProcess1Code" desc="获取一级工序最大编码">
		<![CDATA[
			SELECT MAX(T.PROCESS_CODE) FROM COM_BASE_PROCESS T
		]]>
	</query>
	
	<query id="CoreProcessBasics.queryProcess2Data" desc="获取二级工序与一级工序关系">
		<![CDATA[
			SELECT T.PROCESS_CDOE_C,
			       T.PROCESS_DESC_C,
			       T.PROCESS_CDOE,
			       T.PROCESS_DESC,
			       T.CREATE_NAME,
			       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
			       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
			       T.UPDATE_NAME,
			       T.DELETE_NAME,
			       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
			       T.MEMO,
			       T.VALIDFLAG,
			       T.PROCESS_ID_C,
			       DECODE(T.VALIDFLAG, '0', '无效', '有效') VALIDFLAGNAME,
			       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE =T.PROCESS_STYLE) PROCESS_STYLE,
			       T.MINUTE_PRODUCT,
				   T.MINUTE_WAITE,
				   T.BATCH_WAITE,
				   T.MINUTE_PRODUCT_OUT,
				   T.MINUTE_WAITE_OUT,
				   T.BATCH_WAITE_OUT
			  FROM COM_BASE_PROCESS_C T
			 WHERE T.VALIDFLAG IN ('1', ?)
			 AND T.PROCESS_DESC_C LIKE '%'|| ? ||'%'
			 ORDER BY PROCESS_CDOE_C
		]]>
	</query>
	
	<query id="CoreProcessBasics.isExistProcess2Id" desc="是否存在顺序号">
		<![CDATA[
			SELECT COUNT(1) FROM com_base_process_c WHERE PROCESS_ID_C = ?
		]]>
	</query>
	
	<query id="CoreProcessBasics.insertProcess2Data" desc="添加二级工序与一级工序关系">
		<![CDATA[
			INSERT INTO COM_BASE_PROCESS_C T
				  (T.PROCESS_CDOE_C,
				   T.PROCESS_DESC_C,
				   T.PROCESS_CDOE,
				   T.PROCESS_DESC,
				   T.PROCESS_ID_C,
				   T.CREATE_NAME,
				   T.CREATE_TIME,
				   T.VALIDFLAG,
				   T.MEMO,
				   T.PROCESS_STYLE,
				   T.MINUTE_PRODUCT,
				   T.MINUTE_WAITE,
				   T.BATCH_WAITE,
				   T.MINUTE_PRODUCT_OUT,
				   T.MINUTE_WAITE_OUT,
				   T.BATCH_WAITE_OUT)
				VALUES
				  (?, ?, ?, ?, ?, ?, SYSDATE, '1', ?,?, ?, ?, ?, ?, ?, ?)
		]]>
	</query>
	
	<query id="CoreProcessBasics.loadProcess1Data" desc="加载一级工序数据">
		<![CDATA[
			SELECT T.PROCESS_CODE, T.PROCESS_DESC
			  FROM COM_BASE_PROCESS T
			 WHERE T.VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="CoreProcessBasics.getMaxProcess2Code" desc="加载一级工序数据">
		<![CDATA[
			SELECT MAX(T.PROCESS_CDOE_C) FROM COM_BASE_PROCESS_C T
		]]>
	</query>
	
	
	<query id="CoreProcessBasics.updateProcess2" desc="更新二级工序数据">
		<![CDATA[
			UPDATE COM_BASE_PROCESS_C T
			   SET T.PROCESS_DESC_C = ?,
			       T.PROCESS_CDOE   = ?,
			       T.PROCESS_DESC   = ?,
			       T.PROCESS_ID_C   = ?,
			       T.UPDATE_NAME    = ?,
			       T.UPDATE_TIME    = SYSDATE,
			       T.MEMO           = ?,
			       T.PROCESS_STYLE  = ?,
			       T.MINUTE_PRODUCT = ?,
				   T.MINUTE_WAITE   = ?,
				   T.BATCH_WAITE    = ?,
				   T.MINUTE_PRODUCT_OUT = ?,
				   T.MINUTE_WAITE_OUT = ?,
				   T.BATCH_WAITE_OUT = ?
			   WHERE T.PROCESS_CDOE_C = ?
		]]>
	</query>
	
	<query id="CoreProcessBasics.deleteProcess2" desc="作废二级工序数据">
		<![CDATA[
			UPDATE COM_BASE_PROCESS_C T
			   SET T.VALIDFLAG = ?,
			   T.DELETE_NAME = ?,
			   T.DELETE_TIME = SYSDATE
			 WHERE T.PROCESS_CDOE_C = ?
		]]>
	</query>
	
	<query id="CoreProcessBasics.resumeProcess2" desc="恢复二级工序数据">
		<![CDATA[
			UPDATE COM_BASE_PROCESS_C T
			   SET T.VALIDFLAG = ?,
			   T.DELETE_NAME = '',
			   T.DELETE_TIME = ''
			 WHERE T.PROCESS_CDOE_C = ?
		]]>
	</query>
	
	<query id="CoreProcessBasics.isExistProcess2" desc="是否存在二级工序数据">
		<![CDATA[
			SELECT COUNT(1) FROM COM_BASE_PROCESS_C T WHERE T.PROCESS_DESC_C = ?
			AND T.PROCESS_CDOE_C != ?
		]]>
	</query>
	
	<query id="CoreProcessBasics.isExistProcess1" desc="是否存在一级工序数据">
		<![CDATA[
			SELECT COUNT(1) FROM COM_BASE_PROCESS T WHERE T.PROCESS_DESC = ?
			AND T.PROCESS_CODE != ?
		]]>
	</query>
	
	<query id="CoreProcessBasics.LoadProcessStyle" desc="是否存在一级工序数据">
		<![CDATA[
			SELECT BASENAME,BASECODE 
			FROM COM_BASE_INFO
			WHERE SORTCODE = '4072'
			AND VALIDFLAG ='1' 
		]]>
	</query>
	
	<query id="CoreProcessBasics.getAllProcess" desc="查询所有的工序">
		<![CDATA[
SELECT T.PROCESS_CODE, T.PROCESS_DESC FROM COM_BASE_PROCESS T
		]]>
	</query>
	
</queryMap>