shish преди 2 години
родител
ревизия
2d8c4c114c
променени са 1 файла, в които са добавени 19 реда и са изтрити 1 реда
  1. 19 1
      biz-ghs/order/classes/PurchaseOrderClass.php

+ 19 - 1
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -88,6 +88,8 @@ class PurchaseOrderClass extends BaseClass
         }
         $productInfoList = ProductClass::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id', true);
 
+        $hasChange = 0;
+
         foreach ($cgItemList as $cgItem) {
             $cgItemId = $cgItem->id ?? 0;
             $cgItemNum = $cgItem->itemNum ?? 0;
@@ -210,8 +212,24 @@ class PurchaseOrderClass extends BaseClass
                     $giveGhsId = $giveGhs->id ?? 0;
                     $sendInfo->bookGhsGiveId = $giveGhsId;
                     $sendInfo->save();
+                    $hasChange = 1;
+                }
+            }
+        }
+        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]);
         }
     }
 
@@ -1253,7 +1271,7 @@ class PurchaseOrderClass extends BaseClass
         //是否需要提醒更新货位
         $needRemindRefreshSeat = 0;
         if (!empty($shopBookSn) && $shopBookSn == $bookSn) {
-            if(isset($orderData['status']) && $orderData['status']==3){
+            if (isset($orderData['status']) && $orderData['status'] == 3) {
                 $needRemindRefreshSeat = 1;
             }
         }