From: fomichev Date: Wed, 14 May 2025 15:44:46 +0000 (+0300) Subject: Добавление таблицы X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=7b55c4959419f35d9b02bbc66a12edd6026d96bf;p=erp24_rep%2Fyii-erp24%2F.git Добавление таблицы --- diff --git a/erp24/controllers/BouquetController.php b/erp24/controllers/BouquetController.php index d3312aee..fdfd9ab0 100644 --- a/erp24/controllers/BouquetController.php +++ b/erp24/controllers/BouquetController.php @@ -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 index 00000000..213112e8 --- /dev/null +++ b/erp24/migrations/m250514_143555_create_matrix_bouquet_forecast_table.php @@ -0,0 +1,49 @@ +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 index 00000000..aed1e688 --- /dev/null +++ b/erp24/records/MatrixBouquetForecast.php @@ -0,0 +1,74 @@ + 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', + ]; + } + +}