LD 5 лет назад
Родитель
Сommit
9adf6168fa
2 измененных файлов с 5 добавлено и 7 удалено
  1. 4 7
      app/Imports/RejectedImport.php
  2. 1 0
      resources/views/rejected/import.blade.php

+ 4 - 7
app/Imports/RejectedImport.php

@@ -39,7 +39,7 @@ class RejectedImport implements ToCollection, WithHeadingRow
             $amount = trim($row['数量']??$row['amount']??'');
             $quality_label_name = trim($row['品质']??$row['quality_label_name']??'');
             $remark = trim($row['备注']??$row['remark']??'');
-            $id_owner=Session::get('jianshangIdOwner');
+            $owner=trim($row['货主']??$row['owner']??'');
 
             $lastReturnNumber = Session::get('jianshangLastImportedBill');
             if(!$logistic_number_return)$logistic_number_return=$lastReturnNumber;
@@ -49,10 +49,7 @@ class RejectedImport implements ToCollection, WithHeadingRow
             if(!$logistic_name)$logistic_name=$lastlogistic_name;
 
 
-            if(!$id_owner){
-                $id_owner=Owner::query()->where('name','like','%笕尚%')->first()['id'];
-                Session::put('jianshangIdOwner',$id_owner);
-            }
+            $owner=Owner::query()->where('name','like',$owner.'%')->first();
             $id_logistic_return=Logistic::query()->where('name','like',"%{$logistic_name}%")->first()['id'];
             if(!$id_logistic_return){
                 $id_logistic_return=Logistic::query()->where('name','like',"%其它%")->first()['id'];
@@ -87,7 +84,7 @@ class RejectedImport implements ToCollection, WithHeadingRow
                 $bill->syncOrderIssue();
             }else{
                 $bill=new RejectedBill([
-                    'id_owner'=>$id_owner,
+                    'id_owner'=>$owner['id'],
                     'mobile_sender'=>$mobile_sender,
                     'logistic_number_return'=>$logistic_number_return,
                     'id_logistic_return'=>$id_logistic_return,
@@ -114,7 +111,7 @@ class RejectedImport implements ToCollection, WithHeadingRow
             }
 
             $lastBill = Session::get('jianshangLastImportedBill');
-            if($lastBill&&$lastBill !=trim($logistic_number_return)){
+            if($owner['name']=='笕尚'&&$lastBill&&$lastBill !=trim($logistic_number_return)){
                 $this->submitToApi($bill);
             }
             Session::put('jianshangLastImportedLogisticName',trim($logistic_name));

+ 1 - 0
resources/views/rejected/import.blade.php

@@ -17,6 +17,7 @@
                     <div class="form-group row text-center">
                         <div class="col-12 text-danger">
                             导入表格需要包含以下字段:
+                            货主,
                             退回单号,
                             手机号,
                             快递公司,