haozi vor 4 Jahren
Ursprung
Commit
9b8ce4544e

+ 0 - 2
app/Http/ApiControllers/InventoryController.php

@@ -177,7 +177,6 @@ class InventoryController
      */
     public function stockInventory(Request $request)
     {
-        Log::error('执行开始',[now()->toDateTimeString()]);
         $task_item_id = $request->input("task_item_id");
         $verified_amount = $request->input("verified_amount");
         /**
@@ -198,7 +197,6 @@ class InventoryController
             $stockService->updateInventory($task_id);
         }
         $notStocktakingList=$service->getUnInventoryTaskList($task_id);
-        Log::error('执行结束',[now()->toDateTimeString()]);
         $this->response($notStocktakingList);
     }
 

+ 20 - 10
app/Http/Controllers/TestController.php

@@ -311,17 +311,27 @@ class TestController extends Controller
 
     public function inventory()
     {
-        $location='H05-35-04';
-        $inventoryAccountId=792;
-        $barcode='6973244250033';
-        $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])
-            ->whereHas('commodity',function($query)use($barcode){
-            $query->whereHas('barcodes',function($sql)use($barcode){
-                $sql->where('code','=',$barcode);
-            });
-        })->where('location',$location)->where('inventory_account_id',$inventoryAccountId)->toSql();
-        dd($inventoryAccountMission);
+        $location='B15-01-01';
+        $taskId=1;
+        $barcode='Fxdsc';
+        $start=microtime(true);
+//        $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])
+//            ->whereHas('commodity',function($query)use($barcode){
+//            $query->whereHas('barcodes',function($sql)use($barcode){
+//                $sql->where('code','=',$barcode);
+//            });
+//        })->where('location',$location)->where('inventory_account_id',$taskId)->first();
+//
 
+        $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])
+            ->whereIn('commodity_id',function($query)use($barcode){
+                $query->from('commodity_barcodes')->select('commodity_id')->where('code',$barcode);
+            })->where('location',$location)
+            ->where('inventory_account_id',$taskId)
+            ->where('checked','否')
+            ->first();
+        $end=microtime(true);
+        dump(round($end-$start,3),$inventoryAccountMission);
     }
 
     public function testZC()

+ 1 - 1
app/Services/AndroidInventoryService.php

@@ -54,7 +54,7 @@ class AndroidInventoryService
                     });
                 })->where('location',$location)
                 ->where('inventory_account_id',$taskId)
-                ->where('checked','否')
+                ->whereIn('checked',['是','否'])
                 ->first();
         });
     }