SFQHDDeliveryService.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace App\Services;
  3. use App\OracleDocOrderDeliveryInfo;
  4. use App\OracleDOCOrderHeader;
  5. use App\OwnerLogisticPrintTemplate;
  6. use App\Services\Interfaces\DeliveryInterface;
  7. use App\Traits\DrawImage;
  8. use Illuminate\Database\Query\Builder;
  9. use Illuminate\Support\Str;
  10. class SFQHDDeliveryService implements DeliveryInterface
  11. {
  12. use DrawImage;
  13. function getDeliveryInfo($logistic_number): array
  14. {
  15. return OracleDOCOrderHeader::query()->whereIn('deliveryNo',$logistic_number)->where('ConsigneeId',"SFQHD")->where('SoStatus', '<>','90')->get()->map(function($item){
  16. return [
  17. // TODO 需要动态获取面单获取的组件 TYPE
  18. 'type' => 'SFQHD',
  19. 'task_id' => Str::uuid(),
  20. 'data' => '',
  21. 'component_type' => 'SFQHD',
  22. 'owner_code' => $item->customerid ?? '',
  23. 'logistic_code' => $item->userdefine1 ?? '',
  24. 'logistic_number' => $item['deliveryno'],
  25. 'delivery' => $this->getDelivery($item),
  26. 'base64' => $this->getBase64($item),
  27. ];
  28. })->toArray();
  29. }
  30. public function getBase64($item)
  31. {
  32. $item = OwnerLogisticPrintTemplate::query()->with('printTemplate')->where('owner_id', function(Builder $query)use($item){
  33. $query->from("owners")->where("code",$item['owner_code']);
  34. })->where('logistic_id', function(Builder $query)use($item){
  35. $query->from("logistic")->where("code",$item['logistic_code']);
  36. })->first();
  37. $image = $this->draw($item['delivery'],$item,null);
  38. $path = '';
  39. $this->saveImage($image,$path);
  40. return $this->readImageBase64($path);
  41. }
  42. function getDelivery($item)
  43. {
  44. return null;
  45. }
  46. function processing(&$params)
  47. {
  48. }
  49. function construct($param)
  50. {
  51. }
  52. }