mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-29 01:14:14 +00:00
add yd reschedule container logic
This commit is contained in:
+20
-1
@@ -131,7 +131,6 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
* @param Carbon|null $start
|
||||
* @param Carbon|null $end
|
||||
* @return void
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function execute(?Carbon $start = null, ?Carbon $end = null)
|
||||
{
|
||||
@@ -162,6 +161,7 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$deliveryDate = null;
|
||||
$etd = null;
|
||||
$eta = null;
|
||||
$delayDate = null;
|
||||
|
||||
$trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [
|
||||
'trakingno' => $row->expressno
|
||||
@@ -182,6 +182,12 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$eta = Carbon::parse($tracking[2]);
|
||||
}
|
||||
|
||||
|
||||
if($trackingRow->remark === '预计船时间为'){
|
||||
$tracking = explode('预计船时间为', $trackingRow->tracking);
|
||||
$delayDate = Carbon::parse(explode('日', $tracking[1])[0]);
|
||||
}
|
||||
|
||||
if($trackingRow->tracking === '货物已进目的港仓库'){
|
||||
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
|
||||
}
|
||||
@@ -189,6 +195,7 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
if($trackingRow->tracking === '货物已派送完成'){
|
||||
$deliveryDate = Carbon::parse($trackingRow->trackingtime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$customerno = preg_split('(-|\(|\)|\/)', $row->customerno);
|
||||
@@ -304,6 +311,18 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $eta, ApprovalStatus::APPROVED));
|
||||
}
|
||||
|
||||
if($delayDate){
|
||||
|
||||
$transport = $container->transports()->first();
|
||||
|
||||
if(!$transport->schedules()->where('eta', '=', $delayDate)->first()) {
|
||||
$etd = $transport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->etd;
|
||||
$transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]);
|
||||
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $delayDate, ApprovalStatus::APPROVED));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($unstuffingDate && $container->status !== ApprovalStatus::COMPLETED){
|
||||
$container->update(['status' => ApprovalStatus::COMPLETED]);
|
||||
|
||||
Reference in New Issue
Block a user