|
|
@@ -9,6 +9,7 @@ use App\City;
|
|
|
use App\Commodity;
|
|
|
use App\CommodityBarcode;
|
|
|
use App\Events\CancelOrder;
|
|
|
+use App\InventoryAccount;
|
|
|
use App\InventoryAccountMission;
|
|
|
use App\InventoryCompare;
|
|
|
use App\InventoryDailyLog;
|
|
|
@@ -90,7 +91,26 @@ class TestController extends Controller
|
|
|
{
|
|
|
return call_user_func([$this, $method], $request);
|
|
|
}
|
|
|
-
|
|
|
+ public function updateInventory(){
|
|
|
+ $inventoryAccounts=InventoryAccount::query()->get();
|
|
|
+ $updateParams = [[
|
|
|
+ 'id','processed','ignored','updated_at'
|
|
|
+ ]];
|
|
|
+ $updated_at=Carbon::now()->toDateTimeString();
|
|
|
+ foreach ($inventoryAccounts as $inventoryAccount){
|
|
|
+ if ($inventoryAccount->getIgnoredAmount()>0){
|
|
|
+ $updateParams[] = [
|
|
|
+ 'id'=>$inventoryAccount->id,
|
|
|
+ 'processed'=>$inventoryAccount->getProcessedAmount(),
|
|
|
+ 'ignored' => $inventoryAccount->getIgnoredAmount(),
|
|
|
+ 'updated_at'=>$updated_at,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(count($updateParams) > 1){
|
|
|
+ app(BatchUpdateService::class)->batchUpdate('inventory_accounts',$updateParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
public function test4(){
|
|
|
$row = [];
|
|
|
for ($i=0;$i<50;$i++){
|