CORE_SETTINGS = $f3->get('CORE.fb'); $this->findBoxCore = new FindBoxCoreSystem(...array_values($this->CORE_SETTINGS)); } /** * Send QueueSystem command for all labels associated * * @param Distinta $distinta * @param array $commesse */ private function sendLabelMsg($distinta, array $commesse) { global $f3; foreach($commesse as $commessa) { $labelid = $distinta->GetLabelIdFromBarcode($commessa['commessa']); if ($labelid == null) { $f3->set('INFOTEXT', "Alcune etichette non accenderano il led in quanto non associate."); continue; } $msgBlink = new QueueCommand($labelid); $msgSaveP = new QueueCommand($labelid); $msgBlink->setLeds(2, 1, 1000, 16, 0); $msgSaveP->saveProducts($commessa['descrizione'], [ 'Q.ta' => $commessa['qta_prelevare'], 'Commessa' => $commessa['commessa'] ]); $qm = new QueueSystem('FindBoxService'); $qm->send($msgBlink); $qm->send($msgSaveP); } } public function Pick2Light(object $f3, array $args) { $stepValues = array_map('strtoupper', $this->getSanitizedPostRequest()); $distinta = new Distinta(); switch ($args['step']) { case 1: if (count($stepValues) == 0) { $f3->clear('INFOTEXT'); $f3->clear('SESSION.barcode_mv'); $f3->set('NEXTSTEP', 1); break; } $commesse = $distinta->getCommesseFromProduct($stepValues['barcode_mv']); if (count($commesse) == 0) { $f3->set('INFOTEXT', "Nessuna commessa associata al prodotto selezionato"); $f3->set('NEXTSTEP', 1); break; } // Send blink to all labels associated to barcode $this->sendLabelMsg($distinta, $commesse); $f3->set('SESSION.barcode_mv', $stepValues['barcode_mv']); $f3->reroute("/pick2light/2"); return; break; case 2: $f3->set('NEXTSTEP', 2); if (isset($stepValues['commessa'])) { if (!$distinta->commessaExists($stepValues['commessa'])) { $f3->set('INFOTEXT', "Codice cesta non corretto"); } else { $labelid = $distinta->GetLabelIdFromBarcode($stepValues['commessa']); if ($labelid != null) { // Send BlinkOFF $obj = new QueueCommand($labelid); $obj->setToBlinkOff(); // Send command to queue $qm = new QueueSystem('FindBoxService'); $qm->send($obj); $distinta->DeleteCommessaArticle($stepValues['barcode_mv'], $stepValues['commessa']); } } } $commesse = $distinta->getCommesseFromProduct($f3->get('SESSION.barcode_mv')); if (count($commesse) == 0) { $f3->set('INFOTEXT', "Ventilazione terminata"); $f3->set('RESTART_VENTILAZIONE', TRUE); } /* foreach($commesse as $commessa) { $labelid = $distinta->GetLabelIdFromBarcode($commessa['commessa']); if ($labelid == null) { $f3->set('INFOTEXT', "Alcune etichette non accenderano il led in quanto non associate."); continue; } }*/ $f3->set('COMMESSE', $commesse); break; } $f3->set('CONTENT', 'pick2light.tpl'); echo \Template::instance()->render('masterpage.tpl'); } public function Bind($f3) { $params = $this->getSanitizedPostRequest(); $distinta = new Distinta(); if (count($params)) { $bindData = array_map('strtoupper', $this->getSanitizedPostRequest()); //$err = $this->findBoxCore->Bind($bindData['labelid'], $bindData['labelid']); $label = new SmartESL($this->findBoxCore, [$bindData['labelid']]); $labelTemplateId = \F3::get("LABELS.TEMPLATES.DT31"); $err = $label->Display($labelTemplateId, $bindData['labelid']); $eslData = array( 'Q.ta' => 0, 'Commessa' => $bindData['commessa'] ); $j_eslData = json_encode($eslData); $err = $this->findBoxCore->SaveProducts($bindData['labelid'], '', $eslData); // Add or Update label $label = new SQL\Mapper($f3->get('DB'), 'label_bindings'); $label->load(['label_id=?', $bindData['labelid']]); $label->label_id = $bindData['labelid']; $label->barcode = $bindData['commessa']; $label->template_id = $labelTemplateId; $label->esl_datafields = $j_eslData; $label->descrizione = $bindData['codcliente']; $label->save(); /* $this->dbHandle->exec("DELETE FROM label_bindings WHERE label_id='{$bindData['labelid']}'"); $this->dbHandle->exec( "INSERT INTO label_bindings (label_id, barcode, template_id, esl_datafields, descrizione) VALUES " . "('{$bindData['labelid']}', '{$bindData['commessa']}', '{$labelTemplateId}', '{$j_eslData}', '{$bindData['codcliente']}')" );*/ } $liste = $distinta->getListeToBind(); $f3->set('ORDINE', $liste[0]['commessa']); $f3->set('LISTE', $liste); $f3->set('CONTENT', 'bind.tpl'); echo \Template::instance()->render('masterpage.tpl'); } /** * @deprecated for now not used * @param $f3 * @param array $args */ public function UnBind($f3, array $args) { $stepValues = array_map('strtoupper', $this->getSanitizedPostRequest()); if ($args['step'] == 2) { $success = $this->findBoxCore->UnBind($stepValues['labelid']); if ($success['err'] <> 0) { $f3->set('INFOTEXT', $success['value']); } } $f3->set('STEP', $args['step']); $f3->set('CONTENT', 'unbind.tpl'); echo \Template::instance()->render('masterpage.tpl'); } /** * @deprecated for now not used * @param $f3 */ public function ElencoDistinta($f3) { $distinta = new Distinta(); $f3->set('PRODUCTS', $distinta->getDistinte()); $f3->set('CONTENT', 'distinta.tpl'); echo \Template::instance()->render('masterpage.tpl'); } /** * Import lists from as400 * @param $f3 */ public function ImportFromAS400($f3) { $migData = new MigrationData(); $migData->SoapConnector($f3->get('VERTICALSTORAGE.MV_ADDRESS')); $migData->DatabaseConnector($f3->get('VERTICALSTORAGE.DB2_ADDRESS')); // Get lists from as400 $data = $migData->query($migData->strQueryMassificata('SCARICO')); // Compile xml for SOAP $migData->soapCompileFrom($data, 'SCARICO'); if (!$migData->sendToIcam()) $f3->set('IMPORT_RESULT', "Errore durante l'invio della lista al Magazzino Verticale.

Controllare la console ICAM per gli errori."); else { // Importo la lista nel database di OM-Link solamente se non ci sono stati errori nell'invio al Magazzino Verticale $count = $migData->saveDistinta($data); $f3->set('IMPORT_RESULT', "Liste inviate correttamente al Magazzino Verticale

Righe con massimizzazione importate: $count"); } $f3->set('CONTENT', 'import.tpl'); echo \Template::instance()->render('masterpage.tpl'); } /** * Send list of all goods loaded into MAV to as400 * @param $f3 */ public function MAV2AS400($f3) { echo \Template::instance()->render('masterpage.tpl'); } }