From: marina Date: Mon, 9 Dec 2024 08:43:37 +0000 (+0300) Subject: ERP-259 Доработка второго шага передачи смен X-Git-Tag: 1.7~187^2~1 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=7b0fff6b1be07493fa7dddb3061180c2009f6938;p=erp24_rep%2Fyii-erp24%2F.git ERP-259 Доработка второго шага передачи смен --- 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('У данного товара нет цены либо замен!');