<?php

namespace App\Console\Commands;

use App\OwnerAreaReport;
use App\Services\LogService;
use App\Services\OwnerService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class CreateOwnerAreaReport extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'createOwnerAreaReport';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'create owner area report';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 1号生成盘点面积记录，记录留空由人工填写
     *
     * @return void
     */
    public function handle()
    {
        /** @var OwnerService $ownerService */
        $ownerService = app('OwnerService');
        $chunks = ($ownerService->get([],["ownerStoragePriceModels"],false,true))->chunk(50);
        foreach ($chunks as $owners){
            app("OwnerAreaReportService")->notExistToInsert($owners);
        }
    }
}
