From 7ac0a594db1985dcea26446ae4fc6b94a1333b5a Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Mon, 8 Sep 2025 18:05:11 +0300 Subject: [PATCH] =?utf8?q?=D0=A3=D0=B1=D0=B8=D1=80=D0=B0=D0=B5=D0=BC=20?= =?utf8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B4=D1=80=D1=83=D0=B3?= =?utf8?q?=D0=BE=D0=B9=20=D0=B2=D0=B5=D1=82=D0=BA=D0=B8=20=D0=B2=20DataCon?= =?utf8?q?troller.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api2/controllers/DataController.php | 43 ----------------------- 1 file changed, 43 deletions(-) diff --git a/erp24/api2/controllers/DataController.php b/erp24/api2/controllers/DataController.php index c23fc2b5..5a33815b 100644 --- a/erp24/api2/controllers/DataController.php +++ b/erp24/api2/controllers/DataController.php @@ -16,9 +16,6 @@ use yii_app\records\AnalystsBusinessOperationsTypes; use yii_app\records\ApiCron; use yii_app\records\Assemblies; use yii_app\records\Balances; -use yii_app\records\BouquetComposition; -use yii_app\records\BouquetCompositionMatrixTypeHistory; -use yii_app\records\BouquetCompositionProducts; use yii_app\records\Cashes; use yii_app\records\CityStore; use yii_app\records\CreateChecks; @@ -1192,7 +1189,6 @@ class DataController extends BaseController } if (!empty($result["nomenclature"]["elements"])) { // Products1c::deleteAll(['and', ['tip' => 'products'], ['view' => 0]]); - $bouquets = BouquetComposition::find()->select('guid')->column(); foreach ($result["nomenclature"]["elements"] as $gi => $arr) { // if (!empty($arr["name"]) && in_array($arr["name"][0], ['ь', 'Ь', 'ъ', 'Ъ'])) { // Не вносим номенклатуру, помеченную на удаление // continue; @@ -1216,45 +1212,6 @@ class DataController extends BaseController LogService::apiErrorLog(json_encode(["error_id" => 8, "error" => $products1c6->getErrors()], JSON_UNESCAPED_UNICODE)); } - if(!empty($arr["components"])) { - if(!in_array($arr["id"], $bouquets)) { - $newBouquetComp = new BouquetComposition(); - $newBouquetComp->guid = $arr["id"]; - $newBouquetComp->name = $arr["name"]; - $newBouquetComp->created_by = Admin::getAdminAgentId() ?: null; - if(!$newBouquetComp->save()) { - LogService::apiErrorLog(json_encode(["error_id" => 8.1, "error" => $newBouquetComp->getErrors()], JSON_UNESCAPED_UNICODE)); - } else { - foreach ($arr["components"] as $guid => $quantity) { - $newBouquetCompProd = new BouquetCompositionProducts(); - $newBouquetCompProd->bouquet_id = $newBouquetComp->id; - $newBouquetCompProd->product_guid = $guid; - $newBouquetCompProd->count = $quantity; - $newBouquetCompProd->created_by = Admin::getAdminAgentId() ?: null; - if(!$newBouquetCompProd->save()) { - LogService::apiErrorLog(json_encode(["error_id" => 8.2, "error" => $newBouquetCompProd->getErrors()], JSON_UNESCAPED_UNICODE)); - } - } - $costModels = []; - foreach (BouquetComposition::getRegions() as $region_id) { - $costModels[$region_id] = $newBouquetComp->getCostModel($region_id, array_keys($arr["components"]), true); - } - if(empty($costModels)) { - LogService::apiErrorLog(json_encode(["error_id" => 8.3, "error" => "Стоимость и цена не подсчитаны"], JSON_UNESCAPED_UNICODE)); - } - $bouquetTypeHistory = new BouquetCompositionMatrixTypeHistory(); - $bouquetTypeHistory->bouquet_id = $newBouquetComp->id; - $bouquetTypeHistory->matrix_type_id = 1; - $bouquetTypeHistory->created_by = Admin::getAdminAgentId() ?: null; - $bouquetTypeHistory->is_active = 1; - $bouquetTypeHistory->date_from = date('Y-m-d H:i:s'); - if(!$bouquetTypeHistory->save()) { - LogService::apiErrorLog(json_encode(["error_id" => 8.4, "error" => $bouquetTypeHistory->getErrors()], JSON_UNESCAPED_UNICODE)); - } - } - } - } - foreach ($arr as $key => $property) { if (!in_array($key, Products1c::PRODUCT1C_FIELDS)) { if (empty($property)) continue; -- 2.39.5