From: fomichev Date: Wed, 18 Dec 2024 10:39:20 +0000 (+0300) Subject: Добавил сохрание ошибок в error_text X-Git-Tag: 1.7~147^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=d92974e04dd750bfac2e9b0838554e9dca26664e;p=erp24_rep%2Fyii-erp24%2F.git Добавил сохрание ошибок в error_text --- diff --git a/erp24/api2/controllers/DataController.php b/erp24/api2/controllers/DataController.php index 558cee44..a43a92e8 100644 --- a/erp24/api2/controllers/DataController.php +++ b/erp24/api2/controllers/DataController.php @@ -260,6 +260,7 @@ class DataController extends BaseController { $waybillWriteOffsErp = WaybillWriteOffs::find()->where(['in', 'id', $waybillWriteOffIds])->all(); foreach ($waybillWriteOffsErp as $waybillWriteOffsErpElem) { $waybillWriteOffsErpElem->status = WriteOffsErp::STATUS_SEND; + $waybillWriteOffsErpElem->error_text = ''; $waybillWriteOffsErpElem->send_at = date('Y-m-d H:i:s'); $waybillWriteOffsErpElem->save(); if ($waybillWriteOffsErpElem->getErrors()) { @@ -267,7 +268,7 @@ class DataController extends BaseController { } } } catch (Exception $e3) { - file_put_contents(self::OUT_DIR . '/log_created_write_offs_erp_error.txt', PHP_EOL . date("d.m.Y H:i:s",time()). $e3->getMessage(), FILE_APPEND); + file_put_contents(self::OUT_DIR . '/log_created_waybill_write_offs_erp_error.txt', PHP_EOL . date("d.m.Y H:i:s",time()). $e3->getMessage(), FILE_APPEND); } } @@ -1069,6 +1070,7 @@ class DataController extends BaseController { if (!empty($waybillWriteOffsErp)) { /** @var WaybillWriteOffs $waybillWriteOffsErp */ $waybillWriteOffsErp->status = WriteOffsErp::STATUS_ERROR_1С; + $waybillWriteOffsErp->error_text = $errorText; $waybillWriteOffsErp->save(); if ($waybillWriteOffsErp->getErrors()) { LogService::apiErrorLog( diff --git a/erp24/records/WaybillWriteOffs.php b/erp24/records/WaybillWriteOffs.php index cac624eb..b93fb1d1 100644 --- a/erp24/records/WaybillWriteOffs.php +++ b/erp24/records/WaybillWriteOffs.php @@ -116,7 +116,7 @@ class WaybillWriteOffs extends \yii\db\ActiveRecord $model->setAttributes([ 'guid' => DataHelper::createGuidMy(), 'shift_transfer_id' => $shiftTransfer->id, - 'status' => self::STATUS_NEW, + 'status' => WriteOffsErp::STATUS_CREATED, 'store_id' => array_flip(array_map('strval', CityStore::getAllActiveGuidId()))[$shiftTransfer->store_guid], 'store_guid' => $shiftTransfer->store_guid, 'date' => $shiftTransfer->date,