仓库金融单据服务
Some checks failed
Build Docker / build (push) Has been cancelled

This commit is contained in:
2025-07-08 15:10:36 +08:00
commit 7423491d9c
69 changed files with 12995 additions and 0 deletions

View File

@ -0,0 +1,116 @@
<?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');
}
};

View File

@ -0,0 +1,76 @@
<?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');
}
};