mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-24 15:05:09 +00:00
fix vt warehouse list api
This commit is contained in:
+11
-10
@@ -116,7 +116,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
|
||||
|
||||
try {
|
||||
|
||||
$start = $start ? $start : Carbon::now()->subMonth();
|
||||
$start = $start ? $start : Carbon::today()->subDays(2);
|
||||
|
||||
$startLimit = Carbon::parse('11-08-2021');
|
||||
|
||||
@@ -124,7 +124,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
|
||||
$start = $startLimit;
|
||||
}
|
||||
|
||||
$end = $end ? $end : Carbon::now();
|
||||
$end = $end ? $end : Carbon::today()->addDay();
|
||||
|
||||
$filter = '["ParcelDate:$between$%js%\"'.$start->format('Y-m-d').'T00:00:00.000\"$and$%js%\"'.$end->format('Y-m-d').'T00:00:00.000\"\u0000"]';
|
||||
|
||||
@@ -134,18 +134,20 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
|
||||
|
||||
foreach ($response->Rows as $parcel){
|
||||
|
||||
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $parcel[29]));
|
||||
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $parcel[11]));
|
||||
$orderNumber = $marking[array_key_last($marking)];
|
||||
|
||||
if(!$parcel[3]){
|
||||
$quantity = $parcel[16];
|
||||
if(!$quantity){
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
|
||||
} catch (ResourceNotFoundException $exception) {
|
||||
|
||||
$oldOrder = OldOrders::where('marking', '=', $orderNumber)->first();
|
||||
|
||||
if(!$oldOrder){
|
||||
continue;
|
||||
}
|
||||
@@ -175,7 +177,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
|
||||
}
|
||||
|
||||
|
||||
$warehouseId = $parcel[44];
|
||||
$warehouseId = $parcel[43];
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $warehouseId === 11 ? 3 : 4]);
|
||||
|
||||
$order = $this->createOrderProcessor->execute($companyModule->company, $originWarehouse, $address, $orderNumber);
|
||||
@@ -186,10 +188,9 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
|
||||
}
|
||||
|
||||
$packingListReference = $parcel[0];
|
||||
$quantity = $parcel[3];
|
||||
// $measurement = round(($parcel[10]/$quantity) ** (1/3) * 100, 2);
|
||||
$description = $parcel[31];
|
||||
$tracking = $parcel[38];
|
||||
$description = $parcel[13];
|
||||
$tracking = $parcel[37];
|
||||
$receiveDate = $parcel[1];
|
||||
|
||||
$packingListObject = new PackingListObject($packingListReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id, PackingListType::WAREHOUSE_RECEIVE_LIST, ApprovalStatus::APPROVED);
|
||||
@@ -215,7 +216,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
|
||||
$packingList->packages()->delete();
|
||||
if($replica) $replica->packages()->delete();
|
||||
|
||||
$packageObject = new PackageObject(PackageType::CARTON, $description, $parcel[10], $parcel[9], $parcel[8], 0, $quantity, ApprovalStatus::APPROVED);
|
||||
$packageObject = new PackageObject(PackageType::CARTON, $description, $parcel[23], $parcel[22], $parcel[21], 0, $quantity, ApprovalStatus::APPROVED);
|
||||
$this->createPackageProcessor->execute($packageObject, $packingList);
|
||||
}
|
||||
} catch (\Exception $exception){
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
<div class="btn btn-default no-border" @click="expanded = !expanded">
|
||||
<i class="fa" :class="{'fa-angle-down': !expanded, 'fa-angle-up': expanded}" ></i>
|
||||
</div>
|
||||
<a class="btn btn-default no-border" :href="route('container.show', item.container_reference)">
|
||||
<i class="fa fa-angle-right fa-fw"></i>
|
||||
<a class="btn btn-default no-border" :href="route('container.refresh', item.container_reference)" target="_blank">
|
||||
<i class="fa fa-refresh fa-fw"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+22
-1
@@ -139,6 +139,8 @@ Route::get('/customer/{marking}/details', function ($marking) {
|
||||
|
||||
Route::get('/orders/refresh', function(){
|
||||
|
||||
dd((App()->make(\App\Classes\Modules\PackingLists\Processors\FetchWarehouseReceiveListFromVTPortalProcessor::class))->execute());
|
||||
|
||||
FetchWarehouseReceiveListFromVTPortalJob::withChain([
|
||||
new FetchLoadedContainersFromVTPortalJob,
|
||||
new FetchPackingListFromVTPortalJob,
|
||||
@@ -232,7 +234,26 @@ Route::get('/yd', function (\Illuminate\Http\Request $request){
|
||||
$start = $request->input('start_date') ? \Carbon\Carbon::parse($request->input('start_date')): null;
|
||||
$end = $request->input('end_date') ? \Carbon\Carbon::parse($request->input('end_date')): null;
|
||||
(App()->make(FetchOrderListsFromYdPortalProcessor::class))->execute($start, $end);
|
||||
});
|
||||
})->name('yd.refresh');
|
||||
|
||||
Route::get('/container/{reference}/refresh/', function (string $reference){
|
||||
$container = Container::where('reference', $reference)->first();
|
||||
$supplier = in_array($container->owner_id, [3, 4]) ? 'VT' : 'YD';
|
||||
|
||||
if($supplier === 'YD'){
|
||||
$arrivalDates = \App\Models\PackingList::whereIn('reference', $container->packingLists->pluck('reference'))->where('type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->get()->map(function($packingList){
|
||||
return $packingList->transports()->first()->drop_date;
|
||||
})->sortBy(function($date){
|
||||
return $date;
|
||||
});
|
||||
|
||||
$startDate = $arrivalDates->first()->subDay()->format('d-m-Y');
|
||||
$endDate = $arrivalDates->last()->addDay()->format('d-m-Y');
|
||||
|
||||
return redirect(route('yd.refresh').'?start_date='.$startDate.'&end_date='.$endDate);
|
||||
}
|
||||
|
||||
})->name('container.refresh');
|
||||
|
||||
Route::get('/min_cbm', function (){
|
||||
$companies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orders', function ($query){
|
||||
|
||||
Reference in New Issue
Block a user