/** * After final failure */ public function afterFail() { parent::afterFail(); $this->OrderShipment->clear(); $this->OrderShipment->id = $this->message_id; $this->OrderShipment->saveField('order_shipment_status_id', OrderShipmentStatus::WMS_ERROR); }
/** * Execute Shipment Task Post order process * * @see Order::allocateInventory * @see OrderItem::allocateByWarehouse * @see OrderShipment::split * @link https://younique.atlassian.net/wiki/pages/viewpage.action?pageId=63569977 * * @return bool */ public function execute() { parent::execute(); /** * Setting to turn multiple warehouse allocation on/off */ $multiple_warehouse = $this->SystemSetting->getSystemSetting('multiple_warehouse', 0); if (!empty($multiple_warehouse)) { /** * Translate message id to shipment or order */ if ($this->message_data['name'] == 'Shipment') { $shipment = $this->OrderShipment->find('first', ['conditions' => ['id' => $this->message_id]]); if (!empty($shipment)) { $order_id = $shipment['OrderShipment']['order_id']; } else { return false; } } else { if ($this->message_data['name'] == 'Order') { $order_id = $this->message_id; } else { return false; } } /** * Allocate inventory for order */ return $this->Order->allocateInventory($order_id); } else { return true; } }
/** * After final failure */ public function afterFail() { parent::afterFail(); /** * Set secondary status to 8 not in NetSuite */ $this->export_lib->saveErrorStatus($this->message_id); }
/** * After final failure */ public function afterFail() { parent::afterFail(); /** * Set secondary status to 8 not in Backorder (NetSuite way of handling it) */ //$this->export_lib->saveErrorStatus($this->message_id); }
/** * After final failure */ public function afterFail() { parent::afterFail(); /** * Set shipment error status */ $this->export_lib->saveShipmentErrorStatus($this->message_id); }
/** * Execute Task * * @return bool */ public function execute() { parent::execute(); /** * since there are no tasks to run, just retun * remove this when there is stuff to process */ return true; }
/** * Execute Lipstick Card Task * @return bool */ public function execute() { parent::execute(); /** * Add lipstick card to order if applicable */ $this->Order->id = $this->message_id; $this->Order->addLipstickCard(); return true; }
/** * Execute Add Free Items Task * @return bool */ public function execute() { parent::execute(); /** * Add Free items to order */ $this->Order->id = $this->message_id; $this->Order->addFreeItems(); return true; }
/** * Execute BackOrder Card Task * * @return bool */ public function execute() { parent::execute(); /** * Add backorder card to order if applicable */ $this->Order->id = $this->message_id; $this->Order->addBackOrderCard(); return true; }
/** * Execute NetSuite Ready Task * * @return bool */ public function execute() { parent::execute(); /** * Set NetSuite Ready Status for order */ $this->Order->id = $this->message_id; $this->Order->orderReady(); return true; }
/** * Execute Ratelinx Rate Shop Task * * @return bool */ public function execute() { parent::execute(); /** * Set NetSuite Ready Status for order */ //$order_id = $this->args[0]; $order_id = $this->message_id; $result = $this->OrderShipment->orderCartonizationCall($order_id); if (!$result) { $this->out('OrderCartonizationCall Failed'); } return $result; }
/** * Execute close shipment * * @return bool * @throws CloseShipmentException */ public function execute() { parent::execute(); $shipment_id = $this->message_id; $stage = $this->message_data['payload']->stage; $snap_shipment_id = $this->message_data['payload']->snap_shipment_id; $snap_instance = $this->message_data['payload']->snap_instance; $date_created = $this->message_data['payload']->date_created; if (empty($date_created) || empty($snap_instance) || empty($stage)) { $this->out('=> Error: Message from sqs is malformed.'); return false; } $order_shipment = $this->getDbShipment($shipment_id); if (!$order_shipment) { $this->out("=> Error: No Order shipment record found.", 1, Shell::VERBOSE); return false; } // lookup the order and store the tracking number $snap_shipment = $this->getShipment("shipments/{$snap_shipment_id}", $snap_instance); if (!$snap_shipment) { return true; } $order_id = $snap_shipment->CustomerRef; $this->Order->id = $order_id; $this->out("=> Processing Shipment Stage: {$stage}"); /** * Handle shipment stages */ switch ($stage) { case SnapConfig::SNAP_CANCELLED: $this->cancelShipment($shipment_id); break; case SnapConfig::SNAP_SHIPPED: $this->closeShipment($shipment_id, $snap_shipment, $date_created); /** * Send message for Net Suite Item fulfillment */ if (Sqs::useQueue()) { $sqs = new Sqs(Sqs::queueUrl('ns_item_fulfillment_queue')); $sqs->sendJSON(['id' => $shipment_id, 'name' => 'Shipment', 'delay_seconds' => 1, 'timeout' => 30.0, 'created' => date("Y-m-d H:i:s")]); } break; default: throw new CloseShipmentException("Stage {$stage} not found for closing shipment {$shipment_id}"); } return true; }
/** * Execute Send Shipment To Snap * @return bool * @throws Exception */ public function execute() { parent::execute(); $commission = json_decode(json_encode($this->message_data['payload']), true); $time_start = microtime(true); $exception = null; $result = $this->RoyaltiesEarned->payRetailCommission($commission, $this->message_data); $time_end = microtime(true); $time_taken = number_format($time_end - $time_start, 2); if (isset($result->reference)) { $reference = $result->reference; } else { $reference = 'None'; } if ($result) { $this->out("=> Success: Paid RoyaltiesEarned id: {$commission['id']} " . " in {$time_taken} Seconds to <" . $commission['payquickeremail'] . "> earned on " . $commission['date_earned'] . " for the amount of " . $commission['amount'] . ". [" . $reference . "]"); return true; } else { $this->out("=> Error: Failed to pay RoyaltiesEarned id: {$commission['id']} " . " in {$time_taken} Seconds to <" . $commission['payquickeremail'] . "> earned on " . $commission['date_earned'] . " for the amount of " . $commission['amount'] . ". [" . $reference . "]"); return false; } }
/** * Execute Shipment Task * * @return bool */ public function execute() { parent::execute(); $this->OrderShipmentMethod->setOrderShipmentMethod($this->message_id); return true; }
/** * Execute DataFlowFour * * @return bool */ public function execute() { parent::execute(); $results = $this->export_lib->execute($this->message_id, $this->message_data, $this->sqs_timeout); return $results['success']; }