shish 5 anni fa
parent
commit
8006b7ca01

+ 6 - 2
biz-ghs/order/classes/OrderClearClass.php

@@ -72,7 +72,7 @@ class OrderClearClass extends BaseClass
         $custom->debtNum = $num;
         $custom->debtNum = $num;
         $custom->save();
         $custom->save();
 
 
-        //客户门店应付供应商款减少
+        //应付供应商款减少
         $customShopId = $custom->shopId;
         $customShopId = $custom->shopId;
         $customShop = ShopClass::getLockById($customShopId);
         $customShop = ShopClass::getLockById($customShopId);
         if (empty($customShop)) {
         if (empty($customShop)) {
@@ -120,8 +120,12 @@ class OrderClearClass extends BaseClass
         $ghs->debtNum = $num;
         $ghs->debtNum = $num;
         $ghs->debt = $remainAmount > 0 ? 2 : 1;
         $ghs->debt = $remainAmount > 0 ? 2 : 1;
         $ghs->save();
         $ghs->save();
+        if ($ghs->debtNum == 0) {
+            $customShop->mayPayNum -= 1;
+            $customShop->save();
+        }
 
 
-        //供应商的门店应收客户款减少
+        //应收客户款减少
         $shopId = $ghs->shopId;
         $shopId = $ghs->shopId;
         $shop = ShopClass::getLockById($shopId);
         $shop = ShopClass::getLockById($shopId);
         $currentGathering = bcsub($shop->mayGathering, $amount, 2);
         $currentGathering = bcsub($shop->mayGathering, $amount, 2);

+ 3 - 0
biz-hd/purchase/classes/PurchaseClearClass.php

@@ -186,6 +186,9 @@ class PurchaseClearClass extends BaseClass
         }
         }
         $currentMayPay = bcsub($customShop->mayPay, $order->actPrice, 2);
         $currentMayPay = bcsub($customShop->mayPay, $order->actPrice, 2);
         $customShop->mayPay = $currentMayPay;
         $customShop->mayPay = $currentMayPay;
+        if($ghs->debtNum == 0){
+            $customShop->mayPayNum -= 1;
+        }
         $customShop->save();
         $customShop->save();
 
 
         if (isset($order->customShopAdminId) && !empty($order->customShopAdminId)) {
         if (isset($order->customShopAdminId) && !empty($order->customShopAdminId)) {

+ 5 - 1
biz-hd/purchase/services/PurchaseService.php

@@ -290,13 +290,17 @@ class PurchaseService extends BaseService
             $coupon->save();
             $coupon->save();
         }
         }
 
 
-        /**零售的供应商资产变化**/
+        /**供应商资产变化**/
         $ghsId = $info->ghsId ?? 0;
         $ghsId = $info->ghsId ?? 0;
         $ghs = GhsClass::getLockById($ghsId);
         $ghs = GhsClass::getLockById($ghsId);
         if (empty($ghs)) {
         if (empty($ghs)) {
             util::fail('没有找到供应商');
             util::fail('没有找到供应商');
         }
         }
         if ($payWay == dict::getDict('payWay', 'debtPay')) {
         if ($payWay == dict::getDict('payWay', 'debtPay')) {
+            if($ghs->debtNum == 0){
+                $shop->mayPayNum += 1;
+                $shop->save();
+            }
             //欠款支付
             //欠款支付
             $ghs->debt = 2;
             $ghs->debt = 2;
             $ghs->debtAmount = bcadd($ghs->debtAmount, $realPrice, 2);
             $ghs->debtAmount = bcadd($ghs->debtAmount, $realPrice, 2);