完善生产异常维修与备件管理功能

This commit is contained in:
2026-09-01 19:17:09 +08:00
parent 02a429af66
commit 32f1486f5e
49 changed files with 1765 additions and 121 deletions
@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
return new class {
public function up(Builder $schema): void
{
if (!$schema->hasTable('produce_exception_record')) {
return;
}
$schema->table('produce_exception_record', function (Blueprint $table) use ($schema): void {
if (!$schema->hasColumn('produce_exception_record', 'process_id')) {
$table->bigInteger('process_id')->nullable()->comment('异常提报工序ID');
$table->index('process_id', 'idx_exception_record_process_id');
}
if (!$schema->hasColumn('produce_exception_record', 'step_id')) {
$table->bigInteger('step_id')->nullable()->comment('异常提报步骤ID');
$table->index('step_id', 'idx_exception_record_step_id');
}
});
}
public function down(Builder $schema): void
{
if (!$schema->hasTable('produce_exception_record')) {
return;
}
$schema->table('produce_exception_record', function (Blueprint $table) use ($schema): void {
if ($schema->hasColumn('produce_exception_record', 'process_id')) {
$table->dropIndex('idx_exception_record_process_id');
$table->dropColumn('process_id');
}
if ($schema->hasColumn('produce_exception_record', 'step_id')) {
$table->dropIndex('idx_exception_record_step_id');
$table->dropColumn('step_id');
}
});
}
};