|
|
@@ -8,16 +8,17 @@
|
|
|
namespace Customers\Lamborghini;
|
|
|
|
|
|
use OpenMind\Labeling\FindBoxCoreSystem;
|
|
|
+use OpenMind\Labeling\SmartESL;
|
|
|
|
|
|
class Distinta
|
|
|
{
|
|
|
private $dbHandle;
|
|
|
private $userId;
|
|
|
|
|
|
- public function __construct(object $f3)
|
|
|
+ public function __construct()
|
|
|
{
|
|
|
- $this->dbHandle = $f3->get('DB');
|
|
|
- $this->userId = $f3->get('USERID');
|
|
|
+ $this->dbHandle = \F3::get('DB');
|
|
|
+ $this->userId = \F3::get('USERID');
|
|
|
}
|
|
|
|
|
|
public function CleanDistintaTable()
|
|
|
@@ -45,7 +46,7 @@ EOF;
|
|
|
"VALUES ({$idutente}, '{$row['consegna']}', '{$row['barcode']}', '{$row['descrizione']}', '{$row['origine']}', '{$row['ubicazione']}', '{$row['sequenza']}', '{$row['qta_prelevare']}', 0)";
|
|
|
$err = $this->dbHandle->exec($sqlInsert);
|
|
|
if (!$err)
|
|
|
- die('CopyDistinta error insert in table distinta_esplosa');
|
|
|
+ die(__FUNCTION__ . ' error insert in table distinta_esplosa');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -89,21 +90,29 @@ EOF;
|
|
|
}
|
|
|
|
|
|
if ($blink) {
|
|
|
- $label = new \SmartESL($findBoxCore, [$labelId]);
|
|
|
+ $label = new SmartESL($findBoxCore, [$labelId]);
|
|
|
$label->BlinkSpecial(2, 1, 1000, $iterations, 0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function getDistinte()
|
|
|
+ public function getDistinta(string $maxRows = '3')
|
|
|
{
|
|
|
- return $this->dbHandle->exec('SELECT distinct consegna, commessa, ordine_produzione, data_creazione, time_creazione, destinazione_merci FROM `distinte` ORDER BY data_creazione');
|
|
|
+ return $this->dbHandle->exec("SELECT * FROM distinta_esplosa WHERE idutente={$this->userId} AND qta_prelevare>0 and anomalie=0 ORDER BY sequenza LIMIT {$maxRows}");
|
|
|
}
|
|
|
|
|
|
- public function getDistinta(string $maxRows = '3')
|
|
|
+ public function GetLabelIdFromBarcode(string $barcode): ?string
|
|
|
{
|
|
|
- return $this->dbHandle->exec("SELECT * FROM distinta_esplosa WHERE idutente={$this->userId} AND qta_prelevare>0 and anomalie=0 ORDER BY sequenza LIMIT {$maxRows}");
|
|
|
+ $label = $this->dbHandle->exec("SELECT label_id FROM `label_bindings` WHERE barcode='{$barcode}'");
|
|
|
+ if (count($label) > 0)
|
|
|
+ return $label[0]['label_id'];
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getDistinte()
|
|
|
+ {
|
|
|
+ return $this->dbHandle->exec('SELECT distinct consegna, commessa, ordine_produzione, data_creazione, time_creazione, destinazione_merci FROM `distinte` ORDER BY data_creazione');
|
|
|
}
|
|
|
|
|
|
public function MarkBarcodeAsAnomalia(string $barcode)
|
|
|
@@ -111,7 +120,7 @@ EOF;
|
|
|
$CORE_SETTINGS = \F3::get('CORE.fb');
|
|
|
$findBoxCore = new FindBoxCoreSystem(...array_values($CORE_SETTINGS));
|
|
|
$lblId = $this->GetLabelIdFromBarcode($barcode);
|
|
|
- $label = new \SmartESL($findBoxCore, [$lblId]);
|
|
|
+ $label = new SmartESL($findBoxCore, [$lblId]);
|
|
|
$label->BlinkSpecial(3, 1, 1000, 10);
|
|
|
|
|
|
$sql = "UPDATE distinta_esplosa d JOIN label_bindings b ON d.barcode = b.barcode SET anomalie=1 WHERE idutente={$this->userId} AND b.barcode='{$barcode}'";
|
|
|
@@ -140,26 +149,12 @@ EOF;
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public function GetLabelIdFromBarcode(string $barcode): ?string
|
|
|
- {
|
|
|
- $label = $this->dbHandle->exec("SELECT label_id FROM `label_bindings` WHERE barcode='{$barcode}'");
|
|
|
- if (count($label) > 0)
|
|
|
- return $label[0]['label_id'];
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- private function getArticoliByConsegna(string $consegna): array
|
|
|
- {
|
|
|
- $sqlCommesse = "SELECT DISTINCT de.barcode, de.descrizione, d.qta_prelevare as qta_nominale, de.qta_prelevare, de.anomalie FROM `distinta_esplosa` AS de JOIN `distinte` AS d ON de.commessa=d.consegna WHERE idutente={$this->userId} AND de.commessa = '{$consegna}' AND de.barcode=d.barcode";
|
|
|
- return $this->dbHandle->exec($sqlCommesse);
|
|
|
- }
|
|
|
-
|
|
|
public function ResetLabelCarrello(string $labelId)
|
|
|
{
|
|
|
$CORE_SETTINGS = \F3::get('CORE.fb');
|
|
|
$findBoxCore = new FindBoxCoreSystem(...array_values($CORE_SETTINGS));
|
|
|
|
|
|
- $label = new \SmartESL($findBoxCore, [$labelId]);
|
|
|
+ $label = new SmartESL($findBoxCore, [$labelId]);
|
|
|
$label->BlinkSpecial(0, 1, 1000, 8, 0);
|
|
|
|
|
|
$dataFields = array(
|
|
|
@@ -208,11 +203,17 @@ EOF;
|
|
|
|
|
|
$dataFields['end_operations'] = $consegna;
|
|
|
|
|
|
- $label = new \SmartESL($findBoxCore, [$labelId]);
|
|
|
+ $label = new SmartESL($findBoxCore, [$labelId]);
|
|
|
$findBoxCore->SaveProducts($barcode, $consegna, $dataFields);
|
|
|
$label->BlinkSpecial(0, 1, 1000, 8, 0);
|
|
|
}
|
|
|
|
|
|
+ private function getArticoliByConsegna(string $consegna): array
|
|
|
+ {
|
|
|
+ $sqlCommesse = "SELECT DISTINCT de.barcode, de.descrizione, d.qta_prelevare as qta_nominale, de.qta_prelevare, de.anomalie FROM `distinta_esplosa` AS de JOIN `distinte` AS d ON de.commessa=d.consegna WHERE idutente={$this->userId} AND de.commessa = '{$consegna}' AND de.barcode=d.barcode";
|
|
|
+ return $this->dbHandle->exec($sqlCommesse);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Esegue il reset delle etichette associate alla distinta
|
|
|
* @param string $commessa
|