| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Services;
- use App\OracleDOCOrderHeader;
- class DeliveryService
- {
- public function getDelivery($printStr): array
- {
- list($batchCodes, $orderCodes, $logisticNumbers) = $this->conversionPrintData($printStr);
- if ($batchCodes){
- $orderHeaders = OracleDOCOrderHeader::query()->selectRaw('orderno')->whereIn('WaveNo',$batchCodes)->get()->toArray();
- $orderCodes = array_unique(array_merge($orderCodes,array_column($orderHeaders,'orderno')));
- }
- $tbParams = app(TBDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
- $pddParams = app(PDDDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
- $sfParams = app(SFDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
- $jdParams = app(JDDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
- $sfQhdParams = app(SFQHDDeliveryService::class)->getDeliveryInfo($orderCodes,$logisticNumbers);
- $params = array_merge($tbParams,$pddParams,$sfParams,$jdParams,$sfQhdParams);
- return $params;
- }
- public function conversionPrintData($printStr): array
- {
- preg_match_all('/[\w]+/', $printStr, $nos);
- foreach ($nos[0] as $no) {
- if (strstr($no, 'SO')) $orderCodes[] = $no;
- elseif (strstr($no, 'W')) $batchesCodes[] = $no;
- else $logisticNumbers[] = $no;
- }
- return [$batchesCodes ?? [], $orderCodes ?? [], $logisticNumbers ?? []];
- }
- public function encodeBase64($params){
- foreach ($params as $param) {
- }
- }
- /**
- * 快递面单填充自定义区域内容 或 自制面单
- * @param $params
- */
- public function customProcessing($params)
- {
- }
- }
|