77 lines
3.5 KiB
PHP
77 lines
3.5 KiB
PHP
<?php
|
|
/**
|
|
* Author: ykxiao
|
|
* Date: 2025/3/7
|
|
* Time: 下午3:27
|
|
* Description: 创建库存汇总表 stock 的迁移文件
|
|
*
|
|
* (c) ykxiao <yk_9001@hotmail.com>
|
|
*
|
|
* This source file is subject to the MIT license that is bundled
|
|
* with this source code in the file LICENSE.
|
|
*/
|
|
|
|
use App\Service\MigrateService;
|
|
use Hyperf\Database\Schema\Schema;
|
|
use Hyperf\Database\Schema\Blueprint;
|
|
use Hyperf\Database\Migrations\Migration;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('stock', function (Blueprint $table) {
|
|
$table->bigIncrements('id');
|
|
|
|
$table->string('company_code', 50)->default('')->comment('公司代码');
|
|
|
|
$table->integer('issuing_id')->default(0)->comment('开证公司id');
|
|
$table->integer('sh_company_id')->default(0)->unsigned()->comment('收货公司id');
|
|
$table->tinyInteger('source')->default(0)->comment('数据来源(1:自建,2:仓储)');
|
|
$table->tinyInteger('type')->default(1)->comment('汇总类型(1:在途,2现货)');
|
|
$table->integer('warehouse_id')->default(0)->comment('仓库ID');
|
|
$table->string('warehouse', 255)->default('')->comment('仓库');
|
|
$table->string('aisle_id', 50)->default('')->comment('通道号');
|
|
$table->string('aisle_name', 45)->default('')->comment('通道名');
|
|
$table->integer('breed_id')->default(0)->comment('品名ID');
|
|
$table->string('breed', 50)->default('')->comment('品名');
|
|
$table->integer('brand_id')->default(0)->comment('品牌ID');
|
|
$table->string('brand', 50)->default('')->comment('品牌');
|
|
$table->integer('grade_id')->default(0)->comment('等级ID');
|
|
$table->string('grade', 50)->default('')->comment('等级');
|
|
$table->string('thickness', 50)->default('')->comment('厚度');
|
|
$table->string('width', 50)->default('')->comment('宽度');
|
|
$table->string('length', 50)->default('')->comment('长度');
|
|
$table->decimal('min_price', 18)->default(0.00)->comment('最低价');
|
|
$table->decimal('sales_price', 18)->default(0.00)->comment('挂牌价');
|
|
$table->integer('number')->default(0)->comment('库存件数');
|
|
$table->integer('enable_number')->default(0)->comment('可用件数');
|
|
$table->integer('lock_number')->default(0)->comment('锁定件数');
|
|
$table->unsignedDecimal('cube', 18, 9)->default(0.000000000)->comment('库存方数');
|
|
$table->unsignedTinyInteger('sales_status')->default(1)->comment('销售状态(1:销售中,2:封盘中,3:隐藏中)');
|
|
$table->tinyInteger('status')->default(1)->comment('库存状态(0:禁用,1:正常)');
|
|
$table->integer('create_time')->default(0)->comment('创建时间');
|
|
$table->integer('update_time')->default(0)->comment('更新时间');
|
|
$table->integer('delete_time')->default(0)->comment('删除时间');
|
|
|
|
$table->unique(['company_code', 'source', 'type', 'warehouse_id', 'breed_id', 'brand_id', 'grade_id', 'thickness', 'width', 'length', 'aisle_id'], 'idx_unique');
|
|
$table->index(['company_code', 'breed_id', 'brand_id', 'grade_id', 'thickness', 'width', 'length'], 'idx_spec');
|
|
|
|
MigrateService::migrateTime($table);
|
|
|
|
$table->comment('库存汇总表');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('stock');
|
|
}
|
|
};
|