Ver Fonte

默认直接完成

shish há 4 anos atrás
pai
commit
673fe5dee1
2 ficheiros alterados com 21 adições e 20 exclusões
  1. 3 5
      app-hd/controllers/WorkController.php
  2. 18 15
      biz-hd/work/classes/WorkClass.php

+ 3 - 5
app-hd/controllers/WorkController.php

@@ -86,14 +86,12 @@ class WorkController extends BaseController
             }
             $post['catName'] = $cat->categoryName ?? '';
             $main = $this->main;
+            //默认直接完成
+            $post['complete'] = 1;
             $work = WorkClass::createFinish($post, $main);
             $transaction->commit();
 
-            //打印
-            $needPrint = $post['needPrint'] ?? dict::getDict('needPrint', 'noNeed');
-            if ($needPrint == dict::getDict('needPrint', 'need')) {
-                WorkClass::print($work, $this->shop);
-            }
+            WorkClass::print($work, $this->shop, false);
 
             util::success($work);
         } catch (\Exception $e) {

+ 18 - 15
biz-hd/work/classes/WorkClass.php

@@ -26,7 +26,7 @@ class WorkClass extends BaseClass
     const STATUS_CANCEL = 2;
 
     //打印工单 ssh 20220601
-    public static function print($work, $shop)
+    public static function print($work, $shop,$mustPrint=true)
     {
         $orderSn = $work->orderSn ?? '';
         if (!empty($orderSn)) {
@@ -40,20 +40,23 @@ class WorkClass extends BaseClass
             $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
             $printLabelSn = $ext->printLabelSn ?? '';
             if (empty($printLabelSn)) {
-                util::fail('请设置标签打印机');
-            }
-            $p = new printUtil($printLabelSn);
-            $workSn = $work->workSn ?? '';
-            $workItemList = WorkClass::getAllByCondition(['workSn' => $workSn], null, '*', null, true);
-            if (!empty($workItemList)) {
-                foreach ($workItemList as $item) {
-                    $goodsSn = $item->goodsSn ?? '';
-                    $num = $item->num ?? 1;
-                    $name = $item->name ?? '';
-                    $content = '<TEXT x="40" y="20" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
-                    $content .= '<BC128 x="40" y="90" h="80" s="1" r="0" n="2" w="2">' . $goodsSn . '</BC128>';
-                    $p->times = $num;
-                    $p->printLabelMsg($content);
+                if($mustPrint){
+                    util::fail('请设置标签打印机');
+                }
+            } else {
+                $p = new printUtil($printLabelSn);
+                $workSn = $work->workSn ?? '';
+                $workItemList = WorkClass::getAllByCondition(['workSn' => $workSn], null, '*', null, true);
+                if (!empty($workItemList)) {
+                    foreach ($workItemList as $item) {
+                        $goodsSn = $item->goodsSn ?? '';
+                        $num = $item->num ?? 1;
+                        $name = $item->name ?? '';
+                        $content = '<TEXT x="40" y="20" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
+                        $content .= '<BC128 x="40" y="90" h="80" s="1" r="0" n="2" w="2">' . $goodsSn . '</BC128>';
+                        $p->times = $num;
+                        $p->printLabelMsg($content);
+                    }
                 }
             }
         }