Zhouzhendong 4 жил өмнө
parent
commit
be4e7fd0f6

+ 1 - 1
app/Http/Controllers/StorageController.php

@@ -47,7 +47,7 @@ class StorageController extends Controller
         })->first();
         //get flux
         $tasks = app("StorageService")->getFluxTask($asn,$barCode,$amount);
-        if (!$tasks)$this->error("单无上架任务或不存在");
+        if (!$tasks)$this->error("单无上架任务或不存在");
         //此处嵌套三层事务 以最高层级为准
         DB::beginTransaction(); //总体事务 回滚WAS错误操作
         try{

+ 3 - 1
app/Services/CacheShelfService.php

@@ -55,7 +55,9 @@ class   CacheShelfService
      */
     public function lightOffTask($locCode, $PTLAction): array
     {
-        $station = Station::query()->with('pendingStationTask.stationTaskMaterialBoxes.materialBox')->where('code', $locCode)->first();
+        $station = Station::query()->with(['pendingStationTask.stationTaskMaterialBoxes.materialBox','storage'=>function(Builder $query){
+            $query->whereNotNull("material_box_id")->orderByDesc("updated_at");
+        }])->where('code', $locCode)->first();
         //站存在 站为缓存架2 站为蓝灯状态
         if ($station && $station->parent_id==7){
             if (!Storage::query()->where("station_id",$station->id)->whereNotNull("material_box_id")->first())return ['success' => false, 'errMsg' => "任务执行中,不允许灭灯"];