| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace App\Services;
- use App\OracleDOCOrderHeader;
- use App\OwnerLogisticPrintTemplate;
- use App\Services\Interfaces\DeliveryInterface;
- use App\Traits\DeliveryProcess;
- use Illuminate\Database\Query\Builder;
- use Illuminate\Support\Str;
- class SFQHDDeliveryService implements DeliveryInterface
- {
- use DeliveryProcess;
- function getDeliveryInfo($logistic_number): array
- {
- $oracleDocOrderHeaders = OracleDOCOrderHeader::query()
- ->whereIn('deliveryNo', $logistic_number)
- ->whereIn('ConsigneeId', ["SFQHD",'SFSYQHD','SFTHQHD'])
- ->get();
- return$oracleDocOrderHeaders->map(function ($item) {
- return [
- // TODO 需要动态获取面单获取的组件 TYPE
- 'type' => 'SFQHD',
- 'task_id' => Str::uuid(),
- 'data' => '',
- 'component_type' => 'SFQHD',
- 'owner_code' => $item->customerid ?? '',
- 'logistic_code' => $item->userdefine1 ?? '',
- 'logistic_number' => $item['deliveryno'],
- 'delivery' => $this->getDelivery($item),
- 'base64' => $this->getBase64($item),
- 'printerName' => '',
- ];
- })->toArray();
- }
- public function getBase64($item)
- {
- $item = OwnerLogisticPrintTemplate::query()->with('printTemplate')->where('owner_id', function (Builder $query) use ($item) {
- $query->from("owners")->selectRaw('id')->where("code", $item['customerid']);
- })->where('logistic_id', function (Builder $query) use ($item) {
- $query->from("logistic")->selectRaw('id')->where("code", $item['userdefine1']);
- })->first();
- $image = $this->draw($item['delivery'], $item, null);
- $path = '';
- $this->saveImage($image, $path);
- app(DeliveryService::class)->pushClearCache($path);
- return $this->readImageBase64($path);
- }
- function getDelivery($item): array
- {
- return $this->getDocOrderInfo($item);
- }
- function processing(&$params)
- {
- }
- function construct($param)
- {
- }
- }
|