Chuyển tới nội dung chính

AbrBusinessGov

Project: Ezy.Module.Selenium.Search.AbrBusinessGov File chính: Search_ABR_Lookup.cs

Tra cứu ABN / business name trên Australian Business Register (site công khai, không đăng nhập).

Nguồn

  • Host: abr.business.gov.au (cũng dùng superfundlookup.gov.au); đọc từ Configs/AbrBusinessGovAu/Setting.jsonURL.
  • Trang detail mở qua link a[href^='/ABN/View'] (tức .../ABN/View?abn=...).

Input

Đọc hàng đợi TextSearch_ABNLookup qua db.Get_TextSearch_ABNLookup(), lọc !IsDisableTypeSearch == "SimpleSearch".

CộtVai trò
ABNLookupTextABN / ACN / tên — nhập vào ô search

Tham số ids[] để giới hạn theo Id.

Login / Captcha

Không. Site ABR công khai, không credential.

Các bước scrape

StartSearchAndDownload:

  1. Mở DB, RefreshCache(), build dictionary dữ liệu cũ theo ABNId (db.Get_ABNLookup_CurrentDetails()).
  2. Nhập ABNLookupText vào SearchText → bấm MainSearchButton (fallback input[class='default']).
  3. Lấy danh sách kết quả a[href^='/ABN/View']:
    • Nhiều kết quả: duyệt từng link tối đa NoOfDetailEachSearch; scroll bằng JS; lấy href; OpenNewTab(...); GetDataFromWebsite(_abnId, ...); lưu TextSearch_Data (nối ;); đóng tab, switch về tab gốc.
    • Không có link kết quả: nếu không thấy input[value='Export'] ⇒ coi như đã vào thẳng trang detail (isDetail=true), parse luôn theo ABNLookupText. Nếu thấy nút Export ⇒ không có kết quả.
  4. GetDataFromWebsite: tạo newItem{ ABNId }; kiểm tra trading name (a[href^='/Help/Glossary#tradingname']); duyệt columns, đọc giá trị bằng DeSearchHelper.GetValue (Id / CssSelector / FullXPath), set property cùng tên qua reflection.
  5. Chụp screenshot (CurrentDetails) → ImageURLs; tải PDF → PdfURLs.
  6. Cập nhật SearchStatus, SaveChanges.

Output

Bảng TextSearch_Data_ABNLookup_CurrentDetails. Ghi qua Insert_ABNLookup_CurrentDetails / Update_ABNLookup_CurrentDetails.

Field chính: ABNId, EntityName, ABNStatus, EntityType, GST, MainBusinessLocation, BusinessInformation, RegistrationDate, NextReviewDate, ImageURLs, PdfURLs.

Hàng đợi cũng được cập nhật cột TextSearch_Data = danh sách ABN tìm thấy (nối ;).

Lỗi / edge cases

  • Try/catch toàn bộ: lỗi → Log_Exception + SearchStatus = "Search Fail At...".
  • Không có queue data → "Search data not found" + log.
  • Column không tồn tại và !IsIgnoreLogLog_Exception("Column not exist").
  • Trading name không có → bỏ qua các column chứa "TradingName".
  • Có nút Export (không có kết quả thực) → SearchStatus "Found: 0".

Trạng thái: active.