Browse Source

销售统计报表 数据不对

liuchaohui 3 years ago
parent
commit
5d1d74c84a

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/controller/SoSoDetailsController.java

@@ -232,9 +232,9 @@ public class SoSoDetailsController extends JeecgController<SoSoDetails, ISoSoDet
 	 })
 	 @GetMapping(value = "/QuerySO_SOMainReportBydepartment")
 	 public Result<List<SoSoDetails>> QuerySO_SOMainReportBydepartment(String vendorType,String startYearMonth,String endYearMonth,
-														String department){
+														String department,String customer){
 		 Result<List<SoSoDetails>> result =new Result<>();
-		 List<SoSoDetails> list = soSoDetailsService.QuerySO_SOMainReportBydepartment(department,vendorType, startYearMonth, endYearMonth);
+		 List<SoSoDetails> list = soSoDetailsService.QuerySO_SOMainReportBydepartment(department,customer,vendorType, startYearMonth, endYearMonth);
 		 result.setResult(list);
 		 return result;
 	 }
@@ -252,9 +252,9 @@ public class SoSoDetailsController extends JeecgController<SoSoDetails, ISoSoDet
 	 })
 	 @GetMapping(value = "/QuerySO_SOMainReportBycustomer")
 	 public Result<List<SoSoDetails>> QuerySO_SOMainReportBycustomer(String vendorType,String startYearMonth,String endYearMonth,
-																	 String customer){
+																	 String customer,String department){
 		 Result<List<SoSoDetails>> result =new Result<>();
-		 List<SoSoDetails> list = soSoDetailsService.QuerySO_SOMainReportBycustomer(customer,vendorType, startYearMonth, endYearMonth);
+		 List<SoSoDetails> list = soSoDetailsService.QuerySO_SOMainReportBycustomer(customer,department,vendorType, startYearMonth, endYearMonth);
 		 result.setResult(list);
 		 return result;
 	 }

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/mapper/SoSoDetailsMapper.java

@@ -22,10 +22,10 @@ public interface SoSoDetailsMapper extends BaseMapper<SoSoDetails> {
      */
   IPage<SoSoDetails> getSO_SOMainReport(IPage<SoSoDetails> page, @Param("map")Map<String,Object> map);
 
-  List<SoSoDetails> QuerySO_SOMainReportBydepartment(@Param("department")String department,
+  List<SoSoDetails> QuerySO_SOMainReportBydepartment(@Param("department")String department,@Param("customer")String customer,
     @Param("vendorType")String vendorType,@Param("startYearMonth")String startYearMonth,@Param("endYearMonth")String endYearMonth);
 
-  List<SoSoDetails> QuerySO_SOMainReportBycustomer(@Param("customer")String customer,
+  List<SoSoDetails> QuerySO_SOMainReportBycustomer(@Param("customer")String customer,@Param("department")String department,
     @Param("vendorType")String vendorType,@Param("startYearMonth")String startYearMonth,@Param("endYearMonth")String endYearMonth);
 
 }

+ 27 - 21
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/mapper/xml/SoSoDetailsMapper.xml

@@ -5,7 +5,7 @@
         SELECT
         de.cDepName,
         cc.cCusAbbName as cVenAbbName,
-        convert(char(7),ss.dPreDateBT,120) yearMonth,
+        convert(char(7),ssd.dPreDate,120) yearMonth,
         ssd.iNatUnitPrice,
         case when max(ssd.cSCloser) is null then sum(ssd.iQuantity)
         else sum(ssd.foutquantity) end as iQuantity,
@@ -13,19 +13,19 @@
         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 Vendor v on ss.cCusCode=v.cVenCode
         left join Department de on ss.cDepCode=de.cDepCode
         left join Customer cc on ss.cCusCode = cc.cCusCode
-        WHERE 1=1
+        WHERE ss.iStatus = 1
         <if test="map.startYearMonth!=null and map.startYearMonth!='' and map.endYearMonth!=null and map.endYearMonth!=''">
-            AND CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ) <![CDATA[ >= ]]> #{map.startYearMonth}
-            AND CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ) <![CDATA[ <= ]]> #{map.endYearMonth}
+            AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ >= ]]> #{map.startYearMonth}
+            AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ <= ]]> #{map.endYearMonth}
         </if>
         <if test="map.vendorType!=null and map.vendorType!='' and map.vendorType=='内部'">
