Browse Source

feat(pCheckAmount): 更新未对账数据筛选条件

hejq 7 years ago
parent
commit
b9454d8d5b

+ 8 - 8
src/main/java/com/uas/platform/b2b/model/util/ApCheckTodoCountSqls.java

@@ -28,7 +28,7 @@ public class ApCheckTodoCountSqls {
      */
     public static final String SALE_ACCEPT_COUNT_SQL = "select coalesce(sum((pai_qty - coalesce(pai_ycheckqty, 0)) * pai_orderprice), 0) as count, pa_currency as currency \n" +
         "from purc$accept left join `purc$acceptitem` on pai_paid = pa_id " +
-        "where pa_venduu = ? and pa_enuu = ? and pai_qty > coalesce(pai_ycheckqty, 0) and pai_orderprice <> 0 " +
+        "where pa_venduu = ? and pa_enuu = ? and pai_orderprice <> 0 " +
         "group by pa_currency";
 
     /**
@@ -36,7 +36,7 @@ public class ApCheckTodoCountSqls {
      */
     public static final String THISMONTH_SALE_ACCEPT_COUNT_SQL = "select coalesce(sum((pai_qty - coalesce(pai_ycheckqty, 0)) * pai_orderprice), 0) as count, pa_currency as currency \n" +
         "from purc$accept left join `purc$acceptitem` on pai_paid = pa_id " +
-        "where pa_venduu = ? and pa_enuu = ? and pai_qty > coalesce(pai_ycheckqty, 0) and pai_orderprice <> 0 and pa_date >= ? and pa_date < ? " +
+        "where pa_venduu = ? and pa_enuu = ? and pai_orderprice <> 0 and pa_date >= ? and pa_date < ? " +
         "group by pa_currency";
 
     /**
@@ -44,14 +44,14 @@ public class ApCheckTodoCountSqls {
      */
     public static final String SALE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) * pri_qty ) - coalesce(pri_ycheckqty, 0)) *  pri_orderprice), 0) as count, pr_currency as currency \n" +
         "from `purc$return` left join `purc$returnitem` on pr_id = pri_prid " +
-        "where pr_venduu = ? and pr_enuu = ? and pri_qty > abs(coalesce(pri_ycheckqty, 0)) group by pr_currency";
+        "where pr_venduu = ? and pr_enuu = ? group by pr_currency";
 
     /**
      * 客户采购验退单未对账金额查询语句
      */
     public static final String THISMONTH_SALE_RETURN_COUNT_SQL = "select sum(((-(1) * pri_qty ) - coalesce(pri_ycheckqty, 0)) *  pri_orderprice) as count, pr_currency as currency \n" +
         "from `purc$return` left join `purc$returnitem` on pr_id = pri_prid " +
-        "where pr_venduu = ? and pr_enuu = ? and pr_date >= ? and pr_date < ? and pri_qty > abs(coalesce(pri_ycheckqty, 0)) group by pr_currency";
+        "where pr_venduu = ? and pr_enuu = ? and pr_date >= ? and pr_date < ? group by pr_currency";
 
     /**
      * 客户委外验收单未对账金额查询语句
@@ -59,7 +59,7 @@ public class ApCheckTodoCountSqls {
     public static final String MAKE_ACCEPT_COUNT_SQL = "select coalesce(sum((mai_qty - coalesce(mai_ycheckqty, 0)) * mai_orderpice), 0) as count, ma_currency as currency " +
         " from make$accept " +
         "join make$acceptitem on ma_id = mai_paid " +
-        "where ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 and  mai_qty > coalesce(mai_ycheckqty, 0) group by ma_currency";
+        "where ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 group by ma_currency";
 
     /**
      * 客户委外验收单未对账金额查询语句
@@ -67,7 +67,7 @@ public class ApCheckTodoCountSqls {
     public static final String THISMONTH_MAKE_ACCEPT_COUNT_SQL = "select coalesce(sum((mai_qty - coalesce(mai_ycheckqty, 0)) * mai_orderpice), 0) as count, ma_currency as currency " +
         " from make$accept " +
         "join make$acceptitem on ma_id = mai_paid " +
-        "where ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 and ma_date >= ? and ma_date < ? and mai_qty > coalesce(mai_ycheckqty, 0) group by ma_currency";
+        "where ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 and ma_date >= ? and ma_date < ? group by ma_currency";
 
     /**
      * 客户委外验退单未对账金额查询语句
@@ -75,7 +75,7 @@ public class ApCheckTodoCountSqls {
     public static final String MAKE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) * mri_orderpice), 0) as count,mr_currency as currency " +
         " from make$return " +
         "join make$returnitem on mr_id =  mri_paid " +
-        "where mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 and mri_qty > abs(coalesce(mri_ycheckqty, 0)) group by mr_currency";
+        "where mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 group by mr_currency";
 
     /**
      * 客户委外验退单未对账金额查询语句
@@ -83,6 +83,6 @@ public class ApCheckTodoCountSqls {
     public static final String THISMONTH_MAKE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) * mri_orderpice), 0) as count, mr_currency as currency " +
         " from make$return " +
         "join make$returnitem on mr_id =  mri_paid " +
-        "where mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 and mr_date >= ? and mr_date < ? and mri_qty > abs(coalesce(mri_ycheckqty, 0)) " +
+        "where mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 and mr_date >= ? and mr_date < ?  " +
         "group by mr_currency";
 }

+ 1 - 3
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java

@@ -810,9 +810,7 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
             currencySet.forEach(currency -> {
                 Double amount = totalTrades.stream().filter(tradeCount -> null != tradeCount && currency.equals(tradeCount.getCurrency()))
                     .mapToDouble(ApCheckAmount::getCount).sum();
-                if (amount > 0) {
-                    resultCounts.add(new ApCheckAmount(currency, DecimalUtils.decimalPoint(amount, 2)));
-                }
+                resultCounts.add(new ApCheckAmount(currency, DecimalUtils.decimalPoint(amount, 2)));
             });
         }
         return resultCounts;