feat: 第三阶段业务模块(服务产康/月嫂/进销存)
- 新增3个migration(15张表): service/nanny/inventory - 新增15个Model + 13个Controller - 新增55条API路由(总计212条) - 新增3个前端API模块 + 11个管理页面 - vite build验证通过
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace App\Models\Inventory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
class Inventory extends Model
|
||||
{
|
||||
const CREATED_AT = null;
|
||||
protected $table = 'inventories';
|
||||
protected $fillable = ['warehouse_id','material_id','quantity','batch_no','expire_date'];
|
||||
protected function casts(): array { return ['quantity'=>'decimal:2','expire_date'=>'date']; }
|
||||
public function warehouse(): BelongsTo { return $this->belongsTo(Warehouse::class); }
|
||||
public function material(): BelongsTo { return $this->belongsTo(Material::class); }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace App\Models\Inventory;
|
||||
use App\Traits\BelongsToStore;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
class Material extends Model
|
||||
{
|
||||
use BelongsToStore;
|
||||
protected $fillable = ['store_id','name','code','category','unit','spec','min_stock','shelf_life_days','status'];
|
||||
protected function casts(): array { return ['min_stock'=>'integer','shelf_life_days'=>'integer','status'=>'integer']; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace App\Models\Inventory;
|
||||
use App\Models\User;
|
||||
use App\Traits\BelongsToStore;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
class PurchaseOrder extends Model
|
||||
{
|
||||
use BelongsToStore;
|
||||
protected $fillable = ['store_id','order_no','supplier_id','total_amount','status','items','audit_user_id','audit_at','remark','created_by'];
|
||||
protected function casts(): array { return ['total_amount'=>'decimal:2','status'=>'integer','items'=>'array','audit_at'=>'datetime']; }
|
||||
public function supplier(): BelongsTo { return $this->belongsTo(Supplier::class); }
|
||||
public function auditor(): BelongsTo { return $this->belongsTo(User::class, 'audit_user_id'); }
|
||||
public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace App\Models\Inventory;
|
||||
use App\Models\User;
|
||||
use App\Traits\BelongsToStore;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
class StockMovement extends Model
|
||||
{
|
||||
use BelongsToStore;
|
||||
protected $fillable = ['store_id','warehouse_id','movement_no','type','direction','items','related_order','status','operator_id','remark'];
|
||||
protected function casts(): array { return ['type'=>'integer','direction'=>'integer','items'=>'array','status'=>'integer']; }
|
||||
public function warehouse(): BelongsTo { return $this->belongsTo(Warehouse::class); }
|
||||
public function operator(): BelongsTo { return $this->belongsTo(User::class, 'operator_id'); }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace App\Models\Inventory;
|
||||
use App\Traits\BelongsToStore;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
class Supplier extends Model
|
||||
{
|
||||
use BelongsToStore;
|
||||
protected $fillable = ['store_id','name','contact','phone','address','bank_info','status'];
|
||||
protected function casts(): array { return ['status'=>'integer']; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace App\Models\Inventory;
|
||||
use App\Models\User;
|
||||
use App\Traits\BelongsToStore;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
class Warehouse extends Model
|
||||
{
|
||||
use BelongsToStore;
|
||||
protected $fillable = ['store_id','name','manager_id','status'];
|
||||
protected function casts(): array { return ['status'=>'integer']; }
|
||||
public function manager(): BelongsTo { return $this->belongsTo(User::class, 'manager_id'); }
|
||||
}
|
||||
Reference in New Issue
Block a user