From 7b0fff6b1be07493fa7dddb3061180c2009f6938 Mon Sep 17 00:00:00 2001 From: marina Date: Mon, 9 Dec 2024 11:43:37 +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/controllers/ShiftTransferController.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/erp24/controllers/ShiftTransferController.php b/erp24/controllers/ShiftTransferController.php index 8044e05d..cefc4a5a 100644 --- a/erp24/controllers/ShiftTransferController.php +++ b/erp24/controllers/ShiftTransferController.php @@ -288,16 +288,21 @@ class ShiftTransferController extends Controller $shiftTransfer = ShiftTransfer::findOne($shiftTransferId); $storeId = array_flip(array_map('strval', CityStore::getAllActiveGuidId()))[$shiftTransfer->store_guid]; $productSelfCost = SelfCostProduct::findOne(['product_guid' => $productGuid, 'date' => $shiftTransfer->date, 'store_id' => $storeId]); + $productReplacement = ArrayHelper::map( - Product1cReplacement::find() - ->andWhere(['in', 'guid_replacement', ShiftTransfer::find() - ->select('product_replacement_id') - ]) - ->andWhere(['guid' => $productGuid]) - ->select('guid_replacement') - ->column(), - 'id', 'name' - ); + Products1c::find() + ->andWhere(['id' => Product1cReplacement::find() + ->andWhere(['deleted_at' => null]) + ->andWhere(['guid' => $productGuid]) + ->andWhere(['guid_replacement' => ShiftRemains::find() + ->andWhere(['shift_transfer_id' => $shiftTransferId]) + ->andWhere(['<>', 'fact_and_1c_diff', 0]) + ->select('product_guid') + ->column()]) + ->select(['guid']) + ->column()]) + ->all(), + 'id', 'name'); if (!$productPrice || !$productReplacement || !$productSelfCost) { throw new \Exception('У данного товара нет цены либо замен!'); -- 2.39.5