<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="本地计量记录表">


    <query id="RecordServer.doQueryRecord" desc="查询模板">
        <![CDATA[

SELECT RECORD_NO,
       TO_CHAR(RECORD_DATE, 'YYYY-MM-DD HH24:MI:SS')  RECORD_DATE,
       RECODER,
       CAR_NO,
       RECORD_TYPE,
       RECORD_WEIGHT,
       RECORD_NUMBER,
       VALIDFLAG,
       MAT_NAME,
       MAT_TYPE,
       LOADVEHICLE_NO,
       RECEIVE_NAME,
       ORDER_NAME,
       SHIPPERS_NAME,
       TRANSPORT_NAME,
       DELETE_DATE,
       DELETE_USER,
       MEMO,
       WT_TYPE,
       RECODER_LOCATION,
       REAL_WT
  FROM CMM_WEIGHT_RECORD
    WHERE  1=1
        ]]>
    </query>

    <query id="RecordServer.doQueryRecordId" desc="查询过磅记录流水">
        <![CDATA[
                 SELECT 'LS' || TO_CHAR(SYSDATE, 'yyyyMMDD') ||
    LPAD(NVL(MAX(TO_NUMBER(SUBSTR(RECORD_NO, LENGTH(RECORD_NO) - 5))),
    0) + 1,
    6,
    '0') RECORD_NO
    FROM  CMM_WEIGHT_RECORD
    WHERE RECORD_NO LIKE 'LS' || TO_CHAR(SYSDATE, 'yyyyMMDD') || '______'
        ]]>
    </query>


    <query  id="RecordServer.doSaveRecordId" desc="保存过磅记录">
        <![CDATA[
        INSERT INTO CMM_WEIGHT_RECORD(
        RECORD_NO,
        RECORD_DATE,
        RECODER,
        CAR_NO,
        RECORD_TYPE,
        RECORD_WEIGHT,
        RECORD_NUMBER,
        VALIDFLAG,
        MAT_NAME,
        MAT_TYPE,
        LOADVEHICLE_NO,
        RECEIVE_NAME,
        ORDER_NAME,
        SHIPPERS_NAME,
        TRANSPORT_NAME,
        MEMO,
        WT_TYPE,
        RECODER_LOCATION
        )
        VALUES(
        '#RECORD_NO#',
        SYSDATE,
        '#RECODER#',
        '#CAR_NO#',
        '#RECORD_TYPE#',
        '#RECORD_WEIGHT#',
        '#RECORD_NUMBER#',
        '#VALIDFLAG#',
        '#MAT_NAME#',
        '#MAT_TYPE#',
        '#LOADVEHICLE_NO#',
        '#RECEIVE_NAME#',
        '#ORDER_NAME#',
        '#SHIPPERS_NAME#',
        '#TRANSPORT_NAME#',
        '#MEMO#',
        '#WT_TYPE#',
        '#RECODER_LOCATION#')
           ]]>
    </query>





    <query  id="RecordServer.doUpdateValidFlag" desc="保存过磅记录">
        <![CDATA[
        UPDATE CMM_WEIGHT_RECORD
        SET VALIDFLAG = ?
        WHERE RECORD_NO = ?
           ]]>
    </query>


    <query  id="RecordServer.Update" desc="保存过磅记录">
        <![CDATA[
      UPDATE CMM_WEIGHT_RECORD T
   SET
        T.RECORD_TYPE = '#RECORD_TYPE#',
        T.RECORD_WEIGHT = '#RECORD_WEIGHT#',
        T.RECORD_NUMBER = '#RECORD_NUMBER#',
        T.MAT_NAME = '#MAT_NAME#',
        T.MAT_TYPE = '#MAT_TYPE#',
        T.LOADVEHICLE_NO = '#LOADVEHICLE_NO#',
        T.RECEIVE_NAME = '#RECEIVE_NAME#',
        T.ORDER_NAME = '#ORDER_NAME#',
        T.SHIPPERS_NAME = '#SHIPPERS_NAME#',
        T.TRANSPORT_NAME = '#TRANSPORT_NAME#',
        T.MEMO = '#MEMO#',
        T.WT_TYPE = '#WT_TYPE#',
        T.REAL_WT = '#REAL_WT#'
 WHERE
T.RECORD_NO = '#RECORD_NO#'
           ]]>
    </query>


</queryMap>