liuhairui 4 сар өмнө
parent
commit
120ced2a72

+ 20 - 5
application/admin/controller/Deliver.php

@@ -171,6 +171,7 @@ class Deliver extends Backend
         $bach = new QcodeBach();
         $small = new QcodeSmall();
         $export = new QcodeExport();
+        $Product = new QcodeProduct();
         if ($this->request->isAjax() === false){
             $this->error('请求错误');
         }
@@ -212,6 +213,8 @@ class Deliver extends Backend
         }
         $exportData = $this->exportdata($bach_id,$lager_id,$userinfo['company'],$lager_num,$n);
         $file_dir = $this->exportExcel($exportData);
+
+        $qcode_product = $Product->name('qcode_product')->where('product_name',$bachDetail['matter_name'])->find();
         $row = [
             'username'  => $bachDetail['supplier_name'],
             'matter_name' => $bachDetail['matter_name'],
@@ -227,13 +230,25 @@ class Deliver extends Backend
             'file_dir' => $file_dir,
             'company_id' => $userinfo['company'],
         ];
-        if ($bachDetail['box_num'] != 1){
-            $row['num'] = $bachDetail['box_num'];
-            $row['mater_type'] = 1;
-        }else{
-            $row['num'] = $bachDetail['s_weight'];
+        $row['num'] = $bachDetail['box_num'];
+
+        if ($qcode_product['main_unit'] == '万支'){
+            $row['mater_type'] = 3;
+        }else if ($qcode_product['main_unit'] == '公斤'){
             $row['mater_type'] = 2;
+        }else{
+            $row['mater_type'] = 1;
         }
+//        if ($bachDetail['box_num'] != 1){
+//            $row['num'] = $bachDetail['box_num'];
+//            $row['mater_type'] = 1;
+//        }else{
+//            $row['num'] = $bachDetail['s_weight'];
+//            $row['mater_type'] = 2;
+//        }
+//echo "<pre>";
+//print_r($row);
+//echo "<pre>";die;
         $res = $export->save($row);
         if ($res === false){
             $this->error('发货失败');