Bladeren bron

预谋功能优化

shish 2 jaren geleden
bovenliggende
commit
de4e4c1197

+ 3 - 1
app-ghs/controllers/BookCustomController.php

@@ -27,7 +27,9 @@ class BookCustomController extends BaseController
         $search = $get['search']??'';
         $where['bookSn'] = $bookSn;
         if (!empty($search)) {
-            if (stringUtil::isLetter($search)) {
+            if(is_numeric($search)){
+                $where['seatSn'] = $search;
+            }elseif (stringUtil::isLetter($search)) {
                 $search = strtolower($search);
                 $where['py'] = ['like', $search];
             } else {

+ 10 - 0
app-ghs/controllers/BookItemCustomController.php

@@ -14,6 +14,11 @@ class BookItemCustomController extends BaseController
     //下架 ssh 20240721
     public function actionGoOff()
     {
+        $staff = $this->shopAdmin;
+        if(isset($staff->identity) && $staff->identity == 2){
+            util::fail('不能操作');
+        }
+
         $get = Yii::$app->request->get();
         $id = $get['id'] ?? 0;
         $num = $get['num'] ?? 0;
@@ -76,6 +81,11 @@ class BookItemCustomController extends BaseController
     //仓库有货上架和上齐 ssh 20240721
     public function actionGoOn()
     {
+        $staff = $this->shopAdmin;
+        if(isset($staff->identity) && $staff->identity == 2){
+            util::fail('不能操作');
+        }
+
         $get = Yii::$app->request->get();
         $id = $get['id'] ?? 0;
         $num = $get['num'] ?? 0;

+ 15 - 0
app-ghs/controllers/CheckOrderController.php

@@ -14,6 +14,11 @@ class CheckOrderController extends BaseController
     //预订中减少库存
     public function actionBookDelStock()
     {
+        $staff = $this->shopAdmin;
+        if(isset($staff->identity) && $staff->identity == 2){
+            util::fail('不能操作');
+        }
+
         $get = Yii::$app->request->get();
         $productId = $get['itemId'] ?? 0;
         $bookItemCustomId = $get['bookItemCustomId'] ?? 0;
@@ -46,6 +51,11 @@ class CheckOrderController extends BaseController
     //预订中增加库存
     public function actionBookAddStock()
     {
+        $staff = $this->shopAdmin;
+        if(isset($staff->identity) && $staff->identity == 2){
+            util::fail('不能操作');
+        }
+
         $get = Yii::$app->request->get();
         $productId = $get['itemId'] ?? 0;
         $bookItemCustomId = $get['bookItemCustomId'] ?? 0;
@@ -82,6 +92,11 @@ class CheckOrderController extends BaseController
     //借库存 ssh 20240720
     public function actionLoan()
     {
+        $staff = $this->shopAdmin;
+        if(isset($staff->identity) && $staff->identity == 2){
+            util::fail('不能操作');
+        }
+
         $get = Yii::$app->request->get();
         $inId = $get['inId'] ?? 0;
         $outId = $get['outId'] ?? 0;

+ 5 - 0
app-ghs/controllers/CustomController.php

@@ -545,6 +545,11 @@ class CustomController extends BaseController
     //客户列表 ssh 2021.7.8
     public function actionList()
     {
+        $staff = $this->shopAdmin;
+        if(isset($staff->identity) && $staff->identity == 2){
+            util::success(['list'=>[]]);
+        }
+
         $get = Yii::$app->request->get();
         $type = isset($get['type']) ? $get['type'] : 0;
         $name = isset($get['name']) ? $get['name'] : '';

+ 5 - 0
app-ghs/controllers/OrderController.php

@@ -716,6 +716,11 @@ class OrderController extends BaseController
     //订单列表 ssh 2021.1.20
     public function actionList()
     {
+        $staff = $this->shopAdmin;
+        if(isset($staff->identity) && $staff->identity == 2){
+            util::success(['list'=>[]]);
+        }
+
         $get = Yii::$app->request->get();
         $where['mainId'] = $this->mainId;
         $status = $get['status'] ?? 0;

+ 8 - 0
app-ghs/controllers/PurchaseOrderController.php

@@ -618,6 +618,7 @@ class PurchaseOrderController extends BaseController
     {
         $where = [];
         $get = Yii::$app->request->get();
+        $search = $get['search']??'';
         $where['shopId'] = $this->shopId;
         $orderStatus = $get['status'] ?? '';
         if ($orderStatus) {
@@ -627,6 +628,13 @@ class PurchaseOrderController extends BaseController
         if (!empty($ghsId)) {
             $where['ghsId'] = $ghsId;
         }
+        if(!empty($search)){
+            if(is_numeric($search) && strlen($search)==4){
+                $where['orderSn'] = ['like', $search];
+            }else{
+                $where['ghsName'] = ['like', $search];
+            }
+        }
         $data = PurchaseOrderClass::getOrderList($where);
         //状态统计,很慢,暂时隐藏
         //$statData = PurchaseOrderClass::statNum($this->shopId);

+ 20 - 6
biz-ghs/order/classes/CheckOrderClass.php

@@ -46,10 +46,10 @@ class CheckOrderClass extends BaseClass
         if (empty($bookSn)) {
             util::fail('没有在预订活动中');
         }
-        $booItem = BookItemClass::getByCondition(['bookSn' => $bookSn, 'itemId' => $productId], true);
-        if (!empty($booItem)) {
+        $bookItem = BookItemClass::getByCondition(['bookSn' => $bookSn, 'itemId' => $productId], true);
+        if (!empty($bookItem)) {
             //借出的人预订控制在不受影响范围
-            $bookNum = $booItem->bookNum ?? 0;
+            $bookNum = $bookItem->bookNum ?? 0;
             if ($bookNum > 0) {
                 $roadNum = $bookItem->roadNum ?? 0;
                 $needCgNum = $bookItem->needCgNum ?? 0;
@@ -93,6 +93,12 @@ class CheckOrderClass extends BaseClass
 
     public static function bookToAddStock($productId, $num, $shop, $staff, $bookItemCustomRes)
     {
+        $cacheKey = 'change_book_item_num_' . $productId;
+        $noLock = util::lock($cacheKey);
+        if (!$noLock) {
+            util::fail("系统繁忙,1秒后再提交");
+        }
+
         $mainId = $shop->mainId ?? 0;
         $product = ProductClass::getById($productId, true);
         if (empty($product) || $product->mainId != $mainId) {
@@ -140,11 +146,18 @@ class CheckOrderClass extends BaseClass
             util::fail('盘点加库存没有找到bookCustom');
         }
         $bookCustomRes = BookCustomClass::delNeedCgNum($bookCustomRes, $delNeedCgNum, 0, $inOrder, $shop, $in, $params);
+        util::unlock($cacheKey);
         return true;
     }
 
     public static function loanStock($inId, $outId, $num, $shop, $staff, $bookItemCustomRes)
     {
+        $cacheKey = 'change_book_item_num_' . $inId;
+        $noLock = util::lock($cacheKey);
+        if (!$noLock) {
+            util::fail("系统繁忙,1秒后再提交");
+        }
+
         $sjId = $shop->sjId ?? 0;
         $shopId = $shop->id ?? 0;
         $mainId = $shop->mainId ?? 0;
@@ -162,10 +175,10 @@ class CheckOrderClass extends BaseClass
         $bookSn = $shop->bookSn ?? 0;
         $couldLoan = 0;
         if (!empty($bookSn)) {
-            $booItem = BookItemClass::getByCondition(['bookSn' => $bookSn, 'itemId' => $outId], true);
-            if (!empty($booItem)) {
+            $bookItem = BookItemClass::getByCondition(['bookSn' => $bookSn, 'itemId' => $outId], true);
+            if (!empty($bookItem)) {
                 //借出的人预订控制在不受影响范围
-                $bookNum = $booItem->bookNum ?? 0;
+                $bookNum = $bookItem->bookNum ?? 0;
                 if ($bookNum > 0) {
                     $roadNum = $bookItem->roadNum ?? 0;
                     $needCgNum = $bookItem->needCgNum ?? 0;
@@ -247,6 +260,7 @@ class CheckOrderClass extends BaseClass
             util::fail('借库存没有找到bookCustom');
         }
         $bookCustomRes = BookCustomClass::delNeedCgNum($bookCustomRes, $delNeedCgNum, 0, $inOrder, $shop, $in, $params);
+        util::unlock($cacheKey);
         return true;
     }