<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.fbsDispatchList.mapper.FbsDispatchListMapper">
    <select id="getWatingSendList" resultType="java.util.HashMap">

       <!--  SELECT
                c.cWhName warehouseName,a.cInvCode materialCode,d.cInvName materialName,d.cInvStd specs,

                a.iQuantity sendSum
                ,CONVERT(varchar(30),b.dDate,23) planSendDate,a.cItemName cItemName,a.cItemCode cItemCode
        FROM
             DispatchLists a
             left join DispatchList b on a.DLID  = b.DLID
             left join Warehouse c on a.cWhCode = c.cWhCode
             left join Inventory d on a.cInvCode = d.cInvCode
          where
              a.fOutQuantity =0
              and a.iQuantity>0
              AND datediff( MONTH, b.dDate, getdate ( ) ) = 0
					order by b.dDate desc -->
        SELECT
        a.cWhName warehouseName,
        sum(a.iQuantity) sendSum,
        <!--CONVERT ( VARCHAR ( 30 ), b.dDate, 23 ) planSendDate,sql修改-->
        DATE_FORMAT( b.dDate,'%Y-%m-%d') planSendDate,
        a.cItemName cItemName,
        a.cItemCode cItemCode ,
        a.cWhCode
        FROM
        DispatchLists a
        LEFT JOIN DispatchList b ON a.DLID  = b.DLID
        <!--LEFT JOIN Warehouse c ON a.cWhCode = c.cWhCode sql修改-->
        WHERE
        a.fOutQuantity = 0
        AND a.iQuantity> 0
        AND a.cWhCode is NOT null
        <!--AND datediff( MONTH, b.dDate, getdate( ) ) = 0sql修改-->
        AND DATE_FORMAT( b.dDate, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
        and b.cVerifier is not null
        GROUP BY
        b.DLID,
        b.dDate,
        a.cItemName ,
        a.cItemCode  ,
        a.cWhCode,
        a.cWhName
        ORDER BY
        b.dDate DESC

    </select>

     <select id="getSendSum" resultType="int">

         SELECT COUNT(1)
        FROM
             DispatchLists a
             left join DispatchList b on a.DLID  = b.DLID
             <!--left join Warehouse c on a.cWhCode = c.cWhCode sql修改-->
             left join Inventory d on a.cInvCode = d.cInvCode
          where  (a.iQuantity - a.fOutQuantity) = 0
          and a.iQuantity>0
          AND a.fOutQuantity>0
          AND a.iQuantity=a.fOutQuantity
            <!--AND datediff( MONTH, b.dDate, getdate ( ) ) = 0 sql修改-->
            AND DATE_FORMAT(b.dDate,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')
    </select>
</mapper>