43 lines
1.8 KiB
PHP
43 lines
1.8 KiB
PHP
<?php
|
||
|
||
use Illuminate\Database\Migrations\Migration;
|
||
use Illuminate\Database\Schema\Blueprint;
|
||
use Illuminate\Support\Facades\Schema;
|
||
|
||
return new class extends Migration
|
||
{
|
||
/**
|
||
* Run the migrations.
|
||
* 采购管理(C1-C6):采购单、采购明细(发送供应商)、采购金额分摊(D3)
|
||
*/
|
||
public function up(): void
|
||
{
|
||
// 采购单表(C1 基于所有门店订单汇总生成)
|
||
if (! Schema::hasTable('purchase_order')) {
|
||
Schema::create('purchase_order', function (Blueprint $table) {
|
||
$table->increments('id')->comment('采购单ID');
|
||
$table->string('purchase_no', 32)->unique()->comment('采购单编号');
|
||
$table->date('purchase_date')->comment('采购日期');
|
||
$table->integer('status')->default(0)->comment('采购单状态(0待发送 1部分发送 2全部发送 3已完成)');
|
||
$table->decimal('total_quantity', 10, 2)->default(0)->comment('采购总量');
|
||
$table->decimal('total_weight', 10, 3)->default(0)->comment('采购总重量');
|
||
$table->decimal('estimate_amount', 10, 2)->default(0)->comment('预估金额(按订货汇总)');
|
||
$table->decimal('actual_amount', 10, 2)->default(0)->comment('实际采购金额');
|
||
$table->integer('operator_id')->default(0)->comment('采购员(系统用户ID)');
|
||
$table->string('remark', 255)->default('')->nullable()->comment('备注');
|
||
$table->timestamps();
|
||
$table->index(['purchase_date', 'status'], 'purchase_order_date_status_index');
|
||
$table->comment('采购单表');
|
||
});
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Reverse the migrations.
|
||
*/
|
||
public function down(): void
|
||
{
|
||
Schema::dropIfExists('purchase_order');
|
||
}
|
||
};
|