|
|
@@ -5,8 +5,6 @@
|
|
|
* @time 11:43
|
|
|
*/
|
|
|
|
|
|
-define('MAX_RIGHE_CAMPI_CARRELLO', 30);
|
|
|
-
|
|
|
class Distinta
|
|
|
{
|
|
|
private $dbHandle;
|
|
|
@@ -148,7 +146,7 @@ EOF;
|
|
|
|
|
|
private function getArticoliByConsegna(string $consegna): array
|
|
|
{
|
|
|
- $sqlCommesse = "SELECT DISTINCT CONCAT(barcode, ' ', descrizione, ' ', qta_prelevare) FROM `distinta_esplosa` WHERE idutente={$this->userId} AND commessa = '{$consegna}'";
|
|
|
+ $sqlCommesse = "SELECT DISTINCT barcode, descrizione, qta_prelevare, anomalie FROM `distinta_esplosa` WHERE idutente={$this->userId} AND commessa = '{$consegna}'";
|
|
|
return $this->dbHandle->exec($sqlCommesse);
|
|
|
}
|
|
|
|
|
|
@@ -160,18 +158,14 @@ EOF;
|
|
|
$label = new \SmartESL($findBoxCore, [$labelId]);
|
|
|
$label->BlinkSpecial(0, 1, 1000, 8, 0);
|
|
|
|
|
|
- $elenco = [];
|
|
|
- for($i = 1; $i <= MAX_RIGHE_CAMPI_CARRELLO; $i++) {
|
|
|
- $fieldName = 'campo' . str_pad($i, 2, '0', STR_PAD_LEFT);
|
|
|
- $elenco[$fieldName] = '';
|
|
|
- }
|
|
|
-
|
|
|
- $dataFields = array_merge($elenco, array(
|
|
|
+ $dataFields = array(
|
|
|
'end_operations' => '',
|
|
|
'origine' => '',
|
|
|
'commessa' => '',
|
|
|
'ordine_produzione' => '',
|
|
|
- 'data_creazione' => ''));
|
|
|
+ 'data_creazione' => '',
|
|
|
+ 'xml' => '',
|
|
|
+ 'xslt' => '');
|
|
|
|
|
|
$findBoxCore->SaveProducts($labelId, '', $dataFields);
|
|
|
}
|
|
|
@@ -194,23 +188,56 @@ EOF;
|
|
|
$dataFields = array_shift($dataFields);
|
|
|
|
|
|
$articles = $this->getArticoliByConsegna($consegna);
|
|
|
- $joinFields = array_map('array_shift', $articles);
|
|
|
- $elenco = [];
|
|
|
- for($i = 1; $i <= MAX_RIGHE_CAMPI_CARRELLO; $i++) {
|
|
|
- $fieldName = 'campo' . str_pad($i, 2, '0', STR_PAD_LEFT);
|
|
|
- $elenco[$fieldName] = '';
|
|
|
- }
|
|
|
- foreach($joinFields as $i => $campo) {
|
|
|
- $fieldName = 'campo' . str_pad($i + 1, 2, '0', STR_PAD_LEFT);
|
|
|
- $elenco[$fieldName] = $campo;
|
|
|
+
|
|
|
+ $xmlField = '<?xml version="1.0" encoding="UTF-8"?><distinta>';
|
|
|
+
|
|
|
+ foreach($articles as $i => $articolo) {
|
|
|
+ $xmlField .= "<materiale anomalia=\"{$articolo['anomalie']}\"><barcode>{$articolo['barcode']}</barcode><description>{$articolo['descrizione']}</description><qta_prelevata>{$articolo['qta_prelevare']}</qta_prelevata><qta_prelevare>n/d</qta_prelevare></materiale>";
|
|
|
}
|
|
|
|
|
|
- $dataFields = array_merge($dataFields, $elenco);
|
|
|
+ $xmlField .= '</distinta>';
|
|
|
+ $xmlField = addslashes($xmlField);
|
|
|
+
|
|
|
+ $dataFields['xml'] = $xmlField;
|
|
|
+ /* $dataFields['xslt'] = <<<EOF
|
|
|
+ <?xml version="1.0" encoding="UTF-8"?>
|
|
|
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
|
+ <xsl:template match="/">
|
|
|
+ <svg xmlns="http://www.w3.org/2000/svg" width="640" height="384" viewBox="0 0 640 384">
|
|
|
+ <xsl:for-each select="distinta/materiale">
|
|
|
+ <xsl:if test="@anomalia='1'">
|
|
|
+ <xsl:variable name="posDeltaY" select="((position()-1)*15)+4"/>
|
|
|
+ <rect width="640" height="15px" y="{\$posDeltaY}px" style="fill:rgb(0,0,0)"/>
|
|
|
+ </xsl:if>
|
|
|
+ </xsl:for-each>
|
|
|
+ <text style="font-family: Tahoma; font-size: 8pt; font-weight: bold">
|
|
|
+ <xsl:for-each select="distinta/materiale">
|
|
|
+ <xsl:variable name="textcolor">
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="@anomalia='1'">
|
|
|
+ <xsl:value-of select="'white'"/>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:value-of select="'black'"/>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ </xsl:variable>
|
|
|
+ <tspan fill="{\$textcolor}" dy="15px" x="0"><xsl:value-of select="barcode"/></tspan>
|
|
|
+ <tspan fill="{\$textcolor}" x="90"><xsl:value-of select="substring(description, 1, 28)" /></tspan>
|
|
|
+ <tspan fill="{\$textcolor}" x="300"><xsl:value-of select="qta_prelevata" /></tspan>
|
|
|
+ <tspan fill="{\$textcolor}" x="330"><xsl:value-of select="qta_prelevare" /></tspan>
|
|
|
+ </xsl:for-each>
|
|
|
+ </text>
|
|
|
+ </svg>
|
|
|
+ </xsl:template>
|
|
|
+ </xsl:stylesheet>
|
|
|
+ EOF;*/
|
|
|
+
|
|
|
|
|
|
$dataFields['end_operations'] = $consegna;
|
|
|
|
|
|
$label = new \SmartESL($findBoxCore, [$labelId]);
|
|
|
- $findBoxCore->SaveProducts($barcode, $consegna, $dataFields);
|
|
|
+ $ret = $findBoxCore->SaveProducts($barcode, $consegna, $dataFields);
|
|
|
$label->BlinkSpecial(0, 1, 1000, 8, 0);
|
|
|
}
|
|
|
|