<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="合同评审价格界面查询">
 
    <query id="CoreExcelToGrid.UpdateOrderLinePrice" desc="合同价格说明信息">
        <![CDATA[
             UPDATE SLM_ORDER_LINE T
       SET T.BALNCE_PRICE        =
       (SELECT A.BLA_PRICE
          FROM SLM_ORDER_PRICE_LIST A
         WHERE PRICE_NO = ?
           AND T.ORD_LN_PK = A.ORD_LN_PK),
       T.BALNCE_PRICE_STS     = '1',
       T.BALNCE_PRICE_ORG_STS = '1',
       T.OUT_PRICE           =
       (SELECT A.OUT_PRICE
          FROM SLM_ORDER_PRICE_LIST A
         WHERE PRICE_NO = ?
           AND T.ORD_LN_PK = A.ORD_LN_PK),
       TRANS_PRICE           =
       (SELECT A.TRS_PRICE
          FROM SLM_ORDER_PRICE_LIST A
         WHERE PRICE_NO = ?
           AND T.ORD_LN_PK = A.ORD_LN_PK),
       T.PAK_PRICE           =
       (SELECT A.PAK_PRICE
          FROM SLM_ORDER_PRICE_LIST A
         WHERE PRICE_NO = ?
           AND T.ORD_LN_PK = A.ORD_LN_PK)
       WHERE T.ORD_LN_PK IN
       (SELECT ORD_LN_PK FROM SLM_ORDER_PRICE_LIST WHERE PRICE_NO = ?)
             
        ]]>
    </query>
     
    <query id="CoreExcelToGrid.isExistsPriceNo" desc="合同价格说明信息">
        <![CDATA[
           SELECT  TRIM(T.PRICE_NO) FROM SLM_ORDER_HEAD T
           WHERE T.ORD_PK = ? AND LENGTH(T.PRICE_NO)>10
        ]]>
    </query>
    
     <query id="CoreExcelToGrid.getPriceNoStatus" desc="合同价格说明信息">
        <![CDATA[
           SELECT  PRICE_STATUS FROM SLM_ORDER_PRICE T
           WHERE   T.PRICE_NO = ? AND PRICE_STATUS !='D'
        ]]>
    </query>
    
    
     <query id="CoreExcelToGrid.UpdateOrderPrice" desc="合同价格说明信息">
        <![CDATA[
       UPDATE SLM_ORDER_PRICE
   SET PRICE_BASE      = ?,
       UPDATE_NAME     = ?,
       UPDATE_TIME     = SYSDATE,
       DELETE_NAME     = '',
       DELETE_TIME     = '',
       PRICE_STATUS    = 'S',
       REPORT_DEPTCODE = ?,
       REPORT_DEPTDESC = ?,
       REPORT_UNITCODE = ?,
       REPORT_UNITDESC = ?,
       REPORT_NAME     = ?,
       REPORT_TIME     = SYSDATE,
       DEAL_NAME       = ?,
       DEAL_TIME       = SYSDATE,
       DEAL_DEPTCODE   = ?,
       DEAL_DEPTDESC   = ?,
       DEAL_UNITCODE   = ?,
       DEAL_UNITDESC   = ?
       WHERE PRICE_NO  = ?
       
          
        ]]>
    </query>
    
   <query id="CoreExcelToGrid.UpdateOrderPriceList" desc="合同价格说明信息">
        <![CDATA[
    	
		UPDATE SLM_ORDER_PRICE_LIST
  		 SET BLA_PRICE   = ?,
      	 OUT_PRICE   = ?,
      	 TRS_PRICE   = ?,
       	 PAK_PRICE   = ?,
     	 UPDATE_NAME = ?,
         UPDATE_TIME = SYSDATE
         WHERE PRICE_NO = ?
         AND ORD_LN_PK = (SELECT T.ORD_LN_PK FROM SLM_ORDER_LINE T 
         WHERE T.ORD_PK = ? AND TO_NUMBER(T.ORDER_SEQ) = TO_NUMBER(?) 
         AND VALIDFLAG = '1' )
    	 
        ]]>
    </query>
    
    
    
    <query id="CoreExcelToGrid.InsertOrderPrice" desc="合同价格说明信息">
        <![CDATA[
        INSERT INTO SLM_ORDER_PRICE
  (PRICE_NO,
   PRICE_BASE,
   CREATE_NAME,
   CREATE_TIME,
   PRICE_STATUS,
   REPORT_DEPTCODE,
   REPORT_DEPTDESC,
   REPORT_UNITCODE,
   REPORT_UNITDESC,
   REPORT_NAME,
   REPORT_TIME,
   DEAL_NAME,
   DEAL_TIME,
   DEAL_DEPTCODE,
   DEAL_DEPTDESC,
   DEAL_UNITCODE,
   DEAL_UNITDESC,
   ORD_PK)
  VALUES
  (?, ?, ?, SYSDATE, 'S', ?, ?, ?, ?, ?,
   SYSDATE, ?, SYSDATE, ?, ?, ?, ?, ?)

         
        ]]>
    </query>
    
    <query id="CoreExcelToGrid.InsertOrderPriceList" desc="合同价格说明信息">
        <![CDATA[
      INSERT INTO SLM_ORDER_PRICE_LIST
  (PRICE_NO,
   ORD_LN_PK,
   BLA_PRICE,
   OUT_PRICE,
   TRS_PRICE,
   PAK_PRICE,
   CREATE_NAME,
   CREATE_TIME)
   VALUES
   (?, (SELECT T.ORD_LN_PK FROM SLM_ORDER_LINE T 
      WHERE T.ORD_PK = ? AND TO_NUMBER(T.ORDER_SEQ) = TO_NUMBER(?) 
      AND VALIDFLAG = '1' ), ?, ?, ?, ?, ?, SYSDATE)
      
          
        ]]>
    </query>
    
    <query id="CoreExcelToGrid.UpdateOrderHeadPriceNo" desc="合同价格说明信息">
        <![CDATA[
  		UPDATE SLM_ORDER_HEAD T
  		SET T.PRICE_NO = ?
  		WHERE T.ORD_PK = ?
          
        ]]>
    </query>
    
    
    <query id="CoreExcelToGrid.queryOrderPk" desc="获取合同PK值 用于判断是否存在合同">
        <![CDATA[
  	 SELECT T.ORD_PK FROM SLM_ORDER_HEAD T 
  	 WHERE T.ORDER_NO = ? AND T.VALIDFLAG = '1'
  		  
        ]]>
    </query>
    
     <query id="CoreExcelToGrid.queryOrderSaleOrg" desc="获取合同PK值 用于判断是否存在合同">
        <![CDATA[
  	 SELECT T.SALE_ORG FROM SLM_ORDER_HEAD T 
  	 WHERE T.ORD_PK = ? AND T.VALIDFLAG = '1'
  		  
        ]]>
    </query>
    
    

</queryMap>
