|
|
@@ -65,6 +65,7 @@ use App\OwnerPriceOperation;
|
|
|
use App\OrderPackageCountingRecord;
|
|
|
use App\OwnerReport;
|
|
|
use App\ProcurementCheckSheet;
|
|
|
+use App\ReceiveRecord;
|
|
|
use App\RejectedBill;
|
|
|
use App\SeeLog;
|
|
|
use App\Services\AuthorityService;
|
|
|
@@ -215,24 +216,19 @@ class TestController extends Controller
|
|
|
}while (true);
|
|
|
socket_close($sock);
|
|
|
}
|
|
|
- private static $delayedHour = 48;
|
|
|
public function test(Request $request)
|
|
|
{
|
|
|
- /**
|
|
|
- * Execute the console command.
|
|
|
- *
|
|
|
- */
|
|
|
- $delayedDateTime = Carbon::now()->subHours(self::$delayedHour)->toDateTimeString();
|
|
|
- dd($delayedDateTime);
|
|
|
- dd(\App\ReceiveRecord::query()
|
|
|
- ->where("record_at",">",$delayedDateTime)
|
|
|
- ->where("delayed",0)
|
|
|
- ->whereIn("logistic_number",RejectedBill::query()->select("logistic_number_return")
|
|
|
- ->where("created_at",">",$delayedDateTime)->whereIn("logistic_number_return",
|
|
|
- \App\ReceiveRecord::query()->select("logistic_number")
|
|
|
- ->where("record_at",">",$delayedDateTime)
|
|
|
- ->where("delayed",0)))->get());
|
|
|
- dd(1);
|
|
|
+ $service = new LogisticService();
|
|
|
+ foreach (ReceiveRecord::query()->where("logistic_id",0)->get() as $receive){
|
|
|
+ $name = $service->assertExpressCompany($receive->logistic_number);
|
|
|
+ if ($name){
|
|
|
+ $logistic = Logistic::query()->select("id","name")
|
|
|
+ ->where("name","like","%{$name}%")->first();
|
|
|
+ $logisticId = $logistic ? $logistic->id : 0;
|
|
|
+ } else $logisticId = 0;
|
|
|
+ if ($logisticId!=0)$receive->update(["logistic_id"=>$logisticId]);
|
|
|
+ }
|
|
|
+ dd(ReceiveRecord::query()->where("logistic_id",0)->count());
|
|
|
$path = '';
|
|
|
$id = 115;
|
|
|
|