<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="销售出厂装车">




    <query  id="LoadVehicleServer.doQueryLoadvehicleInfo" desc="查询装车主表信息">
        <![CDATA[
 SELECT *
   FROM (SELECT T.*,
                  H.CUSTOMER_NM || (DECODE(H.FST_DRAWEE_UNIT,
                                         '120604',
                                         '【钢贸】',
                                         '120605',
                                         '【国贸】',
                                         '120608',
                                         '【制造】',
                                         '')) CUSTOMER_NM,
    I.BASENAME
           FROM YDM_ZC_LOADVEHICLE T , YDM_ZC_BILL_M M, SLM_ORDER_HEAD H
           LEFT JOIN COM_BASE_INFO I
             ON H.SUPPLY_UNIT = I.BASECODE
          WHERE T.BILL_NO = M.BILL_NO
            AND M.ORD_PK = H.ORD_PK
            AND T.AFFIRM_FLAG = '0'
            AND T.VEHICLE_NO = ?
            AND T.VALIDFLAG = '1'
            AND T.PONDER_NO IS NULL
            AND T.PONDER_GROSS_WT IS NULL
          ORDER BY LOAD_TIME DESC)
  WHERE ROWNUM = 1



           ]]>
    </query>

    <query  id="LoadVehicleServer.doQueryHook" desc="查询装车主表信息">
        <![CDATA[
 SELECT JUDGE_STOVE_NO ,SUM(HOOK_WEIGHT)  HOOK_WEIGHT,SUM(SEND_NUM) SEND_NUM FROM YDM_ZC_HOOK_WEIGHT WHERE LOADVEHICLE_NO =?
  GROUP BY JUDGE_STOVE_NO

           ]]>
    </query>




    <query  id="LoadVehicleServer.doQueryLoadvehicleMatInfo" desc="查询装车子表表信息">
        <![CDATA[
     SELECT M.STORAGE_NO,
       B.STORAGE_NAME,
       M.STOVE_NO,
       M.VEHICLE_NO,
       M.ORDER_NO,
       M.ORDER_SEQ,
       M.ORDER_SEQ_NO,
       M.PRODUCCODE,
       M.PRODUCNAME,
       STD_CODE,
       STD_NAME,
       M.GRADECODE,
       M.GRADENAME,
       M.STEELCODE,
       M.STEELNAME,
       M.SPEC_CODE,
       M.SPEC_NAME,
       M.MODEL_CODE,
       M.MODEL_DESC,
       M.ACT_LEN_MIN,
       M.ACT_LEN_MAX,
         M.JUDGE_STOVE_NO,
          M.ACT_DIMATER,
          M.ACT_HEIGHT,
       SUM(ACT_WEIGHT) ACT_WEIGHT,
       SUM(ACT_COUNT) ACT_COUNT
  FROM YDM_ZC_LOADVEHICLE_MAT M
  LEFT JOIN YDM_BS_STORAGE B
    ON M.STORAGE_NO = B.STORAGE_NO
 WHERE LOADVEHICLE_NO = ?
 GROUP BY M.STORAGE_NO,
          B.STORAGE_NAME,
          M.STOVE_NO,
          M.VEHICLE_NO,
          M.ORDER_NO,
          M.ORDER_SEQ,
            M.ORDER_SEQ_NO,
          M.PRODUCCODE,
          M.PRODUCNAME,
          STD_CODE,
          STD_NAME,
          M.GRADECODE,
          M.GRADENAME,
          M.STEELCODE,
          M.STEELNAME,
          M.SPEC_CODE,
          M.SPEC_NAME,
          M.MODEL_CODE,
          M.MODEL_DESC,
          M.ACT_LEN_MIN,
          M.ACT_LEN_MAX,
          M.JUDGE_STOVE_NO,
          M.ACT_DIMATER,
          M.ACT_HEIGHT


           ]]>
    </query>


    <query  id="LoadVehicleServer.doQueryLoadList" desc="查询出库单信息">
        <![CDATA[
       SELECT * FROM YDM_ZC_LOADVEHICLE T WHERE T.LOADVEHICLE_NO  =?  AND T.VALIDFLAG ='1'
           ]]>
    </query>




    <query  id="LoadVehicleServer.doUpdateLoadList" desc="更新装车信息">
        <![CDATA[

    UPDATE YDM_ZC_LOADVEHICLE T
    SET T.PONDER_NO = ?, T.PONDER_GROSS_WT = ?
    WHERE T.LOADVEHICLE_NO = ?

           ]]>
    </query>


    <query  id="LoadVehicleServer.doUpdateLoadMat" desc="更新装车信息">
        <![CDATA[

    UPDATE YDM_ZC_LOADVEHICLE_MAT T
    SET T.PONDER_NO = ?, T.PONDER_GROSS_WT = ? ,SEND_NUM = ?
    WHERE T.LOADVEHICLE_NO = ?
     AND T.JUDGE_STOVE_NO=?
           ]]>
    </query>


    <query  id="LoadVehicleServer.doUpdateLoadMat2" desc="更新装车信息">
        <![CDATA[

    UPDATE YDM_ZC_LOADVEHICLE_MAT T
    SET T.PONDER_GROSS_WT = T.PONDER_GROSS_WT + ?,SEND_NUM  = SEND_NUM + ?
    WHERE T.LOADVEHICLE_NO = ?
     AND T.JUDGE_STOVE_NO=?
    AND ROWNUM =1
           ]]>
    </query>

    <query  id="LoadVehicleServer.doUpdateLoadMat3" desc="更新装车信息">
        <![CDATA[

    UPDATE YDM_ZC_LOADVEHICLE_MAT T
    SET T.PONDER_NO = ?, T.PONDER_GROSS_WT = ?,SEND_NUM = ?
    WHERE T.LOADVEHICLE_NO = ?
           ]]>
    </query>


    <query  id="LoadVehicleServer.doUpdateLoadHack" desc="更新装车信息">
        <![CDATA[
UPDATE YDM_ZC_HOOK_WEIGHT T  SET T.PONDER_GROSS_WT = T.SEND_NUM * ? WHERE T.LOADVEHICLE_NO = ?
 AND T.JUDGE_STOVE_NO=?
           ]]>
    </query>


    <query  id="LoadVehicleServer.doUpdateLoadHack2" desc="更新装车信息">
        <![CDATA[
UPDATE YDM_ZC_HOOK_WEIGHT T  SET T.PONDER_GROSS_WT = T.PONDER_GROSS_WT + ?  WHERE T.LOADVEHICLE_NO = ?
 AND T.JUDGE_STOVE_NO=?
AND ROWNUM = 1
           ]]>
    </query>

    <query  id="LoadVehicleServer.doUpdateLoadHack3" desc="更新装车信息">
        <![CDATA[
UPDATE YDM_ZC_HOOK_WEIGHT T  SET T.PONDER_GROSS_WT =  ?  WHERE T.LOADVEHICLE_NO = ?
           ]]>
    </query>




</queryMap>