/** * @name $uploadPipelineConsignments * @param int $wh_id Warehouse ID * @param int $rec_id Record ID (PK id shipment table) * @param varchar $voucher Temprary Voucher Number * @param varchar $batch_no Batch no * @param float $qty Batch received quantity * @param int $location_id Placement Location id where the stock is placed * * This service will upload future shipment transactions, for first call with master id zero, * service will process Stock Master and Stock Detail & Stock Batch Trans with specified batch * and Qty and rest of the required information from shipment table and returns master id, * in next call with master id service will process stock detail with specified batch and qty. * * @author Ajmal Hussain <*****@*****.**> */ public function uploadPipelineConsignmentsAction() { $type = $this->_request->getParam('type', 0); $em = Zend_Registry::get('doctrine'); $em->getConnection()->beginTransaction(); try { $params = $this->_request->getParams(); // echo $created_by->getPkId().'Auth'.$params['auth']; // exit; if ($type == 3) { $stock_master = new Model_StockMaster(); $stock_master->form_values = $params; $result = $stock_master->uploadReceivedQuantityViaScanner(); } else { $rec_id = $this->_request->getParam('rec_id', 0); $pipeline_consignments = $this->_em->getRepository("PipelineConsignments")->find($rec_id); if (count($pipeline_consignments) > 0) { if ($pipeline_consignments->getStatus() == 'Received') { $result = array("message" => 104); echo Zend_Json::encode(array($result)); return false; } } if ($rec_id > 0) { $params = $this->_request->getParams(); $pipeline_consignments = new Model_PipelineConsignments(); $pipeline_consignments->form_values = $params; $result = $pipeline_consignments->updatePipelineConsignmentsReceivedQty(); } else { $params = $this->_request->getParams(); $pipeline_consignments = new Model_PipelineConsignments(); $pipeline_consignments->form_values = $params; $result = $pipeline_consignments->insertPipelineConsignments(); } } $em->getConnection()->commit(); } catch (Exception $e) { $em->getConnection()->rollback(); $em->close(); App_FileLogger::info($e); $result = array("error" => "An error occur"); } echo Zend_Json::encode(array($result)); }