|
|
@@ -7,6 +7,7 @@
|
|
|
|
|
|
namespace Modules\Dimatec;
|
|
|
|
|
|
+use DB\SQL;
|
|
|
use OpenMind\FindBox\FindBoxCoreSystem;
|
|
|
use OpenMind\FindBox\QueueCommand;
|
|
|
use OpenMind\FindBox\SmartESL;
|
|
|
@@ -28,7 +29,7 @@ class Pages extends Controller
|
|
|
/**
|
|
|
* Send QueueSystem command for all labels associated
|
|
|
*
|
|
|
- * @param $distinta
|
|
|
+ * @param Distinta $distinta
|
|
|
* @param array $commesse
|
|
|
*/
|
|
|
private function sendLabelMsg($distinta, array $commesse)
|
|
|
@@ -81,8 +82,6 @@ class Pages extends Controller
|
|
|
// Send blink to all labels associated to barcode
|
|
|
$this->sendLabelMsg($distinta, $commesse);
|
|
|
|
|
|
- $distinta->SendToIcamStorage($commesse);
|
|
|
-
|
|
|
$f3->set('SESSION.barcode_mv', $stepValues['barcode_mv']);
|
|
|
$f3->reroute("/pick2light/2");
|
|
|
return;
|
|
|
@@ -90,7 +89,7 @@ class Pages extends Controller
|
|
|
case 2:
|
|
|
$f3->set('NEXTSTEP', 2);
|
|
|
if (isset($stepValues['commessa'])) {
|
|
|
- if (!$distinta->isCommessaPresent($stepValues['commessa'])) {
|
|
|
+ if (!$distinta->commessaExists($stepValues['commessa'])) {
|
|
|
$f3->set('INFOTEXT', "Codice cesta non corretto");
|
|
|
} else {
|
|
|
$labelid = $distinta->GetLabelIdFromBarcode($stepValues['commessa']);
|
|
|
@@ -103,7 +102,7 @@ class Pages extends Controller
|
|
|
$qm = new QueueSystem('FindBoxService');
|
|
|
$qm->send($obj);
|
|
|
|
|
|
- $distinta->DeleteCommessa($stepValues['commessa']);
|
|
|
+ $distinta->DeleteCommessaArticle($stepValues['barcode_mv'], $stepValues['commessa']);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -148,11 +147,21 @@ class Pages extends Controller
|
|
|
$j_eslData = json_encode($eslData);
|
|
|
$err = $this->findBoxCore->SaveProducts($bindData['labelid'], '', $eslData);
|
|
|
|
|
|
- $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['commessa']}')"
|
|
|
- );
|
|
|
+ // 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']}')"
|
|
|
+ );*/
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -196,10 +205,10 @@ class Pages extends Controller
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * Import lists from as400 to MAV
|
|
|
+ * Import lists from as400
|
|
|
* @param $f3
|
|
|
*/
|
|
|
- public function AS4002MAV($f3)
|
|
|
+ public function ImportFromAS400($f3)
|
|
|
{
|
|
|
$migData = new MigrationData();
|
|
|
|
|
|
@@ -211,11 +220,13 @@ class Pages extends Controller
|
|
|
|
|
|
// Compile xml for SOAP
|
|
|
$migData->soapCompileFrom($data, 'SCARICO');
|
|
|
-
|
|
|
- if (!$migData->sendToIcam($this->finalXml))
|
|
|
+ if (!$migData->sendToIcam())
|
|
|
$f3->set('IMPORT_RESULT', "Errore durante l'invio della lista al Magazzino Verticale.<br/><br/>Controllare la console ICAM per gli errori.");
|
|
|
- else
|
|
|
- $f3->set('IMPORT_RESULT', 'Liste inviate correttamente al Magazzino Verticale');
|
|
|
+ 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<br/><br/>Righe con massimizzazione importate: $count");
|
|
|
+ }
|
|
|
|
|
|
$f3->set('CONTENT', 'import.tpl');
|
|
|
echo \Template::instance()->render('masterpage.tpl');
|