Giancarlo Voci 8 years ago
parent
commit
52c11ecea0
14 changed files with 123 additions and 31 deletions
  1. 0 0
      bundle.css
  2. 9 0
      composer.json
  3. 6 0
      config.ini
  4. 3 0
      index.php
  5. 3 0
      labels.ini
  6. 2 2
      omlinkimporter.php
  7. 11 0
      packconfig.php
  8. 54 11
      src/Modules/Pages.php
  9. 3 0
      ui/bars.tpl
  10. 9 4
      ui/bind.tpl
  11. 4 0
      ui/custom.css
  12. 1 1
      ui/distinta.tpl
  13. 2 2
      ui/homemenu.tpl
  14. 16 11
      ui/pick2light.tpl

File diff suppressed because it is too large
+ 0 - 0
bundle.css


+ 9 - 0
composer.json

@@ -3,5 +3,14 @@
   "type": "project",
   "require": {
     "bcosca/fatfree": "^3.6"
+  },
+  "authors": [
+    {
+      "name": "Open Mind Group",
+      "email": "service@openmind.srl"
+    }
+  ],
+  "autoload": {
+    "classmap": ["src/"]
   }
 }

+ 6 - 0
config.ini

@@ -14,3 +14,9 @@ ENCODING = "UTF-8"
 HIGHLIGHT = false
 JAR.expire = {{time()+31536000}}
 PASSWORD=$2y$10$bW64jQ6UHFiYskofQD29Ku.5dggO5OAS08SgK/BUU50EBb4AQ/T6S
