117 lines
6.9 KiB
PHP
117 lines
6.9 KiB
PHP
<?php
|
||
|
||
/**
|
||
* Author: ykxiao
|
||
* Date: 2025/3/7
|
||
* Time: 下午3:27
|
||
* Description: 创建库存表 inventory 的迁移文件
|
||
*
|
||
* (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('inventory', function (Blueprint $table) {
|
||
$table->bigIncrements('id');
|
||
|
||
$table->string('company_code', 50)->default('')->comment('公司代码');
|
||
$table->tinyInteger('status')->default(1)->comment('资源状态(-1:删除,0:禁用,1:在途,2:已入库,3:部分出库,4:全部出库,5:待分配库位)');
|
||
$table->integer('bale_id')->default(0)->comment('采购捆包id');
|
||
$table->tinyInteger('source')->default(1)->comment('数据来源(1:自建,2:仓储)');
|
||
$table->integer('stock_id')->default(0)->comment('库存汇总ID');
|
||
$table->string('bale_no', 45)->default('')->comment('捆包号');
|
||
$table->string('supplier', 50)->default('')->comment('供应商');
|
||
$table->integer('supplier_id')->default(0)->comment('供应商id');
|
||
$table->string('issuing', 50)->default('')->comment('开证公司');
|
||
$table->integer('issuing_id')->default(0)->comment('开证公司id');
|
||
$table->string('breed', 50)->default('')->comment('商品名称');
|
||
$table->integer('breed_id')->default(0)->comment('品名id');
|
||
$table->string('brand', 50)->default('')->comment('品牌');
|
||
$table->integer('brand_id')->default(0)->comment('品牌id');
|
||
$table->string('grade', 50)->default('')->comment('等级');
|
||
$table->integer('grade_id')->default(0)->comment('等级id');
|
||
$table->string('thickness', 50)->default('')->comment('厚度');
|
||
$table->string('width', 50)->default('')->comment('宽度');
|
||
$table->string('length', 50)->default('')->comment('长度');
|
||
$table->string('pieces', 50)->default('')->comment('片数');
|
||
$table->decimal('per_cube', 18, 9)->comment('单包立方');
|
||
$table->unsignedInteger('init_number')->default(0)->comment('入库初始件数');
|
||
$table->unsignedInteger('number')->default(0)->comment('库存件数');
|
||
$table->unsignedInteger('lock_number')->default(0)->comment('锁定件数');
|
||
$table->unsignedInteger('enable_number')->default(0)->comment('可用件数');
|
||
$table->unsignedInteger('out_number')->default(0)->comment('已出件数');
|
||
$table->decimal('foreign_currency_price', 18, 2)->default(0.00)->comment('外币单价');
|
||
$table->integer('foreign_currency_id')->default(0)->comment('外币名称id');
|
||
$table->string('foreign_currency_unit', 3)->comment('外币符号');
|
||
$table->decimal('purchase_amount', 18, 2)->default(0.00)->comment('采购金额');
|
||
$table->decimal('sales_price', 18, 2)->default(0.00)->comment('销售单价/挂牌价');
|
||
$table->decimal('pay_rate', 18, 4)->default(0.0000)->comment('实付汇率');
|
||
$table->decimal('purchase_price', 18, 2)->default(0.00)->comment('采购单价');
|
||
$table->decimal('cost_price', 18, 2)->comment('费用平摊单价');
|
||
$table->integer('storage_location_id')->default(0)->comment('库位ID');
|
||
$table->string('storage_location', 100)->default('')->comment('库位');
|
||
$table->string('contract_no', 45)->default('')->comment('合同号');
|
||
$table->string('bill_lading_no', 45)->default('')->comment('提单号');
|
||
$table->integer('port_id')->default(0)->comment('港口id');
|
||
$table->string('purpose_port', 255)->default('')->comment('目的港');
|
||
$table->integer('expected_storage_time')->default(0)->comment('预计入库时间');
|
||
$table->integer('expected_arrival_time')->default(0)->comment('预计到港时间');
|
||
$table->string('place_origin', 255)->default('')->comment('产地');
|
||
$table->tinyInteger('is_changed')->default(0)->comment('是否改动(0:未改动,1:已改动)');
|
||
$table->tinyInteger('qr_code_status')->default(0)->comment('扫码状态(1-未扫码,2-已扫码)');
|
||
$table->tinyInteger('purchase_type')->default(0)->comment('采购类型 (1 合同采购, 2外调采购)');
|
||
$table->json('images')->comment('产品图片');
|
||
$table->string('thumbnail', 255)->default('')->comment('封面缩略图');
|
||
$table->integer('inbound_time')->default(0)->comment('入库时间');
|
||
$table->integer('stocker_id')->default(0)->comment('入库人id');
|
||
$table->string('stocker_name', 30)->default('')->comment('入库人名字');
|
||
$table->string('cargo_remark', 200)->default('')->comment('货物状态');
|
||
|
||
// 仓库字段
|
||
$table->string('purchase_sn', 45)->default('')->comment('采购单号');
|
||
$table->string('contract_sn', 45)->default('')->comment('采购合同号');
|
||
$table->string('container_no', 45)->default('')->comment('柜号/车牌号');
|
||
$table->tinyInteger('customer_type')->default(1)->comment('代理类型:1-代理 2-非代理');
|
||
$table->tinyInteger('category')->default(1)->comment('货物类型:1-原木 2-板材');
|
||
$table->tinyInteger('packaging_type')->default(1)->comment('包装类型(1-整包、2-混包)');
|
||
$table->string('spec', 100)->default('')->comment('仓库规格');
|
||
$table->integer('sh_company_id')->default(0)->unsigned()->comment('收货公司id');
|
||
$table->string('sh_company_name', 45)->default('')->comment('收货公司');
|
||
$table->integer('aisle_id')->default(0)->unsigned()->comment('通道ID');
|
||
$table->string('aisle_name', 45)->default('')->comment('通道名');
|
||
$table->integer('warehouse_id')->default(0)->comment('仓库id');
|
||
$table->string('warehouse', 255)->default('')->comment('仓库');
|
||
$table->integer('location_id')->default(0)->unsigned()->comment('仓库库位ID');
|
||
$table->integer('attribute_id')->default(0)->unsigned()->comment('库位属性ID');
|
||
$table->string('custom', 45)->default('')->comment('自定义属性');
|
||
$table->string('location_no', 100)->default('')->comment('仓库库位拼接信息');
|
||
$table->string('remark', 300)->default('')->comment('备注');
|
||
|
||
MigrateService::migrateCreateInfo($table);
|
||
|
||
$table->comment('库存表');
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Reverse the migrations.
|
||
*/
|
||
public function down(): void
|
||
{
|
||
Schema::dropIfExists('inventory');
|
||
}
|
||
};
|