]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-360 Сборка страницы автопм
authormarina <m.zozirova@gmail.com>
Wed, 18 Jun 2025 07:38:59 +0000 (10:38 +0300)
committermarina <m.zozirova@gmail.com>
Wed, 18 Jun 2025 07:38:59 +0000 (10:38 +0300)
erp24/commands/CronController.php
erp24/migrations/m250618_062332_alter_autoplannogramma_table.php [new file with mode: 0644]

index 26184896d385c02ee1dd8836ead390e6ed6c25c1..2424c57fba693d1df6e1e031950bad761dede2ea 100644 (file)
@@ -1571,6 +1571,23 @@ class CronController extends Controller
         $month = $date->format('m');
         $year = $date->format('Y');
 
+        $service = new AutoPlannogrammaService();
+        $writeOffsForecast = $service->getWeeklyProductsWriteoffsForecast($month, $year, 2);
+        $forecast = $service->getWeeklyBouquetProductsForecast($month, $year, 2);
+
+        foreach ($forecast as $item) {
+
+            $this->stdout('прогноз', BaseConsole::FG_GREEN);
+            $this->stdout(print_r($item, true), BaseConsole::FG_GREEN);
+            break;
+        }
+
+        foreach ($writeOffsForecast as $item) {
+            $this->stdout('списание', BaseConsole::FG_GREEN);
+            $this->stdout(print_r($item, true), BaseConsole::FG_GREEN);
+            break;
+        }
+
         $this->stdout("Начало расчетов автопланограммы для $planDate\n", BaseConsole::FG_GREEN);
 
         $service = new AutoPlannogrammaService();
@@ -1592,6 +1609,8 @@ class CronController extends Controller
                 ]);
 
                 $writeOffsForecast = $service->getWeeklyProductsWriteoffsForecast($month, $year, $store->id);
+                $forecast = $service->getWeeklyBouquetProductsForecast($month, $year, $store->id);
+
 
                 $this->stdout("Рассчитана автопланограмма для магазина {$store->name}\n", BaseConsole::FG_GREEN);
             } catch (\Throwable $e) {
diff --git a/erp24/migrations/m250618_062332_alter_autoplannogramma_table.php b/erp24/migrations/m250618_062332_alter_autoplannogramma_table.php
new file mode 100644 (file)
index 0000000..152dffb
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+use yii\db\Migration;
+
+class m250618_062332_alter_autoplannogramma_table extends Migration
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->addColumn('autoplannogramma', 'calculate', $this->float()->comment('Суммарное расчетное значение'));
+        $this->addColumn('autoplannogramma', 'modify', $this->float()->comment('Значение проставленное закупщиком'));
+        $this->addColumn('autoplannogramma', 'total', $this->float()->comment('Расчетное значение продаж'));
+        $this->addColumn('autoplannogramma', 'details', $this->json()->comment('Детализация итоговой суммы'));
+
+        $this->dropColumn('autoplannogramma', 'quantity_forecast');
+        $this->dropColumn('autoplannogramma', 'quantity');
+        $this->dropColumn('autoplannogramma', 'writeoffs_forecast');
+
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->addColumn('autoplannogramma', 'quantity_forecast', $this->float()->comment('Расчетное количество'));
+        $this->addColumn('autoplannogramma', 'quantity', $this->float()->comment('Измененное количество'));
+        $this->addColumn('autoplannogramma', 'writeoffs_forecast', $this->float()->comment('Прогноз списаний'));
+
+        $this->dropColumn('autoplannogramma', 'details');
+        $this->dropColumn('autoplannogramma', 'total');
+        $this->dropColumn('autoplannogramma', 'modify');
+        $this->dropColumn('autoplannogramma', 'calculate');
+    }
+
+}