<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="合同交货期界面查询">
<query id="frmOrderReviewDelivery.CoreOrderDelvryQuery" desc="合同交货期评审信息">
        <![CDATA[
             SELECT B3.ORDER_NO,B3.CUSTM_ORDER_NO,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.ORDER_TYP) ORDER_TYP,
            B3.SALE_AREA_DESC SALE_AREA_NO,B1.ORD_PK,
            B1.PRDCYC_MEET DELVRY_EDATE_MET,
            B3.ORDER_YEAR,B3.SIGN_DATE,B3.SIGN_ADDRESS,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.SUPPLY_UNIT) SUPPLY_UNIT,
            (SELECT CUSTOMER_NM FROM SLM_BASE_CUSTOMER  WHERE  CUSTOMER_NO = B3.STLMT_UNIT_NO) STLMT_UNIT_NO,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.MNY_ASK_TYP) MNY_ASK_TYP,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.CURRENCY) CURRENCY,
      (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.ORDER_STS) ORDER_STS,CLOSE_TIME,
      B3.EFFECT_TIME,B3.APPROVAL_TIME,B3.DELETE_TIME,B3.DELETE_NAME,B3.UPDATE_TIME,B3.UPDATE_NAME,
      B3.CREATE_TIME,B3.CREATE_NAME,
      decode(B3.VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
      B3.ORDER_MODEL_DESC ORDER_MODEL_NO,
            B3.MNY_ASK_DESC,B3.MANAG_NO,
            B3.CUSTOMER_NM CUSTOMER_NO,
             B3.MEMO,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.PRICE_FL) PRICE_FL,
            B3.CUSTOMER_MODEL_FL
            FROM SLM_ORDER_HEAD B3,slm_ord_design_sts_main B1
           WHERE 1 = 1 and B3.ORD_PK = B1.ORD_PK

        ]]>
    </query>
    <query id="frmOrderReviewDelivery.CoreOrderSqeDelvryQuery" desc="合同交货期评审合同行信息">
        <![CDATA[
           SELECT ORDER_SEQ,
       T. ORDER_LN_STATUS,T.ORD_LN_PK,
       T. PRODUCNAME,
       T. ORDER_SPEC_DESC,
       T. MODEL_DESC,
       T. LEN_DESC,
       T. ORDER_QTY,
       T. ORDER_UNIT,
       T. PRDCT_WGT,
       '﹣' || T.DELVRY_RANGE_MIN || '~' || T.DELVRY_RANGE_MAX ||
       T.DELVRY_RANGE_TPE DELVRY_RANGE,
       T. FINAL_USER_DESC,
       T. VALIDFLAG,
       T. CREATE_NAME,
       T. CREATE_TIME,
       T. UPDATE_NAME,
       T. UPDATE_TIME,
       T. DELETE_NAME,
       T. DELETE_TIME,
       T. OUTS_BILLET_FL,
       T. OUTS_STL_PIPE_FL,
       T. ASSEL_FL,
       T. ORDER_ADD_DESC,
       T. CUST_ALPHA_NO,T1.DELVRY_EDATE_MET
  FROM SLM_ORDER_LINE T, SLM_ORDER_REVIEW_ITEM_LIST T1
 WHERE T.ORD_PK = ?
   AND T.ORD_PK = T1.LIST_PK_VAL AND T1.IS_CURT_REVIEW ='1' AND T1.REVIEW_ITM = 'D' 
     ]]>
    </query>
    <query id="frmOrderReviewDelivery.CoreOrderDelvryTableQuery" desc="合同交货期评审交货行信息">
        <![CDATA[
             SELECT T1.DELVRY_EDATE,
             T1.DELVRY_QTY,T1.ORD_LN_PK,T1.ORD_PK,T1.ORD_LN_DLY_PK,
             T1.ORDER_UNIT,
             T1.WGT_ESTMT,
             T1.ENSU_TOTL_LEN,
             T2.PRD_CYC,
             T2.RCMD_DELVRY_EDATE,
             T2.CYC_EDIT,
             T1.                  RECEIV_NM,
             T1.TRANSIT_PLAN,
             T1.DELVRY_ADDR,
             DECODE(T2.REVIEW_STATUS,'L','封锁','W','待评审','D','评审中','S','评审通过','F','评审失败') REVIEW_STATUS
        FROM SLM_ORDER_LINE_DELIVERY T1, SLM_ORDER_REVIEW_ITEM_LIST T2
       WHERE T1.ORD_PK = T2.LIST_PK_VAL AND T1.ORD_PK = ? AND T2.REVIEW_ITM = 'D' AND T2.IS_CURT_REVIEW = '1'

     ]]>
    </query>
     <query id="frmOrderReviewDelivery.ReviewDeliverySave" desc="合同交货期评审保存">
        <![CDATA[
             UPDATE SLM_ORDER_LINE_DELIVERY SET  DELVRY_EDATE = TO_DATE(?,'YYYY/MM/DD'),DELVRY_QTY= ? WHERE ORD_LN_PK = ? AND ORD_LN_DLY_PK = ?
     ]]>
    </query>
    <query id="frmOrderReviewDelivery.ReviewDeliveryDelete" desc="合同交货期评审删除">
        <![CDATA[
             DELETE SLM_ORDER_LINE_DELIVERY  WHERE ORD_LN_PK = ? AND ORD_LN_DLY_PK = ?
     ]]>
    </query>
     <query id="frmOrderReviewDelivery.reviewDeliverySure" desc="合同交货期评审合同头信息">
        <![CDATA[
            UPDATE SLM_ORDER_HEAD SET ORDER_STS = '120223',ORDER_STS_DESC = '评审通过',APPROVAL_MAN = ?,APPROVAL_TIME = SYSDATE,UPDATE_NAME= ? , UPDATE_TIME = SYSDATE WHERE ORD_PK = ?
        ]]>
    </query>
     <query id="frmOrderReviewDelivery.reviewDeliverySure2" desc="合同交货期评审评审主表">
        <![CDATA[
            UPDATE SLM_ORDER_REVIEW SET REVIEW_STATUS = 'S',UPDATE_NAME = ?,UPDATE_TIME = SYSDATE WHERE ORD_PK = ?
        ]]>
    </query>
    <query id="frmOrderReviewDelivery.reviewDeliverySure3" desc="合同交货期评审评审项目表">
        <![CDATA[
            UPDATE SLM_ORDER_REVIEW_ITEM SET REVIEW_STATUS = 'S',UPDATE_NAME= ?,CREATE_TIME = SYSDATE WHERE REVIEW_NO = 
            (SELECT T.REVIEW_NO FROM SLM_ORDER_REVIEW T WHERE T.ORD_PK = ?) AND REVIEW_ITM = 'D'
        ]]>
    </query>
     <query id="frmOrderReviewDelivery.reviewDeliverySure4" desc="合同交货期评审评审项目明细表">
        <![CDATA[
            UPDATE SLM_ORDER_REVIEW_ITEM_LIST SET REVIEW_STATUS = 'S',REVIEW_F_RS = '',REVIEW_MAN = ?,UPDATE_NAME = ?,UPDATE_TIME = SYSDATE WHERE LIST_PK_VAL = ?
        ]]>
    </query>
    <query id="frmOrderReviewDelivery.reviewDeliverySure5" desc="合同交货期评审评审合同行表">
        <![CDATA[
            UPDATE SLM_ORDER_LINE SET ORDER_LN_STATUS = '已评审',UPDATE_NAME = ?,UPDATE_TIME = SYSDATE WHERE ORD_PK = ?
        ]]>
    </query>
</queryMap>
