Browse Source

Dimatec DEMO Release

Giancarlo Voci 8 years ago
parent
commit
06d2c6e844

+ 1 - 0
config.ini

@@ -14,6 +14,7 @@ SITENAME=OM-Link Kitting
 ;LOGO_CUSTOMER={{@BASEURL}}/ui/images/LamborghiniLogo.png
 ;LOGO_CUSTOMER={{@BASEURL}}/ui/images/LamborghiniLogo.png
 LOGO_CUSTOMER={{@BASEURL}}/ui/images/DimatecLogo.png
 LOGO_CUSTOMER={{@BASEURL}}/ui/images/DimatecLogo.png
 ICON_LOGOUT={{@BASEURL}}/ui/images/logout.png
 ICON_LOGOUT={{@BASEURL}}/ui/images/logout.png
+MV_ADDRESS=192.168.253.128
 
 
 ; Select which customer class enable
 ; Select which customer class enable
 CUSTOMERNAME=dimatec
 CUSTOMERNAME=dimatec

+ 115 - 67
src/Modules/Dimatec/Distinta.php

@@ -7,9 +7,14 @@
 
 
 namespace Modules\Dimatec;
 namespace Modules\Dimatec;
 
 
+use OpenMind\System\Soap;
+
 class Distinta
 class Distinta
 {
 {
+  /** @var \DB\SQL $dbHandle */
   protected $dbHandle;
   protected $dbHandle;
+
+  /** @var int $userId */
   protected $userId;
   protected $userId;
 
 
   public function __construct()
   public function __construct()
@@ -18,84 +23,61 @@ class Distinta
     $this->userId = \F3::get('USERID');
     $this->userId = \F3::get('USERID');
   }
   }
 
 
-  public function setCommessaEnd(string $commessa) {
-    $this->dbMysql->exec("UPDATE `distinte` SET deleted=1 WHERE commessa='{$commessa}' AND idUtente={$this->userId} AND deleted=0");
+  /**
+   * Virtual delete commessa, set delete=1 in database only
+   *
+   * @param string $commessa
+   */
+  public function DeleteCommessa(string $commessa)
+  {
+    $this->dbHandle->exec("UPDATE `distinte` SET deleted=1 WHERE commessa='{$commessa}' AND idUtente={$this->userId} AND deleted=0");
   }
   }
 
 
   /**
   /**
-   * Clean table distinta_esplosa for current user
+   * Virtual delete all commesse of an user, set to delete=1 in database only
    */
    */
-  public function CleanDistintaTable()
+  public function DeleteAllCommesse()
   {
   {
-    $this->dbHandle->exec('UPDATE `distinte` SET deleted=1 WHERE idutente=' . $this->userId);
+    $this->dbHandle->exec("UPDATE `distinte` SET deleted=1 WHERE idUtente={$this->userId} AND deleted=0");
   }
   }
 
 
-  public function getListeToBind()
+  /**
+   * Check if commessa isn't deleted and present
+   *
+   * @param string $barcode
+   * @return bool
+   */
+  public function isCommessaPresent(string $barcode): bool
   {
   {
-    return $this->dbHandle->exec("SELECT DISTINCT commessa FROM `distinte` WHERE deleted=0 and idutente={$this->userId} AND commessa NOT IN (SELECT barcode FROM label_bindings) ORDER BY commessa");
+    return (count($this->dbHandle->exec("SELECT * FROM `distinte` WHERE `commessa` = '{$barcode}' AND `idUtente` = '{$this->userId}' AND `deleted` = '0'")) > 0);
   }
   }
 
 
   /**
   /**
-   * @param string $maxArticles the LIMIT mysql query parameter
-   * @param bool $blink true if need to blink
-   * @param int $iterations
+   * Retrieve all commesse associated to a Product
+   *
+   * @param string $barcode
+   * @return array
    */
    */
-  public function SaveProductsToFindBox(string $maxArticles, bool $blink, int $iterations = 20)
+  public function getCommesseFromProduct(string $barcode): array
   {
   {
-    $CORE_SETTINGS = \F3::get('CORE.fb');
-    $findBoxCore = new FindBoxCoreSystem(...array_values($CORE_SETTINGS));
-
-    $datiDistinta = $this->getDistinta($maxArticles);
-    foreach($datiDistinta as $row) {
-
-      $labelId = $this->GetLabelIdFromBarcode($row['barcode']);
-      if ($labelId != null) {
-
-        $datiBind = new \DB\SQL\Mapper($this->dbHandle, 'label_bindings');
-        $datiBind->load("label_id='{$labelId}'");
-
-        if (!$datiBind->dry()) {
-          $oldHash = md5(join('', [$datiBind->barcode, $datiBind->descrizione, $datiBind->barcode, $datiBind->qta_prelevare]));
-          $newHash = md5(join('', [$row['barcode'], $row['descrizione'], $row['barcode'], $row['qta_prelevare']]));
-          if ($oldHash <> $newHash) {
-            $dataFields = array(
-              'qr_code' => $row['barcode'],
-              'qta_prelevare' => $row['qta_prelevare']
-            );
-            $findBoxCore->SaveProducts($row['barcode'], $row['descrizione'], $dataFields);
-            $datiBind->copyfrom([
-              'barcode' => $row['barcode'],
-              'descrizione' => $row['descrizione'],
-              'qr_code' => $row['barcode'],
-              'qta_prelevare' => $row['qta_prelevare']
-            ]);
-            $datiBind->update();
-
-          }
-        }
-
-        if ($blink) {
-          $label = new SmartESL($findBoxCore, [$labelId]);
-          $label->BlinkSpecial(2, 1, 1000, $iterations, 0);
-        }
-      }
-    }
+    return $this->dbHandle->exec("SELECT * FROM `distinte` WHERE `barcode` = '{$barcode}' AND `idUtente` = '{$this->userId}' AND `deleted` = '0' ORDER BY `commessa`");
   }
   }
 
 
