| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use App\Traits\ModelLogChanging;
- class StationCacheShelfGrid extends Model
- {
- use ModelLogChanging;
- protected $fillable = ['station_id','material_box_id','grid_id','status'];
- public static $status = [
- '0' => '无',
- '1' => '待处理',
- ];
- public function station(): BelongsTo
- {
- return $this->belongsTo(Station::class);
- }
- public function materialBox(): BelongsTo
- {
- return $this->belongsTo(MaterialBox::class);
- }
- public static function getLocation(Station $station,StationCacheShelfGrid $grid)
- {
- $code = $station['code'];
- $grid_id = $grid['grid_id'];
- $row = 2- ($grid_id / 3) +1;
- $col = 2- ($grid_id % 3) +1;
- return 'HAI'.$code.'-0'.$row.'-0'.$col;
- }
- }
|