|
@@ -0,0 +1,32 @@
|
|
|
+<?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.report.mapper.SoSoDetailsMapper">
|
|
|
+ <select id="getSO_SOMainReport" parameterType="java.util.HashMap" resultType="java.util.HashMap">
|
|
|
+ SELECT
|
|
|
+ de.cDepName,
|
|
|
+ ss.cCusCode,
|
|
|
+ v.cVenAbbName,
|
|
|
+ convert(char(7),ss.dPreDateBT,120) yearMonth,
|
|
|
+ ssd.iNatUnitPrice,
|
|
|
+ case when max(ssd.cSCloser) is null then sum(ssd.iQuantity)
|
|
|
+ else sum(ssd.foutquantity) end as iQuantity,
|
|
|
+ sum(ssd.iNatMoney) as iNatMoney
|
|
|
+ FROM
|
|
|
+ SO_SOMain ss
|
|
|
+ LEFT JOIN SO_SODetails ssd ON ss.ID= ssd.ID
|
|
|
+ left join Vendor v on ss.cCusCode=v.cVenCode
|
|
|
+ left join Department de on ss.cDepCode=de.cDepCode
|
|
|
+ WHERE
|
|
|
+ CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ) <![CDATA[ >= ]]> #{map.startYearMonth}
|
|
|
+ AND CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ) <![CDATA[ <= ]]> #{map.endYearMonth}
|
|
|
+ <if test="map.vendorType!=null and map.vendorType!='' and map.vendorType=='内部'">
|
|
|
+ and (v.cVenAbbName='宁波森语' or v.cVenAbbName='马菲羊' or v.cVenAbbName='森语集团')
|
|
|
+ </if>
|
|
|
+ <if test="map.vendorType!=null and map.vendorType!='' and map.vendorType=='外部'">
|
|
|
+ and v.cVenAbbName <![CDATA[ <> ]]> '宁波森语' and v.cVenAbbName <![CDATA[ <> ]]> '马菲羊' and v.cVenAbbName <![CDATA[ <> ]]> '森语集团')
|
|
|
+ </if>
|
|
|
+ GROUP BY de.cDepName,ss.cCusCode,v.cVenAbbName,convert(char(7),ss.dPreDateBT,120),ssd.iNatUnitPrice
|
|
|
+ ORDER BY
|
|
|
+ de.cDepName,ss.cCusCode,CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ),ssd.iNatUnitPrice
|
|
|
+ </select>
|
|
|
+</mapper>
|