Jump to content

Bramhowl

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by Bramhowl

  1. Ow, ok, thanks I got it. There's no error, the code just "refresh" the page when I press the submit button. I have no clue for data matching, I guess I'm so far from my goal...
  2. Thanks for the reply 😃 For the code, you mean like this? <?php echo "<form id='form_id' method='post' name='form'>"; $conn = odbc_connect('DB_FLUENTIS', 'Calistri', 'Calistri2020'); ... echo"<option>| $ord_id | $ord_anno | $ord_ordine | $ord_lotto | $ord_desc | $mgaa_matr</option>"; echo"<option>$ord_id</option>"; } echo"</select>"; echo"<br>"; echo'<button type="button" class="qrcode-reader" id="openreader-single" data-qrr-target="#single" data-qrr-audio-feedback="false" data-qrr-qrcode-regexp="^https?:\/\/"><img style="width:20%;" src="img/qr1.png"></button>'; echo"<input id=single>"; echo"<br>"; echo'<img src="img/compara.png" class="piccolo">'; echo"<br>"; echo "<input id='submit' name='post' type='submit' value='submit'>"; ?>
  3. After dropdown selection and qr code scan -scan result is referred to production year-, press the submit button ("MANDALA") to match data. I've tried to do this but maybe is too much for me. There's no error message, nothing just happen. Thanks in advance.
  4. Good morning. I'm doing this project but I'm stuck when the app need to match the dropdown result with the scan result of qr code. What should I do? Thanks in advance to everyone. <!doctype html> <html dir=ltr style="overflow-x: hidden;padding: 0px;width: 100%;"> <head> <meta charset=utf-8> <meta http-equiv=X-UA-Compatible content="IE=edge"> <meta name=viewport content="width=device-width, initial-scale=1"> <title></title> <meta name="description" content=""> <meta name="author" content="SoftMat"> <link media="all" href="css/style.css" rel="stylesheet" /> <!-- qrcode-reader core CSS file --> <link rel="stylesheet" href="css/qrcode-reader.min.css"> <!-- jQuery --> <script src="js/jquery.min.js"></script> <!-- qrcode-reader core JS file --> <script src="js/qrcode-reader.min.js"></script> <script> $(function(){ // overriding path of JS script and audio $.qrCodeReader.jsQRpath = "js/jsQR.min.js"; $.qrCodeReader.beepPath = "audio/sound.mp3"; // bind all elements of a given class $(".qrcode-reader").qrCodeReader(); // bind elements by ID with specific options $("#openreader-multi2").qrCodeReader({multiple: true, target: "#multiple2", skipDuplicates: false}); $("#openreader-multi3").qrCodeReader({multiple: true, target: "#multiple3"}); // read or follow qrcode depending on the content of the target input $("#openreader-single2").qrCodeReader({callback: function(code) { if (code) { window.location.href = code; } }}).off("click.qrCodeReader").on("click", function(){ var qrcode = $("#single2").val().trim(); if (qrcode) { window.location.href = qrcode; } else { $.qrCodeReader.instance.open.call(this); } }); }); </script> </head> <body> <div align="center" class="container"> <div align="center" class="col-xs-12"> <div align="center" class="container" style="background-color:white; box-shadow:0px 2px #00000085;"> <img style="margin-top:15px; margin-bottom:15px;" src="img/logo.png"> </div> <div align="center" class="col-xs-12" style="background-image: url(img/blakcstonemain.png); background-repeat:no-repeat; background-position:center; background-size: cover; margin-top:10px;"> <br> <!--Lavorazione : Scelta OP--> <h1 style="margin-bottom: 0px;">Seleziona Ordine di Produzione</h1> <?php $conn = odbc_connect('', '', ''); if(! $conn){ print( "..." ); exit; } //definisco gli ordini di produzione $sql="SELECT * FROM dbo.OP_Ordini LEFT JOIN dbo.MG_AnaART ON dbo.OP_Ordini.OPOR_MGAA_Id = dbo.MG_AnaArt.MGAA_Id "; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Errore nella tabella!");} echo"<center>"; echo"<br>"; echo"<select>"; echo"<option>--ORDINI--</option>"; while(odbc_fetch_row($rs)) { $ord_id=odbc_result($rs,"OPOR_Id"); $ord_anno=odbc_result($rs,"OPOR_Anno"); $ord_ordine=odbc_result($rs,"OPOR_Ordine"); $ord_lotto=odbc_result($rs,"OPOR_Lotto"); $ord_desc=odbc_result($rs,"OPOR_Descr"); $mgaa_matr=odbc_result($rs,"MGAA_Matricola"); echo"<option>| $ord_id | $ord_anno | $ord_ordine | $ord_lotto | $ord_desc | $mgaa_matr</option>"; } echo"</select>"; echo"<br>"; echo"<br>"; ?> <!--Lavorazione : Scansione--> <div align="center" class="col-xs-12"> <h1 style="margin-bottom: 0px;">Scansione Materiale</h1> <br> <label for="single"></label> <input id="single" type="text" size="50"> <button type="button" class="qrcode-reader" id="openreader-single" data-qrr-target="#single" data-qrr-audio-feedback="false" data-qrr-qrcode-regexp="^https?:\/\/"><img style="width:20%;" src="img/qr1.png"></button> <!--Lavorazione : Matching--> <h1 style="margin-bottom: 0px;">Esamina</h1> <img style="width:20%;" src="img/compara.png"> <input id="submit" type="submit" value="MANDALA!"> <!--<video id="preview" class="p-1 border" style="width:75%;border: solid #d34836;box-shadow: 5px 5px #000000a6;"></video>--> </div> </div> </div> </div> </body> </html>
  5. Good morning! Here's my code. I've updated the project and I've cutted off the second dropdown for the material selection. Everything, now, is on the first dropdown. -sel_op.php- <?php $conn = odbc_connect('', '', ''); if(! $conn){ print( "error..." ); exit; } //definisco gli ordini di produzione $sql="SELECT * FROM dbo.OP_Ordini LEFT JOIN dbo.MG_AnaART ON dbo.OP_Ordini.OPOR_MGAA_Id = dbo.MG_AnaArt.MGAA_Id "; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error!");} echo"<center>"; echo"<br>"; echo"<select>"; echo"<option>--ORDERS--</option>"; while(odbc_fetch_row($rs)) { $ord_id=odbc_result($rs,"OPOR_Id"); $ord_anno=odbc_result($rs,"OPOR_Anno"); $ord_ordine=odbc_result($rs,"OPOR_Ordine"); $ord_lotto=odbc_result($rs,"OPOR_Lotto"); $ord_desc=odbc_result($rs,"OPOR_Descr"); $mgaa_matr=odbc_result($rs,"MGAA_Matricola"); echo"<option>| $ord_id | $ord_anno | $ord_ordine | $ord_lotto | $ord_desc | $mgaa_matr</option>"; } echo"</select>"; echo"<br>"; echo"<br>"; echo"<br>"; echo"<br>"; ?> In this part, I'm calling the order list (OPOR) with the material (MGAA). The second step, is the comparison with the dropdown AFTER the scan submit. QR Code have OPOR_Id information. I'm stuck here, I'm strugglin with the data comparison : dropdown option (with OPOR_id data) must be === to scan result (OPOR_Id). This is the qrcode-reader.js: (function($,window,document,undefined){"use strict";if(!window.requestAnimationFrame){window.requestAnimationFrame=function(){return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback,element){window.setTimeout(callback,1e3/60)}}()}var qrr,QRCodeReader=function(){};$.qrCodeReader={jsQRpath:"../dist/js/jsQR/jsQR.min.js",beepPath:"../dist/audio/beep.mp3",instance:null,defaults:{multiple:false,qrcodeRegexp:/./,audioFeedback:true,repeatTimeout:1500,target:null,skipDuplicates:true,lineColor:"#FF3B58",callback:function(code){}}};QRCodeReader.prototype={constructor:QRCodeReader,init:function(){qrr.buildHTML();qrr.scriptLoaded=false;qrr.isOpen=false;$.getScript($.qrCodeReader.jsQRpath,function(data,textStatus,jqxhr){if(jqxhr.status==200){qrr.scriptLoaded=true}else{console.error("Errore leggendo lo script")}})},buildHTML:function(){qrr.bgOverlay=$('<div id="qrr-overlay"></div>');qrr.container=$('<div id="qrr-container"></div>');qrr.closeBtn=$('<span id="qrr-close">&times;</span>');qrr.closeBtn.appendTo(qrr.container);qrr.okBtn=$('<a id="qrr-ok">OK</a>');qrr.loadingMessage=$('<div id="qrr-loading-message"> Impossibile accedere allo stream video</div>');qrr.canvas=$('<canvas id="qrr-canvas" class="hidden"></canvas>');qrr.audio=$('<audio hidden id="qrr-beep" src="'+$.qrCodeReader.beepPath+'" type="audio/mp3"></audio>');qrr.outputDiv=$('<div id="qrr-output"></div>');qrr.outputNoData=$('<div id="qrr-nodata">Nessun QR rilevato.</div>');qrr.outputData=$('<div id="qrr-output-data"></div>');qrr.outputNoData.appendTo(qrr.outputDiv);qrr.outputData.appendTo(qrr.outputDiv);qrr.loadingMessage.appendTo(qrr.container);qrr.canvas.appendTo(qrr.container);qrr.outputDiv.appendTo(qrr.container);qrr.audio.appendTo(qrr.container);qrr.okBtn.appendTo(qrr.container);qrr.bgOverlay.appendTo(document.body);qrr.bgOverlay.on("click",qrr.close);qrr.closeBtn.on("click",qrr.close);qrr.container.appendTo(document.body);qrr.video=document.createElement("video")},drawLine:function(begin,end,color){var canvas=qrr.canvas[0].getContext("2d");canvas.beginPath();canvas.moveTo(begin.x,begin.y);canvas.lineTo(end.x,end.y);canvas.lineWidth=4;canvas.strokeStyle=color;canvas.stroke()},drawBox:function(location,color){qrr.drawLine(location.topLeftCorner,location.topRightCorner,color);qrr.drawLine(location.topRightCorner,location.bottomRightCorner,color);qrr.drawLine(location.bottomRightCorner,location.bottomLeftCorner,color);qrr.drawLine(location.bottomLeftCorner,location.topLeftCorner,color)},setOptions:function(element,options){var dataOptions={multiple:$(element).data("qrr-multiple"),qrcodeRegexp:new RegExp($(element).data("qrr-qrcode-regexp")),audioFeedback:$(element).data("qrr-audio-feedback"),repeatTimeout:$(element).data("qrr-repeat-timeout"),target:$(element).data("qrr-target"),skipDuplicates:$(element).data("qrr-skip-duplicates"),lineColor:$(element).data("qrr-line-color"),callback:$(element).data("qrr-callback")};options=$.extend({},dataOptions,options);var settings=$.extend({},$.qrCodeReader.defaults,options);$(element).data("qrr",settings)},getOptions:function(element){qrr.settings=$(element).data("qrr")},open:function(){if(qrr.isOpen)return;qrr.getOptions(this);qrr.bgOverlay.show();qrr.container.slideDown();qrr.codes=[];qrr.outputNoData.show();qrr.outputData.empty();qrr.outputData.hide();if(qrr.settings.multiple){qrr.okBtn.show();qrr.okBtn.off("click").on("click",qrr.doneReading)}else{qrr.okBtn.hide()}$(document).on("keyup.qrCodeReader",function(e){if(e.keyCode===27){qrr.close()}if(qrr.settings.multiple&&e.keyCode===13){qrr.doneReading()}});qrr.isOpen=true;if(qrr.scriptLoaded){qrr.start()}},start:function(){navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}).then(function(stream){qrr.video.srcObject=stream;qrr.video.setAttribute("playsinline",true);qrr.video.play();qrr.startReading()})},startReading:function(){qrr.requestID=window.requestAnimationFrame(qrr.read)},doneReading:function(){var value=qrr.codes[0];if(qrr.settings.target){if(qrr.settings.multiple){var value=qrr.codes.join("\n")}$(qrr.settings.target).val(value)}if(qrr.settings.callback){try{if(qrr.settings.multiple){qrr.settings.callback(qrr.codes)}else{qrr.settings.callback(value)}}catch(err){console.error(err)}}qrr.close()},read:function(){var codeRead=false;var canvas=qrr.canvas[0].getContext("2d");qrr.loadingMessage.text("Caricamento video...");qrr.canvas.off("click.qrCodeReader",qrr.startReading);if(qrr.video.readyState===qrr.video.HAVE_ENOUGH_DATA){qrr.loadingMessage.hide();qrr.canvas.removeClass("hidden");qrr.canvas[0].height=qrr.video.videoHeight;qrr.canvas[0].width=qrr.video.videoWidth;canvas.drawImage(qrr.video,0,0,qrr.canvas[0].width,qrr.canvas[0].height);var imageData=canvas.getImageData(0,0,qrr.canvas[0].width,qrr.canvas[0].height);var code=jsQR(imageData.data,imageData.width,imageData.height,{inversionAttempts:"dontInvert"});if(code&&qrr.settings.qrcodeRegexp.test(code.data)){qrr.drawBox(code.location,qrr.settings.lineColor);codeRead=true;qrr.codes.push(code.data);qrr.outputNoData.hide();qrr.outputData.show();if(qrr.settings.audioFeedback){qrr.audio[0].play()}if(qrr.settings.multiple){if(qrr.settings.skipDuplicates){qrr.codes=$.unique(qrr.codes)}$('<div class="qrr-input"></div>').text(code.data).appendTo(qrr.outputData);qrr.outputDiv[0].scrollTop=qrr.outputDiv[0].scrollHeight;qrr.canvas.on("click.qrCodeReader",qrr.startReading);if(qrr.settings.repeatTimeout>0){setTimeout(qrr.startReading,qrr.settings.repeatTimeout)}else{qrr.loadingMessage.text("Clicca sull'immagine per leggere il QR Code");qrr.loadingMessage.show()}}else{qrr.doneReading()}}}if(!codeRead){qrr.startReading()}},close:function(){if(qrr.requestID){window.cancelAnimationFrame(qrr.requestID)}$(document).off("keyup.qrCodeReader");if(qrr.video.srcObject){qrr.video.srcObject.getTracks()[0].stop()}qrr.canvas.addClass("hidden");qrr.loadingMessage.show();qrr.bgOverlay.hide();qrr.container.hide();qrr.isOpen=false}};$.fn.qrCodeReader=function(options){if(!$.qrCodeReader.instance){qrr=new QRCodeReader;qrr.init();$.qrCodeReader.instance=qrr}return this.each(function(){qrr.setOptions(this,options);$(this).off("click.qrCodeReader").on("click.qrCodeReader",qrr.open)})}})(jQuery,window,document);
  6. My customer asked me these steps. However, ok, tomorrow morning I will post you my code thanks to you, too!
  7. Dropdowns get data from sql. The first field populate a "product orders" and the second is for "material". Then, the operator must scan a qr code from the material. With the scan, the app have to do in first a data matching/controll of the previous data. When the controll will results ok, then everything is fine. If the product order field or the material field will be different from the scan result of the material a message will warn the operator. I don't know how many details I have to tell you. However, thanks for your advices
  8. I have already done the scanner but I don't know how to do the data matching/comparison with the previous drop down fields..
  9. Well, I'm stuck to the Qr scan process: when the scan Is complete, I have to check/control/match previous data from the two drop down. I have already made a qr code scan app but not with this situation.
  10. Hello everyone! I'm building a PHP manufacturing inventory system tied to ODBC. The first two fields, two dropdowns, must be validated by scanning a QR code (QR#1:Material). And then, when the check with the first two fields will be true, with another QR scanning (QR#2:Machine) the operator will start a time tracking of his job. The timestamp will be stored into database. In your opinion, is it possible to create a similar application? And if so, what do you recommend? Thanks for the help!!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.