-            and (v.cVenAbbName='宁波森语' or  v.cVenAbbName='马菲羊' or  v.cVenAbbName='森语集团')
+            and (cc.cCusAbbName='宁波森语' or  cc.cCusAbbName='马菲羊' or  cc.cCusAbbName='森语集团')
         </if>
         <if test="map.vendorType!=null and map.vendorType!='' and map.vendorType=='外部'">
-            and (v.cVenAbbName  <![CDATA[ <> ]]> '宁波森语' and  v.cVenAbbName <![CDATA[ <> ]]> '马菲羊' and  v.cVenAbbName <![CDATA[ <> ]]> '森语集团')
+            and (cc.cCusAbbName  <![CDATA[ <> ]]> '宁波森语' and cc.cCusAbbName <![CDATA[ <> ]]> '马菲羊' and  cc.cCusAbbName <![CDATA[ <> ]]> '森语集团')
         </if>
         <if test="map.department!=null and map.department!='' ">
             and de.cDepName = #{map.department}
@@ -33,9 +33,9 @@
         <if test="map.customer!=null and map.customer!='' ">
             and cc.cCusAbbName = #{map.customer}
         </if>
-        GROUP BY de.cDepName,ss.cCusCode,convert(char(7),ss.dPreDateBT,120),ssd.iNatUnitPrice,cc.cCusAbbName
+        GROUP BY de.cDepName,ss.cCusCode,convert(char(7),ssd.dPreDate,120),ssd.iNatUnitPrice,cc.cCusAbbName
         --ORDER BY
-        --de.cDepName,ss.cCusCode,CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ),ssd.iNatUnitPrice
+        --de.cDepName,ss.cCusCode,CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ),ssd.iNatUnitPrice
     </select>
 
     <select id="QuerySO_SOMainReportBydepartment" resultType="org.jeecg.modules.report.entity.SoSoDetails">
@@ -47,23 +47,26 @@
         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 Vendor v on ss.cCusCode=v.cVenCode
         left join Department de on ss.cDepCode=de.cDepCode
         left join Customer cc on ss.cCusCode = cc.cCusCode
-        WHERE 1=1
+        WHERE ss.iStatus = 1
         <if test="startYearMonth!=null and startYearMonth!='' and endYearMonth!=null and endYearMonth!=''">
-            AND CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ) <![CDATA[ >= ]]> #{startYearMonth}
-            AND CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ) <![CDATA[ <= ]]> #{endYearMonth}
+            AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ >= ]]> #{startYearMonth}
+            AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ <= ]]> #{endYearMonth}
         </if>
         <if test="vendorType!=null and vendorType!='' and vendorType=='内部'">
-            and (v.cVenAbbName='宁波森语' or  v.cVenAbbName='马菲羊' or  v.cVenAbbName='森语集团')
+            and (cc.cCusAbbName='宁波森语' or  cc.cCusAbbName='马菲羊' or  cc.cCusAbbName='森语集团')
         </if>
         <if test="vendorType!=null and vendorType!='' and vendorType=='外部'">
-            and (v.cVenAbbName  <![CDATA[ <> ]]> '宁波森语' and  v.cVenAbbName <![CDATA[ <> ]]> '马菲羊' and  v.cVenAbbName <![CDATA[ <> ]]> '森语集团')
+            and (cc.cCusAbbName  <![CDATA[ <> ]]> '宁波森语' and cc.cCusAbbName <![CDATA[ <> ]]> '马菲羊' and  cc.cCusAbbName <![CDATA[ <> ]]> '森语集团')
         </if>
         <if test="department!=null and department!='' ">
             and de.cDepName = #{department}
         </if>
+        <if test="customer!=null and customer!='' ">
+            and cc.cCusAbbName = #{customer}
+        </if>
         GROUP BY cc.cCusAbbName
     </select>
 
