haozi 4 лет назад
Родитель
Сommit
12c87ef9ed

+ 5 - 1
app/Http/ApiControllers/InventoryController.php

@@ -102,7 +102,11 @@ class InventoryController
         $taskId = $request->input("taskId");
         $location = $request->input("location");
         $res=app('AndroidInventoryService')->getLocInvPro($taskId,$location);
-        $this->response($res);
+        if ($res===0){
+            $this->response(null,410,"库位不存在!");
+        }else{
+            $this->response($res);
+        }
     }
 
     /**

+ 7 - 2
app/Services/AndroidInventoryService.php

@@ -32,7 +32,7 @@ class AndroidInventoryService
             ->where('created_at', 'like', Carbon::now()->toDateString() . '%')
             ->where('mark', Auth::user()['name'])->count();
     }
-    public function getLocInvPro($taskId,$location): array
+    public function getLocInvPro($taskId,$location)
     {
         $ins=InventoryAccountMission::query()
             ->where('inventory_account_id',$taskId)
@@ -41,7 +41,12 @@ class AndroidInventoryService
         $total=$ins->count();
         //已盘数
         $invCount=$ins->where('checked','<>','否')->count();
-        return ['total'=>$total,'invCount'=>$invCount];
+        if ($total==0&&$invCount==0){
+            return 0;//库位不存在
+        }else{
+            return ['total'=>$total,'invCount'=>$invCount];
+        }
+
     }
     //根据盘点任务号,库位,条码 查询指定盘点任务
     public function getInventoryDetail($taskId,$location,$barcode)