]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Добавление таблицы
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 14 May 2025 15:44:46 +0000 (18:44 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 14 May 2025 15:44:46 +0000 (18:44 +0300)
erp24/controllers/BouquetController.php
erp24/migrations/m250514_143555_create_matrix_bouquet_forecast_table.php [new file with mode: 0644]
erp24/records/MatrixBouquetForecast.php [new file with mode: 0644]

index d3312aee1704db41016bae79f090d37edfe9047c..fdfd9ab0652db2c63df0bc529a14e96b39bbdcf5 100644 (file)
@@ -317,8 +317,8 @@ class BouquetController extends Controller
                 $spreadsheet = IOFactory::load($filePath);
                 $rows = $spreadsheet->getActiveSheet()->toArray();
 
-                $names = array_filter(array_column($rows, 0));
-                var_dump($names); die();
+                $names = array_filter(array_column($rows, 2));
+
                 $products = Products1c::find()
                     ->select(['id', 'name'])
                     ->where(['name' => $names])
@@ -326,7 +326,7 @@ class BouquetController extends Controller
                     ->all();
 
                 $data = $products;
-
+                //var_dump($products); die();
                 Yii::$app->session->set('productExportData', $data);
             }
         }
diff --git a/erp24/migrations/m250514_143555_create_matrix_bouquet_forecast_table.php b/erp24/migrations/m250514_143555_create_matrix_bouquet_forecast_table.php
new file mode 100644 (file)
index 0000000..213112e
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%matrix_bouquet_forecast}}`.
+ */
+class m250514_143555_create_matrix_bouquet_forecast_table extends Migration
+{
+    const TABLE_NAME = 'erp24.matrix_bouquet_forecast';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+        if (!isset($tableSchema)) {
+            $this->createTable(self::TABLE_NAME, [
+                'id' => $this->primaryKey(),
+                'bouquet_id' => $this->integer()->comment('ИД букета'),
+                'bouquet_name' => $this->string()->comment('Наименование букета'),
+                'bouquet_group' => $this->string()->comment('Матрица букета'),
+                'year' => $this->integer()->comment('Год'),
+                'month' => $this->integer()->comment('Месяц'),
+                's_store' => $this->integer()->comment('Прогноз для оффлайн магазинов типа s'),
+                'm_store' => $this->integer()->comment('Прогноз для оффлайн магазинов типа m'),
+                'l_store' => $this->integer()->comment('Прогноз для оффлайн магазинов типа l'),
+                'xl_store' => $this->integer()->comment('Прогноз для оффлайн магазинов типа xl'),
+                'marketplace' => $this->integer()->comment('Прогноз для маркетплейсов'),
+                'internet' => $this->integer()->comment('Прогноз для интернет магазина'),
+                'created_at' => $this->dateTime()->comment('Дата создания'),
+                'updated_at' => $this->dateTime()->comment('Дата обновления'),
+
+            ]);
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+        if (isset($tableSchema)) {
+            $this->dropTable(self::TABLE_NAME);
+        }
+    }
+}
diff --git a/erp24/records/MatrixBouquetForecast.php b/erp24/records/MatrixBouquetForecast.php
new file mode 100644 (file)
index 0000000..aed1e68
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "matrix_bouquet_forecast".
+ *
+ * @property int $id
+ * @property int|null $bouquet_id ИД букета
+ * @property string|null $bouquet_name Наименование букета
+ * @property string|null $bouquet_group Матрица букета
+ * @property int|null $year Год
+ * @property int|null $month Месяц
+ * @property int|null $s_store Прогноз для оффлайн магазинов типа s
+ * @property int|null $m_store Прогноз для оффлайн магазинов типа m
+ * @property int|null $l_store Прогноз для оффлайн магазинов типа l
+ * @property int|null $xl_store Прогноз для оффлайн магазинов типа xl
+ * @property int|null $marketplace Прогноз для маркетплейсов
+ * @property int|null $internet Прогноз для интернет магазина
+ * @property string|null $created_at Дата создания
+ * @property string|null $updated_at Дата обновления
+ */
+class MatrixBouquetForecast extends \yii\db\ActiveRecord
+{
+
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'matrix_bouquet_forecast';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['bouquet_id', 'bouquet_name', 'bouquet_group', 'year', 'month', 's_store', 'm_store', 'l_store', 'xl_store', 'marketplace', 'internet', 'created_at', 'updated_at'], 'default', 'value' => null],
+            [['bouquet_id', 'year', 'month', 's_store', 'm_store', 'l_store', 'xl_store', 'marketplace', 'internet'], 'default', 'value' => null],
+            [['bouquet_id', 'year', 'month', 's_store', 'm_store', 'l_store', 'xl_store', 'marketplace', 'internet'], 'integer'],
+            [['created_at', 'updated_at'], 'safe'],
+            [['bouquet_name', 'bouquet_group'], 'string', 'max' => 255],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'bouquet_id' => 'Bouquet ID',
+            'bouquet_name' => 'Bouquet Name',
+            'bouquet_group' => 'Bouquet Group',
+            'year' => 'Year',
+            'month' => 'Month',
+            's_store' => 'S Store',
+            'm_store' => 'M Store',
+            'l_store' => 'L Store',
+            'xl_store' => 'Xl Store',
+            'marketplace' => 'Marketplace',
+            'internet' => 'Internet',
+            'created_at' => 'Created At',
+            'updated_at' => 'Updated At',
+        ];
+    }
+
+}