Browse Source

修改短名和设置物流标签

shish 1 year ago
parent
commit
dd5baac617
2 changed files with 40 additions and 0 deletions
  1. 15 0
      app-ghs/controllers/CustomController.php
  2. 25 0
      app-ghs/controllers/ShopExtController.php

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

@@ -311,6 +311,21 @@ class CustomController extends BaseController
         util::complete('已修改');
     }
 
+    //修改短名 ssh 2025312
+    public function actionModifyShortName()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $shortName = $get['shortName'] ?? 0;
+        $custom = CustomClass::getById($id, true);
+        if (empty($custom) || $custom->ownMainId != $this->mainId) {
+            util::fail('修改失败');
+        }
+        $custom->shortName = $shortName;
+        $custom->save();
+        util::complete('修改成功');
+    }
+
     //修改物流信息 ssh 20230105
     public function actionChangeWl()
     {

+ 25 - 0
app-ghs/controllers/ShopExtController.php

@@ -122,6 +122,10 @@ class ShopExtController extends BaseController
         $printKey = $get['printKey'] ?? '';
         $printLabelSn = $get['printLabelSn'] ?? '';
         $printLabelKey = $get['printLabelKey'] ?? '';
+
+        $wlLabelSn = $get['wlLabelSn'] ?? '';
+        $wlLabelKey = $get['wlLabelKey'] ?? '';
+
         $shop = $this->shop;
         $default = $shop->default ?? 0;
         $shopName = $shop->shopName ?? '';
@@ -162,6 +166,27 @@ class ShopExtController extends BaseController
             $ext->printLabelKey = '';
             $ext->save();
         }
+
+        if (!empty($wlLabelSn) && !empty($wlLabelKey)) {
+            $labelPrint = new printUtil($wlLabelSn);
+            $return = $labelPrint->addPrint($wlLabelKey, $name);
+            if ($return) {
+                $ext->wlLabelSn = $wlLabelSn;
+                $ext->wlLabelKey = $wlLabelKey;
+                $ext->save();
+                //将打印纸张设置为60X100
+                $labelPrint->times = 1;
+                $content = '<SIZE>60,100</SIZE>';
+                $labelPrint->printLabelMsg($content);
+            } else {
+                $hasFail = 1;
+            }
+        } else {
+            $ext->wlLabelSn = '';
+            $ext->wlLabelKey = '';
+            $ext->save();
+        }
+
         if ($hasFail == 1) {
             util::success(['hasFail' => 1], '出现添加失败的情况');
         }