huangsanjia 3 жил өмнө
parent
commit
61d657c763

+ 6 - 4
application/admin/controller/Feeding.php

@@ -51,7 +51,7 @@ class Feeding extends Backend
             return $this->view->fetch();
         }
         $params = $this->request->post('row/a');
-
+        
         $params = $this->preExcludeFields($params);
         $tid = Db::name('task')->where('bach',$params['bach'])->order('id desc')->find();
         $arr = [];
@@ -97,11 +97,11 @@ class Feeding extends Backend
         $res = Db::name('task')->where('bach',$bach)->order('create','desc')->select();
         //已有过工序
         if($row){
-            Session::set('process',serialize($row));
+//            Session::set('process',serialize($row));
             $result['inspector'] = $row[0]['inspector'];
             $result['operator'] = $row[0]['operator'];
         }else{
-            Session::delete('process');
+//            Session::delete('process');
             $result['inspector'] = '';
             $result['operator'] = '';
         }
@@ -113,7 +113,9 @@ class Feeding extends Backend
     public function get_formula(){
         $bach = $this->request->post('bach');//批次号
         $num = $this->request->post('num');//生产量
-        $process = unserialize(Session::get('process'));
+//        $process = unserialize(Session::get('process'));
+//        print_r($process);die;
+        $process = Db::name('feeding')->where('bach',$bach)->select();
         if($num){//如果有,批次号重复,需精确查找
             $res = Db::name('task')->alias('t')
                 ->join('formula_detail f','f.pid=t.fid','left')

+ 6 - 2
public/assets/js/backend/feeding.js

@@ -163,12 +163,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                         });
                                     });
                                 }else{//批次号不重复直接赋值
+                                    console.log(2222)
                                     $("#btn").css('display','none');
                                     $("#c-name").val(res.data[0].name);
                                     $("#c-specifications").val(res.data[0].drawer_name);
                                     $("#c-unit").val(res.data[0].examine_name);
-                                    $("#c-operator").val(res.data.operator);
-                                    $("#c-inspector").val(res.data.inspector);
+                                    $("#c-operator").val(res.operator);
+                                    $("#c-inspector").val(res.inspector);
                                     $.ajax({
                                         method: "POST",
                                         url: "feeding/get_formula",
@@ -216,6 +217,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
                                                         //扫描的物料=table中的物料,,,变红,否则语音提示
                                                         if(result.data[i].material===wuliao && result.data[i].gy_num == result.process){
                                                             $(".material")[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].material===wuliao){
                                                             Layer.confirm("此物料不在当前工序,请确认!");