shish 2 éve
szülő
commit
b47b310ecf

+ 10 - 2
app-ghs/controllers/BookController.php

@@ -84,7 +84,15 @@ class BookController extends BaseController
                 $shop->bookSn = 0;
                 $shop->save();
                 $transaction->commit();
-                util::success(['bookSn' => 0],'已关闭');
+                $bookSn = $shop->bookSn ?? 0;
+
+                //删除采购单货位需要更新标记
+                $cacheKey1 = 'ghs_cg_order_staff_refresh_seat_' . $bookSn;
+                Yii::$app->redis->executeCommand('DEL', [$cacheKey1]);
+                $cacheKey2 = 'ghs_cg_order_guest_refresh_seat_' . $bookSn;
+                Yii::$app->redis->executeCommand('DEL', [$cacheKey2]);
+
+                util::success(['bookSn' => 0], '已关闭');
             } else {
                 $orderSn = orderSn::getBookSn();
                 $data = [
@@ -97,7 +105,7 @@ class BookController extends BaseController
                 $shop->bookSn = $orderSn;
                 $shop->save();
                 $transaction->commit();
-                util::success(['bookSn' => $orderSn],'开启成功');
+                util::success(['bookSn' => $orderSn], '开启成功');
             }
         } catch (\Exception $e) {
             Yii::info("操作失败原因:" . $e->getMessage());

+ 4 - 4
biz-ghs/book/classes/BookItemClass.php

@@ -4,6 +4,7 @@ namespace bizGhs\book\classes;
 
 use bizGhs\base\classes\BaseClass;
 use bizGhs\custom\classes\CustomClass;
+use bizGhs\notify\classes\NotifyClass;
 use bizGhs\product\classes\ProductClass;
 use bizGhs\shop\classes\ShopClass;
 use common\components\noticeUtil;
@@ -155,9 +156,8 @@ class BookItemClass extends BaseClass
             $bookItemRes->roadNum = bcsub($bookItemRes->roadNum, $secondNeedSubNum);
             $bookCustomRes->roadNum = bcsub($bookCustomRes->roadNum, $secondNeedSubNum);
 
-            //删除路上数量
+            //删除供货商的路上数量!!!
             BookItemGhsClass::delRoadNum($bookItemCustomRes, $secondNeedSubNum, $bookSn, $order);
-            //todo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 路上数量减掉了要改送货人的货位号
 
             if ($secondRemainSubNum <= 0) {
                 $bookItemCustomRes->save();
@@ -178,7 +178,8 @@ class BookItemClass extends BaseClass
             $bookItemRes->onNum = bcsub($bookItemRes->onNum, $thirdNeedSubNum);
             $bookCustomRes->onNum = bcsub($bookCustomRes->onNum, $thirdNeedSubNum);
 
-            //todo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 上架数量减掉了要通知货要拿掉
+            //预订减少造成下架而产生通知
+            NotifyClass::bookReduceOutItem($bookItemCustomRes, $thirdNeedSubNum, $shop);
 
             if ($thirdRemainSubNum <= 0) {
                 $bookItemCustomRes->save();
@@ -193,7 +194,6 @@ class BookItemClass extends BaseClass
         }
     }
 
-    //todo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 预订数量增加没有增加待采购数量,如果有库存要提醒库存要上架
     //数据结构 [['productId' => $productId,'num' => $num]]
     public static function addBatchItem($batchData, $order)
     {

+ 2 - 0
biz-ghs/book/classes/BookItemCustomClass.php

@@ -1,5 +1,7 @@
 <?php
+
 namespace bizGhs\book\classes;
+
 use bizGhs\base\classes\BaseClass;
 use common\components\util;
 use Yii;

+ 1 - 1
biz-ghs/book/classes/BookItemGhsClass.php

@@ -71,7 +71,7 @@ class BookItemGhsClass extends BaseClass
             $cgOrderItemRes->confirmSendNum = $lastConfirm;
             $cgOrderItemRes->save();
 
-            // todo 通知采购单页要刷新货位
+            //通知采购单页要刷新货位
             $cacheKey = 'ghs_cg_order_staff_refresh_seat_' . $bookSn;
             $mainId = $order->mainId ?? 0;
             $staffList = ShopAdminClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);

+ 33 - 0
biz-ghs/notify/classes/NotifyClass.php

@@ -18,6 +18,39 @@ class NotifyClass extends BaseClass
         return $data;
     }
 
+    //减少预订造成花材需要下架
+    public static function bookReduceOutItem($bookItemCustomRes, $num, $shop)
+    {
+        $mainId = $shop->mainId ?? 0;
+        $shopId = $shop->id ?? 0;
+        $id = $bookItemCustomRes->id ?? 0;
+        $customName = $bookItemCustomRes->customName ?? '';
+        $seatSn = $bookItemCustomRes->seatSn ?? 0;
+        $itemName = $bookItemCustomRes->name ?? '';
+        $itemId = $bookItemCustomRes->itemId ?? 0;
+        $staffList = ShopAdminClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
+        if (!empty($staffList)) {
+            foreach ($staffList as $staff) {
+                $staffId = $staff->id;
+                $data = [
+                    'mainId' => $mainId,
+                    'shopId' => $shopId,
+                    'staffId' => $staffId,
+                    'title' => '预订减少下架花材',
+                    'type' => 2,
+                    'targetId' => $id,
+                    'read' => 0,
+                    'content' => '请下架' . $customName . '(' . $seatSn . ')' . $itemName . $num . '份',
+                    'page' => '/admin/book/itemCustom?itemId=' . $itemId . '&itemName=' . $itemName,
+                ];
+                self::add($data);
+                $notifyNum = bcadd($staff->notifyNum, 1);
+                $staff->notifyNum = $notifyNum;
+                $staff->save();
+            }
+        }
+    }
+
     //新增售后申请通过 ssh 20230814
     public static function addRefundApplyNotify($refund)
     {

+ 2 - 0
biz/wx/classes/WxMessageClass.php

@@ -47,6 +47,7 @@ class WxMessageClass extends BaseClass
                 'ZHH202405111703' => '账单已结清提醒',
                 'ZHH202405111704' => '充值成功通知',
                 'ZHH202405121036' => '采购商品入库成功通知',
+                'ZHH202407100108' => '取货提醒',
             ],
             //供货商
             dict::getDict('ptStyle', 'ghs') => [
@@ -73,6 +74,7 @@ class WxMessageClass extends BaseClass
                 'ZHH202405111703' => '账单已结清提醒',
                 'ZHH202405111704' => '充值成功通知',
                 'ZHH202405121036' => '采购商品入库成功通知',
+                'ZHH202407100108' => '取货提醒',
             ],
             //商城
             dict::getDict('ptStyle', 'mall') => [