mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-25 15:34:24 +00:00
fix yd delivery address update api
This commit is contained in:
@@ -158,6 +158,7 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$containerReference = null;
|
||||
$loadingDate = null;
|
||||
$unstuffingDate = null;
|
||||
$deliveryDate = null;
|
||||
$etd = null;
|
||||
$eta = null;
|
||||
|
||||
@@ -182,6 +183,10 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
if($trackingRow->tracking === '货物已进目的港仓库'){
|
||||
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
|
||||
}
|
||||
|
||||
if($trackingRow->tracking === '货物已派送完成'){
|
||||
$deliveryDate = Carbon::parse($trackingRow->trackingtime);
|
||||
}
|
||||
}
|
||||
|
||||
$customerno = preg_split('(-|\(|\)|\/)', $row->customerno);
|
||||
@@ -311,6 +316,22 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
|
||||
}
|
||||
|
||||
if($deliveryDate){
|
||||
$packingList->status = ApprovalStatus::COMPLETED;
|
||||
$packingList->save();
|
||||
|
||||
$deliveryDate = Carbon::parse($deliveryDate);
|
||||
$transportObject = new TransportObject(TransportType::LAND, null, null, $deliveryDate, $deliveryDate, ApprovalStatus::APPROVED);
|
||||
/** @var Transport $transport */
|
||||
$transport = $this->createsTransport->execute($transportObject, $packingList);
|
||||
$this->createsSchedule->execute($transport, new ScheduleObject($deliveryDate, $deliveryDate, ApprovalStatus::APPROVED));
|
||||
|
||||
$deliveryStep = $packingList->steps()->where('reference', '=', 'LAST_MILE_DELIVERY')->first();
|
||||
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
|
||||
$this->updatesContractObligations->execute($signature, $deliveryStep->obligation_hash_id);
|
||||
$deliveryStep->update(['status' => ApprovalStatus::COMPLETED]);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
Log::debug($exception);
|
||||
|
||||
Reference in New Issue
Block a user