From 14ca4dd1c62a2b0fed76786849de84b01cc07d60 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Wed, 18 Dec 2024 13:02:29 +0300 Subject: [PATCH] error_text --- erp24/api2/controllers/DataController.php | 8 ++--- ...er_waybill_incoming_waybill_write_offs.php | 36 +++++++++++++++++++ erp24/records/ShiftTransfer.php | 7 ++-- erp24/records/WaybillIncoming.php | 4 ++- erp24/records/WaybillWriteOffs.php | 4 ++- 5 files changed, 51 insertions(+), 8 deletions(-) create mode 100755 erp24/migrations/m241218_094917_add_column_error_text_to_shift_transfer_waybill_incoming_waybill_write_offs.php diff --git a/erp24/api2/controllers/DataController.php b/erp24/api2/controllers/DataController.php index c72aa219..b6f3ac9e 100644 --- a/erp24/api2/controllers/DataController.php +++ b/erp24/api2/controllers/DataController.php @@ -351,7 +351,7 @@ class DataController extends BaseController { 'date', 'comment', 'quantity', - 'summ' + 'summ_self_cost' ]) ->indexBy('id') ->andWhere(['status' => WriteOffsErp::STATUS_CONFIRM]) @@ -362,7 +362,7 @@ class DataController extends BaseController { $waybillIncomingIds = array_column($waybillIncoming, 'id'); $products = WaybillIncomingProducts::find() - ->select(['waybill_incoming_id', 'product_id', 'product_count', 'product_price', 'summ']) + ->select(['waybill_incoming_id', 'product_id', 'product_count', 'product_self_cost', 'summ_self_cost']) ->where(['in', 'waybill_incoming_id', $waybillIncomingIds]) ->asArray() ->all(); @@ -373,7 +373,7 @@ class DataController extends BaseController { $waybillIncomingProducts[$product['waybill_incoming_id']][] = [ 'product_id' => $product['product_id'], 'quantity' => (string) $product['product_count'], - 'price' => $product['product_price'], + 'price' => $product['product_self_cost'], ]; } @@ -398,7 +398,7 @@ class DataController extends BaseController { 'type' => 'ревизия при передаче смены', 'cause' => 'Документ ревизии при передаче смены в ERP ' . $row['number'], 'items' => $row['items'], - 'summ' => $row['summ'], + 'summ' => $row['summ_self_cost'], 'comment' => $row['comment'], ]; } diff --git a/erp24/migrations/m241218_094917_add_column_error_text_to_shift_transfer_waybill_incoming_waybill_write_offs.php b/erp24/migrations/m241218_094917_add_column_error_text_to_shift_transfer_waybill_incoming_waybill_write_offs.php new file mode 100755 index 00000000..57fd4330 --- /dev/null +++ b/erp24/migrations/m241218_094917_add_column_error_text_to_shift_transfer_waybill_incoming_waybill_write_offs.php @@ -0,0 +1,36 @@ +addColumn(self::TABLE_NAME, 'error_text', $this->text()->null()->comment('Ошибка')); + $this->addColumn(self::TABLE_NAME2, 'error_text', $this->text()->null()->comment('Ошибка')); + $this->addColumn(self::TABLE_NAME3, 'error_text', $this->text()->null()->comment('Ошибка')); + $this->addColumn(self::TABLE_NAME4, 'error_text', $this->text()->null()->comment('Ошибка')); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn(self::TABLE_NAME4, 'error_text'); + $this->dropColumn(self::TABLE_NAME3, 'error_text'); + $this->dropColumn(self::TABLE_NAME2, 'error_text'); + $this->dropColumn(self::TABLE_NAME, 'error_text'); + } +} diff --git a/erp24/records/ShiftTransfer.php b/erp24/records/ShiftTransfer.php index 9a3eece7..25839337 100644 --- a/erp24/records/ShiftTransfer.php +++ b/erp24/records/ShiftTransfer.php @@ -22,6 +22,8 @@ use Yii; * @property string|null $comment Комментарий принимающей стороны * @property string|null $report в формате HTML или TXT или JSON внешний вид всех данных при приеме * @property string|null $product_groups Список alias выбранных чекбоксов, через запятую + * @property string|null $error_text Ошибка + * */ class ShiftTransfer extends \yii\db\ActiveRecord { @@ -64,7 +66,7 @@ class ShiftTransfer extends \yii\db\ActiveRecord [['status_id', 'end_shift_admin_id', 'start_shift_admin_id'], 'integer'], [['date_start', 'date_end', 'groups1', 'groups2'], 'safe'], [['goods_transfer_summ', 'goods_transfer_count', 'discrepancy_pieces', 'discrepancy_rubles'], 'number'], - [['comment', 'report', 'product_groups'], 'string'], + [['comment', 'report', 'product_groups', 'error_text'], 'string'], [['date', 'store_guid'], 'string', 'max' => 36], ]; } @@ -91,7 +93,8 @@ class ShiftTransfer extends \yii\db\ActiveRecord 'report' => 'Отчёт', 'product_groups' => 'Продуктовые группы', 'groups1' => 'Другие группы', - 'groups2' => 'Основная группа' + 'groups2' => 'Основная группа', + 'error_text' => 'Error Text', ]; } diff --git a/erp24/records/WaybillIncoming.php b/erp24/records/WaybillIncoming.php index 665e7920..2cf98097 100644 --- a/erp24/records/WaybillIncoming.php +++ b/erp24/records/WaybillIncoming.php @@ -29,6 +29,7 @@ use yii_app\helpers\DataHelper; * @property string $created_at Дата создания * @property string|null $updated_at Дата обновления * @property string|null $send_at Дата отправления в 1с + * @property string|null $error_text Ошибка */ class WaybillIncoming extends \yii\db\ActiveRecord { @@ -51,7 +52,7 @@ class WaybillIncoming extends \yii\db\ActiveRecord [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id', 'number'], 'default', 'value' => null], [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id'], 'integer'], [['date', 'created_at', 'updated_at', 'send_at'], 'safe'], - [['comment'], 'string'], + [['comment', 'error_text'], 'string'], [['quantity', 'summ', 'summ_self_cost'], 'number'], [['guid', 'store_guid', 'number', 'number_1c'], 'string', 'max' => 100], [['guid'], 'unique'], @@ -101,6 +102,7 @@ class WaybillIncoming extends \yii\db\ActiveRecord 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'send_at' => 'Send At', + 'error_text' => 'Error Text', ]; } diff --git a/erp24/records/WaybillWriteOffs.php b/erp24/records/WaybillWriteOffs.php index 3e80d56a..3a198d1a 100644 --- a/erp24/records/WaybillWriteOffs.php +++ b/erp24/records/WaybillWriteOffs.php @@ -30,6 +30,7 @@ use yii_app\helpers\DataHelper; * @property string $created_at Дата создания * @property string|null $updated_at Дата обновления * @property string|null $send_at Дата отправления в 1с + * @property string|null $error_text Ошибка * @property ShiftTransfer $shiftTransfer * @property WaybillWriteOffsProducts[] $waybillWriteOffsProducts @@ -56,7 +57,7 @@ class WaybillWriteOffs extends \yii\db\ActiveRecord [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id'], 'default', 'value' => null], [['shift_transfer_id', 'status', 'created_admin_id', 'updated_admin_id', 'store_id'], 'integer'], [['date', 'created_at', 'updated_at', 'send_at'], 'safe'], - [['comment'], 'string'], + [['comment', 'error_text'], 'string'], [['quantity', 'summ', 'summ_self_cost'], 'number'], [['guid', 'store_guid', 'number', 'number_1c'], 'string', 'max' => 100], [['guid'], 'unique'], @@ -105,6 +106,7 @@ class WaybillWriteOffs extends \yii\db\ActiveRecord 'created_at' => 'Дата создания', 'updated_at' => 'Дата обновления', 'send_at' => 'Дата отправления в 1с', + 'error_text' => 'Error Text', ]; } -- 2.39.5