|
|
@@ -11,6 +11,8 @@ use common\components\util;
|
|
|
use Yii;
|
|
|
use bizGhs\base\classes\BaseClass;
|
|
|
use bizGhs\order\traits\OrderTrait;
|
|
|
+use biz\shop\classes\ShopExtClass;
|
|
|
+use common\components\printUtil;
|
|
|
|
|
|
class StockOutOrderClass extends BaseClass
|
|
|
{
|
|
|
@@ -293,47 +295,40 @@ class StockOutOrderClass extends BaseClass
|
|
|
return self::$statusMap[$status] ?? '';
|
|
|
}
|
|
|
|
|
|
- public static function printOrder()
|
|
|
+ public static function printOrder($out, $shop)
|
|
|
{
|
|
|
+ $orderSn = $out->orderSn;
|
|
|
+ $itemList = StockOutOrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
|
|
|
+
|
|
|
+ $content = '';
|
|
|
+ $content .= "<CB>出库单</CB><BR><BR>";
|
|
|
+ $content .= '<B>' . $orderSn . '</B><BR>';
|
|
|
+ $content .= '<B>' . date("m-d", strtotime($out->outTime)) . '</B><BR>';
|
|
|
|
|
|
$content .= '<BR>';
|
|
|
- $content .= '商品 数量/单价 金额 <BR>';
|
|
|
+ $content .= '商品 数量 <BR>';
|
|
|
$content .= '--------------------------------<BR>';
|
|
|
|
|
|
- if (isset($respond['product']) && !empty($respond['product'])) {
|
|
|
- foreach ($respond['product'] as $current) {
|
|
|
- $content = self::printGroup($current, $content, $showPrice, $fontSizeType);
|
|
|
- }
|
|
|
- }
|
|
|
+ if (isset($itemList) && !empty($itemList)) {
|
|
|
+ foreach ($itemList as $current) {
|
|
|
|
|
|
- }
|
|
|
+ $json = $current['itemInfo'] ?? '';
|
|
|
+ $info = json_decode($json, true);
|
|
|
+ print_r($info);
|
|
|
+ die;
|
|
|
+ $show = $name . ' ' . $lastNum . $unitName;
|
|
|
+ $content .= '<B>' . $show . '</B><BR>';
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
|
|
|
- public static function printGroup($current, $content, $showPrice = 1, $fontSizeType = 0)
|
|
|
- {
|
|
|
- //58mm的机器,一行打印16个汉字,32个字母
|
|
|
- $productPrice = $current['price'] ?? '';
|
|
|
- $name = $current['name'] ?? '';
|
|
|
- if (floatval($productPrice) == 0.01) {
|
|
|
- $name = $name . '(送)';
|
|
|
- }
|
|
|
- $productNum = $current['num'] ?? '';
|
|
|
- $itemNum = $current['itemNum'] ?? 0;
|
|
|
- $refundNum = $current['refundNum'] ?? 0;
|
|
|
- $unitName = $current['unitName'] ?? '扎';
|
|
|
-
|
|
|
- $lastNum = bcsub($itemNum, $refundNum);
|
|
|
-
|
|
|
- $show = $name . ' ' . $lastNum . $unitName;
|
|
|
-
|
|
|
- $content .= '<B>' . $show . '</B><BR>';
|
|
|
- if ($refundNum > 0) {
|
|
|
- $content .= '(买' . $itemNum . $unitName . ' 退' . $refundNum . $unitName . ')<BR>';
|
|
|
+ }
|
|
|
}
|
|
|
- if ($showPrice == 1) {
|
|
|
- $content .= $productNum . ' = ' . $productPrice . '元<BR>';
|
|
|
+ $shopId = $shop->id;
|
|
|
+ $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
|
|
|
+ $printSn = $ext['printSn'] ?? '';
|
|
|
+ if (!empty($printSn)) {
|
|
|
+ $p = new printUtil($printSn);
|
|
|
+ $p->printMsg($content, $shop);
|
|
|
}
|
|
|
- $content .= '--------------------------------<BR>';
|
|
|
- return $content;
|
|
|
}
|
|
|
|
|
|
}
|