<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "对基础信息实绩操作">
	<query id = "ComBasePlineReback.query" desc = "查询产线">
	<![CDATA[
SELECT 'False' CHK, T.*, C.PROPORTION, C.PERCENT 
FROM 
(SELECT A.PLINE_CODE, A.PLINE_NAME, B.ITEM_CODE, B.ITEM_NAME FROM COM_BASE_PLINE A, COST_BASE_PRICE B
 ) T
LEFT JOIN COST_BASE_PLINE_REBACK C
ON C.PLINE_CODE = T.PLINE_CODE
AND C.ITEM_CODE = T.ITEM_CODE
	]]>
	</query>
	<query id = "ComBasePlineReback.queryPliao" desc = "获取产线返率信息">
	<![CDATA[
SELECT 'FALSE' CHK, T.*, C.PROPORTION, C.PERCENT
  FROM (SELECT A.PLINE_CODE,
               A.PLINE_NAME,
               CPL.PROCESS_DESC,
               B.ITEM_CODE,
               B.ITEM_NAME
          FROM COM_BASE_PLINE A
          LEFT JOIN COM_BASE_PLINE CPL
            ON CPL.PLINE_CODE = A.PLINE_CODE
          LEFT JOIN COST_BASE_METAL_TYPE B
            ON B.ARC_CODE = '111004'
           AND B.VALIDFLAG = '1'
         WHERE A.VALIDFLAG = '1'
           AND DECODE({0}, NULL, '1', A.PLINE_NAME) LIKE
               DECODE({0}, NULL, '1', '%' || {0} || '%')) T
  LEFT JOIN COST_BASE_PLINE_REBACK C
    ON C.PLINE_CODE = T.PLINE_CODE
   AND C.ITEM_CODE = T.ITEM_CODE

	]]>
	</query>
	
	<query id = "ComBasePlineReback.queryNum" desc = "获取产线返率信息">
	<![CDATA[
	SELECT COUNT(*) 
	FROM COST_BASE_PLINE_REBACK T 
	WHERE 1=1
	]]>
	</query>
	
	<query id = "ComBasePlineReback.isave" desc = "保存产线返回率信息">
	<![CDATA[
 INSERT INTO COST_BASE_PLINE_REBACK(
        PLINE_CODE,
        PLINE_NAME,
        ITEM_CODE,
        ITEM_NAME,
        PROPORTION,
        PERCENT,
        CREATE_NAME,
        CREATE_TIME)
 VALUES( 
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#ITEM_CODE#',
        '#ITEM_NAME#',
        '#PROPORTION#',
        '#PERCENT#',
        '#CREATE_NAME#',
        SYSDATE)
	]]>
	</query>
	
	<query id = "ComBasePlineReback.usave" desc = "保存产线返回率信息">
	<![CDATA[
 UPDATE COST_BASE_PLINE_REBACK T
   SET 
        T.PLINE_CODE = '#PLINE_CODE#',
        T.PLINE_NAME = '#PLINE_NAME#',
        T.ITEM_CODE = '#ITEM_CODE#',
        T.ITEM_NAME = '#ITEM_NAME#',
        T.PROPORTION = '#PROPORTION#',
        T.PERCENT = '#PERCENT#',
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE
 WHERE
T.PLINE_CODE = '#PLINE_CODE#'
AND T.ITEM_CODE = '#ITEM_CODE#'
	]]>
	</query>
</queryMap>