LD %!s(int64=5) %!d(string=hai) anos
pai
achega
9fa3a54aa4

+ 1 - 1
app/Console/Commands/SyncBatchTask.php

@@ -33,8 +33,8 @@ class SyncBatchTask extends Command
 
     public function handle()
     {
-        sleep(rand(0,10));
         $this->disposeHeader();
+        sleep(rand(0,10));
         $this->disposeDetail();
     }
 

+ 8 - 1
app/Http/Controllers/StationController.php

@@ -55,7 +55,14 @@ class StationController extends Controller
     public function monitorShow(Station $station)
     {
         $stationTypeBinMonitor = StationTypeBinMonitor::query()->where("station_id",$station->id)->first();
-        if (!$stationTypeBinMonitor)$stationTypeBinMonitor = factory(StationTypeBinMonitor::class)->make(StationTypeBinMonitor::$default);
+        if (!$stationTypeBinMonitor){
+            $stationTypeBinMonitor =StationTypeBinMonitor::query()->create([
+                'station_id' => $station['id'],
+                'bin_row_length' => 4,
+                'bin_column_length' => 5,
+                'bin_wall_amount' => 2,
+            ]);
+        }
         return view('station.monitor.show',compact('station',"stationTypeBinMonitor"));
     }
 

+ 0 - 1
app/Services/StationService.php

@@ -67,7 +67,6 @@ class StationService
             "stationTaskBatches.batch"
             /*,"taskMaterialBoxes.box"*/
         ]);
-        $stationTask->toJson();
         $this->broadcast($station_id, $stationTask->toJson());
         //...
         //$stationTask->stationTaskBatch

+ 1 - 1
laravel-echo-server.lock

@@ -1,3 +1,3 @@
 {
-	"process": 11024
+	"process": 17164
 }

+ 6 - 4
resources/views/station/monitor/show.blade.php

@@ -116,7 +116,7 @@
                 stationTypeBinMonitor:{
                     row:Number("{{$stationTypeBinMonitor->bin_row_length}}"),
                     column:Number("{{$stationTypeBinMonitor->bin_column_length}}"),
-                    amount:Number("{{$stationTypeBinMonitor->bin_stationTypeBinMonitor_amount}}"),
+                    amount:Number("{{$stationTypeBinMonitor->bin_wall_amount}}"),
                 },
                 color:"red",
                 error:"",
@@ -130,6 +130,7 @@
                     $('.navbar,.nav1,.nav2').hide();
                 });
                 this._broadcast();
+                console.log(this.stationTypeBinMonitor);
                 this._renderingstationTypeBinMonitor(this.stationTypeBinMonitor.amount,this.stationTypeBinMonitor.row,this.stationTypeBinMonitor.column);
                /* this._renderingBox(3,5);*/
             },
@@ -137,8 +138,9 @@
                 _broadcast(){
                     initEcho();
                     window.Echo.channel(this.broadcastName).listen(this.channelName,(msg)=> {
-                        console.log(1231,json)
+                        console.log(1231,msg)
                         let json = JSON.parse(msg.json);
+                        console.log(json)
                         this._refreshData(json);
                     });
                 },
@@ -149,7 +151,7 @@
                     task.sum = 0;
                     task.currentSum = 0;
                     task.currentCommodityIndex = "";
-                    obj.task_commodities.forEach((taskCommodity,i)=> {
+                    obj.station_task_commodities.forEach((taskCommodity,i)=> {
                         task.sum += Number(taskCommodity.amount);
                         if (taskCommodity.status === '完成') task.currentSum += Number(taskCommodity.amount);
                         if (taskCommodity.status === '处理中') task.currentCommodityIndex = i;
@@ -162,7 +164,7 @@
                             materialBox:taskCommodity.material_box,
                         });
                     });
-                    task.taskBatch=obj.task_batches[0];
+                    task.taskBatch=obj.station_task_batches[0];
                     setBarcode(task.taskBatch.batch.code,"#barcode",2,50,false);
                     this.task = task;
                 },