|
|
@@ -298,47 +298,57 @@ class StockOutOrderClass extends BaseClass
|
|
|
public static function printOrder($out, $shop)
|
|
|
{
|
|
|
$orderSn = $out->orderSn;
|
|
|
- $itemList = StockOutOrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
|
|
|
-
|
|
|
- $sjName = $shop->merchantName ?? '';
|
|
|
- $shopName = $shop->shopName ?? '';
|
|
|
- $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
|
|
|
-
|
|
|
- $content = '';
|
|
|
- $content .= "<CB>{$currentName}</CB><BR>";
|
|
|
- $content .= "<CB>出库单</CB><BR><BR>";
|
|
|
- $content .= '<CB>' . $orderSn . '</CB><BR><BR>';
|
|
|
- $content .= '<CB>' . date("m-d H:i", strtotime($out->outTime)) . '</CB><BR>';
|
|
|
-
|
|
|
- $content .= '<BR>';
|
|
|
- $content .= '商品 数量 <BR>';
|
|
|
- $content .= '--------------------------------<BR>';
|
|
|
-
|
|
|
- if (isset($itemList) && !empty($itemList)) {
|
|
|
- foreach ($itemList as $current) {
|
|
|
- $json = $current['itemInfo'] ?? '';
|
|
|
- $info = json_decode($json, true);
|
|
|
- $name = $info['itemName'] ?? '';
|
|
|
- $num = $info['bigNum'] ?? 0;
|
|
|
- $unitName = $info['bigUnit'] ?? '';
|
|
|
- $show = $name . ' ' . $num . $unitName;
|
|
|
- $content .= '<B>' . $show . '</B><BR>';
|
|
|
- $content .= '--------------------------------<BR>';
|
|
|
- }
|
|
|
+ $returnList = StockOutOrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
|
|
|
+ if(empty($returnList)){
|
|
|
+ return false;
|
|
|
}
|
|
|
- $content .= '<BR>';
|
|
|
- $content .= '<BR>';
|
|
|
- $content .= '<BR>';
|
|
|
- $content .= '<B>签名:</B><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);
|
|
|
+ $arr = array_chunk($returnList,40);
|
|
|
+ $totalPage = count($arr);
|
|
|
+ foreach($arr as $key => $itemList){
|
|
|
+
|
|
|
+ $sjName = $shop->merchantName ?? '';
|
|
|
+ $shopName = $shop->shopName ?? '';
|
|
|
+ $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
|
|
|
+
|
|
|
+ $content = '';
|
|
|
+ $content .= "<CB>{$currentName}</CB><BR>";
|
|
|
+ $content .= "<CB>出库单</CB><BR><BR>";
|
|
|
+ $content .= '<CB>' . $orderSn . '</CB><BR><BR>';
|
|
|
+ $content .= '<CB>' . date("m-d H:i", strtotime($out->outTime)) . '</CB><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 $current) {
|
|
|
+ $json = $current['itemInfo'] ?? '';
|
|
|
+ $info = json_decode($json, true);
|
|
|
+ $name = $info['itemName'] ?? '';
|
|
|
+ $num = $info['bigNum'] ?? 0;
|
|
|
+ $unitName = $info['bigUnit'] ?? '';
|
|
|
+ $show = $name . ' ' . $num . $unitName;
|
|
|
+ $content .= '<B>' . $show . '</B><BR>';
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $content .= '<BR>';
|
|
|
+ $content .= '<BR>';
|
|
|
+ $content .= '<BR>';
|
|
|
+ $content .= '<B>签名:</B><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);
|
|
|
+ }
|
|
|
}
|
|
|
$out->printNum = bcadd($out->printNum, 1);
|
|
|
$out->save();
|