]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-259 Доработка второго шага передачи смен
authormarina <m.zozirova@gmail.com>
Mon, 16 Dec 2024 09:28:12 +0000 (12:28 +0300)
committermarina <m.zozirova@gmail.com>
Mon, 16 Dec 2024 09:28:12 +0000 (12:28 +0300)
erp24/records/WaybillIncoming.php
erp24/records/WaybillIncomingProducts.php
erp24/records/WaybillWriteOffsProducts.php

index f9d4551438b2132776c8b522b839146bf0d3a9c0..2aa449a613df9fcea14a5a9d7340add449c6177f 100644 (file)
@@ -134,36 +134,6 @@ class WaybillIncoming extends \yii\db\ActiveRecord
                 'number' => 'ЕРП_НС_' . date("Y-m-d_H-i") . '_' . $model->id
             ]);
 
-            WaybillWriteOffsProducts::setData($model, $shiftTransfer);
-
-            $summaries = WaybillWriteOffsProducts::find()
-                ->andWhere(['waybill_write_offs_id' => $model->id])
-                ->select([
-                    'total_product_count' => 'sum(product_count)',
-                    'total_summ' => 'sum(summ)',
-                    'total_summ_self_cost' => 'sum(summ_self_cost)'
-                ])
-                ->asArray()
-                ->one();
-
-            if ($summaries) {
-                $model->updateAttributes([
-                    'quantity' => $summaries['total_product_count'],
-                    'summ' => $summaries['total_summ'],
-                    'summ_self_cost' => $summaries['total_summ_self_cost']
-                ]);
-            }
-        } catch (\Exception $exception) {
-            throw new \Exception($exception);
-        }
-
-        try{
-            $model->save();
-
-            $model->updateAttributes([
-                'number' => 'ЕРП_ПН_' . date("Y-m-d_H-i") . '_' . $model->id
-            ]);
-
             WaybillIncomingProducts::setData($model, $shiftTransfer);
 
             $summaries = WaybillIncomingProducts::find()
@@ -183,7 +153,7 @@ class WaybillIncoming extends \yii\db\ActiveRecord
                     'summ_self_cost' => $summaries['total_summ_self_cost']
                 ]);
             }
-        } catch (\Throwable $exception) {
+        } catch (\Exception $exception) {
             throw new \Exception($exception);
         }
     }
index d56955592e54f4b56966c23dd810003bec442e04..ba72a66fba502d1d97e1f97131e6b8b91f37fd01 100644 (file)
@@ -78,7 +78,7 @@ class WaybillIncomingProducts extends \yii\db\ActiveRecord
             $count = 0;
             if ($er) {
                 if ($er->product_count == $itemCount) {
-                    return;
+                    continue;
                 }
 
                 if ($itemCount > $er->product_count) {
index df9f377aaf17442d2d6dd834f88bbaec7b07ac6e..c5363573f9ef9ab1ede31393ee70dbd4985fee0d 100644 (file)
@@ -80,7 +80,7 @@ class WaybillWriteOffsProducts extends \yii\db\ActiveRecord
 
             if ($er) {
                 if ($er->product_count == $itemCount) {
-                    return;
+                    continue;
                 }
 
                 if ($itemCount > $er->product_count) {