-  public function getDistinta(string $maxRows = '3')
+  public function getListeToBind()
   {
   {
-    return $this->dbHandle->exec("SELECT * FROM distinta_esplosa WHERE idutente={$this->userId} AND qta_prelevare>0 and anomalie=0 ORDER BY sequenza LIMIT {$maxRows}");
+    return $this->dbHandle->exec("SELECT DISTINCT commessa FROM `distinte` WHERE deleted=0 and idutente={$this->userId} AND commessa NOT IN (SELECT barcode FROM label_bindings) ORDER BY commessa");
   }
   }
 
 
-  public function GetLabelIdFromBarcode(string $barcode): ?string
+  public function getDistinta(string $maxRows = '3')
   {
   {
-    $label = $this->dbHandle->exec("SELECT label_id FROM `label_bindings` WHERE barcode='{$barcode}'");
-    if (count($label) > 0)
-      return $label[0]['label_id'];
-    return null;
+    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 MarkBarcodeAsAnomalia(string $barcode)
+  /**
+   * @param string $barcode
+   * @return array
+   */
+  public function MarkBarcodeAsAnomalia(string $barcode): array
   {
   {
     $CORE_SETTINGS = \F3::get('CORE.fb');
     $CORE_SETTINGS = \F3::get('CORE.fb');
     $findBoxCore = new FindBoxCoreSystem(...array_values($CORE_SETTINGS));
     $findBoxCore = new FindBoxCoreSystem(...array_values($CORE_SETTINGS));
@@ -107,20 +89,25 @@ class Distinta
     return $this->dbHandle->exec($sql);
     return $this->dbHandle->exec($sql);
   }
   }
 
 
-  public function RemoveQuantity(string $labelId)
-  {
-    $sql = "UPDATE distinta_esplosa d JOIN label_bindings b ON d.barcode = b.barcode SET d.qta_prelevare=d.qta_prelevare-1 WHERE idutente={$this->userId} AND b.barcode='{$labelId}' AND d.qta_prelevare>0";
-    $ret = $this->dbHandle->exec($sql);
-    return $ret;
-  }
-
-  public function GetArticleCount(string $barcode): int
+  /**
+   * Get quantity for article binded to label
+   *
+   * @param string $barcode
+   * @return int
+   */
+  public function getArticleCount(string $barcode): int
   {
   {
-    $sql = "SELECT d.qta_prelevare from distinta_esplosa d JOIN label_bindings b ON d.barcode = b.barcode WHERE idutente={$this->userId} AND b.barcode='{$barcode}'";
+    $sql = "SELECT d.qta_prelevare from distinta d JOIN label_bindings b ON d.barcode = b.barcode WHERE idutente={$this->userId} AND b.barcode='{$barcode}'";
     $record = $this->dbHandle->exec($sql);
     $record = $this->dbHandle->exec($sql);
-    return $record[0]['qta_prelevare'];
+    if (count($record) > 0)
+      return $record[0]['qta_prelevare'];
+    return 0;
   }
   }
 
 
+  /**
+   * @param string $labelId
+   * @return null|string
+   */
   public function GetBarcodeFromLabelId(string $labelId): ?string
   public function GetBarcodeFromLabelId(string $labelId): ?string
   {
   {
     $binding = $this->dbHandle->exec("SELECT barcode FROM `label_bindings` WHERE label_id='{$labelId}'");
     $binding = $this->dbHandle->exec("SELECT barcode FROM `label_bindings` WHERE label_id='{$labelId}'");
@@ -129,4 +116,65 @@ class Distinta
     return null;
     return null;
   }
   }
 
 
+  /**
+   * @param string $barcode
+   * @return null|string
+   */
+  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;
+  }
+
+  public function SendToIcamStorage(array $commesse)
+  {
+    $xml = <<<SOAP
+<?xml version="1.0" encoding="utf-8"?>
+<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+  <soap:Body>
+    <ImportLists xmlns="servizi_xchange">
+SOAP;
+
+    $xmlData = '';
+    foreach($commesse as $commessa) {
+      $listaCode = 'OpenMindTestList' . rand(10, 200);
+      $xmlData .= <<<SOAP
+<InputLists>
+  <ListToImport>
+    <ListHead>
+      <external_list_code>{$listaCode}</external_list_code>
+      <operation_type>VISUALIZZAZIONE</operation_type>
+      <operation>SCARICO</operation>
+      <user_id>sa</user_id>
+    </ListHead>
+    <ListDetail>
+      <item_id>{$commessa['barcode']}</item_id>
+      <quantity>{$commessa['qta_prelevare']}</quantity>
+    </ListDetail>
+  </ListToImport>
+</InputLists>
+SOAP;
+
+    }
+
+    $xml .= $xmlData;
+
+    $xml .= <<<SOAP
+      <Output_Type>1</Output_Type>
+    </ImportLists>
+  </soap:Body>
+</soap:Envelope>
+SOAP;
+
+
+    $mvHost = \F3::get('MV_ADDRESS');
+    $icam = new Soap("http://{$mvHost}/servizi_xchange.asmx?wsdl", array(
+      'trace' => true,
+      'exceptions' => true,
+      'cache_wsdl' => false,
+    ));
+    $icam->ImportLists($xml, "http://{$mvHost}/servizi_xchange.asmx", 'servizi_xchange/ImportLists');
+  }
 }
 }

+ 46 - 94
src/Modules/Dimatec/Pages.php

