Пример #1
0
 public function calculateLam(Filter $filter, $pcbID = -1)
 {
     $base = $this->getFilterTypeValue($filter->getFilterType());
     $sEnv = $filter->getEnvironment();
     $piE = $this->systemService->getPiE(211, $sEnv);
     $qual = $filter->getQuality();
     if ($qual == 'MIL-SPEC') {
         $piQ = 1;
     } else {
         $piQ = 2.9;
     }
     $lambda = $base * $piQ * $piE * pow(10, -6);
     return $lambda;
 }
 /**
  * @Route("/newFilter", name="newFilter")
  * @Template()
  */
 public function newFilterAction()
 {
     $post = $this->get('request')->request;
     $id = $post->get('id');
     $formData = $post->get('formData');
     $objF = json_decode($formData);
     $obj = $objF->filterForm;
     $filter = new Filter();
     $filter->setParams($obj);
     $service = $this->get('ikaros_filterService');
     $lambda = $service->calculateLam($filter);
     $serviceParts = $this->get('ikaros_partService');
     $e = $serviceParts->setLams($lambda, $filter, $id);
     if ($e != "") {
         return new Response(json_encode(array('e' => $e)), 400, array('Content-Type' => 'application/json; charset=utf-8'));
     }
     return new Response(json_encode(array('Label' => $filter->getLabel(), 'Lam' => $filter->getLam(), 'FilterType' => $filter->getFilterType(), 'Type' => $filter->getType(), 'CasePart' => $filter->getCasePart(), 'Environment' => $filter->getEnvironment(), 'Quality' => $filter->getQuality(), 'idP' => $filter->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8'));
 }