<?xml version="1.0" encoding="UTF-8"?>

<queryMap  desc = "加工备注确认">

 <query id = "CoreAffirmProcessMemo.queryMemo" desc = "查询加工备注">
  <![CDATA[
 
  SELECT A.ORD_PK,
       B.ORD_LN_PK,
       A.ORDER_NO,
       B.ORDER_SEQ,
       C.ORDER_ADD_DESC,
       C.BACK_REASON,
       DECODE(C.AFFIRM_STATUS, 'L', '待确认', 'S', '已确认', 'F', '确认回退') AFFIRM_STATUS,
       C.AFFIRM_STATUS STATUS_CODE

  FROM SLM_ORDER_HEAD A, SLM_ORDER_LINE B, SLM_ORDER_LINE_PURCHASE C
 WHERE A.ORD_PK = ?
   AND A.ORD_PK = B.ORD_PK
   AND B.ORD_PK = C.ORD_PK
   AND B.ORD_LN_PK = C.ORD_LN_PK
   AND A.VALIDFLAG = '1'
   AND B.VALIDFLAG = '1'
   AND C.VALIDFLAG = '1'
 ]]>
  
  </query>

  <query id = "CoreAffirmProcessMemo.AffirmMemo" desc = "确认加工备注">
   <![CDATA[
 	      UPDATE SLM_ORDER_LINE_PURCHASE T
 	      SET T.AFFIRM_STATUS = 'S',
 	          T.AFFIRM_NAME = ?,
              T.AFFIRM_DATE = SYSDATE,
              T.AFFIRM_DEPID = ?,
              T.AFFIRM_DEPNAME = ?
 	      
 	      WHERE T.ORD_PK = ?
 	      AND T.VALIDFLAG = '1'
   ]]>
   </query>
   
    <query id = "CoreAffirmProcessMemo.queryMemoStatus" desc = "确认加工备注">
   <![CDATA[
 	      SELECT TO_CHAR(WM_CONCAT(T.AFFIRM_STATUS)) AFFIRM_STATUS
     FROM SLM_ORDER_LINE_PURCHASE T
     WHERE T.ORD_PK = ?
     AND T.VALIDFLAG = '1'
 	      
   ]]>
  
   </query>
   
    <query id = "CoreAffirmProcessMemo.BackMemo" desc = "回退加工备注">
   <![CDATA[
        UPDATE SLM_ORDER_LINE_PURCHASE T
 	      SET T.AFFIRM_STATUS = 'F',
 	          BACK_REASON  = ?,
 	          AFFIRM_NAME = ?,
 	          AFFIRM_DATE = SYSDATE,
 	          AFFIRM_DEPID  = ?,
              AFFIRM_DEPNAME = ?
 	      WHERE T.ORD_PK = ?
 	      AND T.ORD_LN_PK = ?
 	      AND T.VALIDFLAG = '1'
  
    ]]>
  
   </query>
   




</queryMap>