|
|
@@ -154,7 +154,7 @@ class OrderClass extends BaseClass
|
|
|
$wlName = $custom['wlName'] ?? '';
|
|
|
$myList[] = ['sendNum' => $sendNum, 'customMobile' => $customMobile, 'shortName' => $shortName, 'wlName' => $wlName];
|
|
|
}
|
|
|
- $myList = arrayUtil::arraySort($myList,'customMobile');
|
|
|
+ $myList = arrayUtil::arraySort($myList, 'customMobile');
|
|
|
|
|
|
$size = 50;
|
|
|
$arr = array_chunk($myList, $size);
|
|
|
@@ -2828,4 +2828,90 @@ XL;
|
|
|
util::success(['file' => $fileUrl, 'shortFile' => $file]);
|
|
|
}
|
|
|
|
|
|
+ public static function printLogisticsLabel($order, $shop, $ext)
|
|
|
+ {
|
|
|
+ $mainId = $shop->mainId;
|
|
|
+ if (getenv('YII_ENV') == 'production') {
|
|
|
+ $map = [65726];
|
|
|
+ } else {
|
|
|
+ $map = [644];
|
|
|
+ }
|
|
|
+
|
|
|
+ $customId = $order->customId ?? 0;
|
|
|
+ $custom = CustomClass::getById($customId, true);
|
|
|
+ if (empty($custom)) {
|
|
|
+ if (!in_array($mainId, $map)) {
|
|
|
+ util::fail('没有找到客户');
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $shortName = $custom->shortName ?? '';
|
|
|
+
|
|
|
+ $shortName = stringUtil::subStringUtf8($shortName, 5);
|
|
|
+ $customMobile = $order->customMobile ?? '';
|
|
|
+ if (empty($customMobile)) {
|
|
|
+ if (!in_array($mainId, $map)) {
|
|
|
+ util::fail('客户手机号无效');
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $customName = $order->customName ?? '';
|
|
|
+ $shortMobile = substr($customMobile, -4);
|
|
|
+ $remark = $order->remark ?? '';
|
|
|
+ $shortRemark = stringUtil::subStringUtf8($remark, 8);
|
|
|
+
|
|
|
+ $address = $order->address ?? '';
|
|
|
+ $floor = $order->floor ?? '';
|
|
|
+ $fullAddress = $address . $floor;
|
|
|
+
|
|
|
+ $shopName = $shop->shopName ?? '';
|
|
|
+ $sjName = $shop->merchantName;
|
|
|
+ $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
|
|
|
+ $telephone = $shop->telephone ?? '';
|
|
|
+
|
|
|
+ $wlLabelSn = $ext->wlLabelSn ?? '';
|
|
|
+ if (empty($wlLabelSn)) {
|
|
|
+ if (!in_array($mainId, $map)) {
|
|
|
+ util::fail('请绑定物流标签机');
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $p = new printUtil($wlLabelSn);
|
|
|
+
|
|
|
+ if (!in_array($mainId, $map)) {
|
|
|
+ if (empty($shortName)) {
|
|
|
+ util::fail('客户短名没有设置');
|
|
|
+ }
|
|
|
+ $p->times = 2;
|
|
|
+ $content = '<TEXT x="420" y="130" font="12" w="4" h="4" r="90">' . $shortName . '</TEXT>';
|
|
|
+ $content .= '<TEXT x="395" y="10" font="12" w="2" h="2" r="90">地址</TEXT>';
|
|
|
+ $content .= '<TEXT x="290" y="130" font="12" w="4" h="4" r="90">' . $shortMobile . '</TEXT>';
|
|
|
+ $content .= '<TEXT x="265" y="10" font="12" w="2" h="2" r="90">代码</TEXT>';
|
|
|
+ $content .= '<TEXT x="170" y="130" font="12" w="4" h="4" r="90">' . $shortRemark . '</TEXT>';
|
|
|
+ $content .= '<TEXT x="150" y="10" font="12" w="2" h="2" r="90">物流</TEXT>';
|
|
|
+ $content .= '<TEXT x="45" y="70" font="12" w="2" h="2" r="90">' . $currentName . ' ' . $telephone . '</TEXT>';
|
|
|
+ } else {
|
|
|
+ $sameTimeIds = $order->sameTimeIds;
|
|
|
+ $num = 1;
|
|
|
+ if (!empty($sameTimeIds)) {
|
|
|
+ $ids = explode(',', $sameTimeIds);
|
|
|
+ if (!empty($ids)) {
|
|
|
+ $num = count($ids);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($num > 1) {
|
|
|
+ $customName = $customName . ' ' . $num . '单';
|
|
|
+ }
|
|
|
+ $content = '<TEXT x="430" y="30" font="12" w="4" h="4" r="90">' . $shortName . '</TEXT>';
|
|
|
+ $content .= '<TEXT x="300" y="30" font="12" w="2" h="3" r="90">' . $customName . '</TEXT>';
|
|
|
+ $content .= '<TEXT x="190" y="10" font="12" w="1" h="2" r="90">' . $fullAddress . '</TEXT>';
|
|
|
+ $content .= '<TEXT x="120" y="10" font="12" w="2" h="2" r="90">' . $customMobile . '</TEXT>';
|
|
|
+ }
|
|
|
+ $p->printLabelMsg($content);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|