shish hace 1 año
padre
commit
7fb6155936
Se han modificado 1 ficheros con 48 adiciones y 7 borrados
  1. 48 7
      app-ghs/controllers/OrderController.php

+ 48 - 7
app-ghs/controllers/OrderController.php

@@ -25,6 +25,7 @@ use common\components\httpUtil;
 use common\components\noticeUtil;
 use common\components\oss;
 use common\components\payUtil;
+use common\components\printUtil;
 use common\components\qrCodeUtil;
 use common\components\stringUtil;
 use Yii;
@@ -1077,15 +1078,15 @@ class OrderController extends BaseController
         }
 
         if (getenv('YII_ENV') == 'production') {
-            if($this->mainId == 1082){
+            if ($this->mainId == 1082) {
                 //泉城鲜花批发的出车,只能开收现金方式,多处要修改,关键词qc_cash
-                if($hasPay != 0){
+                if ($hasPay != 0) {
                     util::fail('只能使用扫码付款,编号193');
                 }
             }
-        }else{
-            if($this->mainId == 644){
-                if($hasPay != 0){
+        } else {
+            if ($this->mainId == 644) {
+                if ($hasPay != 0) {
                     //util::fail('只能使用扫码付款,编号190');
                 }
             }
@@ -1465,11 +1466,11 @@ class OrderController extends BaseController
         Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 4, 'has']);
 
         if (getenv('YII_ENV') == 'production') {
-            if($this->mainId == 1082){
+            if ($this->mainId == 1082) {
                 //泉城鲜花批发的出车,只能开收现金方式,多处要修改,关键词qc_cash
                 util::fail('只能使用扫码付款,编号293');
             }
-        }else{
+        } else {
 
         }
 
@@ -2854,4 +2855,44 @@ class OrderController extends BaseController
         }
     }
 
+    //打印发物流用和标签 ssh 20250312
+    public function actionPrintWlLabel()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $order = OrderClass::getById($id, true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        $customId = $order->customId ?? 0;
+        $custom = CustomClass::getById($customId, true);
+        if (empty($custom)) {
+            util::fail('没有找到客户');
+        }
+        $shortName = $custom->shortName ?? '';
+        if (empty($shortName)) {
+            util::fail('客户的短名没有设置');
+        }
+        $shortName = stringUtil::subStringUtf8($shortName, 5);
+        $customMobile = $order->customMobile ?? '';
+        if (empty($customMobile)) {
+            util::fail('客户手机号无效');
+        }
+        $shortMobile = substr($customMobile, -4);
+        $remark = $order->remark ?? '';
+        $shortRemark = stringUtil::subStringUtf8($remark, 5);
+        $ext = $this->shopExt;
+        $wlLabelSn = $ext->wlLabelSn ?? '';
+        if (empty($wlLabelSn)) {
+            util::fail('请绑定物流标签机');
+        }
+        $p = new printUtil($wlLabelSn);
+        $p->times = 2;
+        $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $shortName . '</TEXT>';
+        $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $shortMobile . '</BC128>';
+        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $shortRemark . '</TEXT>';
+        $p->printLabelMsg($content);
+        util::complete();
+    }
+
 }