@@ -24,115 +24,66 @@ class Pages extends \OpenMind\Web\Controller
 
 
   public function Pick2Light(object $f3, array $args)
   public function Pick2Light(object $f3, array $args)
   {
   {
-    $stepValues = [];
-    if ($args['step'] == 1) {
-      $f3->clear('COOKIE.p2l');
-      $f3->clear('COOKIE.consegna');
-      $f3->clear('COOKIE.labelid');
-    } else {
-      $stepValues = array_map('strtoupper', $this->getSanitizedPostRequest());
-      if (count($stepValues) == 0)
-        $stepValues = json_decode($f3->get('COOKIE.p2l'), true);
-    }
+    $stepValues = array_map('strtoupper', $this->getSanitizedPostRequest());
 
 
     $distinta = new Distinta();
     $distinta = new Distinta();
 
 
     switch ($args['step']) {
     switch ($args['step']) {
-      case 3:
-        $distinta->CleanDistintaTable();
-        $distinta->CopyDistinta($stepValues['consegna']);
-
-        $label = new SmartESL($this->findBoxCore, [$stepValues['labelid']]);
-        $label->BlinkSpecial(0, 1, 1000, 8, 0);
+      case 1:
+        if (count($stepValues) == 0) {
+          $f3->clear('INFOTEXT');
+          $f3->clear('SESSION.barcode_mv');
+          $f3->set('NEXTSTEP', 1);
+          break;
+        }
 
 
-        $distinta->SaveProductsToFindBox('3', true, 50); // prende soltanto i primi 3 dalla tabella copia delle distinte
+        $commesse = $distinta->getCommesseFromProduct($stepValues['barcode_mv']);
+        if (count($commesse) == 0) {
+          $f3->set('INFOTEXT', "Nessuna commessa associata al prodotto selezionato");
+          $f3->set('NEXTSTEP', 1);
+          break;
+        }
+        $distinta->SendToIcamStorage($commesse);
 
 
-        $f3->set('COOKIE.p2l', json_encode($stepValues));
-        $f3->set('COOKIE.consegna', $stepValues['consegna']);
-        $f3->set('COOKIE.labelid', $stepValues['labelid']);
-        $f3->reroute("/pick2light/4");
+        $f3->set('SESSION.barcode_mv', $stepValues['barcode_mv']);
+        $f3->reroute("/pick2light/2");
         return;
         return;
         break;
         break;
-      case 4:
-        $distinta->SaveProductsToFindBox('3, 2000', false); // LIMIT 3,1000 perchè i primi 3 sono stati fatti nel case 3
-        break;
-      case 5:
-        $datiCommessa['consegna'] = $f3->get('COOKIE.consegna');
-        $datiCommessa['labelid'] = $f3->get('COOKIE.labelid');
-        $pickedBarcode = $f3->get('POST.pickedlabelid');
-        // Decrease quantity and blink label
-        if ($pickedBarcode != null) {
-          // ANOMALIA
-          if ($pickedBarcode == $f3->get('BARCODE_COMMANDS.ANOMALIACODE')) {
-            // <Se è stato ancora passato un codice anomalia, cancella l'operazione di anomalia in corso
-            if (isset($stepValues['anomalia']))
-              unset($stepValues['anomalia']);
-            else
-              $f3->set('ANOMALIA', 'In attesa del codice anomalia');
-            //>
-          } else if ($stepValues['anomalia']) {
-            if ($distinta->MarkBarcodeAsAnomalia($pickedBarcode))
-              unset($stepValues['anomalia']);
-            else
-              $f3->set('ANOMALIA', 'Codice non trovato!');
-          } else { // E' stato passato un codice
-            $codeFromLabelId = $distinta->GetBarcodeFromLabelId($pickedBarcode);
-            $pickedBarcode = $codeFromLabelId ?? $pickedBarcode;
-            if ($distinta->RemoveQuantity($pickedBarcode)) {
-              // SPEGNE LED ETICHETTA DOPO PICKING
-              $label = new SmartESL($this->findBoxCore, [$distinta->GetLabelIdFromBarcode($pickedBarcode)]);
-              $label->BlinkOff();
-            } else {
-              $f3->set('INFOTEXT', 'Barcode non riconosciuto o non associato ad alcuna etichetta elettronica');
-              file_put_contents('not_found.log', $pickedBarcode . "\r\n", FILE_APPEND);
-            }
+      case 2:
+        $f3->set('NEXTSTEP', 2);
+        if (isset($stepValues['commessa'])) {
+          $ok = $distinta->isCommessaPresent($stepValues['commessa']);
+          if (!$ok) {
+            $f3->set('INFOTEXT', "Codice cesta non corretto");
+          } else {
+            $distinta->DeleteCommessa($stepValues['commessa']);
           }
           }
         }
         }
-
-        $rowsDistinta = $distinta->getDistinta();
-        $f3->set('PRODUCTS', $rowsDistinta);
-        // End Picking List
-        if (count($rowsDistinta) == 0) {
-          //$distinta->ResetDistintaLabels($datiCommessa['consegna'], $datiCommessa['labelid']);
-          $anomalie = $distinta->getAnomalieFromConsegne($datiCommessa['consegna']);
-          $f3->set('LISTANOMALIE', $anomalie);
-
-          //$label = new SmartESL($this->findBoxCore, [$datiCommessa['labelid']]);
-          $distinta->SaveLabelCarrello($datiCommessa['labelid'], $datiCommessa['labelid'], $datiCommessa['consegna']);
-
-          // Se non ci sono anomalie torna alla homepage
-          if (count($anomalie) == 0) {
-            $f3->reroute('/');
-            return;
-          }
-        } else {
-          // Seleziona le prossime tre etichette
-          foreach($rowsDistinta as $rowDist) {
-            $labelId = $distinta->GetLabelIdFromBarcode($rowDist['barcode']);
-            if ($labelId != null) {
-              $label = new SmartESL($this->findBoxCore, [$labelId]);
-              // Se è lo stesso barcode di quello appena pickato dall'operatore, non lo blinka di nuovo
-              if ($distinta->GetArticleCount($rowDist['barcode']) > 0) {
-                $label->BlinkSpecial(2, 1, 1000, 20);
-              }
-            }
-          }
+        $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']);
+          $label = new SmartESL($this->findBoxCore, [$labelid]);
+          $eslData = array(
+            'Q.ta' => $commessa['qta_prelevare'],
+            'Commessa' => $commessa['commessa']
+          );
+          $err = $this->findBoxCore->SaveProducts($labelid, $commessa['descrizione'], $eslData);
+          $label->BlinkSpecial(0, 1, 1000, 8, 0);
         }
         }
+        $f3->set('COMMESSE', $commesse);
         break;
         break;
     }
     }
 
 
-    $f3->set('COOKIE.p2l', json_encode($stepValues));
-
-    $distinte = $distinta->getListeToBind();
-    $f3->set('DISTINTE', $distinte);
-    $f3->set('STEP', $args['step']);
-    $f3->set('PAGEVALUES', $stepValues);
-
     $f3->set('CONTENT', 'pick2light.tpl');
     $f3->set('CONTENT', 'pick2light.tpl');
     echo \Template::instance()->render('masterpage.tpl');
     echo \Template::instance()->render('masterpage.tpl');
   }
   }
 
 
