|
|
@@ -9,6 +9,7 @@ use bizGhs\cg\classes\CgClass;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\order\classes\OrderClass;
|
|
|
use bizGhs\order\classes\PurchaseOrderClass;
|
|
|
+use bizGhs\shop\classes\MainClass;
|
|
|
use bizHd\purchase\classes\PurchaseClass;
|
|
|
use common\components\dict;
|
|
|
use common\components\orderSn;
|
|
|
@@ -140,10 +141,15 @@ class ClearClass extends BaseClass
|
|
|
if (empty($shop)) {
|
|
|
util::fail('没有找到供应商门店');
|
|
|
}
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+ $main = MainClass::getLockById($mainId);
|
|
|
+ if (empty($main)) {
|
|
|
+ util::fail('没有main信息');
|
|
|
+ }
|
|
|
//门店应收客户款减少
|
|
|
- $currentGathering = bcsub($shop->mayGathering, $order->actPrice, 2);
|
|
|
- $shop->mayGathering = $currentGathering;
|
|
|
- $shop->save();
|
|
|
+ $currentGathering = bcsub($main->mayGathering, $order->actPrice, 2);
|
|
|
+ $main->mayGathering = $currentGathering;
|
|
|
+ $main->save();
|
|
|
|
|
|
//采购单状态变更
|
|
|
foreach ($list as $purchase) {
|
|
|
@@ -165,8 +171,8 @@ class ClearClass extends BaseClass
|
|
|
$custom->isDebt = $remain > 0 ? 1 : 0;
|
|
|
$custom->save();
|
|
|
if ($custom->debtNum == 0) {
|
|
|
- $shop->mayGatheringNum -= 1;
|
|
|
- $shop->save();
|
|
|
+ $main->mayGatheringNum -= 1;
|
|
|
+ $main->save();
|
|
|
}
|
|
|
|
|
|
//应付供应商款减少
|
|
|
@@ -175,12 +181,17 @@ class ClearClass extends BaseClass
|
|
|
if (empty($customShop)) {
|
|
|
util::fail('没有找到客户门店');
|
|
|
}
|
|
|
- $currentMayPay = bcsub($customShop->mayPay, $order->actPrice, 2);
|
|
|
- $customShop->mayPay = $currentMayPay;
|
|
|
+ $customMainId = $customShop->mainId ?? 0;
|
|
|
+ $customMain = MainClass::getLockById($customMainId);
|
|
|
+ if (empty($customMain)) {
|
|
|
+ util::fail('没有main信息');
|
|
|
+ }
|
|
|
+ $currentMayPay = bcsub($customMain->mayPay, $order->actPrice, 2);
|
|
|
+ $customMain->mayPay = $currentMayPay;
|
|
|
if ($ghs->debtNum == 0) {
|
|
|
- $customShop->mayPayNum -= 1;
|
|
|
+ $customMain->mayPayNum -= 1;
|
|
|
}
|
|
|
- $customShop->save();
|
|
|
+ $customMain->save();
|
|
|
}
|
|
|
|
|
|
//供应商的采购信息 ssh 20210625
|