|
|
@@ -985,7 +985,7 @@ class OrderClass extends BaseClass
|
|
|
}
|
|
|
$productNum = $current['num'] ?? '';
|
|
|
$count = $current['count'] ?? '';
|
|
|
- $unitName = $current['unitName'] ?? '喳';
|
|
|
+ $unitName = $current['unitName'] ?? '扎';
|
|
|
if (isset($current['refundNum']) && $current['refundNum'] > 0) {
|
|
|
$show = $name . ' ' . $count . '(退' . $current['refundNum'] . $unitName . ')';
|
|
|
} else {
|
|
|
@@ -999,6 +999,177 @@ class OrderClass extends BaseClass
|
|
|
return $content;
|
|
|
}
|
|
|
|
|
|
+ //合并打印订单 ssh 20230929
|
|
|
+ public static function mergePrintOrder($ids, $mainId)
|
|
|
+ {
|
|
|
+ $all = OrderClass::getAllByCondition(['id' => ['in', $ids]], null, '*', null, true);
|
|
|
+ if (empty($all)) {
|
|
|
+ util::fail('没有找到订单');
|
|
|
+ }
|
|
|
+ $snList = [];
|
|
|
+ $sendNumList = [];
|
|
|
+ $remarkList = [];
|
|
|
+ foreach ($all as $info) {
|
|
|
+ if ($info->mainId != $mainId) {
|
|
|
+ util::fail('不是你的订单');
|
|
|
+ }
|
|
|
+ $orderSn = $info->orderSn;
|
|
|
+ if ($info->payStatus == 1) {
|
|
|
+ $snList[] = $orderSn;
|
|
|
+ $orderInfo = $info;
|
|
|
+ $sendNumList[] = $info->sendNum;
|
|
|
+ if (!empty($info->remark)) {
|
|
|
+ $remarkList[] = $info->remark;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $sendNumString = '';
|
|
|
+ if (!empty($sendNumList)) {
|
|
|
+ $sendNumString = implode(',', $sendNumList);
|
|
|
+ }
|
|
|
+ $remarkString = '';
|
|
|
+ if (!empty($remarkList)) {
|
|
|
+ $remarkString = implode(',', $remarkList);
|
|
|
+ }
|
|
|
+ $allItem = OrderItemClass::getAllByCondition(['orderSn' => ['in', $snList]], null, '*');
|
|
|
+ if (empty($allItem)) {
|
|
|
+ util::fail('没有花材信息');
|
|
|
+ }
|
|
|
+ $new = [];
|
|
|
+ foreach ($allItem as $currentItem) {
|
|
|
+ $unitType = $currentItem['xhPreUnitType'] ?? 1;
|
|
|
+ $productId = $currentItem['productId'] ?? 0;
|
|
|
+ if ($unitType == 0 && $productId > 0) {
|
|
|
+ if (isset($new[$productId])) {
|
|
|
+ $xhNum = $currentItem['xhNum'] ?? 0;
|
|
|
+ $refundNum = $currentItem['refundNum'] ?? 0;
|
|
|
+ $giveNum = $currentItem['giveNum'] ?? 0;
|
|
|
+ $new[$productId]['xhNum'] = bcadd($new[$productId]['xhNum'], $xhNum);
|
|
|
+ $new[$productId]['refundNum'] = bcadd($new[$productId]['refundNum'], $refundNum);
|
|
|
+ $new[$productId]['giveNum'] = bcadd($new[$productId]['giveNum'], $giveNum);
|
|
|
+ } else {
|
|
|
+ $new[$productId] = $currentItem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $showPrice = 1;
|
|
|
+
|
|
|
+ $customId = $orderInfo->customId ?? 0;
|
|
|
+ $c = CustomClass::getById($customId);
|
|
|
+ $debtAmount = $c['debtAmount'] ?? 0.00;
|
|
|
+
|
|
|
+ $shopId = $orderInfo->shopId ?? 0;
|
|
|
+ $shop = ShopClass::getById($shopId, true);
|
|
|
+ $sjId = $shop->sjId ?? 0;
|
|
|
+ $fontSizeType = $shop->fontSize ?? 0;
|
|
|
+ $telephone = $shop->telephone ?? '';
|
|
|
+ $sj = SjClass::getById($sjId, true);
|
|
|
+ $sjName = $sj->name ?? '';
|
|
|
+ $shopName = $shop->shopName ?? '';
|
|
|
+ $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
|
|
|
+
|
|
|
+ $fromType = $orderInfo->fromType ?? dict::getDict('fromType', 'shop');
|
|
|
+ $fromTypeMap = dict::getDict('fromTypeMap');
|
|
|
+ $fromTypeName = $fromTypeMap[$fromType] ?? '门店';
|
|
|
+
|
|
|
+ $content = "<CB>" . $currentName . "</CB>";
|
|
|
+ $content .= "<CB>销售单</CB><BR><BR>";
|
|
|
+
|
|
|
+
|
|
|
+ $content .= '<B>' . $sendNumString . ' ' . $fromTypeName . '</B><BR>';
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
+
|
|
|
+ //快捷开单不需要打印买家信息
|
|
|
+ if ($customId != $shop->skCustomId) {
|
|
|
+ $content .= '<B>买家信息:</B><BR><BR>';
|
|
|
+ $content .= '<B>' . $orderInfo->customName . '</B><BR>';
|
|
|
+ $content .= '<B>' . $orderInfo->customMobile . '</B><BR>';
|
|
|
+ if (isset($orderInfo->address) && !empty($orderInfo->address)) {
|
|
|
+ $content .= $orderInfo->fullAddress;
|
|
|
+ if (isset($orderInfo->showAddress) && !empty($orderInfo->showAddress)) {
|
|
|
+ $content .= '(' . $orderInfo->showAddress . ')<BR>';
|
|
|
+ } else {
|
|
|
+ $content .= '<BR>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isset($orderInfo->book) && $orderInfo->book == 1) {
|
|
|
+ $content .= '<B>预订单</B><BR>';
|
|
|
+ }
|
|
|
+ if (isset($orderInfo->presell) && $orderInfo->presell == 1) {
|
|
|
+ $content .= '<B>预售单</B><BR>';
|
|
|
+ }
|
|
|
+ if (isset($orderInfo->sendType)) {
|
|
|
+ $sendName = '送货上门';
|
|
|
+ if ($orderInfo->sendType == 1) {
|
|
|
+ $sendName = '到店自取';
|
|
|
+ }
|
|
|
+ if ($orderInfo->sendType == 2) {
|
|
|
+ $sendName = '代叫配送';
|
|
|
+ }
|
|
|
+ if ($orderInfo->sendType == 3) {
|
|
|
+ $wlName = $orderInfo['wlName'] ?? '未填物流';
|
|
|
+ $sendName = $wlName;
|
|
|
+ }
|
|
|
+ if ($orderInfo->sendType == 4) {
|
|
|
+ $sendName = '发快递';
|
|
|
+ }
|
|
|
+ $content .= '<BR><B>' . $sendName . '</B><BR>';
|
|
|
+ }
|
|
|
+ if (!empty($remarkString)) {
|
|
|
+ $content .= '<BR>';
|
|
|
+ $content .= '备注:<BR>';
|
|
|
+ $content .= '<B>' . $remarkString . '</B><BR>';
|
|
|
+ }
|
|
|
+
|
|
|
+ $content .= '<BR>';
|
|
|
+ $content .= '商品 数量/单价 金额 <BR>';
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
+
|
|
|
+ $totalNum = 0;
|
|
|
+ foreach ($new as $current) {
|
|
|
+ //58mm的机器,一行打印16个汉字,32个字母
|
|
|
+ $productPrice = $current['xhUnitPrice'] ?? '';
|
|
|
+ $name = $current['name'] ?? '';
|
|
|
+ if (floatval($productPrice) == 0.01) {
|
|
|
+ $name = $name . '(送)';
|
|
|
+ }
|
|
|
+ $productNum = $current['xhNum'] ?? '';
|
|
|
+ $unitName = $current['xhUnitName'] ?? '扎';
|
|
|
+ $count = $productNum . $unitName;
|
|
|
+ if (isset($current['refundNum']) && $current['refundNum'] > 0) {
|
|
|
+ $show = $name . ' ' . $count . '(退' . $current['refundNum'] . $unitName . ')';
|
|
|
+ } else {
|
|
|
+ $show = $name . ' ' . $count;
|
|
|
+ }
|
|
|
+ $content .= '<B>' . $show . '</B><BR>';
|
|
|
+ $content .= $productNum . ' = ' . $productPrice . '元<BR>';
|
|
|
+ $content .= '--------------------------------<BR>';
|
|
|
+ $totalNum = bcadd($totalNum, $productNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ $content .= '********************************<BR>';
|
|
|
+ $kindNum = count($new);
|
|
|
+ $content .= "<CB>共{$kindNum}种";
|
|
|
+ $content .= ",{$totalNum}扎";
|
|
|
+ $content .= "</CB>";
|
|
|
+ $content .= '********************************<BR><BR>';
|
|
|
+
|
|
|
+ $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
|
|
|
+ $printSn = $ext['printSn'] ?? '';
|
|
|
+ if (!empty($printSn)) {
|
|
|
+ $p = new printUtil($printSn);
|
|
|
+ $p->printMsg($content, $shop);
|
|
|
+ }
|
|
|
+ foreach ($all as $info) {
|
|
|
+ if ($info->payStatus == 1) {
|
|
|
+ $info->printNum += 1;
|
|
|
+ $info->printStatus = 2;
|
|
|
+ $info->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//云打印 ssh 20210709
|
|
|
public static function onlinePrint($orderInfo, $showPrice = 1)
|
|
|
{
|