feat: 修正 BOM 單位顯示與完工入庫彈窗 UI 統一規範

This commit is contained in:
2026-02-12 16:30:34 +08:00
parent eb5ab58093
commit 5be4d49679
20 changed files with 1186 additions and 549 deletions

View File

@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$guard = 'web';
$permissions = [
'production_orders.approve' => '核准生產工單',
'production_orders.cancel' => '作廢生產工單',
];
foreach ($permissions as $name => $description) {
Permission::firstOrCreate(
['name' => $name, 'guard_name' => $guard],
['name' => $name, 'guard_name' => $guard]
);
}
// 授予 super-admin 所有新權限
$superAdmin = Role::where('name', 'super-admin')->first();
if ($superAdmin) {
$superAdmin->givePermissionTo(array_keys($permissions));
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
$permissions = [
'production_orders.approve',
'production_orders.cancel',
];
foreach ($permissions as $name) {
Permission::where('name', $name)->delete();
}
}
};

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('production_orders', function (Blueprint $table) {
$table->enum('status', ['draft', 'pending', 'approved', 'in_progress', 'completed', 'cancelled'])
->default('draft')
->comment('狀態:草稿/待審/核准/製作中/完成/取消')
->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('production_orders', function (Blueprint $table) {
$table->enum('status', ['draft', 'completed', 'cancelled'])
->default('completed')
->comment('狀態:草稿/完成/取消')
->change();
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('production_orders', function (Blueprint $table) {
$table->string('output_batch_number')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('production_orders', function (Blueprint $table) {
$table->string('output_batch_number')->nullable(false)->change();
});
}
};

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('production_orders', function (Blueprint $table) {
$table->date('production_date')->nullable()->change();
$table->date('expiry_date')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('production_orders', function (Blueprint $table) {
$table->date('production_date')->nullable(false)->change();
$table->date('expiry_date')->nullable(false)->change();
});
}
};

View File

@@ -77,6 +77,8 @@ class PermissionSeeder extends Seeder
'production_orders.create' => '建立',
'production_orders.edit' => '編輯',
'production_orders.delete' => '刪除',
'production_orders.approve' => '核准',
'production_orders.cancel' => '作廢',
// 配方管理
'recipes.view' => '檢視',