]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Правки и чистка
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 4 Jul 2025 07:48:44 +0000 (10:48 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 4 Jul 2025 07:48:44 +0000 (10:48 +0300)
erp24/commands/CronController.php
erp24/services/AutoPlannogrammaService.php

index cf432ec0026f0578177055be96150075acbd13e9..70ffee7c38523b8f340552da56d485bc9762ba2d 100644 (file)
@@ -1611,7 +1611,7 @@ class CronController extends Controller
     public function actionAutoplannogrammaCalculate(): void
     {
         $date = new DateTime();
-        $date->modify('+2 months'); // TODO модифицировать
+        $date->modify('+2 months');
         $planDate = $date->format('Y-m-01');
         $month = (int)$date->format('m');
         $year = (int)$date->format('Y');
@@ -1666,6 +1666,8 @@ class CronController extends Controller
                         $writeOffs = $writeOffsForecast[$productId][$week]['writeOffs'];
                         $details['writeOffs']['quantity'] = $writeOffs;
                         $total += is_array($writeOffs) ? array_sum($writeOffs) : (float)$writeOffs;
+                    } else {
+                        $details['writeOffs']['quantity'] = 0;
                     }
 
                     foreach (['offline', 'online', 'marketplace'] as $type) {
@@ -1834,6 +1836,8 @@ class CronController extends Controller
                         $writeOffs = $writeOffsForecast[$productId][$week]['writeOffs'];
                         $details['writeOffs']['quantity'] = $writeOffs;
                         $total += is_array($writeOffs) ? array_sum($writeOffs) : (float)$writeOffs;
+                    } else {
+                        $details['writeOffs']['quantity'] = 0;
                     }
 
                     foreach (['offline', 'online', 'marketplace'] as $type) {
index b6c3ebee4439f39c4530349c9398513f5745e0d1..39751ab9de856b62dfef51cd3f45fdea656f61d4 100644 (file)
@@ -1566,8 +1566,8 @@ class AutoPlannogrammaService
                 'category' => $cat,
                 'subcategory' => $sub,
                 'species' => $spec,
-                'percent' => $percent,
-                'monthly_goal' => $monthlyGoal,
+                'percent' => $percent ?? 0,
+                'monthly_goal' => $monthlyGoal ?? 0,
                 'weekly_goal' => $weeklyGoal,
             ];
         }