|
|
@@ -4,6 +4,7 @@ namespace console\controllers;
|
|
|
|
|
|
use bizGhs\cg\classes\CgOrderClass;
|
|
|
use bizGhs\order\classes\PurchaseOrderClass;
|
|
|
+use bizGhs\shop\classes\ShopAdminClass;
|
|
|
use common\components\noticeUtil;
|
|
|
use yii\console\Controller;
|
|
|
use Yii;
|
|
|
@@ -40,8 +41,24 @@ class BookController extends Controller
|
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
|
- PurchaseOrderClass::assign($cg);
|
|
|
+ $respond = PurchaseOrderClass::assign($cg);
|
|
|
$transaction->commit();
|
|
|
+ $hasChange = $respond['hasChange'] ?? 0;
|
|
|
+ if ($hasChange == 1) {
|
|
|
+ //通知采购单页要刷新货位
|
|
|
+ $cacheKey = 'ghs_cg_order_staff_refresh_seat_' . $bookSn;
|
|
|
+ $mainId = $order->mainId ?? 0;
|
|
|
+ $staffList = ShopAdminClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
|
|
|
+ if (!empty($staffList)) {
|
|
|
+ foreach ($staffList as $staff) {
|
|
|
+ $staffId = $staff->id ?? 0;
|
|
|
+ $params = $cgId . '-' . $staffId;
|
|
|
+ Yii::$app->redis->executeCommand('SADD', [$cacheKey, $params]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $cacheKey = 'ghs_cg_order_guest_refresh_seat_' . $bookSn;
|
|
|
+ Yii::$app->redis->executeCommand('SADD', [$cacheKey, $cgId]);
|
|
|
+ }
|
|
|
} catch (\Exception $exception) {
|
|
|
$transaction->rollBack();
|
|
|
noticeUtil::push("部分门店待入库采购单,重新分配货位出错,原因:" . $exception->getMessage(), '15280215347');
|