2], null, '*', null, true); if (empty($shopList)) { return false; } foreach ($shopList as $shop) { $mainId = $shop->mainId ?? 0; if (empty($mainId)) { $main = MainClass::add(['id' => null], true); $mainId = $main->id ?? 0; if (empty($mainId)) { echo "mainId没有生成 \n"; exit(); } $shop->mainId = $mainId; $shop->save(); } $shopId = $shop->id ?? 0; StatSaleClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatSaleMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatUserClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatUserMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatVisitClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatVisitMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatOutClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatOutMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); PtYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); ShopYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); CashClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); ShopCapitalClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); RechargeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatYjClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatYjMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); ShopAdminClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatOrderMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatOrderCountClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); //采购统计的中央化 StatCgClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatCgMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatCgGhsClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); StatCgGhsMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); /********琦海 start ************/ //报损中央化 StockWastageOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); $wastageList = StockWastageOrderClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true); if (!empty($wastageList)) { foreach ($wastageList as $wastage) { $wastageOrderSn = $wastage->orderSn ?? 0; StockWastageOrderItemClass::updateByCondition(['orderSn' => $wastageOrderSn], ['mainId' => $mainId]); } } //花材中央化 ItemClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); //花材分类 ItemClassClass::updateByCondition(['sjId' => $shop->sjId], ['mainId' => $mainId]); /********琦海 end ************/ } //零售 $shopList = ShopClass::getAllByCondition(['ptStyle' => 1], null, '*', null, true); if (empty($shopList)) { return false; } foreach ($shopList as $shop) { $mainId = $shop->mainId ?? 0; if (empty($mainId)) { $main = MainClass::add(['id' => null], true); $mainId = $main->id ?? 0; if (empty($mainId)) { echo "mainId没有生成 \n"; exit(); } $shop->mainId = $mainId; $shop->save(); } $sjId = $shop->sjId ?? 0; $shopId = $shop->id ?? 0; GoodsClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]); GoodsCategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]); /********琦海 start ************/ //花材中央化 ItemClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]); /********琦海 end ************/ } } }