|
|
@@ -2,15 +2,10 @@
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
-use App\OracleActAllocationDetails;
|
|
|
-use App\OracleDocOrderDeliveryInfo;
|
|
|
-use App\OracleDOCOrderHeader;
|
|
|
use App\PrintTemplate;
|
|
|
use App\Traits\DrawImage;
|
|
|
use App\Traits\ModelSearchWay;
|
|
|
use App\Traits\ServiceAppAop;
|
|
|
-use Illuminate\Database\Eloquent\Builder;
|
|
|
-use Illuminate\Database\Eloquent\Collection;
|
|
|
use Illuminate\Support\Str;
|
|
|
use Intervention\Image\Facades\Image;
|
|
|
|
|
|
@@ -20,61 +15,6 @@ class PrintService
|
|
|
use ServiceAppAop;
|
|
|
use DrawImage;
|
|
|
|
|
|
- /**
|
|
|
- * 分列 订单号,快递单号,波次号
|
|
|
- * @param string $print
|
|
|
- * @return array[]
|
|
|
- */
|
|
|
- public function conversionPrintData(string $print): array
|
|
|
- {
|
|
|
- preg_match_all('/[\w]+/',$print,$nos);
|
|
|
-
|
|
|
- foreach ($nos[0] as $no){
|
|
|
- if(strstr($no,'SO')) $orderCodes[] = $no;
|
|
|
- elseif(strstr($no,'W')) $batchesCodes[] = $no;
|
|
|
- else $logistic_numbers[] = $no;
|
|
|
- }
|
|
|
-
|
|
|
- return [$batchesCodes ?? [],$orderCodes ?? [],$logistic_numbers ?? []];
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 返回WMS中对应的快递单号
|
|
|
- * @param array $batchCodes
|
|
|
- * @param array $orderCodes
|
|
|
- * @param array $logistic_numbers
|
|
|
- * @return array|mixed
|
|
|
- */
|
|
|
- public function getLogisticNumber($batchCodes=[],$orderCodes = [],$logistic_numbers = []): array
|
|
|
- {
|
|
|
- if($batchCodes){
|
|
|
- $orderHeaders = OracleDOCOrderHeader::query()->selectRaw('OrderNo')->whereIn('WaveNo',$batchCodes)->get()->map(function($item) {
|
|
|
- return $item->orderno;
|
|
|
- });
|
|
|
- $orderCodes = array_merge($orderHeaders, $orderCodes);
|
|
|
- }
|
|
|
- if($orderCodes) {
|
|
|
- $info = OracleActAllocationDetails::query()->where('OrderNo',$orderCodes)->get()->map(function($item){
|
|
|
- return $item->tackingno;
|
|
|
- });
|
|
|
- $logistic_numbers = array_merge($info, $logistic_numbers);
|
|
|
- }
|
|
|
- return $logistic_numbers ?? [];
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取打印信息
|
|
|
- * @param string $print
|
|
|
- * @return Builder[]|Collection
|
|
|
- */
|
|
|
- public function getPrintData(string $print)
|
|
|
- {
|
|
|
- list($batchesCodes,$orderCodes,$logistic_numbers) = $this->conversionPrintData($print);
|
|
|
- $logistic_numbers = $this->getLogisticNumber($batchesCodes, $orderCodes, $logistic_numbers);
|
|
|
- $items = OracleDocOrderDeliveryInfo::query()->select(['TackingNo','OrderNO','UserDefine1'])->whereIn('tackingNo',$logistic_numbers)->get();
|
|
|
- return $this->disposesPrintInfo($items);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 处理打印请求参数
|
|
|
* @param $oracleDocOrderDeliveryInfos
|
|
|
@@ -140,10 +80,7 @@ class PrintService
|
|
|
*/
|
|
|
public function convertPrintImage($image,$printTemplate,$order_package = null)
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
$items = $printTemplate->value;
|
|
|
-
|
|
|
$bg = array_filter($items,function ($item){
|
|
|
return $item['type'] == 'bg';
|
|
|
});
|
|
|
@@ -153,9 +90,7 @@ class PrintService
|
|
|
usort($items,function ($a, $b) {
|
|
|
return $a['z_index'] > $b['z_index'] ? 1 : 0;
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ return $image;
|
|
|
}
|
|
|
|
|
|
|