diff --git a/mirzaev/skillparts/system/models/Supply.php b/mirzaev/skillparts/system/models/Supply.php index 29bc6de..c3b630c 100644 --- a/mirzaev/skillparts/system/models/Supply.php +++ b/mirzaev/skillparts/system/models/Supply.php @@ -471,7 +471,7 @@ class Supply extends Product implements ProductInterface, OfferInterface } // Макрос действий после импорта - static::afterImportExcel($warehouse); + static::afterImportExcel($account, $warehouse); return true; } @@ -590,10 +590,267 @@ class Supply extends Product implements ProductInterface, OfferInterface // Запись производителя в буфер $_row['prod'] = match($prod = ucwords(strtolower(preg_replace('/[^A-zА-я\s]/', ' ', $prod, 300)))) { - 'Сatterpillar', 'Cat' => 'CAT', + 'Akebono' => 'AKEBONO', + 'Bosch' => 'BOSCH', + 'Brembo' => 'BREMBO', + 'Ctr' => 'CTR', + 'Delphi' => 'DELPHI', + 'Gates' => 'GATES', + 'Hella' => 'HELLA', + 'Kyb' => 'KYB', + 'Mando' => 'MANDO', + 'Mk Kachiyama', 'Mk-kachiyama', 'Mk-Kachiyama' => 'MK KACHIYAMA', + 'Narva' => 'NARVA', + 'Ngk' => 'NGK', + 'Nk' => 'NK', + 'Osram' => 'OSRAM', + 'Philips' => 'PHILIPS', + 'Rancho' => 'RANCHO', + 'Sangsin' => 'SANGSIN', + 'Swag' => 'SWAG', + 'Trw' => 'TRW', + 'Filtron' => 'FILTRON', + 'Ajusa' => 'AJUSA', + 'Denso' => 'DENSO', + 'Dolz' => 'DOLZ', + 'Era' => 'ERA', + 'Febest' => 'FEBEST', + 'Freccia' => 'FRECCIA', + 'Gmb' => 'GMB', + 'Gsp' => 'GSP', + 'Honda' => 'HONDA', + 'Hyundai/kia', 'Hyundai/Kia', 'Hyundai-kia', 'Hyundai-Kia' => 'HYUNDAI/KIA', + 'Knecht/mahle', 'Knecht/Mahle', 'Knecht-mahle', 'Knecht-Mahle' => 'KNECHT/MAHLE', + 'Lynx' => 'LYNX', + 'Mann' => 'MANN', + 'Mitsubishi' => 'MITSUBISHI', + 'Nipparts' => 'NIPPARTS', + 'Nissan' => 'NISSAN', + 'Sasic' => 'SASIC', + 'Snr' => 'SNR', + 'Subaru' => 'SUBARU', + 'Toyota' => 'TOYOTA', + 'Trw_moto', 'Trw_Moto', 'Trw-moto', 'Trw-Moto' => 'TRW_MOTO', + 'Vag' => 'VAG', + 'Wynns' => 'WYNNS', + 'Ert' => 'ERT', + 'Dongil' => 'DONGIL', + 'Febi' => 'FEBI', + 'Ford' => 'FORD', + 'Injin' => 'INJIN', + 'Land Rover' => 'LAND ROVER', + 'Lpr' => 'LPR', + 'Luzar' => 'LUZAR', + 'MercedesBenz', 'Mercedesbenz', 'Mercedes Benz' => 'MERCEDES BENZ', + 'Suzuki' => 'SUZUKI', + 'Teikin' => 'TEIKIN', + 'Blue print' => 'BLUE PRINT', + 'Daihatsu' => 'DAIHATSU', + 'Goodwill' => 'GOODWILL', + 'Ina' => 'INA', + 'Iveco' => 'IVECO', + 'Jp Group' => 'JP GROUP', + 'Mfilter' => 'MFILTER', + 'Moog' => 'MOOG', + 'Nibk' => 'NIBK', + 'Asakashi', 'Js Asakashi' => 'JS Asakashi', + 'Lemforder' => 'LEMFORDER', + 'Man' => 'MAN', + 'Volvo' => 'VOLVO', + 'Ctp', 'Costex Tractor Parts', => 'CTP', + 'Czd' => 'CZD', + 'Lavr' => 'LAVR', + 'Wai' => 'WAI', + 'Asam' => 'ASAM', + 'Bmw' => 'BMW', + 'Brisk' => 'BRISK', + 'Fenox' => 'FENOX', + 'Gm', 'General Motors' => 'GENERAL MOTORS', + 'Idemitsu' => 'IDEMITSU', + 'Krauf' => 'KRAUF', + 'Liqui Moly', 'Lm' => 'LIQUI MOLY', + 'Mazda' => 'MAZDA', + 'Musashi' => 'MUSASHI', + 'Seiken' => 'SEIKEN', + 'Totachi' => 'TOTACHI', + 'Trialli' => 'TRIALLI', + 'Dong Feng', 'Dongfeng', 'Dongfeng Motors', 'Dfm' => 'DONGFENG', + 'Miles' => 'MILES', + 'Sidem' => 'SIDEM', + 'Stellox' => 'STELLOX', + 'Tokico' => 'TOKICO', + 'Phc Valeo', 'Valeo Phc' => 'Valeo PHC', + 'Точка Опоры' => 'ТОЧКА ОПОРЫ', + 'Jikiu' => 'JIKIU', + 'Lada' => 'LADA', + 'Mitasu' => 'MITASU', + 'Neolux' => 'NEOLUX', + 'Pilenga' => 'PILENGA', + 'Renault' => 'RENAULT', + 'Startvolt' => 'STARTVOLT', + 'Zic' => 'ZIC', + 'Автодело' => 'АВТОДЕЛО', + 'Berkut' => 'BERKUT', + 'Fiat' => 'FIAT', + 'Profix' => 'PROFIX', + 'Sampa' => 'SAMPA', + 'Topfils' => 'TOPFILS', + 'Uaz', 'Уаз' => 'UAZ', + 'Тольятти-тза', 'Тольятти-Тза', 'Тольятти Тза', 'Тольяттитза' => 'Тольятти-ТЗА', + 'Aywiparts' => 'AYWIPARTS', + 'Сatterpillar', 'Cat', 'Catterpillar Inc' => 'CAT', + 'Difa', 'Дифа' => 'DIFA', + 'Nisshimbo' => 'NISSHINBO', + 'Ruei' => 'RUEI', + 'Vic' => 'VIC', + 'Auto-gur', 'Auto-Gur', 'Auto Gur' => 'AUTO-GUR', + 'Daejin' => 'DAEJIN', + 'Gbrake' => 'G-brake', + 'Img' => 'IMG', + 'Kortex' => 'KORTEX', + 'Koyo' => 'KOYO', + 'Peugeot/citroen', 'Peugeot/Citroen', 'Peugeot-citroen', 'Peugeot-Citroen' => 'PEUGEOT-CITROEN', + 'Tangde' => 'TANGDE', + 'Double-force', 'Double-Force', 'Doubleforce', 'Double Force' => 'DOUBLE FORCE', + 'Just-drive', 'Just-Drive', 'Just Drive' => 'JUST DRIVE', + 'Quattro-freni', 'Quattro-Freni', 'Quattro Freni' => 'QUATTRO FRENI', + 'Roers Parts', 'Roers-parts', 'Roers-Parts' => 'ROTERS-PARTS', + 'Tixona' => 'TIXONA', + 'Zekkert' => 'ZEKKERT', + 'Horex' => 'HOREX', + 'Zevs', 'Зевс' => 'ZEVS', + 'Aiko' => 'AIKO', + 'Castrol' => 'CASTROL', + 'Deko' => 'DEKO', + 'Hyundai Xteer' => 'HYUNDAI XTEER', + 'Dyg' => 'DYG', + 'Nty' => 'NTY', + 'Skf' => 'SKF', + 'Alfi Parts' => 'ALFI PARTS', + 'Fiestroco' => 'FIESTROCO', + 'Golden Snail' => 'GOLDEN SNAIL', + 'Ti-guar', 'Ti-Guar' => 'Ti-Guar', + 'Cautex' => 'CAUTEX', + 'Bm-motorsport', 'Bm-Motorsport' => 'BM-Motorsport', + 'Маз', 'Maz' => 'MAZ', + 'Брт' => 'БРТ', + 'Гпз' => 'ГПЗ', + 'Rm Terex' => 'Terex', + 'Agm' => 'Agama', + 'Tsn' => 'TSN', + 'Igp', 'Isuzu Genuine Parts' => 'Isuzu', + 'Etp', 'Europe Tractor Parts' => 'ETP', + 'Cum' => 'Cummins', + 'Xcmg' => 'XCMG', + 'Sdlg' => 'SDLG', + 'Xcmg-sdlg', 'Xcmg-Sdlg' => 'XCMG-SDLG' + 'Vilitan' => 'ViliTan', + 'Kato' => 'KATO', + 'Bw' => 'Baldwin', + 'Itr' => 'ITR', + 'Ofm' => 'OFM', + 'Kz' => 'Kezhang Mechanic', + 'Dongfeng Cummins Engine Company', 'Dongfeng Cummins' => 'DCEC', + 'Bomag' => 'BOMAG', + 'Shehwa' => 'SHEHWA', + 'Kmp Brand', 'Kmp' => 'KMP', + 'Jd' => 'John Deere', + 'World Gasket', 'Wg', 'World-gasket', 'World-Gasket' => 'WG', + 'Original Equipment Manufacturer', 'Oem' => 'OEM', + 'Case' => 'CASE', + 'Jf Filtration', 'Jf' => 'JF Filtration', + 'Hp' => 'HP', + 'Ярославский Завод Дизельной Аппаратуры', 'Язда' => 'ЯЗДА', + 'Prc' => 'PRC', + 'Sf', 'Sf Filter' => 'SF Filter', + 'Ga' => 'GA', + 'Kentek' => 'KENTEK', + 'Cgr Ghinassi', 'Gb Group' => 'Ghinassi', + 'Doosan' => 'DOOSAN', + 'Dressta' => 'DRESSTA', + 'Ammann' => 'AMMANN', + 'Blumaq' => 'BLUMAQ', + 'Deutz' => 'DEUTZ', + 'Daewoo' => 'DAEWOO', + 'Furukawa' => 'FURUKAWA', + 'Niipon' => 'NIIPON', + 'Cargo' => 'CARGO', + 'Wps' => 'WPS', + 'Zaufer' => 'ZAUFER', + 'Handok' => 'HANDOK', + 'Fg Wilson', 'F.G.Wilson', 'F.g.wilson' => 'F.G.WILSON', + 'Racor' => 'RACOR', + 'Jcb' => 'JCB', + 'Auger' => 'AUGER', + 'Ekka' => 'EKKA', + 'Berco' => 'BERCO', + 'Bosch Rexroth' => 'BOSCH REXROTH', + 'Byg' => 'BYG', + 'Cgr' => 'CGR', + 'Dayco' => 'DAYCO', + 'Dcf' => 'DCF', + 'Dunlop' => 'DUNLOP', + 'Febi' => 'FeBi', + 'Fleetguard' => 'FLEETGUARD', + 'Foton' => 'FOTON', + 'Getlf' => 'GETLF', + 'Hidromek' => 'HIDROMEK', + 'Mann&Hummel', 'Mann&hummel' => 'MANN&HUMMEL', + 'Niitsu' => 'NIITSU', + 'Nok' => 'NOK', + 'Nsk' => 'NSK', + 'Ntn' => 'NTN', + 'Orme' => 'ORME', + 'Parker-racor', 'Parker-Racor' => 'PARKER-RACOR', + 'Sanz' => 'SANZ', + 'Sem' => 'SEM', + 'Separ' => 'SEPAR', + 'Shaanxi' => 'SHAANXI', + 'Shell' => 'SHELL', + 'Skf' => 'SKF', + 'Ssp' => 'SSP', + 'Sst' => 'SST', + 'Stal' => 'STAL', + 'Steyr' => 'STEYR', + 'Toyota' => 'TOYOTA', + 'Tt' => 'Tesla Technics', + 'Vag' => 'VAG', + 'Wix', 'Wix Filters' => 'WIX', + 'Yuchai' => 'Yuchai', + 'Zexel' => 'ZEXEL', + 'Dongil' => 'DONGIL', + 'Sanlux' => 'SANLUX', + 'Amt' => 'AMT', + 'Dt' => 'DT', + 'Pramo' => 'PRAMO', + 'Haffen' => 'HAFFEN', + 'Mfilter' => 'MFILTER', + 'Hengst' => 'HENGST', + 'Sofima' => 'SOFIMA', + 'Dolz' => 'DOLZ', + 'Element' => 'ELEMENT', + 'Sardes' => 'SARDES', + 'Seintex' => 'SEINTEX', + 'Patron' => 'PATRON', + 'Lpr' => 'LPR', + 'Kaichin' => 'KAICHIN', + 'Union' => 'UNION', + 'Rb-exide', 'Rb-Exide' => 'RB-EXIDE', + 'Kurin' => 'KURIN', + 'Topfils' => 'TOPFILS', + 'Knor' => 'KNOR', + 'Megapower' => 'MEGAPOWER', + 'Red Filter', 'Redfilter' => 'REDFilter', + 'Skania' => 'SKANIA', + 'Sct' => 'SCT', + 'Kolbenschmidt' => 'KOLBENSCHMIDT', + 'Big Filter' => 'BIG Filter', + 'Alco Filter' => 'ALCO Filter', default => $prod }; + $row['prod'] + // Запись аналогов в буфер $_row['oemn'] = array_walk($analogs, 'trim'); @@ -1058,14 +1315,18 @@ class Supply extends Product implements ProductInterface, OfferInterface /** * Вызывается после загрузки excel-документа на сервер * + * @param static|null $account Аккаунт * @param string|int $warehouse Склад * * @return bool Статус выполнения */ - public static function afterImportExcel(string|int $warehouse = 'неизвестен'): bool + public static function afterImportExcel(Account|int $account = null, string|int $warehouse = 'неизвестен'): bool { + // Инициализация аккаунта + $account = Account::initAccount($account); + // Отправка уведомления о загрузке - $save = Notification::_write("Загружены товары для склада \"$warehouse\""); + $save = Notification::_write("Загружены товары для склада \"$warehouse\"", account: $account->_key); // Инициализация периода $period = new DatePeriod(new DateTime('@' . strtotime("00:00:00")), new DateInterval('PT5M'), new DateTime('@' . strtotime("next day 00:00:00"))); @@ -1086,7 +1347,7 @@ class Supply extends Product implements ProductInterface, OfferInterface if ($date instanceof DateTime) $date = '5:00'; // Отправка уведомления об обработке - $handle = Notification::_write("Следующее обновление товаров начнётся через $date"); + $handle = Notification::_write("Следующее обновление товаров начнётся через $date", account: $account->_key); return $save && $handle; } diff --git a/mirzaev/skillparts/system/views/product/analogs.php b/mirzaev/skillparts/system/views/product/analogs.php index bb87f18..d6624d8 100644 --- a/mirzaev/skillparts/system/views/product/analogs.php +++ b/mirzaev/skillparts/system/views/product/analogs.php @@ -27,7 +27,7 @@ foreach($analogs as $key => $analog) if ($analog['_key'] === $model->_key) unset
- +
diff --git a/mirzaev/skillparts/system/views/product/list.php b/mirzaev/skillparts/system/views/product/list.php index a24408b..c14a0be 100644 --- a/mirzaev/skillparts/system/views/product/list.php +++ b/mirzaev/skillparts/system/views/product/list.php @@ -39,7 +39,7 @@ $timezone = $timezone[1][0];
.
- + catn ?? 'Неизвестно' ?> (prod ?? 'Неизвестно' ?>) diff --git a/mirzaev/skillparts/system/views/search/index.php b/mirzaev/skillparts/system/views/search/index.php index f4fef74..73cbb95 100644 --- a/mirzaev/skillparts/system/views/search/index.php +++ b/mirzaev/skillparts/system/views/search/index.php @@ -51,7 +51,7 @@ use app\models\Search;
- +
@@ -123,7 +123,7 @@ use app\models\Search;
- +
diff --git a/mirzaev/skillparts/system/views/search/panel.php b/mirzaev/skillparts/system/views/search/panel.php index 2a1d723..abb824c 100644 --- a/mirzaev/skillparts/system/views/search/panel.php +++ b/mirzaev/skillparts/system/views/search/panel.php @@ -45,9 +45,11 @@ if (isset($history) && $history) { $catn = $row['catn']; $prod = $row['prod']; + $_catn = urlencode($row['catn']); + $_prod = urlencode($row['prod']); echo <<$catn$prod + $catn$prod HTML; } } else { diff --git a/mirzaev/skillparts/system/views/supply/list.php b/mirzaev/skillparts/system/views/supply/list.php index 6bb38af..90d97bd 100644 --- a/mirzaev/skillparts/system/views/supply/list.php +++ b/mirzaev/skillparts/system/views/supply/list.php @@ -60,9 +60,9 @@ $timezone = $timezone[1][0]; catn'" ?? null ?>, prod'" ?? null ?>);"> - prod/$product->catn" ?>"> + prod/$product->catn") ?>"> - +