|
|
@@ -8,7 +8,6 @@ use App\Exceptions\ErrorException;
|
|
|
use App\Exceptions\Exception;
|
|
|
use App\MaterialBox;
|
|
|
use App\Station;
|
|
|
-use App\StationCacheShelfGrid;
|
|
|
use App\StationTask;
|
|
|
use App\StationTaskMaterialBox;
|
|
|
use Carbon\Carbon;
|
|
|
@@ -16,7 +15,6 @@ use Illuminate\Support\Collection;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
use App\Traits\ServiceAppAop;
|
|
|
-use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
|
class ForeignHaiRoboticsService
|
|
|
@@ -501,27 +499,58 @@ class ForeignHaiRoboticsService
|
|
|
* put cache rack box to warehousing(将缓存架料箱入库)
|
|
|
*
|
|
|
* @param string $fromLocation
|
|
|
- * @param string $toLocation
|
|
|
* @param integer $boxId
|
|
|
*
|
|
|
- * @return bool
|
|
|
+ * @return int
|
|
|
*/
|
|
|
- public function putWareHousing(string $fromLocation, string $toLocation, $boxId):bool
|
|
|
+ public function putWareHousing(string $fromLocation, $boxId):?int
|
|
|
{
|
|
|
$station = Station::query()->select("id")->where("code",$fromLocation)->first();
|
|
|
- if (!$station)return false;
|
|
|
- if (StationTask::query()->select("id")->where("status","!=",'完成')->where("station_id",$station->id)->first())return false;
|
|
|
+ if (!$station)return null;
|
|
|
+ if (StationTask::query()->select("id")->where("status","!=",'完成')->where("station_id",$station->id)->first())return null;
|
|
|
/** @var \stdClass $task */
|
|
|
$task = StationTask::query()->create([
|
|
|
'status' => "待处理",
|
|
|
'station_id' => $station->id,
|
|
|
]);
|
|
|
- StationTaskMaterialBox::query()->create([
|
|
|
+ /** @var StationTaskMaterialBox|\stdClass $stmb */
|
|
|
+ $stmb = StationTaskMaterialBox::query()->create([
|
|
|
'station_id' => $station->id,
|
|
|
'material_box_id'=>$boxId,
|
|
|
'status'=>"待处理",
|
|
|
'type' => '放',
|
|
|
'station_task_id' => $task->id,
|
|
|
]);
|
|
|
+ return $stmb->id;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 填充缓存架
|
|
|
+ *
|
|
|
+ * @param \Illuminate\Database\Eloquent\Collection $stations
|
|
|
+ */
|
|
|
+ public function paddingCacheShelf($stations)
|
|
|
+ {
|
|
|
+ $collection = new Collection();
|
|
|
+ $stationCollection = new Collection();
|
|
|
+ $blacklist = [];
|
|
|
+ foreach ($stations as $station){
|
|
|
+ $box = app("MaterialBoxService")->getAnEmptyBox($blacklist);
|
|
|
+ if (!$box)continue;
|
|
|
+ $task = StationTask::query()->create([
|
|
|
+ 'status' => "待处理",
|
|
|
+ 'station_id' => $station->id,
|
|
|
+ ]);
|
|
|
+ $collection->add(StationTaskMaterialBox::query()->create([
|
|
|
+ 'station_id' => $station->id,
|
|
|
+ 'material_box_id'=>$box->id,
|
|
|
+ 'status'=>"待处理",
|
|
|
+ 'type' => '取',
|
|
|
+ 'station_task_id' => $task->id,
|
|
|
+ ]));
|
|
|
+ $stationCollection->add($station->code);
|
|
|
+ $blacklist[] = $box->id;
|
|
|
+ }
|
|
|
+ app("ForeignHaiRoboticsService")->fetchGroup_multiLocation($stationCollection,$collection,'','立架出至缓存架');
|
|
|
}
|
|
|
}
|