Browse Source

打印重量数据优化

qiuenguang 1 year ago
parent
commit
16f5b9cc42

+ 11 - 6
application/admin/controller/Deliver.php

@@ -100,7 +100,7 @@ class Deliver extends Backend
             $bach_detail = $bach->name($userInfo['company'].'_'.'qcode_bach')->where('_id',$v['bach_id'])->find();
             $list[$k]['id'] = substr(json_encode($v['_id']),9,-2);
             $list[$k]['bach'] = $bach_detail['bach_num'];
-            $list[$k]['l_flow'] = $bach_detail['l_flow']+$k;
+            $list[$k]['l_flow'] = ltrim(substr($v['code'],53,6),'0');
             $list[$k]['matter_name'] = $bach_detail['matter_name'];
             $list[$k]['manufacture_date'] = date('Y-m-d',strtotime('20'.$bach_detail['manufacture_date']));
             $list[$k]['code'] = $v['code'];
@@ -659,7 +659,8 @@ class Deliver extends Backend
             foreach ($export_id as $k=>$v){
                 $data[$k] = $export->where('_id',$v)->find();
                 $large_str = explode(',',$data[$k]['large_str']);
-                $large_list = $large->whereIn('_id',$large_str)->select();
+                $large_list = $large->name($userinfo['company'].'_'.'qcode_large')->whereIn('_id',$large_str)->select();
+
                 $large_num = $large_weight = 0;
                 foreach ($large_list as $value){
                     $large_num = $large_num + $value['l_num'];
@@ -723,11 +724,15 @@ class Deliver extends Backend
         if ($res === false){
             $this->error('删除失败');
         }
-        $export_id = $goods->where('_id',$ids)->find();
-        $result = $export->where('_id',$export_id['export_id'])->update(['status'=>0]);
-        if ($result === false){
-            $this->error('删除失败');
+        $export_list = $goods->where('_id',$ids)->find();
+        $export_id = explode(',',$export_list['export_id']);
+        foreach ($export_id as $v){
+            $result = $export->where('_id',$v)->update(['status'=>0]);
+            if ($result === false){
+                $this->error('删除失败');
+            }
         }
+
         $this->success('成功');
     }
 

+ 1 - 2
application/admin/controller/QcodeAdd.php

@@ -179,7 +179,6 @@ class QcodeAdd extends Backend
             $fixed_code.=$this->intTochar($batchList['supplier_code'],12);//12位  供应商编码
             $fixed_code.=$this->intTochar($batchList['matter_no'],20);//20位  辅料编码
             $fixed_code.=$batchList['manufacture_date'];//6位  生产日期
-
             $print_code=$batchList['print_date'];//6位  打码日期
             $small_liushui = [
                 'onlycode' => 'AB92'.$fixed_code.$print_code,
@@ -231,7 +230,7 @@ class QcodeAdd extends Backend
                     'create_time' => time(),
                     'p_nums' => 0,
                     'userid' =>$userinfo['id'],
-                    'l_weight' =>$l_weight,
+                    'l_weight' =>$batchList['l_weight'],
                     'l_num' =>$l_num,
                     'l_status' => 0,
                     'l_print' => 0