From: marina Date: Mon, 16 Dec 2024 09:28:12 +0000 (+0300) Subject: ERP-259 Доработка второго шага передачи смен X-Git-Tag: 1.7~160^2~6 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=13a6703e8d2800372e37c65e04cc5302feee232e;p=erp24_rep%2Fyii-erp24%2F.git ERP-259 Доработка второго шага передачи смен --- 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) {