@@ -77,19 +80,22 @@
         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 Vendor v on ss.cCusCode=v.cVenCode
         left join Customer cc on ss.cCusCode = cc.cCusCode
         left join Department de on ss.cDepCode=de.cDepCode
-        WHERE 1=1
+        WHERE ss.iStatus = 1
         <if test="startYearMonth!=null and startYearMonth!='' and endYearMonth!=null and endYearMonth!=''">
-            AND CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ) <![CDATA[ >= ]]> #{startYearMonth}
-            AND CONVERT ( CHAR ( 7 ), ss.dPreDateBT, 120 ) <![CDATA[ <= ]]> #{endYearMonth}
+            AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ >= ]]> #{startYearMonth}
+            AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ <= ]]> #{endYearMonth}
         </if>
         <if test="vendorType!=null and vendorType!='' and vendorType=='内部'">
-            and (v.cVenAbbName='宁波森语' or  v.cVenAbbName='马菲羊' or  v.cVenAbbName='森语集团')
+            and (cc.cCusAbbName='宁波森语' or  cc.cCusAbbName='马菲羊' or  cc.cCusAbbName='森语集团')
         </if>
         <if test="vendorType!=null and vendorType!='' and vendorType=='外部'">
-            and (v.cVenAbbName  <![CDATA[ <> ]]> '宁波森语' and  v.cVenAbbName <![CDATA[ <> ]]> '马菲羊' and  v.cVenAbbName <![CDATA[ <> ]]> '森语集团')
+            and (cc.cCusAbbName  <![CDATA[ <> ]]> '宁波森语' and cc.cCusAbbName <![CDATA[ <> ]]> '马菲羊' and  cc.cCusAbbName <![CDATA[ <> ]]> '森语集团')
+        </if>
+        <if test="department!=null and department!='' ">
+            and de.cDepName = #{department}
         </if>
         <if test="customer!=null and customer!='' ">
             and cc.cCusAbbName = #{customer}

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/service/ISoSoDetailsService.java

@@ -21,9 +21,9 @@ public interface ISoSoDetailsService extends IService<SoSoDetails> {
      */
     IPage<SoSoDetails> getSO_SOMainReport(IPage<SoSoDetails> page,Map<String, Object> map);
 
-    List<SoSoDetails> QuerySO_SOMainReportBydepartment(String department,
+    List<SoSoDetails> QuerySO_SOMainReportBydepartment(String department,String customer,
                                                        String vendorType,String startYearMonth,String endYearMonth);
 
-    List<SoSoDetails> QuerySO_SOMainReportBycustomer(String customer,
+    List<SoSoDetails> QuerySO_SOMainReportBycustomer(String customer,String department,
                                                      String vendorType,String startYearMonth,String endYearMonth);
 }

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/service/impl/SoSoDetailsServiceImpl.java

@@ -29,13 +29,13 @@ public class SoSoDetailsServiceImpl extends ServiceImpl<SoSoDetailsMapper, SoSoD
 
     @Override
     @DS("multi-one")
-    public List<SoSoDetails> QuerySO_SOMainReportBydepartment(String department, String vendorType, String startYearMonth, String endYearMonth) {
-        return this.baseMapper.QuerySO_SOMainReportBydepartment(department,vendorType,startYearMonth,endYearMonth);
+    public List<SoSoDetails> QuerySO_SOMainReportBydepartment(String department,String customer,String vendorType, String startYearMonth, String endYearMonth) {
+        return this.baseMapper.QuerySO_SOMainReportBydepartment(department,customer,vendorType,startYearMonth,endYearMonth);
     }
 
     @Override
     @DS("multi-one")
-    public List<SoSoDetails> QuerySO_SOMainReportBycustomer(String customer, String vendorType, String startYearMonth, String endYearMonth) {
-        return this.baseMapper.QuerySO_SOMainReportBycustomer(customer,vendorType,startYearMonth,endYearMonth);
+    public List<SoSoDetails> QuerySO_SOMainReportBycustomer(String customer,String department,String vendorType, String startYearMonth, String endYearMonth) {
+        return this.baseMapper.QuerySO_SOMainReportBycustomer(customer,department,vendorType,startYearMonth,endYearMonth);
     }
 }