Browse Source

缓存架提示更改

Zhouzhendong 4 years ago
parent
commit
4e28511ac3

+ 8 - 3
app/Services/StationTaskBatchService.php

@@ -281,8 +281,13 @@ class StationTaskBatchService
     {
         $taskMaterialBoxes->loadMissing(["stationTaskCommodities.order","stationTaskCommodities.commodity.barcodes"]);
         //获取可用的库位 加行锁
-        $location = array_column(app("StationService")->getCacheShelf(true)->toArray(),"code");
-        $map = app("StationService")->getStationMapping($location);//获取库位映射信息
+        $stations = app("StationService")->getCacheShelf(true);
+        $location = [];
+        $map = [];
+        foreach ($stations as $station){
+            $location[] = $station->code;
+            $map[$station->code] = $station->id;
+        }
         /** @var Collection $handleTask */
         $handleTask = $taskMaterialBoxes->splice(0,count($location));
         $toLocation = collect();
@@ -310,7 +315,7 @@ class StationTaskBatchService
             $updateTask[] = ["id"=>$task->id,"station_id"=>$task->station_id];
             foreach ($task->stationTaskCommodities as $taskCommodity)$exeInsert($task,$taskCommodity,0);
         }
-        if ($handleTask->collect()>0)app("BatchUpdateService")->batchUpdate("station_task_material_boxes",$updateTask);
+        if ($handleTask->count()>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);

+ 19 - 6
app/Services/StorageService.php

@@ -69,14 +69,27 @@ class StorageService
                             $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 ?? '无') : '无';
+                            $count = count(array_unique(array_column($tasks->toArray(),"commodity_id")));
+                            if ($count==1){
+                                $options["detail01"] = $tasks[0]->bar_code;
+                                $options["detail02"] = "";
+                                $options["detail03"] = "";
+                                foreach ($tasks as $task){
+                                    if (mb_strlen($options["detail02"])>20){
+                                        $options["detail03"] .= $task->bin_number."号-".$task->amount."件,";
+                                    }else $options["detail02"] .= $task->bin_number."号-".$task->amount."件,";
+                                }
+                                $options["detail02"] = rtrim($options["detail02"],",");
+                                $options["detail03"] = rtrim($options["detail03"],",");
+                            }else{
+                                $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}");//关闭无限亮灯
                 }

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

@@ -428,6 +428,7 @@
                     });
                 },
                 selectBatch(stationTaskBatch){
+                    if (this.current_stationTaskBatch!==stationTaskBatch)this.isCacheShelf = false;
                     this.current_stationTaskBatch=stationTaskBatch;
                     if(typeof(this.current_stationTaskBatch.runningStatus)==='undefined')
                         this.current_stationTaskBatch.runningStatus=''