<?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.fbsPuArrivalvouch.mapper.FbsArrivalVouchsMapper">

    <select id="getWillArriveList" resultType="org.jeecg.modules.fbsPuArrivalvouch.entity.FbsArrivalVouchs">

       <!-- select top 5 CONVERT(varchar(100), b.dDate, 23) arriveDate,c.cVenName vendorName,a.cInvCode materialCode,d.cInvName materialName,
          a.iQuantity arriveSum,d.cInvStd specs,b.cMemo memo
            from PU_ArrivalVouchs a
            left join PU_ArrivalVouch b on a.id = b.id
            left join Vendor c on c.cVenCode = b.cVenCode
            left join Inventory d on d.cInvCode = a.cInvCode
            where DATEDIFF(dd,getdate()+3,b.dDate) &gt; 0 and DATEDIFF(dd,getdate()+3,b.dDate) &lt; 4
        order by b.dDate-->
        SELECT  CONVERT
            ( VARCHAR ( 100 ), a.dArriveDate, 23 ) arriveDate,
            c.cVenName vendorName,
            a.cInvCode materialCode,
            d.cInvName materialName,
            a.iQuantity arriveSum,
            d.cInvStd specs,
            b.cMemo memo
        FROM
          PO_Podetails a
        LEFT JOIN PO_Pomain b ON a.POID = b.POID
        LEFT JOIN Vendor c ON c.cVenCode = b.cVenCode
        LEFT JOIN Inventory d ON d.cInvCode = a.cInvCode
        WHERE
            a.iQuantity - isnull( a.iReceivedQTY, 0 ) > 0
            AND dArriveDate <![CDATA[ >= ]]>getdate()
            AND dArriveDate <![CDATA[ <= ]]>dateadd(
            DAY,
            3,
            getdate())
        ORDER BY
            a.dArriveDate
    </select>

   <!-- <select id="getWillArriveList" resultType="org.jeecg.modules.fbsPuArrivalvouch.entity.FbsArrivalVouchs">

       select top 5 CONVERT(varchar(100), b.dDate, 23) arriveDate,c.cVenName vendorName,a.cInvCode materialCode,d.cInvName materialName,
          a.fValidQuantity arriveSum,d.cInvStd specs,b.cMemo memo
            from PU_ArrivalVouchs a
            left join PU_ArrivalVouch b on a.id = b.id
            left join Vendor c on c.cVenCode = b.cVenCode
            left join Inventory d on d.cInvCode = a.cInvCode
           where fValidQuantity - fValidInQuan > 0
        order by b.dDate
    </select>-->

    <select id="getLastSixMonthQualityTargetCompare" resultType="java.util.HashMap">

        select  top 6 CONVERT(varchar(7), b.dDate,23) month, sum(a.fRealQuantity) target, sum(a.fRealQuantity ) fRealQuantity,
        sum(a.fValidQuantity) real,sum(a.fValidInQuan) as fValidInQuan
        from  PU_ArrivalVouchs a
        left join PU_ArrivalVouch b on a.id = b.id
        group by CONVERT(varchar(7), b.dDate,23)
        order by CONVERT(varchar(7), b.dDate,23) desc

    </select>
</mapper>