Bläddra i källkod

缓存架出库

Zhouzhendong 4 år sedan
förälder
incheckning
83f8b828f3

+ 2 - 1
app/Http/Controllers/api/thirdPart/haiq/HaiRoboticsController.php

@@ -25,7 +25,8 @@ class HaiRoboticsController
             'errorMsg'=>'波次任务不能为空'
         ];
         $batchTask=StationTaskBatch::query()->find($request['station_task_batch_id']);
-        $batchesFailed=$this->stationTaskBatchService->runMany(collect([$batchTask]));//执行波次任务
+        $batchesFailed=$this->stationTaskBatchService->runMany(collect([$batchTask]),
+            $request->input("isCacheShelf") ? 'OUTBIN-CACHE-SHELF' : 'OUTBIN-U-SHAPE-LINE');//执行波次任务
         if($batchesFailed && $batchesFailed->isNotEmpty()){
             return [
                 'success'=>false,

+ 5 - 1
app/Jobs/CacheShelfTaskJob.php

@@ -52,7 +52,7 @@ class CacheShelfTaskJob implements ShouldQueue
                         ->where("type","出库")->whereHas("task",function ($query){
                             $query->where("status","待处理");
                         })->where("status",3)
-                        ->where("mark",2)->get(); //检索等待的队列事务来获取对应任务
+                        ->where("mark",2)->groupBy("task_id")->get(); //检索等待的队列事务来获取对应任务
                     if (!$tasks->count())return;
                     if ($tasks->count()>count($available))$tasks = $tasks->slice(0,count($available));//事务过多切割部分处理
                     $toLocation = collect();
@@ -76,6 +76,10 @@ class CacheShelfTaskJob implements ShouldQueue
                     $result = $service->fetchGroup_multiLocation($toLocation,$task,$tasks[0]->station_task_batch_id,'立架出至缓存架',20);
                     if ($result){
                         Cache::forever($this->key,$available);
+                        foreach ($toLocation as $value){
+                            app("CacheShelfService")->lightUp($value,'3','2');
+                            Cache::forever("CACHE_SHELF_OCCUPANCY_{$map[$value]}",true);
+                        }
                         app("StationService")->locationOccupyMulti($toLocation->toArray());
                         DB::commit();
                     }else{

+ 45 - 31
app/Services/StationTaskBatchService.php

@@ -6,6 +6,7 @@ namespace App\Services;
 
 use App\Exceptions\ErrorException;
 use App\StationTaskBatch;
+use App\StationTaskCommodity;
 use App\TaskTransaction;
 use Carbon\Carbon;
 use Exception;
@@ -130,18 +131,19 @@ class StationTaskBatchService
 
     /**
      * @param Collection|null $stationTaskBatches
+     * @param string $locationType
      * @return Collection|\Tightenco\Collect\Support\Collection|null 返回执行失败的记录
      * @throws ErrorException
      */
-    function runMany(?Collection $stationTaskBatches):?Collection
+    function runMany(?Collection $stationTaskBatches, $locationType = 'OUTBIN-U-SHAPE-LINE'):?Collection
     {
         LogService::log(__METHOD__,'runMany','波次任务分配6.1:'.json_encode($stationTaskBatches));
         $stationTaskBatches_failed = null;
-        ($execute = function(Collection $stationTaskBatches, &$stationTaskBatches_failed){
+        ($execute = function(Collection $stationTaskBatches, &$stationTaskBatches_failed)use($locationType){
                 if ($stationTaskBatches->isEmpty()) return; //波次任务不存在 跳出
                 $stationTaskBatches_failed = collect();
-                foreach ($stationTaskBatches as $stationTaskBatch) {
-                    $failed = !$this->run($stationTaskBatch); //运行波次 获取执行结果
+                foreach ($stationTaskBatches as $stationTaskBatch){
+                    $failed = !$this->run($stationTaskBatch, $locationType); //运行波次 获取执行结果
                     if ($failed) $stationTaskBatches_failed->push($stationTaskBatch);//执行失败  记录失败波次
                 }
         })($stationTaskBatches, $stationTaskBatches_failed);
@@ -168,7 +170,7 @@ class StationTaskBatchService
      * @return bool
      * @throws ErrorException
      */
-    function run(StationTaskBatch $stationTaskBatch, $locationType = 'OUTBIN-U-SHAPE-LINE'): bool
+    function run(StationTaskBatch $stationTaskBatch, $locationType): bool
     {
         $this->instant($this->foreignHaiRoboticsService,'ForeignHaiRoboticsService');
         $this->instant($this->stationService,'StationService');
@@ -190,11 +192,20 @@ class StationTaskBatchService
                     fetchGroup($toLocation, $taskMaterialBoxes, $groupPrefix);//执行料箱任务
                     break;
                 case 'OUTBIN-CACHE-SHELF'://缓存架
-                    list($toLocation, $taskMaterialBoxes) = $this->apportionLocation($taskMaterialBoxes);
-                    $isFetchedFromRobotics = $this->foreignHaiRoboticsService->
-                    fetchGroup_multiLocation($toLocation, $taskMaterialBoxes, $groupPrefix, '立架出至缓存架',20);
+                    list($toLocation, $taskMaterialBoxes, $map) = $this->apportionLocation($taskMaterialBoxes);
+                    if ($toLocation->count()>0){
+                        $isFetchedFromRobotics = $this->foreignHaiRoboticsService->
+                        fetchGroup_multiLocation($toLocation, $taskMaterialBoxes, $groupPrefix, '立架出至缓存架',20);
+                        foreach ($toLocation as $value){
+                            app("CacheShelfService")->lightUp($value,'3','2');
+                            Cache::forever("CACHE_SHELF_OCCUPANCY_{$map[$value]}",true);
+                        }
+                        app("StationService")->locationOccupyMulti($toLocation->toArray());
+                    }else $isFetchedFromRobotics = true;
+                    break;
+                default:
+                    $isFetchedFromRobotics = false;
             }
-
             LogService::log(__METHOD__,'runMany','波次任务分配6.r6:'.json_encode($stationTaskBatch));
         }catch(Exception $e){
             throw new ErrorException('$stationTaskBatch运行波次机器人任务失败,获取组失败: '.$stationTaskBatch->toJson() . $e->getMessage());
@@ -262,12 +273,13 @@ class StationTaskBatchService
     /**
      * 为任务分配缓存架库位
      *
-     * @param $taskMaterialBoxes
+     * @param \Illuminate\Database\Eloquent\Collection $taskMaterialBoxes
      *
      * @return array
      */
-    public function apportionLocation($taskMaterialBoxes):array
+    public function apportionLocation(Collection $taskMaterialBoxes):array
     {
+        $taskMaterialBoxes->loadMissing(["stationTaskCommodities.order","stationTaskCommodities.commodity.barcodes"]);
         //获取可用的库位 加行锁
         $location = array_column(app("StationService")->getCacheShelf(true)->toArray(),"code");
         $map = app("StationService")->getStationMapping($location);//获取库位映射信息
@@ -276,29 +288,31 @@ class StationTaskBatchService
         $toLocation = collect();
         $updateTask = [["id","station_id"]];
         $insertTransaction = [];
+        $exeInsert = function ($task,$taskCommodity,$status)use(&$insertTransaction){
+            $insertTransaction[] = [
+                "doc_code" => $taskCommodity->order->code ?? "",
+                "bar_code" => $taskCommodity->commodity->barcodes[0]->code ?? "",
+                "to_station_id" => $task->station_id,
+                "material_box_id" => $task->material_box_id,
+                "task_id" => $task->id,
+                "commodity_id" => $taskCommodity->commodity_id,
+                "amount" => $taskCommodity->amount,
+                "type" => "出库",
+                "status" => $status,
+                "mark" => 2,
+                "bin_number"=>$taskCommodity->bin_number,
+            ];
+        };
         foreach ($handleTask as $index=>$task){
             $task->station_id = $map[$location[$index]];
+            $toLocation->push($location[$index]);
             $handleTask->offsetSet($index,$task);
-            $updateTask[] = ["id"=>$task->id,"station_id"=>$task->station_id]; //TODO 无法获取商品订单信息
-            $insertTransaction = [
-                "doc_code",
-                "bar_code",
-                "fm_station_id",
-                "to_station_id",
-                "material_box_id",
-                "task_id",
-                "commodity_id",
-                "amount",
-                "type",
-                "status",
-                "user_id",
-                "mark"
-            ];
-        }
-        foreach ($taskMaterialBoxes as $obj){
-
+            $updateTask[] = ["id"=>$task->id,"station_id"=>$task->station_id];
+            foreach ($task->stationTaskCommodities as $taskCommodity)$exeInsert($task,$taskCommodity,0);
         }
-        TaskTransaction::query()->insert();
-        return array($toLocation, $handleTask);
+        if ($handleTask->collect()>0)app("BatchUpdateService")->batchUpdate("station_task_material_boxes",$updateTask);
+        foreach ($taskMaterialBoxes as $obj)foreach ($obj->stationTaskCommodities as $taskCommodity)$exeInsert($obj,$taskCommodity,3);
+        TaskTransaction::query()->insert($insertTransaction);
+        return array($toLocation, $handleTask, $map);
     }
 }

+ 99 - 40
app/Services/StorageService.php

@@ -5,6 +5,7 @@ namespace App\Services;
 use App\CommodityMaterialBoxModel;
 use App\Components\ErrorPush;
 use App\MaterialBoxCommodity;
+use App\Order;
 use App\Station;
 use App\StationTask;
 use App\StationTaskMaterialBox;
@@ -40,16 +41,13 @@ class StorageService
                 app("StationService")->locationFreed($stationTaskMaterialBox->station->code,$stationTaskMaterialBox->material_box_id);
                 //清除海柔库位信息
                 $this->clearTask([$stationTaskMaterialBox->station->code]);
-                $task = TaskTransaction::query()->with("materialBox")->where("fm_station_id",$stationTaskMaterialBox->station_id)
-                    ->where("status",0)->first();
-                if ($task){
-                    $options = [
-                        "detail01"=>$task->materialBox->code ?? '',
-                        "detail02"=>$task->doc_code,
-                        "detail03"=>$task->bar_code,
-                        "qty02"=>$task->amount,
-                    ];
-                    switch ($task->mark){
+                $stationId = $stationTaskMaterialBox->station_id;
+                $tasks = TaskTransaction::query()->with("materialBox")->where(function ($query)use($stationId){
+                    $query->where("fm_station_id",$stationId)->orWhere("to_station_id",$stationId);
+                })->where("status",0)->get();
+                if ($tasks->count()!=0){
+                    $options = [];
+                    switch ($tasks[0]->mark){
                         case 1:
                             $options["title"] = '上架任务';
                             break;
@@ -59,6 +57,26 @@ class StorageService
                         default:
                             $options["title"] = '未知类型';
                     }
+                    switch ($tasks->count()){
+                        case 1:
+                            $task = $tasks[0];
+                            $options["detail01"] = $task->materialBox->code ?? '';
+                            $options["detail02"] = $task->doc_code;
+                            $options["detail03"] = $task->bar_code;
+                            $options["qty01"] = $task->amount;
+                            $options["uomDesc01"] = '件';
+                            $options["qty02"] = $task->bin_number;
+                            $options["uomDesc02"] = '号';
+                            break;
+                        default:
+                            $task = $tasks[0];
+                            $options["detail01"] = $task->materialBox->code ?? '';
+                            $options["detail02"] = "货品过多请自行核对";
+                            $options["detail03"] = "波次:".$task->doc_code ?
+                                (Order::query()->with("batch")->where("code",$task->doc_code)->first()->batch->code ?? '无') : '无';
+                            break;
+                    }
+
                     app("CacheShelfService")->lightUp($stationTaskMaterialBox->station->code,'2','0',$options);
                     Cache::forget("CACHE_SHELF_OCCUPANCY_{$stationTaskMaterialBox->station->id}");//关闭无限亮灯
                 }
@@ -106,45 +124,86 @@ class StorageService
      */
     public function checkStorage(Station $station):?bool
     {
-        $task = TaskTransaction::query()->with("materialBox")->where("fm_station_id",$station->id)
-            ->where("status",0)->first();
+        $stationId = $station->id;
+        $task = TaskTransaction::query()->with("materialBox")->where(function ($query)use($stationId){
+            $query->where("fm_station_id",$stationId)->orWhere("to_station_id",$stationId);
+        })->where("status",0)->first();
         if (!$task)return null;
-        //建立入库任务,通知入库,完善库存
-        if ($task->type == '入库' && $task->mark == 1){
-            DB::beginTransaction();
+        switch ($task->type){
+            case "入库":
+                switch ($task->mark){
+                    case 1:
+                        return $this->handlePaTransaction($task, $station);
+                }
+                break;
+            case "出库":
+                switch ($task->mark){
+                    case 2:
+                        return $this->handleOutTransaction($station);
+                }
+        }
+        return null;
+    }
+
+    /**
+     * 处理出货交易
+     *
+     * @param Station|\stdClass $station
+     *
+     * @return bool
+     */
+    private function handleOutTransaction($station):bool
+    {
+        return TaskTransaction::query()->with("materialBox")->orWhere("to_station_id",$station->id)
+            ->where("status",0)->update([
+                "status" => 1,
+            ]) > 0;
+    }
+
+    /**
+     * 处理上架交易
+     *
+     * @param TaskTransaction|\stdClass $task
+     * @param Station|\stdClass $station
+     *
+     * @return bool
+     * @throws
+     */
+    private function handlePaTransaction($task, $station):bool
+    {
+        DB::beginTransaction();
+        try{
+            //get flux
+            $tasks = $this->getFluxTask($task->doc_code,$task->bar_code,$task->amount);
+            if (!$tasks)return false;
+            $ide = $task->materialBox->code;
+            DB::connection("oracle")->beginTransaction();
             try{
-                //get flux
-                $tasks = $this->getFluxTask($task->doc_code,$task->bar_code,$task->amount);
-                if (!$tasks)return false;
-                $ide = $task->materialBox->code;
-                DB::connection("oracle")->beginTransaction();
-                try{
-                    foreach ($tasks as $t)if (!$this->fluxPA($t,$ide)){
-                        DB::connection("oracle")->rollBack();
-                        return false;
-                    };
-                }catch(\Exception $e){
+                foreach ($tasks as $t)if (!$this->fluxPA($t,$ide)){
                     DB::connection("oracle")->rollBack();
                     return false;
-                }
-                $taskMaterialBox = $this->createWarehousingTask($station->id,$task->material_box_id);//建立入库任务
-                //2021-07-27 取消WAS库存维护
-                //if (!$this->enterWarehouse($task->material_box_id,$task->commodity_id,$task->amount))throw new \Exception("库存异常"); //处理库存
-                $task->update([
-                    "task_id" => $taskMaterialBox->id,
-                    "status" => 1,
-                ]);//标记事务完成
-                app("ForeignHaiRoboticsService")->putBinToStore_fromCacheShelf($taskMaterialBox,$station); //呼叫机器人入库
-                DB::commit();
-                DB::connection("oracle")->commit();
-                return true;
+                };
             }catch(\Exception $e){
-                DB::rollBack();
                 DB::connection("oracle")->rollBack();
                 return false;
             }
+            //$taskMaterialBox = $this->createWarehousingTask($station->id,$task->material_box_id);//建立入库任务
+            //2021-07-27 取消WAS库存维护
+            //if (!$this->enterWarehouse($task->material_box_id,$task->commodity_id,$task->amount))throw new \Exception("库存异常"); //处理库存
+            $task->update([
+                //"task_id" => $taskMaterialBox->id,
+                "status" => 1,
+            ]);//标记事务完成
+            //返回亮灯 此处不入库 再下一次按时入库
+            //app("ForeignHaiRoboticsService")->putBinToStore_fromCacheShelf($taskMaterialBox,$station); //呼叫机器人入库
+            DB::commit();
+            DB::connection("oracle")->commit();
+            return true;
+        }catch(\Exception $e){
+            DB::rollBack();
+            DB::connection("oracle")->rollBack();
+            return false;
         }
-        return true;
     }
 
     /**

+ 4 - 0
app/StationTaskCommodity.php

@@ -25,4 +25,8 @@ class StationTaskCommodity extends Model
     {
         return $this->belongsTo(StationTask::class);
     }
+    public function order()
+    {
+        return $this->belongsTo(Order::class);
+    }
 }

+ 2 - 1
app/TaskTransaction.php

@@ -22,7 +22,8 @@ class TaskTransaction extends Model
         "type",
         "status",
         "user_id",
-        "mark"
+        "mark",
+        "bin_number",
     ];
 
     const STATUS = [

+ 32 - 0
database/migrations/2021_07_29_131718_change_task_transactions_table_add_bin_number_column.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeTaskTransactionsTableAddBinNumberColumn extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('task_transactions', function (Blueprint $table) {
+            $table->integer("bin_number")->nullable()->comment("格口");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('task_transactions', function (Blueprint $table) {
+            $table->dropColumn("bin_number");
+        });
+    }
+}

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

@@ -59,6 +59,10 @@
                                             <span v-if="current_stationTaskBatch.runningStatus==='请求成功'">(请求成功)重新执行</span>
                                             <span v-if="current_stationTaskBatch.runningStatus==='请求异常'">(请求异常)重新执行</span>
                                         </button>
+                                        <label class="align-bottom mb-0 p-0">
+                                            <input content="col-4" type="checkbox" class="switch" v-model="isCacheShelf"></input><br>
+                                            <small class="mb-0 h6">缓存架</small>
+                                        </label>
                                     </div>
                                 </div>
                                 <div class="text-center my-2" style="overflow-y: scroll;max-height:200px;">
@@ -329,6 +333,7 @@
                 allTaskBroadcastName : "{{config('database.redis.options.prefix').'station-0'}}",
                 channelName : ".App\\Events\\BroadcastToStation",
                 error:"",
+                isCacheShelf:false,
                 station:{!! $station !!},
                 inputs:{
                     manuallyTakeBox:{
@@ -452,7 +457,7 @@
                     let _this=this;
                     _this.current_stationTaskBatch.runningStatus='请求中';
                     _this.$forceUpdate();
-                    axios.post('{{url('/api/thirdPart/haiq/runTaskBatch')}}',{station_task_batch_id:_this.current_stationTaskBatch.id})
+                    axios.post('{{url('/api/thirdPart/haiq/runTaskBatch')}}',{station_task_batch_id:_this.current_stationTaskBatch.id,isCacheShelf:this.isCacheShelf})
                         .then(function(response){
                             if(!response.data.success){
                                 _this.current_stationTaskBatch.runningStatus='请求失败';

+ 0 - 213
resources/views/station/monitor/show_bak.blade.php

@@ -1,213 +0,0 @@
-@extends('layouts.app')
-@section('title'){{$station->name}} - 监视器 - 站@endsection
-
-@section('content')
-    <div class="container-fluid body" id="container">
-        <div class="card">
-            <div class="card-body">
-                <div class="row border" style="opacity: 0.75">
-                    <div class="col-4 text-center h3 py-2 font-weight-bold text-info">宝时云仓</div>
-                    <div class="col text-center  h3 py-2 text-muted">智能分拣</div>
-                </div>
-                <div class="row pt-3">
-                    <div class="col-4">
-                        <div class="row">
-                            <div class="col py-3 h4">
-                                <div>波次号:</div>
-                                <div class=" text-center">
-                                    <b>@{{ task.taskBatch.batch.code }}</b>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="row">
-                            <div class="col py-3 text-muted text-center">
-                                <img id="barcode" alt="">
-                            </div>
-                        </div>
-                        <div class="row">
-                            <div class="col py-3 h4">
-                                料箱号:<b v-if="task.currentCommodityIndex && task.currentCommodityIndex!==-1">@{{task.taskCommodities[task.currentCommodityIndex]['materialBox']['code']}}</b>
-                            </div>
-                        </div>
-                        <div class="row pt-2">
-                            <div class="col">
-                                {{--                                @include("station.monitor._svg")--}}
-                                <img src="{{asset('images/demoBin.png')}}" alt="" class="img">
-                            </div>
-                        </div>
-                    </div>
-                    <div class="col text-center">
-                        <div class="row">
-                            <div class="col py-3 h4" v-for="stationTypeBinMonitor in stationTypeBinMonitors">
-                                <table class="table border">
-                                    <tr v-for="row in stationTypeBinMonitor">
-                                        <td class="border p-0"
-                                            v-for="column in row"
-                                            :class="
-                                                task.currentCommodityIndex
-                                                && task.currentCommodityIndex!==-1
-                                                && task.taskCommodities[task.currentCommodityIndex]['binNumber'] === column
-                                                    ? 'bg-info'
-                                                    : ''
-                                        ">
-                                            <span style="opacity:0.25">@{{ column }}</span></td>
-                                    </tr>
-                                </table>
-                            </div>
-                        </div>
-                        <div class="row mb-1">
-                            <div class="col-1 text-left font-weight-bold">数量:</div>
-                            <div class="col-2 text-left">@{{ task.currentSum }}/@{{ task.sum }}</div>
-                            <div class="col-1 offset-2 text-muted" v-if="error">异常:</div>
-                            <div class="col-6" v-if="error">@{{ error }}</div>
-                        </div>
-                        <div class="row">
-                            <div class="col py-1">
-                                <table class="table table-hover border">
-                                    <tr class="text-muted">
-                                        <th class="py-2">序号</th>
-                                        <th class="py-2">商品</th>
-                                        <th class="py-2">数量</th>
-                                        <th class="py-2">条码</th>
-                                    </tr>
-                                    <tr class="text-muted" v-for="(taskCommodity,i) in task.taskCommodities" :class="taskCommodity.bg">
-                                        <td>@{{ i+1 }}</td>
-                                        <td>@{{ taskCommodity.name }}</td>
-                                        <td>@{{ taskCommodity.amount }}</td>
-                                        <td><small class="text-dark font-weight-bold" v-for="barcode in taskCommodity.barcodes">@{{ barcode.code }}</small><br></td>
-                                    </tr>
-                                </table>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-@endsection
-
-@section('lastScript')
-    <script type="text/javascript" src="{{mix('js/utilities/barcode.js')}}"></script>
-    <script>
-        $vue=new Vue({
-            el:"#container",
-            data:{
-                {{--broadcastName : "{{config('database.redis.options.prefix').'presence-station-'.$station->id}}",--}}
-                broadcastName : "{{config('database.redis.options.prefix').'station-'.$station->id}}",
-                channelName : ".App\\Events\\BroadcastToStation",
-                task : {
-                    currentCommodityIndex : -1,
-                    taskCommodities:[
-                        /*{amount:"",binNumber:"",name:"",barcodes:[]},*/
-                    ],
-                    taskBatch:{
-                        batch:{
-                            code:"",
-                        },
-                    },
-                    box:{},
-                    sum : 0,
-                    currentSum : 0,
-                },
-                boxes:[],
-                stationTypeBinMonitors:[],
-                stationTypeBinMonitor:{
-                    row:Number("{{$stationTypeBinMonitor->bin_row_length}}"),
-                    column:Number("{{$stationTypeBinMonitor->bin_column_length}}"),
-                    amount:Number("{{$stationTypeBinMonitor->bin_wall_amount}}"),
-                },
-                color:"red",
-                error:"",
-            },
-            mounted() {
-                $('.navbar,.nav1,.nav2').hide();
-                $('.nav3').on('mouseenter', function () {
-                    $('.navbar,.nav1,.nav2').show();
-                });
-                $('.body').on('mouseenter', function () {
-                    $('.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);*/
-            },
-            methods:{
-                _broadcast(){
-                    initEcho();
-                    window.Echo.channel(this.broadcastName).listen(this.channelName,(msg)=> {
-                        console.log(1231,msg)
-                        let json = JSON.parse(msg.json);
-                        console.log(json)
-                        this._refreshData(json);
-                    });
-                },
-                //刷新数据
-                _refreshData(obj){
-                    let task={};
-                    task.taskCommodities = [];
-                    task.sum = 0;
-                    task.currentSum = 0;
-                    task.currentCommodityIndex = "";
-                    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;
-                        task.taskCommodities.push({
-                            bg:this._setColor(taskCommodity.status),
-                            amount:taskCommodity.amount,
-                            binNumber:taskCommodity.bin_number,
-                            name:taskCommodity.commodity?taskCommodity.commodity.name:'',
-                            barcodes:taskCommodity.commodity?taskCommodity.commodity.barcodes:[],
-                            materialBox:taskCommodity.material_box,
-                        });
-                    });
-                    task.taskBatch=obj.station_task_batches[0];
-                    setBarcode(task.taskBatch.batch.code,"#barcode",1,50,false);
-                    console.log(task)
-                    this.task = task;
-                },
-                //渲染墙格口
-                _renderingstationTypeBinMonitor(amount, row, column){
-                    for (let i=0;i<amount;i++){
-                        this.stationTypeBinMonitors.push(this._createstationTypeBinMonitor(row, column, i*(row*column)));
-                    }
-                },
-                _setColor(status){
-                    switch (status) {
-                        case "待处理":return "";
-                        case "挂起"  :return "bg-white";
-                        case "处理中"  :return "bg-primary";
-                        case "完成"  :return "bg-success";
-                        case "异常"  :return "bg-danger";
-                        case "取消"  :return "bg-dark text-white";
-                    }
-                    return "";
-                },
-                //生成墙格口
-                _createstationTypeBinMonitor(row, column, increment){
-                    let stationTypeBinMonitor = [];
-                    for (let i=1;i<=row;i++){
-                        let columns = [];
-                        for (let j=((i-1)*column)+1;j<=i*column;j++){
-                            columns.push(j+increment);
-                        }
-                        stationTypeBinMonitor.unshift(columns);
-                    }
-                    return stationTypeBinMonitor;
-                },
-                //渲染料箱格口
-                _renderingBox(row, column, x=79, y=72, width=21, height=12){
-                    let boxes = [];
-                    for (let i=0;i<column;i++){
-                        for (let j=row-1;j>=0;j--){
-                            if (boxes.length===5) boxes.push({x:((i+j)*width)+x,y:(y+(i*height))-(j*height),sign:true});
-                            else boxes.push({x:((i+j)*width)+x,y:(y+(i*height))-(j*height),sign:false});
-                        }
-                    }
-                    this.boxes = boxes;
-                },
-            },
-        });
-    </script>
-@endsection