shish пре 4 година
родитељ
комит
60202900c1
2 измењених фајлова са 8 додато и 0 уклоњено
  1. 3 0
      app-ghs/controllers/OrderController.php
  2. 5 0
      app-hd/controllers/PurchaseController.php

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

@@ -628,6 +628,9 @@ class OrderController extends BaseController
             util::fail('请选客户哦');
         }
         CustomClass::valid($custom, $this->shopId);
+        if (!empty($custom->mainId) && $custom->mainId == $custom->ownMainId) {
+            util::fail('不能给自己的零售店开单');
+        }
         $post['ghsId'] = $custom['ghsId'] ?? 0;
         $post['customMobile'] = $custom['mobile'] ?? '';
         $customName = $custom['name'] ?? '';

+ 5 - 0
app-hd/controllers/PurchaseController.php

@@ -35,6 +35,11 @@ class PurchaseController extends BaseController
             util::fail('没有找到供应商');
         }
         $ghsShopId = $ghsInfo['shopId'] ?? 0;
+
+        if (isset($ghsInfo['mainId']) && !empty($ghsInfo['mainId']) && $ghsInfo['mainId'] == $ghsInfo['ownMainId']) {
+            util::fail('不能向自己的批发店采购');
+        }
+
         $connection = Yii::$app->db;//事务处理
         $transaction = $connection->beginTransaction();
         try {