diff --git a/app/build/icon.ico b/app/build/icon.ico index bfa0690..d33634a 100644 Binary files a/app/build/icon.ico and b/app/build/icon.ico differ diff --git a/app/build/info.json b/app/build/info.json index 850b2b5..71f899e 100644 --- a/app/build/info.json +++ b/app/build/info.json @@ -5,11 +5,11 @@ "info": { "0000": { "ProductVersion": "0.1.0", - "CompanyName": "My Company", - "FileDescription": "My Product Description", - "LegalCopyright": "© now, My Company", - "ProductName": "My Product", - "Comments": "This is a comment" + "CompanyName": "Notitek Yazılım A.Ş", + "FileDescription": "Bordro Robotu", + "LegalCopyright": "© now, Notitek Yazılım A.Ş", + "ProductName": "Bordro Robotu", + "Comments": "Luca Bordro Robotu" } } } \ No newline at end of file diff --git a/app/lib/bot/luca.go b/app/lib/bot/luca.go index bc24018..e29424c 100644 --- a/app/lib/bot/luca.go +++ b/app/lib/bot/luca.go @@ -37,6 +37,9 @@ func (l *Luca) ErrFunc(index bool) { CloseBrowser(l.Browser) } } +func (l *Luca) ClosingBrowserFromExternalLink() { + CloseBrowser(l.Browser) +} func VerifyCaptcha(page *rod.Page) error { captcha := "#captcha" picturePreparation := []string{ @@ -216,6 +219,7 @@ func (l *Luca) Login(company company.Company, month float64, year float64) error if err != nil { return err } + Wait(frame4, 1500) companiesSelectBoxWait, err := frame4.Element("#SirketCombo > option") if err != nil { return err @@ -257,6 +261,7 @@ func (l *Luca) Login(company company.Company, month float64, year float64) error if err != nil { return err } + Wait(frame4, 1500) companiesSelectYear, err := frame4.Elements("#DonemCombo > option") if err != nil { @@ -396,7 +401,11 @@ func (l *Luca) PayrollPageLogin() error { if err != nil { return err } - Wait(newPage, 200) + err = frame.WaitLoad() + if err != nil { + return err + } + Wait(newPage, 500) err = ClickItem(frame, "#apy1000m0i1ITD", 1) if err != nil { return err @@ -429,6 +438,11 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { } isyeriId := "" bolumId := "" + err = WaitLoad(frame3) + if err != nil { + return err + } + Wait(frame3, 1000) bordroCompanySelectBox, err := frame3.Elements("#isyeriId > option") for j := 0; j < len(bordroCompanySelectBox); j++ { text, err := bordroCompanySelectBox[j].Text() @@ -441,7 +455,14 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { break } } - + if isyeriId == "" { + return errors.New("Kayıtlı Şube Bulunamadı") + } + err = WaitLoad(frame3) + if err != nil { + return err + } + Wait(frame3, 500) element, err := frame3.Element("#isyeriId") element.WaitLoad() if err != nil { @@ -456,9 +477,14 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { if err != nil { return err } + Wait(frame3, 1000) bordroDepartmentSelectBox, err := frame3.Elements("#bolumId > option") element, err = frame3.Element("#bolumId > option") + if err != nil { + return err + } element.WaitLoad() + err = WaitLoad(frame3) if err != nil { return err } @@ -474,6 +500,9 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { } fmt.Print(text, value) } + if bolumId == "" { + return errors.New("Kayıtlı Bölüm Bulunamadı") + } element, err = frame3.Element("#bolumId") if err != nil { @@ -496,7 +525,7 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { if err != nil { return err } - + Wait(frame3, 1000) var isEmpty bool = false //var targetID string elems, err := frame3.Elements("#scroll > table > tbody > tr > td[id^='tcKimlikNo']") @@ -521,7 +550,6 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { if err != nil { return err } - l.ErrFunc(lastItem) return errors.New("Böyle Bir Kullanıcı Bulunamadı") } for j := 0; j < len(elems); j++ { @@ -551,7 +579,6 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { if err != nil { return err } - l.ErrFunc(lastItem) return errors.New("Yazılı Bordro Var Lütfen Siliniz") } if foundIndex != -1 && isEmpty == false { @@ -579,6 +606,8 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { return err } err = el.Input(v.String()) + //el.Eval(`this.dispatchEvent(new KeyboardEvent('keydown', {'key': 'Enter'}))`) + break } } fmt.Print(v, k) @@ -610,7 +639,6 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { return err } - l.ErrFunc(lastItem) return errors.New(saveButtonMessage) } @@ -634,6 +662,5 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error { if err != nil { return err } - l.ErrFunc(lastItem) return err } diff --git a/app/lib/srv/srv.go b/app/lib/srv/srv.go index 248f39f..67e90c1 100644 --- a/app/lib/srv/srv.go +++ b/app/lib/srv/srv.go @@ -52,6 +52,7 @@ type userInfo struct { } func (s *Srv) Rpa(companyName string, month float64, year float64) error { + emitLog("") type CompanyInfo struct { company *company.Company // float64.Company türünü gömme month float64 // yeni bir alan ekliyoruz @@ -100,6 +101,11 @@ func (s *Srv) Rpa(companyName string, month float64, year float64) error { slog.Error(err.Error()) return err } + if len(rows) < 3 { + emitLog("Boş Excel Yüklemesi") + b.ClosingBrowserFromExternalLink() + return nil + } if rows[0][0] == "" { rows = rows[1:] } @@ -139,13 +145,13 @@ func (s *Srv) Rpa(companyName string, month float64, year float64) error { emitLog(str) } else { - str += "işlem başarılı, " + str += "Şube : " + brd.Sube + "Bölüm : " + brd.Bolum + "işlem başarılı, " emitLog(str) } } - + b.ClosingBrowserFromExternalLink() return nil }