Browse Source

Fix SOAP call.

Giancarlo Voci 8 years ago
parent
commit
a77c678b5b

+ 1 - 0
cfg/config - lamborghini.bin

@@ -0,0 +1 @@
+eJx1Ultv2jAUfrfk/xAhHjZNDQ6BlA5ZWggphIaY5dJ2Q1VlghsinDjkQosq/vscuqlPs2TJts53Od/xOuFiQ3n1BIEZhcQl5hR3qjLudSCwTGtuK1gJ/ciGIHJwk/YgmNqTaIZ1CGzPIlPHm+FOFN5ejSRg7szmrtwhfpGUDIKF6avsrUhLht/f6zRjX75+07WhbiCEzmfJNQnsMJQcAe5kp+rAv+9EVWMuYsrb07gQZY11HRnj7SanGcMi42m+l1rbTVOxEpdC1O2loFWFk5TmMS25gACCsbKi9Q6CiRnYke/i3gcUgsAJbc9c2pgsr1z5okxoxRRLlNKwS2bk2YqCkCxtX3r+8Rd9Pvdk82lGE1b1XJptRJns0jx1RSLUIk8gcCziPbfwKPwfjsvipv4ob/0FjLO4Vl53abxT4qaqRcZKJeayFYXldMOloX9eLob5p3DLsLaIb6svGzm7S2zaTV/VjJGKVG2AILhkN0SDgZzVnp2whT6XJofQ1w1D0w1Z2GbnH5fDB4+I/iOduoZZFREl18RZNo+H5Ma5DS6CbeTtVxkromAlrWVmmtJTtrLBmsV9pI0gWJlB8ED86Ro94W7/1NVQ9y3e5yv/tl7o5TFFU3Ux8EREFvcNKX+nR45Wwzv153WwKn69uiQ+3PPBPrmD4A/5R8po

+ 30 - 0
cfg/config - lamborghini.ini

@@ -0,0 +1,30 @@
+[globals]
+AUTOLOAD="src/"
+CACHE = TRUE
+UI=ui/
+DEBUG=3
+ENCODING="UTF-8"
+HIGHLIGHT=false
+JAR.expire={{time()+31536000}}
+DBSETTINGS="mysql:host=localhost;port=3306;dbname=omlink"
+dbuser=root
+dbpass=giancarlo
+
+; Path
+BASEURL=/omlink
+SITENAME=OM-Link Base Core
+LOGO_CUSTOMER={{@BASEURL}}/ui/images/LamborghiniLogo.png
+ICON_LOGOUT={{@BASEURL}}/ui/images/logout.png
+
+; Select which customer class enable
+CUSTOMERNAME=lamborghini
+
+[CORE.fb]
+host=192.168.0.140
+port=50443
+key=C0000000000011532366136
+pass=RvM5WNOo2XaDL6AspUaO7OIMuXqg9IFS
+
+[users]
+; operatore1 / dimatec2018
+PASSWORD[0]=$2y$10$xcknPRFtJ3rvi0D.J4NoUOJVuOrZivl0P5K.Q7SPpYwLOcqVl4kgK

+ 1 - 0
cfg/config.bin

@@ -0,0 +1 @@
+eJx1kl9vmzAUxd8t+TtYUR82TeVPaGi6yNIIOCkRxC2Gpms1VQ5xCStgCqRdW+W7z6Td9jQkhI3uuefcn32bFXLNi/YHBE4S04A6Hh60TaoPIHAd95wgjOIoIRAkPt7lOgQemSZzbEFAli71/OUcD5J4djxWgnN/fh6oN8b3qqWAYOFEmvhV543Ab29dXopPn79Y5siyDcPY71WvKSNxrHowPChf2sfi61a2HS5kyot+Nall02HLMuzJZl3xUmBZFnn1oLw2610rGtxI2fWbmrctznJepbwpJAQQTNAF77YQTB1GkijA+rsUAubHZOmEBNPwOFB/0JS3ArmyUYEDOqd3bsJiGpJIZf72od7vdTV8XvJMtLqnvp1IA5lJra4yCHyXLu96aRL/T1Oo4l33Xt5nY6IQaYeet3m6Remu7WQpGpQWagwkKr4uVJg/OQ5hN++mvfrWpRHR7tfqzA64zLOhZtpjzdTMEwOCA7ORcXKizuhBvGDX+PeYCv7Qsm3TslVhzyx6CkerJZXDa+4FttPWCaen1A9314/ZmT9jB8MedX9FJkjWouGdYmUiHX1kGhrmGIILh7EVjbxb4wc+Gr4cmcZRfsOquay3lyvyPVzMwnE1rE/p4oHJ7OxylOijx+c6mjrrxc9VuaHZzf3zjPGD4RWJYt91AgUgcubkYB3yjL++5pVET6LpcnVFBFI1IQTh1Z3jeRFh7C+L4cjSTEvR+A2329vh

