Quellcode durchsuchen

采购数据不一致问题

shish vor 2 Jahren
Ursprung
Commit
9cb4aca8c0

+ 20 - 1
app-ghs/controllers/StatCgGhsController.php

@@ -3,6 +3,7 @@
 namespace ghs\controllers;
 
 use biz\stat\classes\StatCgGhsClass;
+use bizGhs\cg\classes\CgRefundClass;
 use bizGhs\ghs\classes\GhsClass;
 use bizGhs\order\classes\PurchaseOrderClass;
 use bizGhs\order\classes\PurchaseOrderItemClass;
@@ -47,6 +48,8 @@ class StatCgGhsController extends BaseController
         $totalPack = 0;
         $totalFreight = 0;
         $totalTkPrice = 0;
+        //增加项
+        $totalOnlyTkPrice = 0;
         $totalNum = 0;
         if (!empty($orderList)) {
             foreach ($orderList as $orderInfo) {
@@ -83,6 +86,20 @@ class StatCgGhsController extends BaseController
                         }
                     }
                 }
+
+                //增加项
+                if ($tkPrice > 0) {
+                    $refundList = CgRefundClass::getAllByCondition(['relateOrderSn' => $orderSn], null, '*', null, true);
+                    if (!empty($refundList)) {
+                        foreach ($refundList as $refundInfo) {
+                            if (isset($refundInfo->refundType) && $refundInfo->refundType == 2) {
+                                $refundPrice = $refundInfo->refundPrice ?? 0;
+                                $totalOnlyTkPrice = bcadd($totalOnlyTkPrice, $refundPrice, 2);
+                            }
+                        }
+                    }
+                }
+
                 $totalCarton = bcadd($totalCarton, $carton, 2);
                 $totalPack = bcadd($totalPack, $pack, 2);
                 $totalFreight = bcadd($totalFreight, $freight, 2);
@@ -151,7 +168,9 @@ class StatCgGhsController extends BaseController
             'totalNum' => $totalNum,
             'totalPack' => $totalPack,
             'totalFreight' => $totalFreight,
-            'totalTkPrice' => $totalTkPrice
+            'totalTkPrice' => $totalTkPrice,
+            //增加项
+            'totalOnlyTkPrice' => $totalOnlyTkPrice,
         ]);
         //[['amount','ghsId','ghsName','num','py']]
     }

+ 6 - 0
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -1556,10 +1556,16 @@ class PurchaseOrderClass extends BaseClass
         foreach ($orderList as $key => $orderInfo) {
             $orderSn = $orderInfo['orderSn'] ?? '';
             $status = $orderInfo['status'] ?? 0;
+            //增加项
+            $actPrice = $orderInfo['actPrice'] ?? 0;
             if ($status != 4) {
                 unset($orderList[$key]);
                 continue;
             }
+            //增加项
+            if ($actPrice <= 0) {
+                continue;
+            }
             $itemList = $orderItemList[$orderSn] ?? [];
             $orderList[$key]['itemList'] = $itemList;
         }