Commit 267d5f27 authored by hangjun83's avatar hangjun83

更新

parent 4d36ccec
...@@ -209,18 +209,31 @@ class WuxiLabService ...@@ -209,18 +209,31 @@ class WuxiLabService
return false; return false;
} }
try{ try{
$rawsList = $this->rhawnChemicalsService->getChemicalRawThroughtCode($params['products']); $rawIdList = $newPackages = [];
if($rawsList){ if(count($params['products']) > 5000){
foreach ($rawsList as $raw){ $slice_array_length = $current_length = 500;
$rawIdList[] = $raw['r_id']; while(true){
} $product = array_slice($params['products'],$current_length);
$packages = $this->rhawnChemicalsService->getChemicalPackage($rawIdList); $rawsList = $this->rhawnChemicalsService->getChemicalRawThroughtCode($product);
$newPackages = []; if($rawsList){
if($packages){ $tempList = [];
foreach($packages as $pack){ foreach ($rawsList as $raw){
$newPackages[$pack['r_code']] = $pack; $tempList[] = $raw['r_id'];
$rawIdList[] = $raw['r_id'];
}
$packages = $this->rhawnChemicalsService->getChemicalPackage($tempList);
if($packages){
foreach($packages as $pack){
$newPackages[$pack['r_code']] = $pack;
}
}
}
if($current_length >= $slice_array_length){
break;
} }
$current_length += $slice_array_length;
} }
ini_set('memory_limit','3072M'); ini_set('memory_limit','3072M');
$path = app(WuxiLabExport::class)->saveExcel( $path = app(WuxiLabExport::class)->saveExcel(
['rawList' => $rawsList,'packageList' => $newPackages], ['rawList' => $rawsList,'packageList' => $newPackages],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment