فهرست منبع

海柔任务子表

LD 5 سال پیش
والد
کامیت
0b1c456701

+ 13 - 1
app/Services/StationService.php

@@ -5,6 +5,7 @@ namespace App\Services;
 
 
 use App\Station;
+use App\StationTask;
 use App\StationType;
 use Exception;
 use Illuminate\Support\Facades\Cache;
@@ -31,7 +32,18 @@ class StationService
         //event(new BroadcastToStation($station_id,$json_data))
     }
 
-    function broadcastBinMonitor($station_id, ){
+    function broadcastBinMonitor($station_id, StationTask $stationTask){
+        //...
+        //$stationTask->stationTaskBatch
+        //$stationTask->stationTaskMaterialBox
+        //$stationTask->stationCommodities
+        //$batch= $stationTask->stationTaskBatch->batch
+        //$orders= $batch->....
+        //$json_data=['batch_code','order']
+        //$this->broadcast($station_id, $json_data)
+    }
+
+    function broadcastBinMonitorWarning($warnText, $station_id, StationTask $stationTask){
         //...
         //$this->broadcast($station_id, $json_data)
     }

+ 2 - 0
database/migrations/2020_11_30_174327_create_station_task_commodities_table.php

@@ -24,6 +24,8 @@ class CreateStationTaskCommoditiesTable extends Migration
             $table->index(['station_id','material_box_id','status'],'station_task_commodities_s_m_s_index');
             $table->timestamps();
         });
+        Schema::create('', function (Blueprint $table) {
+        });
     }
 
     /**

+ 44 - 0
database/migrations/2020_12_07_114158_create_station_task_children.php

@@ -0,0 +1,44 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateStationTaskChildren extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('station_task_children', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger('station_task_id')->index();
+            $table->string('station_task_table_type');
+            $table->bigInteger('station_task_table_id');
+            $table->index('station_task_table_id','station_task_table_type');
+            $table->timestamps();
+        });
+        Schema::table('station_task_batches', function (Blueprint $table) {
+            $table->dropColumn('station_id');
+        });
+        Schema::table('station_task_commodities', function (Blueprint $table) {
+            $table->dropColumn('station_id');
+        });
+        Schema::table('station_task_material_boxes', function (Blueprint $table) {
+            $table->dropColumn('station_id');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('station_task_children');
+    }
+}