| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace App\Services;
- use App\OracleDocOrderDeliveryInfo;
- use App\OracleDOCOrderHeader;
- use App\OwnerLogisticPrintTemplate;
- use App\Services\Interfaces\DeliveryInterface;
- use App\Traits\DrawImage;
- use Illuminate\Database\Query\Builder;
- use Illuminate\Support\Str;
- class JDDeliveryService implements DeliveryInterface
- {
- use DrawImage;
- function getDeliveryInfo($logistic_number)
- {
- return OracleDOCOrderHeader::query()->whereIn('deliveryno',$logistic_number)
- ->whereIn('consigneeId',['JD','BSZX','BSZFC','BSZXDF','BSZFCDF'])
- ->get()->map(function($item){
- return [
- // TODO 需要动态获取面单获取的组件 TYPE
- 'type' => 'JD',
- 'is_process' => false,
- 'task_id' => Str::uuid(),
- 'data' => '',
- 'component_type' => 'JD',
- 'owner_code' => $item->customerid ?? '',
- 'logistic_code' => $item->userdefine1 ?? '',
- 'logistic_number' => $item['deliveryno'],
- 'delivery' => null,
- 'base64' => $this->getBase64($item),
- ];
- })->toArray();
- }
- public function getBase64($item): string
- {
- $item = OwnerLogisticPrintTemplate::query()->with('printTemplate')->where('owner_id', function(Builder $query)use($item){
- $query->from("owners")->where("code",$item['owner_code']);
- })->where('logistic_id', function(Builder $query)use($item){
- $query->from("logistic")->where("code",$item['logistic_code']);
- })->first();
- $image = $this->draw($item['delivery'],$item,null);
- $path = '';
- $this->saveImage($image,$path);
- return $this->readImageBase64($path);
- }
- /*
- * 订单号
- * 波次号
- * 运单号
- * 店铺
- * 商家联系号
- * 商家订单号
- * 发货地址,省,市区
- *
- * 发货分拣中心
- * 发货人
- * 发货人号码
- * 收货地址
- * 收货分拣中心
- * 收件人
- * 商品
- * 备注
- *
- */
- function getDelivery($item)
- {
- $delivery = [
- 'oerderno' => $item['orderno'],
- 'waveno' => $item['waveno'],
- 'logistic_number' => $item['deliveryno'],
- 'shop' => $item[''],
- 'c_address1' => $item['c_address1'],
- 'c_city' => $item['c_city'],
- 'c_province' => $item['c_province'],
- 'c_district' => $item['c_district'],
- 'c_tel' => $item['c_tel1'] ?? $item['c_tel2'],
- 'i_contact' => $item['i_contact'],
- 'i_tel1' => $item['i_tel1'],
- 'i_tel2' => $item['i_tel2'],
- 'soreference1' => $item['soreference1'],
- 'b_addresss1' => $item['MJ-ZP'], // 目的地分拣中心
- 'd_addresss1' => 'BB-Y3-21',
- ];
- }
- function processing(&$params)
- {
- }
- }
|