|
|
@@ -27,29 +27,72 @@ class Pages extends BaseController
|
|
|
|
|
|
public function Pick2Light(object $f3, array $args)
|
|
|
{
|
|
|
+ if ($args['step'] == 1)
|
|
|
+ $f3->clear('COOKIE.p2l');
|
|
|
+ else {
|
|
|
+ $stepValues = $f3->get('POST');
|
|
|
+ if (count($stepValues) == 0)
|
|
|
+ $stepValues = json_decode($f3->get('COOKIE.p2l'), true);
|
|
|
+ }
|
|
|
+
|
|
|
switch ($args['step']) {
|
|
|
- case 2:
|
|
|
- $f3->set('SESSION.commessa', $f3->get('POST.commessa'));
|
|
|
- break;
|
|
|
- case 3;
|
|
|
- $f3->set('SESSION.labelid', $f3->get('POST.labelid'));
|
|
|
- break;
|
|
|
case 4:
|
|
|
- $f3->set("INFOTEXT", "Aggancia l'etichetta elettronica al carrello e scannerizza il barcode");
|
|
|
+ $f3->set('INFOTEXT', 'Quando pronto, aggancia l\'etichetta elettronica al carrello e scannerizza il barcode');
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ $f3->set('INFOTEXT', 'Carrello sbagliato');
|
|
|
+ if ($stepValues['cartcode'] != $stepValues['confirmcartcode']) {
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- $f3->set('DISTINTE', $f3->Get('DB')->exec('SELECT DISTINCT commessa FROM distinte'));
|
|
|
+ $f3->set('COOKIE.p2l', json_encode($stepValues));
|
|
|
+
|
|
|
+ $f3->set('DISTINTE', $f3->Get('DB')->exec('SELECT DISTINCT consegna FROM distinte'));
|
|
|
$f3->set('STEP', $args['step']);
|
|
|
+ $f3->set('PAGEVALUES', $stepValues);
|
|
|
+
|
|
|
$f3->set('CONTENT', 'pick2light.tpl');
|
|
|
echo \Template::instance()->render('masterpage.tpl');
|
|
|
}
|
|
|
|
|
|
public function Bind($f3, $args)
|
|
|
{
|
|
|
- if ($args['step'] > 2) {
|
|
|
- $f3->set("INFOTEXT", "Step 3 non ancora implementato");
|
|
|
- $args['step'] = 2;
|
|
|
+ if ($args['step'] == 1)
|
|
|
+ $f3->clear('COOKIE.bind');
|
|
|
+ else {
|
|
|
+ $stepValues = $f3->get('POST');
|
|
|
+ if (count($stepValues) == 0)
|
|
|
+ $stepValues = json_decode($f3->get('COOKIE.p2l'), true);
|
|
|
+ }
|
|
|
+
|
|
|
+ $f3->set('COOKIE.bind', json_encode($stepValues));
|
|
|
+
|
|
|
+ if ($args['step'] == 3) {
|
|
|
+ $CORE_SETTINGS = $f3->get('CORE.fb');
|
|
|
+ $findBoxCore = new \FindBoxCoreSystem(...array_values($CORE_SETTINGS));
|
|
|
+ $findBoxCore->Bind($stepValues['labelid'], $stepValues['barcode']);
|
|
|
+ $label = new \SmartESL($findBoxCore, [$stepValues['labelid']]);
|
|
|
+
|
|
|
+ $articles = new \DB\SQL\Mapper($f3->get('DB'), 'articles');
|
|
|
+ $articles->load("materiale='{$stepValues['barcode']}'");
|
|
|
+ $desc = preg_replace('/\s\s+/', '%20', $articles['descrizione']);
|
|
|
+
|
|
|
+ if (!$articles->dry()) {
|
|
|
+ $dataFields = array(
|
|
|
+ 'tipo_magazzino' => $articles['tipo_magazzino'],
|
|
|
+ 'ubicazione' => $articles['ubicazione'],
|
|
|
+ 'incc_intr' => $articles['incc_intr']
|
|
|
+ );
|
|
|
+ $findBoxCore->SaveProducts($stepValues['barcode'], $desc, $dataFields);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Get template from field dev_type o label details
|
|
|
+ $details = $label->getDetails();
|
|
|
+ $devType = $details[$stepValues['labelid']]['status']['dev_type'];
|
|
|
+ $labelTemplateId = $f3->get("LABELS.TEMPLATES.DT{$devType}");
|
|
|
+ $label->Display($labelTemplateId, $stepValues['barcode']);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
$f3->set('STEP', $args['step']);
|