shish 1 год назад
Родитель
Сommit
2e6e1fe555
1 измененных файлов с 14 добавлено и 8 удалено
  1. 14 8
      app-ghs/controllers/StockOutController.php

+ 14 - 8
app-ghs/controllers/StockOutController.php

@@ -18,14 +18,6 @@ class StockOutController extends BaseController
     public function actionOneKeyStockOut()
     {
         $get = Yii::$app->request->get();
-        $inShopId = $get['inShopId'] ?? 0;
-        if ($inShopId == $this->shopId) {
-            util::fail('出库和入库门店一样');
-        }
-        $inShop = ShopClass::getById($inShopId, true);
-        if (empty($inShop)) {
-            util::fail('没有找到入库门店');
-        }
         $orderSn = $get['orderSn'] ?? '';
         $in = StockInOrderClass::getByCondition(['orderSn' => $orderSn], true);
         if (empty($in)) {
@@ -34,6 +26,20 @@ class StockOutController extends BaseController
         if ($in->inMainId != $this->mainId) {
             util::fail('不是你的入库单');
         }
+
+        $inShopId = $get['inShopId'] ?? 0;
+        if ($inShopId == $this->shopId) {
+            util::fail('出库和入库门店一样');
+        }
+        if(empty($inShopId)){
+            //如果没有传门店,表示要调回原店,注意!!!!!!!!!!!!!!!!!
+            $inShopId = $in->outShopId;
+        }
+        $inShop = ShopClass::getById($inShopId, true);
+        if (empty($inShop)) {
+            util::fail('没有找到入库门店');
+        }
+
         $inItemList = StockInOrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
         if (empty($inItemList)) {
             util::fail('没有找到入库单的花材');