DeliveryService.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Services;
  3. use App\OracleDOCOrderHeader;
  4. class DeliveryService
  5. {
  6. public function getDelivery($printStr): array
  7. {
  8. list($batchCodes, $orderCodes, $logisticNumbers) = $this->conversionPrintData($printStr);
  9. if ($batchCodes){
  10. $orderHeaders = OracleDOCOrderHeader::query()->selectRaw('orderno')->whereIn('WaveNo',$batchCodes)->get()->toArray();
  11. $orderCodes = array_unique(array_merge($orderCodes,array_column($orderHeaders,'orderno')));
  12. }
  13. $tbParams = app(TBDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
  14. $pddParams = app(PDDDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
  15. $sfParams = app(SFDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
  16. $jdParams = app(JDDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
  17. $sfQhdParams = app(SFQHDDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
  18. $params = array_merge($tbParams,$pddParams,$sfParams,$jdParams,$sfQhdParams);
  19. return $params;
  20. }
  21. public function conversionPrintData($printStr): array
  22. {
  23. preg_match_all('/[\w]+/', $printStr, $nos);
  24. foreach ($nos[0] as $no) {
  25. if (strstr($no, 'SO')) $orderCodes[] = $no;
  26. elseif (strstr($no, 'W')) $batchesCodes[] = $no;
  27. else $logisticNumbers[] = $no;
  28. }
  29. return [$batchesCodes ?? [], $orderCodes ?? [], $logisticNumbers ?? []];
  30. }
  31. public function encodeBase64($params){
  32. foreach ($params as $param) {
  33. }
  34. }
  35. /**
  36. * 快递面单填充自定义区域内容 或 自制面单
  37. * @param $params
  38. */
  39. public function customProcessing($params)
  40. {
  41. }
  42. }