public function importShipment($shipmentId) { $this->_customer = $this->getCustomerByAbbr('RUSPM'); if (($shipment = $this->isShipmentExist($shipmentId)) === false) { $shipment = new Entity\Shipment(); $shipment->setStatus($this->getStatusByCode('PBV')); $shipment->setCustomer($this->_customer); $shipment->setMbl($shipmentId); } else { $shipment->setStatus($this->getStatusByCode('UBV')); } $shipFrom = $this->getLocation($this->getValueByAttribute('ShipFrom', 'InternalId')); $shipment->setShipFrom($shipFrom); $shipment->setAtd($this->getDateByAttribute('ShipmentInfo', 'Shipped')); $shipment->setEtd($this->getDateByAttribute('ShipmentInfo', 'EstShip')); $shipment->setEta($this->getDateByAttribute('ShipmentInfo', 'EstDeliver')); $shipment->setCustomInt1($this->getValueByAttribute('Measures', 'Qty', 'ShipmentInfo')); $shipment->setCustomInt2($this->getValueByAttribute('Measures', 'Cases', 'ShipmentInfo')); $shipmentInfo = $this->getTagByName('ShipmentInfo')->item(0); $shipment->setCustomFloat1($this->getValueByAttribute('EstWeight', 'Value', $this->getChildElement($shipmentInfo, 'Measures'))); $shipment->setCustomFloat2($this->getValueByAttribute('EstVolume', 'Value', $this->getChildElement($shipmentInfo, 'Measures'))); $shipment->setHbl('SPM' . $shipmentId); $pbl = strtoupper($this->getValueByAttribute('MiscInfo', 'Misc5', 'ShipmentInfo')); $shipment->setCustomString1($pbl); $shipment->setCustomString2($this->getValueByAttribute('MiscInfo', 'Misc8', 'ShipmentInfo')); $shipment->setType(); #$vehicle = $this->getTagByName('Vehicle')->item(0); $shipment->setCustomString3($this->getValueByAttribute('Vehicle', 'Id', 'ShipmentInfo')); $shipment->setCustomString4($this->getValueByAttribute('Seal', 'Id')); $shipment->setCustomInt3($this->getValueByAttribute('PartnerId1', 'InternalLocnId')); $shipTo = $this->getLocation($this->getValueByAttribute('ShipTo', 'InternalId')); $shipment->setShipTo($shipTo); $this->_em->persist($shipment); #Добавляем LPN $lpns = $this->getTagByName('LPN'); foreach ($lpns as $lpn) { #добавляем коробки $package = $this->importPackage($lpn, $shipment); #добавляем lineItem $this->importShipmentLineItem($lpn, $shipment, $package); } $this->_po = array_values(array_unique($this->_po)); #определяем букинг if (false === ($booking = $this->detectBooking($pbl))) { $this->_error[] = "Booking for shipment with PBL#{$pbl} not found"; } else { $shipment->setBooking($booking); } if (!empty($this->_error)) { $subject = "Exceptions were occured in import from EEM"; @mail('ivan.popov@panalpina.com,stanislav.biryukov@panalpina.com,margarita.slyusareva@panalpina.com', $subject, implode("\n\r", $this->_error)); } }