shish пре 4 година
родитељ
комит
0e3e8d5d7c
2 измењених фајлова са 28 додато и 1 уклоњено
  1. 27 0
      app-ghs/controllers/ProductController.php
  2. 1 1
      biz-hd/work/classes/WorkClass.php

+ 27 - 0
app-ghs/controllers/ProductController.php

@@ -24,6 +24,33 @@ class ProductController extends BaseController
 
     public $guestAccess = ['index'];
 
+    //打印花材的条码 ssh 20220602
+    public function actionPrint()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $num = $get['num'] ?? 1;
+        $info = ProductClass::getById($id, true);
+        if (empty($info)) {
+            util::fail('没有找到花材');
+        }
+        $name = $info->name ?? '';
+        $ptItemId = $info->itemId ?? 0;
+
+        $ext = $this->shopExt;
+        $printLabelSn = $ext->printLabelSn ?? '';
+        if (empty($printLabelSn)) {
+            util::fail('请设置条码打印机');
+        }
+        $p = new printUtil($printLabelSn);
+
+        $p->times = $num;
+        $content = '<TEXT x="50" y="20" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
+        $content .= '<BC128 x="50" y="90" h="80" s="1" r="0" n="2" w="2">' . $ptItemId . '</BC128>';
+        $p->printLabelMsg($content);
+        util::complete();
+    }
+
     //按分类列出所有花材
     public function actionIndex()
     {

+ 1 - 1
biz-hd/work/classes/WorkClass.php

@@ -38,7 +38,7 @@ class WorkClass extends BaseClass
         } else {
 
             $p = new printUtil('570200946');
-            $p->times = 50;
+            $p->times = 5;
             $content = '<BC128 x="60" y="100" h="80" s="1" r="0" n="2" w="2">1005</BC128>';
             $p->printLabelMsg($content);