2020_03_25_164138_create_process_statistics_table.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateProcessStatisticsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * 二次加工统计表
  11. *
  12. * @return void
  13. */
  14. public function up()
  15. {
  16. Schema::create('process_statistics', function (Blueprint $table) {
  17. $table->bigInteger('process_id')->unique()->comment('外键二次加工单');
  18. $table->timestamp('started_at')->nullable()->comment('开始日期');
  19. $table->timestamp('ended_at')->nullable()->comment('结束日期');
  20. $table->decimal('revenue')->nullable()->comment('收入合计');
  21. $table->integer('duration_days')->nullable()->comment('完成天数');
  22. $table->integer('duration_man_hours')->nullable()->comment('总工时');
  23. $table->integer('top_capacity')->nullable()->comment('最高日产能');
  24. $table->integer('bottom_capacity')->nullable()->comment('最低日产能');
  25. $table->integer('average_capacity')->nullable()->comment('平均日产能');
  26. $table->decimal('total_cost')->nullable()->comment('合计成本');
  27. $table->decimal('gross_profit')->nullable()->comment('毛利润');
  28. $table->decimal('gross_profit_rate',7,3)->nullable()->comment('毛利率');
  29. });
  30. }
  31. /**
  32. * Reverse the migrations.
  33. *
  34. * @return void
  35. */
  36. public function down()
  37. {
  38. Schema::dropIfExists('process_statistics');
  39. }
  40. }