|
|
@@ -7,6 +7,7 @@ namespace App\Services;
|
|
|
use App\MaterialBox;
|
|
|
use App\Station;
|
|
|
use App\StationTaskMaterialBox;
|
|
|
+use App\Storage;
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
use Illuminate\Support\Collection;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
@@ -84,11 +85,12 @@ sql;
|
|
|
*
|
|
|
* @return string|null
|
|
|
*/
|
|
|
- public function getBoxLocation(string $ide)
|
|
|
+ public function getBoxLocation(string $ide):?string
|
|
|
{
|
|
|
- $bin = DB::connection("mysql_haiRobotics")->table("ks_bin")->select("ks_bin_space_code")
|
|
|
- ->where("ks_bin_code",$ide)->where("status",1)->first();
|
|
|
- return $bin->ks_bin_space_code ?? null;
|
|
|
+ $storage = Storage::query()->with("station")->whereHas("materialBox",function (Builder $box)use($ide){
|
|
|
+ $box->where("code",$ide);
|
|
|
+ })->whereNotNull("station_id")->first();
|
|
|
+ return $storage->station->code ?? null;
|
|
|
}
|
|
|
|
|
|
/**
|