-  public function Bind($f3)
+  public
+  function Bind($f3)
   {
   {
     $params = $this->getSanitizedPostRequest();
     $params = $this->getSanitizedPostRequest();
     $distinta = new Distinta();
     $distinta = new Distinta();
@@ -145,7 +96,6 @@ class Pages extends \OpenMind\Web\Controller
       $labelTemplateId = \F3::get("LABELS.TEMPLATES.DT31");
       $labelTemplateId = \F3::get("LABELS.TEMPLATES.DT31");
 
 
       $err = $label->Display($labelTemplateId, $bindData['labelid']);
       $err = $label->Display($labelTemplateId, $bindData['labelid']);
-      // TODO assegnare il template corretto ed i custom field
       $eslData = array(
       $eslData = array(
         'Q.ta' => 0,
         'Q.ta' => 0,
         'Commessa' => $bindData['commessa']
         'Commessa' => $bindData['commessa']
@@ -173,7 +123,8 @@ class Pages extends \OpenMind\Web\Controller
    * @param $f3
    * @param $f3
    * @param array $args
    * @param array $args
    */
    */
-  public function UnBind($f3, array $args)
+  public
+  function UnBind($f3, array $args)
   {
   {
     $stepValues = array_map('strtoupper', $this->getSanitizedPostRequest());
     $stepValues = array_map('strtoupper', $this->getSanitizedPostRequest());
     if ($args['step'] == 2) {
     if ($args['step'] == 2) {
@@ -191,7 +142,8 @@ class Pages extends \OpenMind\Web\Controller
    * @deprecated for now not used
    * @deprecated for now not used
    * @param $f3
    * @param $f3
    */
    */
-  public function ElencoDistinta($f3)
+  public
+  function ElencoDistinta($f3)
   {
   {
     $distinta = new Distinta();
     $distinta = new Distinta();
     $f3->set('PRODUCTS', $distinta->getDistinte());
     $f3->set('PRODUCTS', $distinta->getDistinte());

+ 1 - 1
src/OpenMind/Findbox/FindBoxCoreSystem.php

@@ -124,7 +124,7 @@ class FindBoxCoreSystem
   {
   {
     $product = json_encode([[[
     $product = json_encode([[[
       "barcode" => $barcode,
       "barcode" => $barcode,
-      "name1" => urlencode($name),
+      "name1" => $name,
       "datafields" => $dataFields
       "datafields" => $dataFields
     ]]]);
     ]]]);
 
 

+ 0 - 2
src/OpenMind/System/PluginStrategy.php

@@ -85,7 +85,6 @@ class PluginStrategy implements IPluginStrategy
 
 
   /**
   /**
    * Add menu to application for the plugin, if another menu with same $menuName is present, the last added has priority on other.
    * Add menu to application for the plugin, if another menu with same $menuName is present, the last added has priority on other.
-   * Use 'flex-line-break' as 'className' to break line.
    *
    *
    * @param string $menuName Name of menu to add
    * @param string $menuName Name of menu to add
    * @param array $options the struct of OMLink Menu
    * @param array $options the struct of OMLink Menu
@@ -95,7 +94,6 @@ class PluginStrategy implements IPluginStrategy
    * &nbsp;&nbsp;'menu_name' => 'Bind',<br/>
    * &nbsp;&nbsp;'menu_name' => 'Bind',<br/>
    * &nbsp;&nbsp;'url' => '/bind',<br/>
    * &nbsp;&nbsp;'url' => '/bind',<br/>
    * &nbsp;&nbsp;'isDisabled' => false<br/>
    * &nbsp;&nbsp;'isDisabled' => false<br/>
-   * &nbsp;&nbsp;'className' => 'flex-line-break'<br/>
    * ]
    * ]
    */
    */
   public function AddMenuItem(string $menuName, array $options)
   public function AddMenuItem(string $menuName, array $options)

+ 21 - 14
src/OpenMind/System/Soap.php

@@ -11,23 +11,30 @@ namespace OpenMind\System;
 class Soap extends \SoapClient
 class Soap extends \SoapClient
 {
 {
 
 
-  private $webServiceUrl;
-
-  public function __doRequest($req, $location, $action)
+  public function __doRequest($req, $location, $action, $version = SOAP_1_1, $one_way = NULL)
   {
   {
-    parent::__doRequest($req, $location, $action);
-    /*    $xml = explode("\r\n", parent::__doRequest($req, $location, $action, $version, $one_way));
-        $response = preg_replace('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/', "", $xml[0]);
-        return $response;*/
+
+    $xml = explode("\r\n", parent::__doRequest($req, $location, $action, $version, $one_way));
+    $response = preg_replace('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/', "", $xml[0]);
+    return $response;
+
   }
   }
 
 
-  public function __construct($webServiceUrl)
+  /**
+   * Send list to Soap Service
+   * return string error or null if successful
+   *
+   * @param string $xml The xml in string format
+   * @param $url the wsdl url service: "http://192.168.253.128/servizi_xchange.asmx?wsdl"
+   * @param $soapaction the SOAPACTION: "servizi_xchange/ImportLists"
+   * @return string
+   */
+  public function ImportLists(string $xml, $url, $soapaction)
   {
   {
-    $this->webServiceUrl = $webServiceUrl;
-    parent::__construct("{$webServiceUrl}?wsdl", array(
-      'trace' => true,
-      'exceptions' => true,
-      'cache_wsdl' => false,
-    ));
+    try {
+      $this->__doRequest($xml, $url, $soapaction, SOAP_1_1);
+    } catch (SoapFault $e) {
+      return $e->getMessage();
+    }
   }
   }
 }
 }

+ 0 - 49
test.php

@@ -1,49 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: softw
- * Date: 24/04/2018
- * Time: 14:29
- */
-
-
-require 'vendor/autoload.php';
-
-$f3 = \Base::instance();
-
-$config = gzuncompress(base64_decode(file_get_contents("config.bin")));
-$tmpcfg = $f3->get('TEMP') . 'cnf';
-file_put_contents($tmpcfg, $config);
-$f3->config($tmpcfg, true);
-unlink($tmpcfg);
-
-$f3->config('labels.ini', true);
-
-$f3->set('DB',
-  new \DB\SQL(
-    $f3->get('DBSETTINGS'),
-    $f3->get('dbuser'),
-    $f3->get('dbpass'),
-    array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_PERSISTENT => TRUE))
-);
-
-$CORE_SETTINGS = $f3->get('CORE.fb');
-$findBoxCore = new FindBoxCoreSystem(...array_values($CORE_SETTINGS));
-
-$db = $f3->get('DB');
-$articles = $db->exec('SELECT * FROM ARTICLES');
-
-foreach($articles as $articolo) {
-  $dataFields = array(
-    'tipo_magazzino' => $articolo['tipo_magazzino'],
-    'ubicazione' => $articolo['ubicazione'],
-    'incc_intr' => $articolo['incc_intr']
-  );
-  $dataFields = array_merge($dataFields, array(
-    'quantita_contenitore' => $articolo['qta_contenitore'],
-    'quantita_magazzino' => $articolo['qta_riordino']
-  ));
-  echo "{$articolo['materiale']} {$articolo['descrizione']} {$dataFields['tipo_magazzino']} {$dataFields['ubicazione']} {$dataFields['incc_intr']} {$dataFields['quantita_contenitore']} {$dataFields['quantita_magazzino']}\r\n";
-
-  //$findBoxCore->SaveProducts($stepValues['barcode'], $articles['descrizione'], $dataFields);
-}

+ 0 - 22
test.xml

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
-  <soap:Body>
-    <ImportLists xmlns="servizi_xchange">
-      <InputLists>
-        <ListToImport>
-          <ListHead>
-            <external_list_code>test3</external_list_code>
-            <operation_type>VISUALIZZAZIONE</operation_type>
-            <operation>SCARICO</operation>
-            <user_id>sa</user_id>
-          </ListHead>
-          <ListDetail>
-            <item_id>00003092070</item_id>
-            <quantity>1</quantity>
-          </ListDetail>
-        </ListToImport>
-      </InputLists>
-      <Output_Type>1</Output_Type>
-    </ImportLists>
-  </soap:Body>
-</soap:Envelope>

+ 3 - 1
ui/bind.tpl

@@ -2,6 +2,7 @@
 	<div class="col-md-5 align-self-center">
 	<div class="col-md-5 align-self-center">
 		<div>
 		<div>
 
 
+			{*Tabella elenco commesse*}
 			<table class="table table-sm table-striped table-light">
 			<table class="table table-sm table-striped table-light">
 				<thead class="bg-secondary">
 				<thead class="bg-secondary">
 				<tr>
 				<tr>
@@ -11,11 +12,12 @@
 				<tbody>
 				<tbody>
 				<repeat group="{{ @LISTE }}" key="{{@key}}" value="{{ @LISTA }}">
 				<repeat group="{{ @LISTE }}" key="{{@key}}" value="{{ @LISTA }}">
 					<tr>
 					<tr>
-						<td {{(@key==0)? 'class="blink bg-success text-white font-weight-bold"': ''}}>{{@LISTA.commessa}}</td>
+						<td {{(@key==0)? 'class="blink bg-success text-black font-weight-bold"': ''}}>{{@LISTA.commessa}}</td>
 					</tr>
 					</tr>
 				</repeat>
 				</repeat>
 				</tbody>
 				</tbody>
 			</table>
 			</table>
+
 		</div>
 		</div>
 		<form class="form" method="post" action="{{@BASEURL}}/bind">
 		<form class="form" method="post" action="{{@BASEURL}}/bind">
 			<input type="hidden" value="{{@ORDINE}}" hidden name="commessa"/>
 			<input type="hidden" value="{{@ORDINE}}" hidden name="commessa"/>

+ 18 - 33
ui/css/omlink.css

@@ -22,8 +22,8 @@ html, body {
 }
 }
 
 
 body {
 body {
-  background-color: white !important;
-  color: black !important;
+  background-color: white;
+  color: black;
   font-family: "Roboto";
   font-family: "Roboto";
 }
 }
 
 
@@ -56,26 +56,31 @@ input[type="text"]:focus, input[type="password"]:focus {
   color: #ffd242 !important;
   color: #ffd242 !important;
 }
 }
 */
 */
-input {
-  border-color: #3c3e77 !important;
-  color: #e6e6e6 !important;
+/*input {
+  border-color: darken($inputBgColor, 10%);
+  color: darken($inputColor, 10%);
 }
 }
 
 
 input:focus {
 input:focus {
-  background-color: #4d5099 !important;
-  border-color: white !important;
-}
-
+  background-color: $inputBgColor !important;
+  border-color: $inputColor !important;
+}*/
 .form-control, .btn {
 .form-control, .btn {
   background-color: #4d5099 !important;
   background-color: #4d5099 !important;
   color: white !important;
   color: white !important;
 }
 }
 
 
 .form-control:focus, .btn:focus {
 .form-control:focus, .btn:focus {
+  background-color: #6063af !important;
   border-color: #3c3e77 !important;
   border-color: #3c3e77 !important;
   box-shadow: 0 0 10px #4d5099 !important;
   box-shadow: 0 0 10px #4d5099 !important;
 }
 }
 
 
+.form-control:disabled {
+  color: #e6e6e6 !important;
+  background-color: #3f427e !important;
+}
+
 .debugborder {
 .debugborder {
   border: 1px solid red !important;
   border: 1px solid red !important;
 }
 }
@@ -105,44 +110,24 @@ input::-ms-input-placeholder {
   background-color: rgba(94, 103, 178, 0.95) !important;
   background-color: rgba(94, 103, 178, 0.95) !important;
 }
 }
 
 
-.flex-line-break {
-  width: 100%;
-}
-
 .rounded {
 .rounded {
   border-radius: 15px !important;
   border-radius: 15px !important;
 }
 }
 
 
 @keyframes blink {
 @keyframes blink {
   0% {
   0% {
-    -webkit-opacity: 0;
-    -moz-opacity: 0;
-    -ms-opacity: 0;
-    -o-opacity: 0;
-    opacity: 0;
+    background-color: #afecbd;
   }
   }
   100% {
   100% {
-    -webkit-opacity: 1;
-    -moz-opacity: 1;
-    -ms-opacity: 1;
-    -o-opacity: 1;
-    opacity: 1;
+    background-color: #1e7e34;
   }
   }
 }
 }
 @-webkit-keyframes blink {
 @-webkit-keyframes blink {
   0% {
   0% {
-    -webkit-opacity: 0;
-    -moz-opacity: 0;
-    -ms-opacity: 0;
-    -o-opacity: 0;
-    opacity: 0;
+    background-color: #afecbd;
   }
   }
   100% {
   100% {
-    -webkit-opacity: 1;
-    -moz-opacity: 1;
-    -ms-opacity: 1;
-    -o-opacity: 1;
-    opacity: 1;
+    background-color: #1e7e34;
   }
   }
 }
 }
 .blink {
 .blink {

+ 18 - 12
ui/css/omlink.scss

@@ -68,15 +68,15 @@ input[type="text"]:focus, input[type="password"]:focus {
 }
 }
 */
 */
 
 
-input {
-  border-color: darken($inputBgColor, 10%) !important;
-  color: darken($inputColor, 10%) !important;
+/*input {
+  border-color: darken($inputBgColor, 10%);
+  color: darken($inputColor, 10%);
 }
 }
 
 
 input:focus {
 input:focus {
   background-color: $inputBgColor !important;
   background-color: $inputBgColor !important;
   border-color: $inputColor !important;
   border-color: $inputColor !important;
-}
+}*/
 
 
 .form-control, .btn {
 .form-control, .btn {
   background-color: $inputBgColor !important;
   background-color: $inputBgColor !important;
@@ -85,10 +85,16 @@ input:focus {
 
 
 .form-control:focus, .btn:focus {
 .form-control:focus, .btn:focus {
 //  border-color: #c5ac0f !important;
 //  border-color: #c5ac0f !important;
+  background-color: lighten($inputBgColor, 8%) !important;
   border-color: darken($inputBgColor, 10%) !important;
   border-color: darken($inputBgColor, 10%) !important;
   box-shadow: 0 0 10px $inputBgColor !important;
   box-shadow: 0 0 10px $inputBgColor !important;
 }
 }
 
 
+.form-control:disabled {
+  color: darken($inputColor, 10%) !important;
+  background-color: darken($inputBgColor, 8%) !important;
+}
+
 .debugborder {
 .debugborder {
   border: 1px solid red !important;
   border: 1px solid red !important;
 }
 }
@@ -118,10 +124,6 @@ input::-ms-input-placeholder {
   background-color: $navbarsColor;
   background-color: $navbarsColor;
 }
 }
 
 
-.flex-line-break {
-  width: 100%;
-}
-
 .rounded {
 .rounded {
   border-radius: 15px !important;
   border-radius: 15px !important;
 }
 }
@@ -135,19 +137,23 @@ input::-ms-input-placeholder {
 // Blink Effect
 // Blink Effect
 @keyframes blink {
 @keyframes blink {
   0% {
   0% {
-    @include prefix(opacity, 0);
+   // @include prefix(opacity, 0);
+    background-color: lighten(#28a745, 40%);
   }
   }
   100% {
   100% {
-    @include prefix(opacity, 1);
+   // @include prefix(opacity, 1);
+    background-color: darken(#28a745, 10%);
   }
   }
 }
 }
 
 
 @-webkit-keyframes blink {
 @-webkit-keyframes blink {
   0% {
   0% {
-    @include prefix(opacity, 0);
+    // @include prefix(opacity, 0);
+    background-color: lighten(#28a745, 40%);
   }
   }
   100% {
   100% {
-    @include prefix(opacity, 1);
+    // @include prefix(opacity, 1);
+    background-color: darken(#28a745, 10%);
   }
   }
 }
 }
 
 

+ 2 - 2
ui/customizations/dimatec.scss

@@ -7,10 +7,10 @@
  */
  */
 
 
 // Background color
 // Background color
-$mainColor: white !important;
+$mainColor: white;
 
 
 // Main text color
 // Main text color
-$textColor: black !important;
+$textColor: black;
 
 
 // Upper and Lower navbar background color
 // Upper and Lower navbar background color
 $navbarsColor: rgba(94, 103, 178, 0.95) !important;
 $navbarsColor: rgba(94, 103, 178, 0.95) !important;

+ 1 - 0
ui/js/omlink.js

@@ -8,6 +8,7 @@
 
 
 $(function(){
 $(function(){
   $('form').on('submit', function () {
   $('form').on('submit', function () {
+    $('form input,select').prop('disabled', false);
     setTimeout(function () {
     setTimeout(function () {
       $('form input,select').prop('disabled', true);
       $('form input,select').prop('disabled', true);
     }, 500);
     }, 500);

+ 52 - 19
ui/pick2light.tpl

@@ -1,21 +1,54 @@
 <div class="row h-100 justify-content-center w-100">
 <div class="row h-100 justify-content-center w-100">
-  <check if="{{ @STEP < 4 }}">
-    <div class="col-md-5 align-self-center">
-      <form class="form" method="post" action="{{@BASEURL}}/pick2light/{{@STEP+1}}">
-        <input type="submit" hidden id="submitform"/>
-          <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 if="{{ isset(@INFOTEXT) }}">
-          <div class="alert alert-info mt-3" role="alert">
-            {{@INFOTEXT}}
-          </div>
-        </check>
-      </form>
-    </div>
-  </check>
-  <check if="{{ @STEP == 4 }}">
-    <include href="pick2light_savingproducts.tpl"/>
-  </check>
-  <check if="{{ @STEP == 5 }}">
-    <include href="pick2light_picks.tpl"/>
-  </check>
+	<div class="col-xs-12 col-md-9 col-lg-5 align-self-center">
+		<form class="form" method="post" action="{{@BASEURL}}/pick2light/{{@NEXTSTEP}}">
+			<check if="{{ isset(@INFOTEXT) }}">
+				<div class="alert alert-danger" role="alert">
+					{{@INFOTEXT}}
+				</div>
+			</check>
+			<div class="alert alert-info" role="alert">
+				Inizio ventilazione
+			</div>
+			<input type="submit" hidden id="submitform"/>
+
+			{*Elenco commesse/ceste*}
+			<check if="{{@PARAMS['step'] == 2 }}">
+
+				<table class="table table-sm table-striped table-light">
+					<thead class="bg-secondary">
+					<tr>
+						<th class="text-center text-uppercase text-white" scope="col">In attesa del completamento delle seguenti ceste</th>
+					</tr>
+					</thead>
+					<tbody>
+					<repeat group="{{ @COMMESSE }}" key="{{@key}}" value="{{ @COMMESSA }}">
+						<tr>
+							<td>{{@COMMESSA.commessa}}</td>
+						</tr>
+					</repeat>
+					</tbody>
+				</table>
+
+			</check>
+
+			{*Barcode prodotto*}
+			<input type="text" name="barcode_mv" {{@PARAMS['step']==2 ? 'disabled' : ''}} {{@PARAMS['step']==1 ? 'autofocus' : ''}} value="{{@SESSION.barcode_mv}}" class="form-control form-control-lg mb-3" placeholder="Codice Prodotto del Magazzino Verticale." required autocomplete="false"/>
+
+			{*Codice cesta per la quale mi aspetto che avvenga la ventilazione*}
+			<check if="{{ @PARAMS['step'] == 2 }}">
+				<input type="text" name="commessa" {{@PARAMS['step']==2 ? 'autofocus' : ''}} value="" class="form-control form-control-lg mb-3" placeholder="Codice Cesta" required autocomplete="false"/>
+			</check>
+
+		</form>
+	</div>
 </div>
 </div>
+
+<check if="{{@RESTART_VENTILAZIONE}}">
+	<true>
+		<script>
+      setTimeout(() => {
+        window.location.href = "{{@BASEURL}}/pick2light/1";
+      }, 5000);
+		</script>
+	</true>
+</check>

+ 0 - 100
ui/pick2light_picks.tpl

@@ -1,100 +0,0 @@
-<div class="col-md-8 align-self-center">
-
-  <check if="{{ !isset(@LISTANOMALIE) }}">
-    <div class="alert alert-warning mt-3 text-center" role="alert">
-      PICKING ATTIVO!!
-    </div>
-
-    <form class="form" method="post" action="{{@BASEURL}}/pick2light/{{@STEP}}">
-      <input type="submit" hidden id="submitform"/>
-      <check if="{{ isset(@ANOMALIA) }}">
-        <input type="hidden" hidden name="anomalia" value="1"/>
-      </check>
-      <input type="text" name="pickedlabelid" autofocus class="form-control form-control mb-3" placeholder="Prodotto" required autocomplete="false"/>
-    </form>
-  </check>
-
-  <check if="{{ isset(@ANOMALIA) }}">
-    <div class="alert alert-light mt-3 text-center" role="alert">
-      {{@ANOMALIA}}
-    </div>
-  </check>
-
-  <check if="{{ isset(@INFOTEXT) }}">
-    <div class="alert alert-danger mt-3 text-center" role="alert">
-      {{@INFOTEXT}}
-    </div>
-  </check>
-
-  <check if="{{ count(@PRODUCTS) }}">
-    <true>
-      <div class="table-responsive" style="max-height: 400px; overflow-y: auto">
-        <table class="table table-striped table-dark">
-          <thead>
-          <tr>
-            <th class="text-center text-uppercase" colspan="6" scope="col">Articoli da prelevare</th>
-          </tr>
-          </thead>
-          <thead>
-          <tr>
-            <th scope="col">Barcode</th>
-            <th scope="col">Descrizione</th>
-            <th scope="col">Origine</th>
-            <th scope="col">Ubicazione</th>
-            <th scope="col">Quantità</th>
-            <th scope="col">Sequenza</th>
-          </tr>
-          </thead>
-          <tbody>
-          <repeat group="{{ @PRODUCTS }}" value="{{ @PRODUCT }}">
-            <tr>
-              <th scope="row">{{@PRODUCT.barcode}}</th>
-              <td>{{@PRODUCT.descrizione}}</td>
-              <td>{{@PRODUCT.origine}}</td>
-              <td>{{@PRODUCT.ubicazione}}</td>
-              <td>{{@PRODUCT.qta_prelevare}}</td>
-              <td>{{@PRODUCT.sequenza}}</td>
-            </tr>
-          </repeat>
-          </tbody>
-        </table>
-      </div>
-    </true>
-    <false>
-      <check if="{{ isset(@LISTANOMALIE) }}">
-        <false>
-          <div class="alert alert-success mt-3 text-center" role="alert">
-            Picking list terminata.
-          </div>
-        </false>
-        <true>
-          <div class="table-responsive" style="max-height: 400px; overflow-y: auto">
-            <table class="table table-striped table-dark">
-              <thead>
-              <tr>
-                <th style="color: red" class="text-center text-uppercase" colspan="6" scope="col">Anomalie presenti</th>
-              </tr>
-              </thead>
-              <thead>
-              <tr>
-                <th scope="col">Barcode</th>
-                <th scope="col">Descrizione</th>
-                <th scope="col">Quantità</th>
-              </tr>
-              </thead>
-              <tbody>
-              <repeat group="{{ @LISTANOMALIE }}" value="{{ @PRODUCT }}">
-                <tr>
-                  <th scope="row">{{@PRODUCT.barcode}}</th>
-                  <td>{{@PRODUCT.descrizione}}</td>
-                  <td>{{@PRODUCT.qta_prelevare}}</td>
-                </tr>
-              </repeat>
-              </tbody>
-            </table>
-          </div>
-        </true>
-      </check>
-    </false>
-  </check>
-</div>

+ 0 - 13
ui/pick2light_savingproducts.tpl

@@ -1,13 +0,0 @@
-<div class="col-md-10 align-self-center">
-  <div class="progress" style="height: 50px">
-    <div class="progress-bar progress-bar-striped progress-bar-animated bg-warning" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%; color: black; font-size: 15pt">
-      Salvataggio prodotti, attendere prego
-    </div>
-  </div>
-  <script>
-    setTimeout(function () {
-      window.location.href = "{{@BASEURL}}/pick2light/5"
-    }, 2000)
-  </script>
-
-</div>

+ 0 - 38
verticalstorageimporter.php

@@ -1,38 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: Giancarlo
- * Date: 20/07/2018
- * Time: 16:07
- */
-
- 
- class SoapClientNG extends \SoapClient{
-
-  public function __doRequest($req, $location, $action, $version = SOAP_1_1, $one_way = NULL) {
-
-    $xml = explode("\r\n", parent::__doRequest($req, $location, $action, $version, $one_way));
-    $response = preg_replace( '/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/', "", $xml[0] );
-    return $response;
-
-  }
-
-} 
-
-$soapClient = new SoapClient("http://192.168.253.128/servizi_xchange.asmx?wsdl", array(
-  'trace' => true,
-  'exceptions' => true,
-  'cache_wsdl' => false,
-));
-
-
-try {
-  $r = $soapClient->__doRequest(file_get_contents('test.xml'), 'http://192.168.253.128/servizi_xchange.asmx', 'servizi_xchange/ImportLists', SOAP_1_1);
-} catch (SoapFault $e) {
-  echo "Exception\n";
-  print_r($e);
-  echo "Response\n";
-  print_r($soapClient->__getLastResponse());
-}
-
-print_r($r);

+ 10 - 5
watcher.js

@@ -3,12 +3,12 @@ var { exec } = require('child_process');
 
 
 var twiceFix = false;
 var twiceFix = false;
 
 
-function compileSASS(event, fname) {
+function compileAll(event, fname) {
   console.log(`${fname} as changed`);
   console.log(`${fname} as changed`);
   if(event == 'change' && twiceFix) {
   if(event == 'change' && twiceFix) {
     twiceFix = false;
     twiceFix = false;
     exec('sass ui/css/omlink.scss:ui/css/omlink.css', (error, out, err) => {
     exec('sass ui/css/omlink.scss:ui/css/omlink.css', (error, out, err) => {
-      console.log('------------------------------ compileSASS() ------------------------------');
+      console.log('------------------------------ compileAll() ------------------------------');
       if(error) {
       if(error) {
         console.log(error);
         console.log(error);
         return;
         return;
@@ -21,15 +21,20 @@ function compileSASS(event, fname) {
 
 
 console.log('Adding watcher for ui/css/omlink.scss');
 console.log('Adding watcher for ui/css/omlink.scss');
 fs.watch('ui/css/omlink.scss', function(event, fname) {
 fs.watch('ui/css/omlink.scss', function(event, fname) {
-  compileSASS(event, fname);
+  compileAll(event, fname);
 });
 });
 
 
 console.log('Adding watcher for ui/customizations/dimatec.scss');
 console.log('Adding watcher for ui/customizations/dimatec.scss');
 fs.watch('ui/customizations/dimatec.scss', function(event, fname) {
 fs.watch('ui/customizations/dimatec.scss', function(event, fname) {
-  compileSASS(event, fname);
+  compileAll(event, fname);
 });
 });
 
 
 console.log('Adding watcher for ui/customizations/lamborghini.scss');
 console.log('Adding watcher for ui/customizations/lamborghini.scss');
 fs.watch('ui/customizations/lamborghini.scss', function(event, fname) {
 fs.watch('ui/customizations/lamborghini.scss', function(event, fname) {
-  compileSASS(event, fname);
+  compileAll(event, fname);
+});
+
+console.log('Adding watcher for ui/js/onlink.js');
+fs.watch('ui/js/omlink.js', function(event, fname) {
+  compileAll(event, fname);
 });
 });