瀏覽代碼

开启预订不能直接入库

shish 2 年之前
父節點
當前提交
ea6bb856a5
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      app-ghs/controllers/PurchaseOrderController.php

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

@@ -468,6 +468,13 @@ class PurchaseOrderController extends BaseController
             $post['itemInfo'] = $ghsItemInfo;
             $post['itemInfo'] = $ghsItemInfo;
             //0稍后入库 1直接入库
             //0稍后入库 1直接入库
             $inType = $post['inType'] ?? PurchaseOrderClass::IN_TYPE_NOW;
             $inType = $post['inType'] ?? PurchaseOrderClass::IN_TYPE_NOW;
+
+            $shop = $this->shop;
+            $bookSn = $shop->bookSn ?? 0;
+            if ($inType == 1 && !empty($bookSn)) {
+                util::fail('开启预订不能直接入库');
+            }
+
             $debtStatus = $inType == 1 ? PurchaseOrderClass::DEBT_YES : PurchaseOrderClass::DEBT_UNKNOWN;
             $debtStatus = $inType == 1 ? PurchaseOrderClass::DEBT_YES : PurchaseOrderClass::DEBT_UNKNOWN;
             $post['debt'] = $debtStatus;
             $post['debt'] = $debtStatus;
             $order = PurchaseOrderClass::addOrder($post);
             $order = PurchaseOrderClass::addOrder($post);
@@ -516,6 +523,10 @@ class PurchaseOrderController extends BaseController
         if (empty($bookSn)) {
         if (empty($bookSn)) {
             util::success([]);
             util::success([]);
         }
         }
+        //不是待入库状态不需要分配
+        if ($cg->status != 3) {
+            util::success([]);
+        }
 
 
         $connection = Yii::$app->db;
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         $transaction = $connection->beginTransaction();