Просмотр исходного кода

asn同步匹配退货单正则修改

hu hao 5 лет назад
Родитель
Сommit
53be14a8ab
2 измененных файлов с 7 добавлено и 2 удалено
  1. 1 0
      app/Http/Controllers/TestController.php
  2. 6 2
      app/Services/RejectedBillService.php

+ 1 - 0
app/Http/Controllers/TestController.php

@@ -126,6 +126,7 @@ use App\WaybillPriceModel;
 use Carbon\Carbon;
 use Carbon\CarbonPeriod;
 use ChangeColumnOrderIdToOrderIssues;
+use Doctrine\DBAL\Exception\DatabaseObjectExistsException;
 use Doctrine\DBAL\Query\QueryBuilder;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;

+ 6 - 2
app/Services/RejectedBillService.php

@@ -118,7 +118,7 @@ class RejectedBillService
                     'is_loaded' => 1,
                     'updated_at' => $updated_at,
                 ];
-                if (!$rejectedBill){
+                if (!$rejectedBill && $data->customerid && $data->notes){
                     $checkedNumber=$this->screenCheckNumber($data->customerid,$data->notes);
                     if (!$checkedNumber)continue;
                     $rejects=RejectedBill::query()->where('checked_numbers',$checkedNumber)->get();
@@ -265,7 +265,11 @@ class RejectedBillService
             return $pinyin[0];
         },$pinyinOwnerName);
         $initials=implode("", $pinyinArr);
-        preg_match("/$initials{0,5}\d{6,20}/", $note, $result);
+        if (!$initials) {
+            preg_match("/[a-z0-9]{0,5}\d{6,20}/", $note, $result);
+        }else{
+            preg_match("/$initials{0,5}\d{6,20}/", $note, $result);
+        }
         if (count($result)<1) return null;
         return $result[0];
     }