Merge branch 'dillon/77-yd-api-debugging' into vapor/development

This commit is contained in:
Dillon Ngo
2024-12-15 09:49:07 +08:00
3 changed files with 15 additions and 5 deletions
@@ -159,17 +159,21 @@ class FetchPackingListsFromYdPortalV2Processor
try{
$packingList = $this->fetchesPackingList->execute(['reference' => $row->expressno, 'type' => PackingListType::SHIPPING_PACKING_LIST]);
Log::info('Fetch SHIPPING_PACKING_LIST id: ' . $packingList->id);
$packingList->packages()->delete();
$replica = $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
if($replica) $replica->packages()->delete();
$warehouseReceiveList = $this->fetchesPackingList->execute(['reference' => $row->expressno, 'type' => PackingListType::WAREHOUSE_RECEIVE_LIST]);
Log::info('Fetch WAREHOUSE_RECEIVE_LIST id: ' . $warehouseReceiveList->id);
$warehouseReceiveList->packages()->delete();
$replica = $warehouseReceiveList->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA)->first();
if($replica) $replica->packages()->delete();
} catch (ResourceNotFoundException $exception) {
Log::info('SHIPPING_PACKING_LIST/WAREHOUSE_RECEIVE_LIST NOT FOUND');
if (!$allow_contract) {
$appointee_id = 2307;
@@ -181,6 +185,7 @@ class FetchPackingListsFromYdPortalV2Processor
/** @var PackingList $warehouseReceiveList */
$warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order);
Log::info('Create WAREHOUSE_RECEIVE_LIST id: ' . $warehouseReceiveList->id);
$transportObject = new TransportObject(TransportType::LAND, null, $row->kuaidilist, Carbon::parse($receiveDate), Carbon::parse($receiveDate), $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
$transport = $this->createsTransport->execute($transportObject, $warehouseReceiveList);
@@ -209,6 +214,7 @@ class FetchPackingListsFromYdPortalV2Processor
/** @var PackingList $packingList */
$packingList = $this->createPackingListProcessor->execute($packingListObject, $order);
Log::info('Create SHIPPING_PACKING_LIST id: ' . $packingList->id);
if ($allow_contract) {
foreach ($contractObligations as $obligation) {
@@ -58,10 +58,11 @@
} else {
console.error('Request failed with status:', response.status);
}
this.isDownloading = false;
})
.catch((error) => {
console.error('Network error:', error);
})
.finally(() => {
this.isDownloading = false;
});
},
@@ -29,11 +29,16 @@
</div>
</div>
<div class="btn btn-md btn-complete fs-11" @click="downloadReport()" v-if="parameters.has_filters_and_searched">
<!-- <div class="btn btn-md btn-complete fs-11" @click="downloadReport()" v-if="parameters.has_filters_and_searched">
<span>
Export
</span>
</div>
</div> -->
<open-link-in-new-tab-component custom-class="btn btn-complete"
:url="route('segment-customers.export', options.company_segments_in, options.marking_in ?? 0)"
:is-url-protected="true" v-if="parameters.has_filters_and_searched">
<i class="fa fa-download"></i> Export
</open-link-in-new-tab-component>
<small v-else>Download is only available after filters has been applied.</small>
<list-component class="mt-4" :key="parameters.vueKey" section="listSegmentSection"
@@ -96,8 +101,6 @@ export default {
},
downloadReport() {
if (window.LARAVEL_VAPOR_ENABLED) {
this.isValidationEnabled = !this.isValidationEnabled;
this.parameters = null;
this.submit(this.route('segment-customers.export', this.options.company_segments_in, this.options.marking_in ?? 0), 'get', this.section, false, false);
}
else {