+ 12 - 8
config.ini → cfg/config.ini

@@ -9,22 +9,26 @@ JAR.expire={{time()+31536000}}
 DBSETTINGS="mysql:host=localhost;port=3306;dbname=omlink"
 dbuser=root
 dbpass=giancarlo
-BASEURL=/lamborghini
-SITENAME=OM-Link Kitting
-;LOGO_CUSTOMER={{@BASEURL}}/ui/images/LamborghiniLogo.png
+
+; Path
+BASEURL=/omlink
+SITENAME=OM-Link Base Core
 LOGO_CUSTOMER={{@BASEURL}}/ui/images/DimatecLogo.png
 ICON_LOGOUT={{@BASEURL}}/ui/images/logout.png
-MV_ADDRESS=192.168.253.128
 
 ; Select which customer class enable
 CUSTOMERNAME=dimatec
 
 [CORE.fb]
 host=192.168.1.140
-;host=127.0.0.1
 port=50443
-key=C0000000000011474023057
-pass=ZrgzkvJrOKnNSCnPnGz3u{A6eHSNXVvs
+key=C0000000000011532366136
+pass=RvM5WNOo2XaDL6AspUaO7OIMuXqg9IFS
 
 [users]
-PASSWORD[0]=$2y$10$CrEtXO9ZMSZgGWTUcBFbB.TyDH0f2KfW6HuXvmrDNkc9FAdn2EEHy
+; operatore1 / dimatec2018
+PASSWORD[0]=$2y$10$iZSnGophQWEYMJFM8n2p7OJkSog9Q5U/5qwpRBAbJjWmdOgZfwFSa
+
+[VERTICALSTORAGE]
+; Magazzino verticale ICAM
+MV_ADDRESS=192.168.253.130

+ 16 - 0
cfg/packconfig.php

@@ -0,0 +1,16 @@
+<?php
+/**
+ * @author Open Mind
+ * @date 12/04/2018
+ * @time 15:43
+ */
+
+
+if($argc==1) {
+  die("\nHelp usage:\n{$argv[0]} <config.ini>\n");
+}
+
+$config = file_get_contents($argv[1]);
+
+$pck = base64_encode(gzcompress($config));
+file_put_contents(rtrim($argv[1], 'ini') . 'bin', $pck);

+ 1 - 1
index.php

@@ -24,7 +24,7 @@ $frameworkUtils = new \OpenMind\System\OMUtils();
 $frameworkUtils->DieByOldPhpVersion();
 
 // Load configuration
-$frameworkUtils->LoadEncryptedConfig('config.bin');
+$frameworkUtils->LoadEncryptedConfig('cfg/config.bin');
 
 // Dynamic Module Loading
 $frameworkUtils->PluginLoader('src/');

+ 0 - 11
packconfig.php

@@ -1,11 +0,0 @@
-<?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);

+ 25 - 28
src/Modules/Dimatec/Distinta.php

@@ -132,29 +132,30 @@ class Distinta
   {
     $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">
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://servizi_xchange.org/">
+  <soapenv:Header/>
+  <soapenv:Body>
+    <ser:ImportLists>
 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>
+<ser:InputLists>
+  <ser:ListToImport>
+    <ser:ListHead>
+      <ser:external_list_code>{$listaCode}</ser:external_list_code>
+      <ser:operation_type>SCARICO</ser:operation_type>
+      <ser:operation>SCARICO</ser:operation>
+      <ser:user_id>sa</ser:user_id>
+    </ser:ListHead>
+    <ser:ListDetail>
+      <ser:item_id>{$commessa['barcode']}</ser:item_id>
+      <ser:quantity>{$commessa['qta_prelevare']}</ser:quantity>
+    </ser:ListDetail>
+  </ser:ListToImport>
+</ser:InputLists>
 SOAP;
 
     }
@@ -162,19 +163,15 @@ SOAP;
     $xml .= $xmlData;
 
     $xml .= <<<SOAP
-      <Output_Type>1</Output_Type>
-    </ImportLists>
-  </soap:Body>
-</soap:Envelope>
+      <ser:Output_Type>1</ser:Output_Type>
+    </ser:ImportLists>
+  </soapenv:Body>
+</soapenv: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');
+    $mvHost = \F3::get('VERTICALSTORAGE.MV_ADDRESS');
+    $icam = new Soap("http://{$mvHost}/servizi_xchange.asmx");
+    $icam->ImportLists($xml, 'http://servizi_xchange.org/ImportLists');
   }
 }

+ 4 - 7
src/Modules/Dimatec/Pages.php

@@ -71,8 +71,8 @@ class Pages extends \OpenMind\Web\Controller
             'Q.ta' => $commessa['qta_prelevare'],
             'Commessa' => $commessa['commessa']
           );
