|
@@ -7,6 +7,7 @@ use App\Owner;
|
|
|
use App\Warehouse;
|
|
use App\Warehouse;
|
|
|
use Illuminate\Support\Collection;
|
|
use Illuminate\Support\Collection;
|
|
|
use Carbon\Carbon;
|
|
use Carbon\Carbon;
|
|
|
|
|
+use Illuminate\Support\Facades\Cache;
|
|
|
|
|
|
|
|
Class WarehouseService
|
|
Class WarehouseService
|
|
|
{
|
|
{
|
|
@@ -109,12 +110,13 @@ Class WarehouseService
|
|
|
$collect = collect();
|
|
$collect = collect();
|
|
|
if(count($codes)==0)return $collect;
|
|
if(count($codes)==0)return $collect;
|
|
|
foreach ($codes as $code) {
|
|
foreach ($codes as $code) {
|
|
|
- $collect->push($this->cacheService->getOrExecute("WareHouse_{$code}",function()use($code){
|
|
|
|
|
|
|
+ $collect->push(Cache::remember("WareHouse_{$code}",config('database.cache.expirations.rand'),function()use($code){
|
|
|
$wareHouse = Warehouse::query()->where('code',$code)->first();
|
|
$wareHouse = Warehouse::query()->where('code',$code)->first();
|
|
|
if($wareHouse)return $wareHouse;
|
|
if($wareHouse)return $wareHouse;
|
|
|
$bas_customer = OracleBasCustomer::query()->selectRaw('Customer_Type,CustomerId,Descr_C')->where('CustomerId',$code)->where('Customer_Type','WH')->first();
|
|
$bas_customer = OracleBasCustomer::query()->selectRaw('Customer_Type,CustomerId,Descr_C')->where('CustomerId',$code)->where('Customer_Type','WH')->first();
|
|
|
|
|
+ if(!$bas_customer) return null;
|
|
|
return Warehouse::query()->create(['name'=>$bas_customer['descr_c'],'code'=>$bas_customer['customerid']]);
|
|
return Warehouse::query()->create(['name'=>$bas_customer['descr_c'],'code'=>$bas_customer['customerid']]);
|
|
|
- }),config('cache.expirations.forever'));
|
|
|
|
|
|
|
+ }));
|
|
|
}
|
|
}
|
|
|
return $collect;
|
|
return $collect;
|
|
|
}
|
|
}
|