Alexander Musikhin пре 4 недеља
родитељ
комит
80944573e0
2 измењених фајлова са 25 додато и 22 уклоњено
  1. 3 0
      app/Http/Controllers/ProductController.php
  2. 22 22
      app/Services/ImportService.php

+ 3 - 0
app/Http/Controllers/ProductController.php

@@ -45,6 +45,9 @@ class ProductController extends Controller
             'certificate_date'          => 'Дата сертификата',
             'certificate_issuer'        => 'Орган сертификации',
             'certificate_type'          => 'Вид сертификации',
+            'weight'                    => 'Вес',
+            'volume'                    => 'Объем',
+            'places'                    => 'Мест',
         ],
         'searchFields' =>  [
             'nomenclature_number',

+ 22 - 22
app/Services/ImportService.php

@@ -66,28 +66,28 @@ class ImportService
                 Product::query()
                     ->updateOrCreate(['year' => $year, 'nomenclature_number' => $record[4]],
                     [
-                        'article'               => $record[1],
-                        'name_tz'               => $record[2],
-                        'type_tz'               => $record[3],
-                        'sizes'                 => $record[5],
-                        'manufacturer'          => $record[6],
-                        'unit'                  => $record[7],
-                        'type'                  => $record[8],
-                        'product_price'         => $record[9],
-                        'installation_price'    => $record[10],
-                        'total_price'           => $record[11],
-                        'manufacturer_name'     => $record[12],
-                        'note'                  => $record[13],
-                        'passport_name'         => $record[14],
-                        'statement_name'        => $record[15],
-                        'service_life'          => $record[16],
-                        'certificate_number'    => $record[17],
-                        'certificate_date'      => DateHelper::isDate($record[18]) ? DateHelper::getDateForDB($record[18]) : '',
-                        'certificate_issuer'    => $record[19],
-                        'certificate_type'      => $record[20],
-                        'weight'                => $record[21],
-                        'volume'                => $record[22],
-                        'places'                => $record[23],
+                        'article'               => (string) $record[1],
+                        'name_tz'               => (string) $record[2],
+                        'type_tz'               => (string) $record[3],
+                        'sizes'                 => (string) $record[5],
+                        'manufacturer'          => (string) $record[6],
+                        'unit'                  => (string) $record[7],
+                        'type'                  => (string) $record[8],
+                        'product_price'         => (float) $record[9],
+                        'installation_price'    => (float) $record[10],
+                        'total_price'           => (float) $record[11],
+                        'manufacturer_name'     => (string) $record[12],
+                        'note'                  => (string) $record[13],
+                        'passport_name'         => (string) $record[14],
+                        'statement_name'        => (string) $record[15],
+                        'service_life'          => (string) $record[16],
+                        'certificate_number'    => (string) $record[17],
+                        'certificate_date'      => DateHelper::isDate($record[18]) ? DateHelper::getDateForDB($record[18]) :(string)  '',
+                        'certificate_issuer'    => (string) $record[19],
+                        'certificate_type'      => (string) $record[20],
+                        'weight'                => (float) $record[21],
+                        'volume'                => (float) $record[22],
+                        'places'                => (integer) $record[23],
                     ]);
             }
         } else {