]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-259 Доработка второго шага передачи смен
authormarina <m.zozirova@gmail.com>
Mon, 9 Dec 2024 08:43:37 +0000 (11:43 +0300)
committermarina <m.zozirova@gmail.com>
Mon, 9 Dec 2024 08:43:37 +0000 (11:43 +0300)
erp24/controllers/ShiftTransferController.php

index 8044e05dcfbeca774c73a10fdbafe9eaa33b78dd..cefc4a5a6d01b92d503efe63a98ca1a31d6a9e55 100644 (file)
@@ -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('У данного товара нет цены либо замен!');