2019_11_22_094024_create_waybills_table.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateWaybillsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('waybills', function (Blueprint $table) {
  15. $table->bigIncrements('id');
  16. $table->timestamps();
  17. $table->string('state',20)->nullable()->comment('类型');
  18. $table->enum('type',['直发车','专线'])->comment('类型');
  19. $table->string('waybill_number',50)->unique()->index()->comment('运单号');
  20. $table->bigInteger('owner_id')->index()->comment('货主');
  21. $table->string('wms_bill_number',50)->unique()->nullable()->comment('WMS单号');
  22. $table->string('origination',50)->comment('始发地');
  23. $table->string('destination',50)->comment('目的地');
  24. $table->string('recipient',50)->comment('收件人');
  25. $table->string('recipient_mobile',50)->comment('收件人电话');
  26. $table->decimal('charge')->comment('收费(元)')->nullable();
  27. $table->decimal('collect_fee')->nullable()->comment('到付金额');
  28. $table->text('ordering_remark')->nullable()->comment('下单备注');
  29. $table->bigInteger('carrier_id')->nullable()->index()->comment('承运商');
  30. $table->string('carrier_bill')->nullable()->unique()->comment('承运商单号');
  31. $table->bigInteger('origination_city_id')->nullable()->index()->comment('始发市');
  32. $table->bigInteger('destination_city_id')->nullable()->index()->comment('目的市');
  33. $table->decimal('warehouse_weight')->nullable()->comment('仓库计重(抛)');
  34. $table->bigInteger('warehouse_weight_unit_id')->nullable()->index()->comment('仓库计重单位');
  35. $table->decimal('carrier_weight')->nullable()->comment('承运商计重(抛)');
  36. $table->bigInteger('carrier_weight_unit_id')->nullable()->index()->comment('承运商计重单位');
  37. $table->bigInteger('carType_id')->nullable()->comment('车型');
  38. $table->decimal('fee')->nullable()->comment('运费');
  39. $table->decimal('pick_up_fee')->nullable()->comment('提货费');
  40. $table->decimal('other_fee')->nullable()->comment('其他费用');
  41. $table->text('dispatch_remark')->nullable()->comment('调度备注');
  42. $table->bigInteger('waybill_price_model_id')->nullable()->index()->comment('外联计费模型');
  43. //外键
  44. /* $table->foreign('owner_id')->references('id')->on('owners'); //货主
  45. $table->foreign('carrier_id')->references('id')->on('carrier'); //承运商
  46. $table->foreign('origination_city_id')->references('id')->on('citys'); //城市
  47. $table->foreign('destination_city_id')->references('id')->on('citys'); //城市
  48. $table->foreign('warehouse_weight_unit_id')->references('id')->on('units'); //单位
  49. $table->foreign('carrier_weight_unit_id')->references('id')->on('units'); //单位
  50. $table->foreign('carType_id')->references('id')->on('carTypes'); //车型*/
  51. });
  52. }
  53. /**
  54. * Reverse the migrations.
  55. *
  56. * @return void
  57. */
  58. public function down()
  59. {
  60. Schema::dropIfExists('waybills');
  61. }
  62. }