<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="附加要求项与工序点对应关系">

	<query id="CoreComBaseAskRStation.getAddAsk" desc="查询附加要求分项">
       <![CDATA[
             SELECT A.ASK_ITEM_NO,
       A.ASK_ITEM_DESC,
       A.STATION_CODE,
       A.STATION_DESC,
       A.PIC,
       (SELECT B.ASK_ITEM_DESC
          FROM SLM_BASE_ADD_ASK B
         WHERE B.ASK_ITEM_NO = A.ASK_P_ITEM_NO) ASK_P_ITEM_NO,
       A.VALIDFLAG,
       A.CREATE_NAME,
       A.CREATE_TIME,
       A.UPDATE_NAME,
       A.UPDATE_TIME,
       A.DELETE_NAME,
       A.DELETE_TIME,
       A.STDFLAG
  FROM SLM_BASE_ADD_ASK A
 WHERE A.ASK_P_ITEM_NO IN
       (SELECT A.ASK_ITEM_NO
          FROM SLM_BASE_ADD_ASK A
         WHERE LENGTH(A.ASK_ITEM_NO) = 6)
       ]]>
	</query>

	<query id="CoreComBaseAskRStation.getAddAskRelation" desc="查询附加要求与工序点对应关系">
       <![CDATA[
             SELECT 'False' CHC,
       STATION_CODE,
       STATION_DESC,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = A.STATION_TYPE) STATION_TYPE_DESC,
       A.STATION_TYPE,
       STATION_ID,
       PROCESS_CODE,
       PROCESS_DESC,
       PROCESS_CODE_C,
       PROCESS_DESC_C,
       Cost,
       DECODE(A.CHOOSE,'1','True','False') CHOOSE,
       DECODE(A.RETURN_RESULT,'1','True','False') RETURN_RESULT,
       DECODE(A.SEND_CHECKPLAN,'A','True','False') SEND_CHECKPLAN,
       MONITOR_LV,
       MONITOR_LV2,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       VALIDFLAG,
       MEMO,
       STATION_CODE_OLD
  FROM COM_BASE_STATION A
 WHERE A.VALIDFLAG = '1'
   AND A.STATION_CODE NOT IN
       (SELECT B.STATION_CODE
          FROM COM_BASE_ASK_R_STATION B
         WHERE B.ASK_ITEM_NO = ?
           AND B.VALIDFLAG = '1')
UNION
SELECT 'True' CHC,
       STATION_CODE,
       STATION_DESC,
       (SELECT B.BASENAME
          FROM COM_BASE_INFO B
         WHERE B.BASECODE = A.STATION_TYPE) STATION_TYPE_DESC,
       A.STATION_TYPE,
       STATION_ID,
       PROCESS_CODE,
       PROCESS_DESC,
       PROCESS_CODE_C,
       PROCESS_DESC_C,
       Cost,
       DECODE(A.CHOOSE,'1','True','False') CHOOSE,
       DECODE(A.RETURN_RESULT,'1','True','False') RETURN_RESULT,
       DECODE(A.SEND_CHECKPLAN,'A','True','False') SEND_CHECKPLAN,
       MONITOR_LV,
       MONITOR_LV2,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       VALIDFLAG,
       MEMO,
       STATION_CODE_OLD
  FROM COM_BASE_STATION A
 WHERE A.STATION_CODE IN (SELECT B.STATION_CODE
                            FROM COM_BASE_ASK_R_STATION B
                           WHERE B.ASK_ITEM_NO = ?
                             AND B.VALIDFLAG = '1')
       ]]>
	</query>

	<query id="CoreComBaseAskRStation.saveAddAskRelation" desc="保存附加要求与工序点对应关系">
       <![CDATA[
         INSERT INTO COM_BASE_ASK_R_STATION(
        ASK_ITEM_NO,
        ASK_ITEM_DESC,
        STATION_CODE,
        STATION_DESC,
        PROCESS_CDOE,
        PROCESS_DESC,
        PROCESS_CDOE_C,
        PROCESS_DESC_C,
        CREATE_NAME,
        CREATE_TIME,
        UPDATE_NAME,
        UPDATE_TIME,
        DELETE_NAME,
        DELETE_TIME,
        VALIDFLAG,
        MEMO)
 VALUES( 
        '#ASK_ITEM_NO#',
        '#ASK_ITEM_DESC#',
        '#STATION_CODE#',
        '#STATION_DESC#',
        '#PROCESS_CDOE#',
        '#PROCESS_DESC#',
        '#PROCESS_CDOE_C#',
        '#PROCESS_DESC_C#',
        '#CREATE_NAME#',
        SYSDATE,
        '#UPDATE_NAME#',
        SYSDATE,
        '#DELETE_NAME#',
        SYSDATE,
        '1',
        '#MEMO#')
       ]]>
	</query>

	<query id="CoreComBaseAskRStation.deleteAddAskRelation" desc="删除附加要求与工序点对应关系">
       <![CDATA[
      DELETE COM_BASE_ASK_R_STATION WHERE ASK_ITEM_NO = ?
       ]]>
	</query>


</queryMap>