From 13a6703e8d2800372e37c65e04cc5302feee232e Mon Sep 17 00:00:00 2001 From: marina Date: Mon, 16 Dec 2024 12:28:12 +0300 Subject: [PATCH] =?utf8?q?ERP-259=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?utf8?q?=D1=82=D0=BA=D0=B0=20=D0=B2=D1=82=D0=BE=D1=80=D0=BE=D0=B3=D0=BE?= =?utf8?q?=20=D1=88=D0=B0=D0=B3=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?utf8?q?=D0=B0=D1=87=D0=B8=20=D1=81=D0=BC=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/WaybillIncoming.php | 32 +--------------------- erp24/records/WaybillIncomingProducts.php | 2 +- erp24/records/WaybillWriteOffsProducts.php | 2 +- 3 files changed, 3 insertions(+), 33 deletions(-) diff --git a/erp24/records/WaybillIncoming.php b/erp24/records/WaybillIncoming.php index f9d45514..2aa449a6 100644 --- a/erp24/records/WaybillIncoming.php +++ b/erp24/records/WaybillIncoming.php @@ -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); } } diff --git a/erp24/records/WaybillIncomingProducts.php b/erp24/records/WaybillIncomingProducts.php index d5695559..ba72a66f 100644 --- a/erp24/records/WaybillIncomingProducts.php +++ b/erp24/records/WaybillIncomingProducts.php @@ -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) { diff --git a/erp24/records/WaybillWriteOffsProducts.php b/erp24/records/WaybillWriteOffsProducts.php index df9f377a..c5363573 100644 --- a/erp24/records/WaybillWriteOffsProducts.php +++ b/erp24/records/WaybillWriteOffsProducts.php @@ -80,7 +80,7 @@ class WaybillWriteOffsProducts extends \yii\db\ActiveRecord if ($er) { if ($er->product_count == $itemCount) { - return; + continue; } if ($itemCount > $er->product_count) { -- 2.39.5