Explorar o código

超出数量的打印

shish %!s(int64=2) %!d(string=hai) anos
pai
achega
d3ea17e4ce

+ 44 - 8
biz-ghs/order/classes/OrderClass.php

@@ -1315,12 +1315,49 @@ class OrderClass extends BaseClass
         }
     }
 
-    public static function onlinePrintOver($itemList,$orderInfo,$currentName)
+    //超出数量的打印 sssh 20240605
+    public static function onlinePrintOver($itemList,$orderInfo,$currentName,$shop)
     {
-        echo $currentName;
-        print_r($orderInfo);
-        print_r($itemList);
-        die;
+        $orderSn = $orderInfo->orderSn??'';
+        $arr = array_chunk($itemList,50);
+        $totalPage = count($arr);
+        foreach($arr as $key => $itemList){
+
+            $content = '';
+            $content .= "<CB>{$currentName}</CB><BR>";
+            $content .= "<CB>销售单</CB><BR><BR>";
+            $content .= '<CB>' . $orderSn . '</CB><BR><BR>';
+            if($totalPage>1){
+                $currentPage = bcadd($key,1);
+                $content .= "<CB>第{$currentPage}页,共{$totalPage}页</CB><BR>";
+            }
+            $content .= '<BR>';
+            $content .= '商品             数量 <BR>';
+            $content .= '--------------------------------<BR>';
+
+            if (isset($itemList) && !empty($itemList)) {
+                foreach ($itemList as $info) {
+                    $name = $info['name'] ?? '';
+                    $num = $info['xhNum'] ?? 0;
+                    $refundNum = $info['refundNum']??0;
+                    $lastNum = bcsub($num,$refundNum);
+                    $unitName = $info['xhUnitName'] ?? '';
+                    $show = $name . ' ' . $lastNum . $unitName;
+                    $content .= '<B>' . $show . '</B><BR>';
+                    $content .= '--------------------------------<BR>';
+                }
+            }
+            $content .= '<BR>';
+            $content .= '<BR>';
+            $content .= '<BR>';
+            $shopId = $shop->id;
+            $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
+            $printSn = $ext['printSn'] ?? '';
+            if (!empty($printSn)) {
+                $p = new printUtil($printSn);
+                $p->printMsg($content, $shop);
+            }
+        }
     }
 
     //云打印 ssh 20210709
@@ -1379,12 +1416,11 @@ class OrderClass extends BaseClass
 
         $itemList = $showItem['list']??[];
         if(count($itemList)>50){
-            //超出花材的打印
-            self::onlinePrintOver($itemList,$orderInfo,$currentName);
+            //超出数量的打印
+            self::onlinePrintOver($itemList,$orderInfo,$currentName,$shop);
             return true;
         }
 
-
         $fromType = $orderInfo['fromType'] ?? dict::getDict('fromType', 'shop');
         $fromTypeMap = dict::getDict('fromTypeMap');
         $fromTypeName = $fromTypeMap[$fromType] ?? '门店';

+ 1 - 1
biz-ghs/order/classes/StockOutOrderClass.php

@@ -302,7 +302,7 @@ class StockOutOrderClass extends BaseClass
         if(empty($returnList)){
             return false;
         }
-        $arr = array_chunk($returnList,45);
+        $arr = array_chunk($returnList,50);
         $totalPage = count($arr);
         foreach($arr as $key => $itemList){