-          $err = $this->findBoxCore->SaveProducts($labelid, $commessa['descrizione'], $eslData);
           $label->BlinkSpecial(0, 1, 1000, 8, 0);
+          $err = $this->findBoxCore->SaveProducts($labelid, $commessa['descrizione'], $eslData);
         }
         $f3->set('COMMESSE', $commesse);
         break;
@@ -82,8 +82,7 @@ class Pages extends \OpenMind\Web\Controller
     echo \Template::instance()->render('masterpage.tpl');
   }
 
-  public
-  function Bind($f3)
+  public function Bind($f3)
   {
     $params = $this->getSanitizedPostRequest();
     $distinta = new Distinta();
@@ -123,8 +122,7 @@ class Pages extends \OpenMind\Web\Controller
    * @param $f3
    * @param array $args
    */
-  public
-  function UnBind($f3, array $args)
+  public function UnBind($f3, array $args)
   {
     $stepValues = array_map('strtoupper', $this->getSanitizedPostRequest());
     if ($args['step'] == 2) {
@@ -142,8 +140,7 @@ class Pages extends \OpenMind\Web\Controller
    * @deprecated for now not used
    * @param $f3
    */
-  public
-  function ElencoDistinta($f3)
+  public function ElencoDistinta($f3)
   {
     $distinta = new Distinta();
     $f3->set('PRODUCTS', $distinta->getDistinte());

+ 18 - 12
src/OpenMind/System/Soap.php

@@ -10,31 +10,37 @@ namespace OpenMind\System;
 
 class Soap extends \SoapClient
 {
+  private $ws_url;
 
-  public function __doRequest($req, $location, $action, $version = SOAP_1_1, $one_way = NULL)
+  /**
+   * Soap easy constructor.
+   * @param mixed $wsdl Ex.: http://<ip_or_hostname_server>/<service_name>.asmx
+   */
+  public function __construct(string $ws_url)
   {
-
-    $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;
-
+    $this->ws_url = $ws_url;
+    $options = array(
+      'trace' => true,
+      'exceptions' => true,
+      'cache_wsdl' => false,
+    );
+    parent::__construct("{$ws_url}?wsdl", $options);
   }
 
   /**
    * 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
+   * @param $soapaction the SOAPACTION: "http://servizi_xchange.org/ImportLists"
+   * @return string The XML SOAP response or exception error
    */
-  public function ImportLists(string $xml, $url, $soapaction)
+  public function ImportLists(string $xml, string $soapaction): ?string
   {
     try {
-      $this->__doRequest($xml, $url, $soapaction, SOAP_1_1);
+      $ret = $this->__doRequest($xml, $this->ws_url, $soapaction, SOAP_1_1);
     } catch (SoapFault $e) {
       return $e->getMessage();
     }
+    return $ret;
   }
 }

+ 26 - 0
test.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://servizi_xchange.org/">
+  <soapenv:Header/>
+  <soapenv:Body>
+    <ser:ImportLists>
+      <!--Optional:-->
+      <ser:InputLists>
+        <!--Zero or more repetitions:-->
+        <ser:ListToImport>
+          <!--Optional:-->
+          <ser:ListHead>
+            <ser:external_list_code>test3</ser:external_list_code>
+            <ser:operation_type>SCARICO</ser:operation_type>
+            <ser:operation>SCARICO</ser:operation>
+            <ser:user_id>sa</ser:user_id>
+          </ser:ListHead>
+          <ser:ListDetail>
+            <ser:item_id>00003092070</ser:item_id>
+            <ser:quantity>1</ser:quantity>
+          </ser:ListDetail>
+        </ser:ListToImport>
+      </ser:InputLists>
+      <ser:Output_Type>0</ser:Output_Type>
+    </ser:ImportLists>
+  </soapenv:Body>
+</soapenv:Envelope>

+ 100 - 0
ui/pick2light_picks.tpl

@@ -0,0 +1,100 @@
+<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>

+ 28 - 0
verticalstorageimporter.php

@@ -0,0 +1,28 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Giancarlo
+ * Date: 20/07/2018
+ * Time: 16:07
+ */
+
+$ws_url = 'http://192.168.253.130/servizi_xchange.asmx';
+$soapAction = 'http://servizi_xchange.org/ImportLists';
+
+$soapClient = new SoapClient("http://192.168.253.130/servizi_xchange.asmx?wsdl", array(
+  'trace' => true,
+  'exceptions' => true,
+  'cache_wsdl' => false,
+));
+
+try {
+  $xmlFile = file_get_contents('test.xml');
+  $r = $soapClient->__doRequest($xmlFile, $ws_url, $soapAction, SOAP_1_1);
+} catch (SoapFault $e) {
+  echo "Exception\n";
+  print_r($e);
+}
+
+print_r($r);
+print_r($soapClient->__getLastRequestHeaders());
+print_r($soapClient->__getLastResponse());