+
+[CORE.fb]
+host=192.168.1.231
+port=50443
+key=C0000000000011474023057
+pass=ZrgzkvJrOKnNSCnPnGz3u{A6eHSNXVvs

+ 3 - 0
index.php

@@ -11,7 +11,10 @@ require 'vendor/autoload.php';
 
 $f3 = \Base::instance();
 
+$config = gzuncompress(base64_decode(file_get_contents("config.bin")));
+
 $f3->config('config.ini', true);
+$f3->config('labels.ini', true);
 
 $f3->set('DB',
   new \DB\SQL(

+ 3 - 0
labels.ini

@@ -0,0 +1,3 @@
+[LABELS.TEMPLATES]
+DT31=1004
+DT79=1002

+ 2 - 2
omlinkimporter.php

@@ -64,9 +64,9 @@ class CSVImporter
         foreach ($data as $dataRow) {
             $sql = <<<EOL
 INSERT INTO distinte (
-origine, commessa, ordine_produzione, data_creazione, time_creazione, destinazione_merci, barcode, descrizione, qta_prelevare, qta_mancante
+origine, consegna, commessa, ordine_produzione, data_creazione, time_creazione, destinazione_merci, barcode, descrizione, qta_prelevare, qta_mancante
 ) VALUES (
-'$dataRow[16]', '$dataRow[0]', '$dataRow[3]', str_to_date('$dataRow[6]','%d/%m/%Y'), '$dataRow[7]', '$dataRow[15]','$dataRow[9]', '$dataRow[10]', '$dataRow[11]', 0
+'$dataRow[16]', '$dataRow[0]', '$dataRow[2]', '$dataRow[3]', str_to_date('$dataRow[6]','%d/%m/%Y'), '$dataRow[7]', '$dataRow[15]','$dataRow[9]', '$dataRow[10]', '$dataRow[11]', 0
 );
 EOL;
             if (!$this->dbMysql->query($sql)) {

+ 11 - 0
packconfig.php

@@ -0,0 +1,11 @@
+<?php
+/**
+ * @author Open Mind
+ * @date 12/04/2018
+ * @time 15:43
+ */
+
+$config = file_get_contents("config.ini");
+
+$pck = base64_encode(gzcompress($config));
+file_put_contents("config.bin", $pck);

+ 54 - 11
src/Modules/Pages.php

@@ -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']);

+ 3 - 0
ui/bars.tpl

@@ -7,6 +7,9 @@
 </nav>
 
 <nav class="navbar fixed-bottom navbar-expand-lg navbar-dark bg-dark">
+    <check if="{{ isset(@PREVPAGE) }}">
+        <a href="{{@PREVPAGE}}"><img class="navbar-brand" src="{{@BASEURL}}/ui/images/arrow-left.svg" height="50"/></a>
+    </check>
     <div class="collapse navbar-collapse"></div>
     <a class="navbar-brand" href="{{@BASEURL}}">
         <img src="{{@BASEURL}}/ui/images/om-link-logo.png" height="40"/>

+ 9 - 4
ui/bind.tpl

@@ -5,14 +5,19 @@
         <form class="form" method="post" action="{{@BASEURL}}/bind/{{@STEP+1}}">
             <input type="submit" hidden/>
             <input type="text" name="labelid" class="form-control form-control-lg" placeholder="Label ID" required {{@AUTOFOCUS1}} autocomplete="false" value="{{ @POST.labelid }}"/>
-            <check if="{{ @STEP == '2'}}">
+            <check if="{{ @STEP > 1 }}">
                 <input type="text" name="barcode" class="form-control form-control-lg mt-3" placeholder="Barcode" required {{@AUTOFOCUS2}} autocomplete="false" value="{{ @POST.barcode }}"/>
             </check>
         </form>
-        <check if="{{@INFOTEXT}}">
-            <div class="alert alert-danger mt-5" role="alert">
-                {{@INFOTEXT}}
+        <check if="{{@STEP==3}}">
+            <div class="alert alert-info mt-5" role="alert">
+                Invio bind
             </div>
+            <script>
+              setTimeout(function () {
+                window.location.href = "{{@BASEURL}}/bind/1";
+              }, 2000);
+            </script>
         </check>
     </div>
 </div>

+ 4 - 0
ui/custom.css

@@ -34,3 +34,7 @@ input[type="text"]:focus, input[type="password"]:focus {
 .bg-dark {
     background-color: #686f75 !important;
 }
+
+.disablebutton {
+    opacity: 0.4;
+}

+ 1 - 1
ui/distinta.tpl

@@ -6,7 +6,7 @@
         <table class="table table-striped table-dark">
             <thead>
             <tr>
-                <th class="text-center" colspan="4" scope="col">Elenco Distinta commessa: 012737</th>
+                <th class="text-center" colspan="4" scope="col">Elenco Distinta consegna: 012737</th>
             </tr>
             </thead>
             <thead>

+ 2 - 2
ui/homemenu.tpl

@@ -5,7 +5,7 @@
         <div class="content">
             <div class="row justify-content-center">
                 <div class="col-md-2 m-3">
-                    <img class="img-fluid" src="ui/images/utente.png"/>
+                    <img class="img-fluid disablebutton" src="ui/images/utente.png"/>
                 </div>
                 <div class="col-md-2 m-2">
                     <a href="{{@BASEURL}}/elencodistinta"><img class="img-fluid" src="ui/images/elenco_distinta.png"/></a>
@@ -19,7 +19,7 @@
                     <a href="{{@BASEURL}}/bind/1"><img class="img-fluid" src="ui/images/bind.png"/></a>
                 </div>
                 <div class="col-md-2 m-3">
-                    <img class="img-fluid" src="ui/images/bindcarrello.png"/>
+                    <img class="img-fluid disablebutton" src="ui/images/bindcarrello.png"/>
                 </div>
             </div>
         </div>

+ 16 - 11
ui/pick2light.tpl

@@ -1,3 +1,7 @@
+<check if="{{ @STEP > 1 && @STEP < 4 }}">
+    <set PREVPAGE="{{ @BASEURL . '/pick2light/' . (@STEP-1) }}"/>
+</check>
+
 <include href="bars.tpl"/>
 
 <div class="row h-100 justify-content-center">
@@ -5,26 +9,27 @@
         <form class="form" method="post" action="{{@BASEURL}}/pick2light/{{@STEP+1}}">
             <input type="submit" hidden id="submitform"/>
 
-            <select name="commessa" class="form-control form-control-lg bg-secondary mb-3" onchange="javascript:{$('#submitform').click()}">
-                <option selected>Seleziona una distinta</option>
+            <select name="consegna" class="form-control form-control-lg bg-secondary mb-3" onchange="javascript:{$('#submitform').click()}">
+                <option {{isset(@PAGEVALUES.consegna) ? '' : 'selected'}} >Seleziona una distinta</option>
                 <repeat group="{{ @DISTINTE }}" value="{{ @DISTINTA }}">
-                    <option value="{{@@DISTINTA.commessa}}">{{@@DISTINTA.commessa}}</option>
+                    <option {{@PAGEVALUES.consegna == @@DISTINTA.consegna ? 'selected' : ''}} value="{{@@DISTINTA.consegna}}">{{@@DISTINTA.consegna}}</option>
                 </repeat>
             </select>
-
             <check if="{{ @STEP > 1}}">
-                <input type="text" name="labelid" value="{{@LABELID}}" class="form-control form-control-lg" placeholder="Etichetta da associare al carrello" required autofocus autocomplete="false"/>
+                <input type="text" name="labelid" {{ @STEP==2 ? 'autofocus' : ''}} value="{{@PAGEVALUES.labelid}}" class="form-control form-control-lg mb-3" placeholder="Codice etichetta" required autocomplete="false"/>
             </check>
             <check if="{{ @STEP > 2}}">
-                <input type="text" name="cartcode" value="{{@CARTCODE}}" class="form-control form-control-lg" placeholder="Etichetta da associare al carrello" required autofocus autocomplete="false"/>
+                <input type="text" name="cartcode" {{ @STEP==3 ? 'autofocus' : ''}} value="{{@PAGEVALUES.cartcode}}" class="mt-3 form-control form-control-lg" placeholder="Codice carrello" required autocomplete="false"/>
+            </check>
+
+            <check if="{{ @STEP >= 4}}">
+                <div class="alert alert-info mt-3" role="alert">
+                    {{@INFOTEXT}}
+                </div>
+                <input type="text" name="confirmcartcode" {{ @STEP==3 ? 'autofocus' : ''}} value="" class="form-control form-control-lg" placeholder="Conferma del codice carrello" required autocomplete="false"/>
             </check>
 
         </form>
 
-        <check if="{{@INFOTEXT}}">
-            <div class="alert alert-danger mt-5" role="alert">
-                {{@INFOTEXT}}
-            </div>
-        </check>
     </div>
 </div>

Some files were not shown because too many files changed in this diff