ajun 4 gadi atpakaļ
vecāks
revīzija
4860c4136d
1 mainītis faili ar 25 papildinājumiem un 2 dzēšanām
  1. 25 2
      app/Services/PrintPartService.php

+ 25 - 2
app/Services/PrintPartService.php

@@ -1,7 +1,9 @@
-<?php 
+<?php
 
 namespace App\Services;
 
+use App\Order;
+use App\OrderPackage;
 use App\Traits\ServiceAppAop;
 use App\PrintPart;
 
@@ -10,4 +12,25 @@ class PrintPartService
     use ServiceAppAop;
     protected $modelClass=PrintPart::class;
 
-}
+    public function getPrintData($orderNos = null, $logistic_numbers = null, $batch_code = null)
+    {
+        $query = OrderPackage::query()->with('order.batch');
+        if ($orderNos) {
+            $orderQuery = Order::query()->selectRaw('id');
+            if (is_string($orderNos)) $query->where('code', $orderNos);
+            if (is_array($orderNos)) $query->whereIn('code', $orderNos);
+            $query->whereIn('order_id', $orderQuery);
+        }
+
+        if ($logistic_numbers) {
+            if (is_string($logistic_numbers)) $query->where('logistic_number', $logistic_numbers);
+            if (is_array($logistic_numbers)) $query->whereIn('logistic_number', $logistic_numbers);
+        }
+
+        if($batch_code) {
+
+        }
+
+
+    }
+}