Ver Fonte

投料功能优化221227

liuhairui há 3 anos atrás
pai
commit
33bbb1ebc2
1 ficheiros alterados com 36 adições e 18 exclusões
  1. 36 18
      public/assets/js/backend/feeding.js

+ 36 - 18
public/assets/js/backend/feeding.js

@@ -231,15 +231,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                 str += "'></td>";
                                                 if(result.data[i].weight == 0){
                                                     str += "<td><button type=\"button\" class=\"btn btn-primary btn-embossed submit \">保存</button></td>";
+                                                    str += "<td><input class='form-control bach' type='text' name='row[bach][]'   value=''></td>";
                                                 }else{
                                                     str += "<td><button type=\"button\" class=\"btn btn-primary btn-embossed\">已保存</button></td>";
-                                                }
-                                                if(result.data[i].material_bach){
                                                     str += "<td><input class='form-control bach' type='text' name='row[bach][]' readonly  value='"+result.data[i].material_bach+"'></td>";
-                                                }else{
-                                                    str += "<td><input class='form-control bach' type='text' name='row[bach][]'  value=''></td>";
                                                 }
-                                                str += "<td><input class='form-control' type='text' name='row[gy_name][]'  value='"+result.data[i].gy_name+"'></td>";
+                                                // if(result.data[i].material_bach){
+                                                //     str += "<td><input class='form-control bach' type='text' name='row[bach][]' readonly  value='"+result.data[i].material_bach+"'></td>";
+                                                // }else{
+                                                //     str += "<td><input class='form-control bach' type='text' name='row[bach][]'  value=''></td>";
+                                                // }
+                                                str += "<td><input class='form-control' type='text' name='row[gy_name][]'   value='"+result.data[i].gy_name+"'></td>";
                                                 str += "</tr>";
                                                 html += `<tr class="print${i} print"><td>${result.data[i].material}</td>
                                                                 <td>${result.data[i].nweight}</td><td>`;
@@ -286,12 +288,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                                         //扫描的物料=table中的物料,,,变红,否则语音提示
                                                                         if(result.data[i].material===data.data[j].m_name){
                                                                             if (result.data[i].gy_num <= result.process){
-                                                                                $(".material")[i].setAttribute('style','color:red');
-                                                                                $(".nweight")[i].setAttribute('style','color:red');
+                                                                                //投料重量为空时 扫描物料文字为红
+                                                                                if (result.data[i].weight == 0) {
+                                                                                    $(".material")[i].setAttribute('style','color:red');
+                                                                                    $(".nweight")[i].setAttribute('style','color:red');
+                                                                                }
                                                                                 var the_bach = document.getElementsByClassName('bach')[i];
-                                                                                the_bach.value = bach;
+                                                                                if(the_bach.readOnly == false){
+                                                                                    the_bach.value = bach;
+                                                                                }
+                                                                                // 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++;
@@ -318,8 +327,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                                             var arr = result.data[i].material.split('/');
                                                                             if (arr.indexOf($("#wuliao").val()) !== -1 && result.data[i].gy_num == result.process) {
                                                                                 $(".material")[i].value = wuliao;
-                                                                                $(".material")[i].setAttribute('style', 'color:red');
-                                                                                $(".nweight")[i].setAttribute('style', 'color:red');
+                                                                                if (result.data[i].weight == 0) {
+                                                                                    $(".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();
@@ -354,11 +365,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                                     //扫描的物料=table中的物料,,,变红,否则语音提示
                                                                     if(result.data[i].material===wuliao){
                                                                         if (result.data[i].gy_num <= result.process){
-                                                                            $(".material")[i].setAttribute('style','color:red');
-                                                                            $(".nweight")[i].setAttribute('style','color:red');
+                                                                            if (result.data[i].weight == 0) {
+                                                                                $(".material")[i].setAttribute('style','color:red');
+                                                                                $(".nweight")[i].setAttribute('style','color:red');
+                                                                            }
                                                                             var the_bach = document.getElementsByClassName('bach')[i];
-                                                                            // console.log(the_bach);
-                                                                            the_bach.value = bach;
+                                                                            if(the_bach.readOnly == false){
+                                                                                the_bach.value = bach;
+                                                                            }
                                                                             $(".number")[i].focus();
                                                                             //语音播报
                                                                             var msg = new SpeechSynthesisUtterance("应投入物料"+result.data[i].material+"应投入重量"+result.data[i].nweight+"千克");
@@ -389,10 +403,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                                         var spanValue = document.getElementById("input").innerHTML;
                                                                         if (arr.indexOf(spanValue) !== -1 && result.data[i].gy_num == result.process) {
                                                                             $(".material")[i].value = wuliao;
-                                                                            $(".material")[i].setAttribute('style', 'color:red');
-                                                                            $(".nweight")[i].setAttribute('style', 'color:red');
+                                                                            if (result.data[i].weight == 0) {
+                                                                                $(".material")[i].setAttribute('style','color:red');
+                                                                                $(".nweight")[i].setAttribute('style','color:red');
+                                                                            }
                                                                             var the_bach = document.getElementsByClassName('bach')[i];
-                                                                            the_bach.value = bach;
+                                                                            if(the_bach.readOnly == false){
+                                                                                the_bach.value = bach;
+                                                                            }
                                                                             $(".number")[i].focus();
                                                                             var msg = new SpeechSynthesisUtterance("应投入物料"+result.data[i].material+"应投入重量"+result.data[i].nweight+"千克");
                                                                             window.speechSynthesis.speak(msg);