style: 修正盤點與盤調畫面 Table Padding 並統一 UI 規範
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 1m4s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-28 18:04:45 +08:00
parent 852370cfe0
commit e5edad4fd0
24 changed files with 3648 additions and 102 deletions

View File

@@ -0,0 +1,54 @@
<?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::create('inventory_count_docs', function (Blueprint $table) {
$table->id();
$table->string('doc_no')->unique(); // 單號
$table->foreignId('warehouse_id')->constrained('warehouses')->cascadeOnDelete();
$table->string('status')->default('draft'); // draft, counting, completed, cancelled
$table->timestamp('snapshot_date')->nullable(); // 快照建立時間
$table->timestamp('completed_at')->nullable(); // 完成時間
$table->string('remarks')->nullable();
// 審核/建立資訊
$table->foreignId('created_by')->constrained('users');
$table->foreignId('updated_by')->nullable()->constrained('users');
$table->foreignId('completed_by')->nullable()->constrained('users');
$table->timestamps();
});
Schema::create('inventory_count_items', function (Blueprint $table) {
$table->id();
$table->foreignId('count_doc_id')->constrained('inventory_count_docs')->cascadeOnDelete();
$table->foreignId('product_id')->constrained('products');
$table->string('batch_number')->nullable(); // 針對特定批號盤點
$table->decimal('system_qty', 10, 2)->default(0); // 系統帳面數量 (快照當下)
$table->decimal('counted_qty', 10, 2)->nullable(); // 實盤數量
$table->decimal('diff_qty', 10, 2)->default(0); // 差異 (實盤 - 系統)
$table->string('notes')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('inventory_count_items');
Schema::dropIfExists('inventory_count_docs');
}
};

View File

@@ -0,0 +1,53 @@
<?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::create('inventory_adjust_docs', function (Blueprint $table) {
$table->id();
$table->string('doc_no')->unique(); // 單號
$table->foreignId('warehouse_id')->constrained('warehouses')->cascadeOnDelete();
$table->string('status')->default('draft'); // draft, posted, voided
$table->string('reason')->nullable(); // 調整原因 (e.g. 報廢, 盤盈虧, 其他)
$table->string('remarks')->nullable();
// 審核/建立資訊
$table->timestamp('posted_at')->nullable(); // 過帳時間
$table->foreignId('created_by')->constrained('users');
$table->foreignId('updated_by')->nullable()->constrained('users');
$table->foreignId('posted_by')->nullable()->constrained('users');
$table->timestamps();
});
Schema::create('inventory_adjust_items', function (Blueprint $table) {
$table->id();
$table->foreignId('adjust_doc_id')->constrained('inventory_adjust_docs')->cascadeOnDelete();
$table->foreignId('product_id')->constrained('products');
$table->string('batch_number')->nullable();
// 記錄當下 "調整前" 的庫存與成本 (參考用)
$table->decimal('qty_before', 10, 2)->default(0);
// 實際調整的數量 (可以正負, 正=增加, 負=減少)
$table->decimal('adjust_qty', 10, 2);
$table->string('notes')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('inventory_adjust_items');
Schema::dropIfExists('inventory_adjust_docs');
}
};

View File

@@ -0,0 +1,47 @@
<?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::create('inventory_transfer_orders', function (Blueprint $table) {
$table->id();
$table->string('doc_no')->unique();
$table->foreignId('from_warehouse_id')->constrained('warehouses')->cascadeOnDelete();
$table->foreignId('to_warehouse_id')->constrained('warehouses')->cascadeOnDelete();
$table->string('status')->default('draft'); // draft, completed, voided
$table->string('remarks')->nullable();
// 審核/建立資訊
$table->timestamp('posted_at')->nullable(); // 過帳時間
$table->foreignId('created_by')->constrained('users');
$table->foreignId('updated_by')->nullable()->constrained('users');
$table->foreignId('posted_by')->nullable()->constrained('users');
$table->timestamps();
});
Schema::create('inventory_transfer_items', function (Blueprint $table) {
$table->id();
$table->foreignId('transfer_order_id')->constrained('inventory_transfer_orders')->cascadeOnDelete();
$table->foreignId('product_id')->constrained('products');
$table->string('batch_number')->nullable();
$table->decimal('quantity', 10, 2);
$table->string('notes')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('inventory_transfer_items');
Schema::dropIfExists('inventory_transfer_orders');
}
};

View File

@@ -0,0 +1,32 @@
<?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('inventory_adjust_docs', function (Blueprint $table) {
$table->foreignId('count_doc_id')
->after('doc_no')
->nullable()
->constrained('inventory_count_docs')
->nullOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('inventory_adjust_docs', function (Blueprint $table) {
$table->dropConstrainedForeignId('count_doc_id');
});
}
};