liuhairui пре 3 година
родитељ
комит
f8442de0b0
1 измењених фајлова са 26 додато и 32 уклоњено
  1. 26 32
      public/assets/js/backend/feeding.js

+ 26 - 32
public/assets/js/backend/feeding.js

@@ -57,6 +57,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
             Table.api.bindevent(table);
         },
         add: function () {
+            // 进入页面全屏
+
+            // if(document.documentElement){
+            //     document.documentElement.webkitRequestFullScreen();
+            //     document.body.onkeyup = function (e) {
+            //         e = e || window.event;
+            //         if(e.keyCode == 27){//按Esc全屏或退出全屏
+            //             document.documentElement.webkitRequestFullScreen();
+            //         }
+            //     };
+            // }
             $('#c-bach').focus();
             var num=0;
             $('#c-bach').keydown((e)=>{
@@ -267,18 +278,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                             material:wuliao
                                                         },
                                                         success(data) {
-                                                            console.log(data.data)
                                                             if (data.total > 0){
-                                                                // alert(1);
                                                                 wuliao = data.string;
                                                                 $('#input').html(wuliao);
                                                                 for (var i=0;i<result.data.length;i++){
                                                                     for (var j=0;j<data.data.length;j++){
                                                                         //扫描的物料=table中的物料,,,变红,否则语音提示
                                                                         if(result.data[i].material===data.data[j].m_name){
-                                                                            // console.log(result.data[i].material);
-                                                                            // console.log(data.data[j].m_name);
-                                                                            if (result.data[i].gy_num > result.process){
+                                                                            if (result.data[i].gy_num <= result.process){
+                                                                                $(".material")[i].setAttribute('style','color:red');
+                                                                                $(".nweight")[i].setAttribute('style','color:red');
+                                                                                var the_bach = document.getElementsByClassName('bach')[i];
+                                                                                the_bach.value = bach;
+                                                                                $(".number")[i].focus();
+                                                                                //语音播报
+                                                                                var msg = new SpeechSynthesisUtterance("应投入物料"+result.data[i].material+"应投入重量"+result.data[i].nweight+"千克");
+                                                                                window.speechSynthesis.speak(msg);
+                                                                                error++;
+                                                                            }else if (result.data[i].gy_num > result.process){
                                                                                 Layer.confirm("此物料不在当前工序,请确认!",{
                                                                                     area: ['60%', '60%'],
                                                                                 });
@@ -286,30 +303,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                                                 var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
                                                                                 window.speechSynthesis.speak(msg);
                                                                                 error++;
-                                                                            }else{
-                                                                                $(".material")[i].setAttribute('style','color:red');
-                                                                                $(".nweight")[i].setAttribute('style','color:red');
-                                                                                //语音播报
-                                                                                var msg = new SpeechSynthesisUtterance("应投入物料"+result.data[i].material+"应投入重量"+result.data[i].nweight+"千克");
-                                                                                window.speechSynthesis.speak(msg);
-                                                                                error++;
-                                                                            }
-                                                                            // if (result.data[i].gy_num == result.process){
-                                                                            //     $(".material")[i].setAttribute('style','color:red');
-                                                                            //     $(".nweight")[i].setAttribute('style','color:red');
-                                                                            //     //语音播报
-                                                                            //     var msg = new SpeechSynthesisUtterance("应投入物料"+result.data[i].material+"应投入重量"+result.data[i].nweight+"千克");
-                                                                            //     window.speechSynthesis.speak(msg);
-                                                                            //     error++;
-                                                                            // }else
-                                                                            //     if (result.data[i].gy_num > result.process){
-                                                                            //     Layer.confirm("此物料不在当前工序,请确认!",{
-                                                                            //         area: ['60%', '60%'],
-                                                                            //     });
-                                                                            //     //语音播报
-                                                                            //     var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
-                                                                            //     window.speechSynthesis.speak(msg);
-                                                                            //     error++;
                                                                             // }else{
                                                                             //     Layer.confirm("此物料已经投料,请确认此工序是否有此物料!",{
                                                                             //         area: ['60%', '60%'],
@@ -318,7 +311,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                                             //     var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
                                                                             //     window.speechSynthesis.speak(msg);
                                                                             //     error++;
-                                                                            // }
+                                                                            }
                                                                         }
                                                                         //替代料变扫描的物料
                                                                         if(result.data[i].material.indexOf('/')!==-1) {
@@ -327,6 +320,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                                                 $(".material")[i].value = wuliao;
                                                                                 $(".material")[i].setAttribute('style', 'color:red');
                                                                                 $(".nweight")[i].setAttribute('style', 'color:red');
+                                                                                var the_bach = document.getElementsByClassName('bach')[i];
+                                                                                the_bach.value = bach;
+                                                                                $(".number")[i].focus();
                                                                                 error++;
                                                                             } else if (arr.indexOf($("#wuliao").val()) !== -1) {
                                                                                 Layer.confirm("此物料不在当前工序,请确认!", {
@@ -339,7 +335,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                                             }
                                                                         }
                                                                     }
-
                                                                 }
                                                                 if(error===0){
                                                                     layer.confirm("此物料不在配方中,且没有替代料,请确认!", {//物料不存在提示错误信息
@@ -353,7 +348,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                                     synth.speak(msg);
                                                                 }
                                                             }else{
-                                                                // alert(2);
                                                                 //没有在数据库查到,直接去比较物料与配方
                                                                 $('#input').html(wuliao);
                                                                 for (var i=0;i<result.data.length;i++){