Quellcode durchsuchen

修改货位号

shish vor 2 Jahren
Ursprung
Commit
348e87155c
2 geänderte Dateien mit 50 neuen und 1 gelöschten Zeilen
  1. 39 1
      app-ghs/controllers/CustomController.php
  2. 11 0
      biz-ghs/custom/classes/CustomClass.php

+ 39 - 1
app-ghs/controllers/CustomController.php

@@ -24,6 +24,44 @@ use Yii;
 class CustomController extends BaseController
 {
 
+    //生成货位号 ssh 20231215
+    public function actionCreateSeatSn()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $custom = CustomClass::getById($id, true);
+        if ($custom->ownMainId != $this->mainId) {
+            util::fail('不是您的客户');
+        }
+        $seatSn = $custom->seatSn ?? '';
+        if (!empty($seatSn)) {
+            util::fail('已经有货位号了');
+        }
+        $new = CustomClass::createSeatSn($this->mainId);
+        $custom->seatSn = $new;
+        $custom->save();
+        util::complete('已生成');
+    }
+
+    //修改货位号 ssh 20231215
+    public function actionModifySeatSn()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $new = $get['seatSn'] ?? 0;
+        $custom = CustomClass::getById($id, true);
+        if ($custom->ownMainId != $this->mainId) {
+            util::fail('不是您的客户');
+        }
+        $seatSn = $custom->seatSn ?? '';
+        if (empty($seatSn)) {
+            util::fail('没有货位号,请先生成');
+        }
+        $custom->seatSn = $new;
+        $custom->save();
+        util::complete('修改成功');
+    }
+
     //修改客户地址 ssh 20230929
     public function actionModifyAddress()
     {
@@ -32,7 +70,7 @@ class CustomController extends BaseController
         unset($post['id']);
         $custom = CustomClass::getById($id, true);
         if ($custom->ownMainId != $this->mainId) {
-            util::fail('没有权限修改');
+            util::fail('不是您的客户哦');
         }
         $city = $post['city'] ?? '';
         $dist = $post['dist'] ?? '';

+ 11 - 0
biz-ghs/custom/classes/CustomClass.php

@@ -57,6 +57,17 @@ class CustomClass extends BaseClass
         self::LEVEL_ZS => 'zsAddPrice',
     ];
 
+    public static function createSeatSn($mainId)
+    {
+        $info = self::getByCondition(['mainId' => $mainId], true, 'seatSn DESC');
+        $new = 1;
+        if (!empty($info)) {
+            $old = $info->seatSn;
+            $new = bcadd($old, 1);
+        }
+        return $new;
+    }
+
     //建立客户和供货商关系
     public static function build($ghsShopId, $hdShopId, $changeName = '')
     {