<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="内倒车辆维护">
    <query id="CarEffServer.doQuery" desc="查询结果">
        <![CDATA[
           SELECT *
  FROM CMM_WEIGHT_RECORD T
 WHERE T.VALIDFLAG = '1'
   AND T.WT_TYPE = '0'
   AND T.CAR_NO IN
       (SELECT C.CAR_NO FROM CMM_CAR_EFF C WHERE C.VALIDFLAG = '1')
        ]]>
    </query>

    <query id="CarEffServer.doUpdate" desc="查询结果">
        <![CDATA[
          UPDATE CMM_WEIGHT_RECORD
   SET VALIDFLAG = '2'
 WHERE RECORD_NO IN (

                     SELECT T.RECORD_NO
                       FROM CMM_WEIGHT_RECORD T, CMM_CAR_EFF C
                      WHERE T.VALIDFLAG = '1'
                        AND T.WT_TYPE = '0'
                        AND T.CAR_NO = C.CAR_NO
                        AND C.VALIDFLAG = '1'
                        AND T.RECORD_DATE + 1 / 24 * C.TIME_EFF <= SYSDATE)
        ]]>
    </query>


    <query id="CarEffServer.doUpdate2" desc="查询结果">
        <![CDATA[
          UPDATE CMM_CAR_EFF T
      SET T.TARE_DATE =
          (SELECT MAX(D.RECORD_DATE)
             FROM CMM_WEIGHT_RECORD D
            WHERE D.VALIDFLAG = '1'
              AND D.WT_TYPE = '0'
                AND D.CAR_NO = T.CAR_NO
              )
    WHERE T.VALIDFLAG = '1'

        ]]>
    </query>

</queryMap>