zealerChina před 1 rokem
rodič
revize
0dfd4ef43f
1 změnil soubory, kde provedl 10 přidání a 5 odebrání
  1. 10 5
      application/common/service/ProduceOrderService.php

+ 10 - 5
application/common/service/ProduceOrderService.php

@@ -221,7 +221,7 @@ class ProduceOrderService
                         'error'=>$errorMsg,
                     ];
                     $PHPExcel->setActiveSheetIndex(0)->setCellValue($errorWriteColumn.$currentRow,$errorMsg);
-                    throw_user($errorMsg);
+                    // throw_user($errorMsg);
                 }
                 $city = Area::where('name', 'like', '%'.$row['city'].'%')->where('pid', $province->id)->find();
                 if (empty($city)) {
@@ -231,7 +231,7 @@ class ProduceOrderService
                         'error'=>$errorMsg,
                     ];
                     $PHPExcel->setActiveSheetIndex(0)->setCellValue($errorWriteColumn.$currentRow,$errorMsg);
-                    throw_user($errorMsg);
+                    // throw_user($errorMsg);
                 }
                 $area = Area::where('name', 'like', '%'.$row['area'].'%')->where('pid', $city->id)->find();
                 if (empty($area)) {
@@ -241,16 +241,21 @@ class ProduceOrderService
                         'error'=>$errorMsg,
                     ];
                     $PHPExcel->setActiveSheetIndex(0)->setCellValue($errorWriteColumn.$currentRow,$errorMsg);
-                    throw_user($errorMsg);
+                    // throw_user($errorMsg);
                 }
+
+                $provinceId = $province->id ?? 0;
+                $cityId = $city->id ?? 0;
+                $areaId = $area->id ?? 0;
+                
                 // 配置省市区数据
-                $row['city'] = $province->id . ',' . $city->id . ',' . $area->id;
+                $row['city'] = $provinceId . ',' . $cityId . ',' . $areaId;
                 unset($row['province'], $row['area']);
 
                 // 配置产品ID
                 $row['produce_id'] = Produce::where('local_code', $row['produce_id'])->value('id');
                 if (empty($row['produce_id'])) {
-                    $errorMsg = '本地产品编码';
+                    $errorMsg = '本地产品编码有误';
                     $errLog[]=[
                         'line' =>$currentRow,
                         'error'=>$errorMsg,