s and g , n and b distinction was made

This commit is contained in:
2024-05-23 17:18:09 +03:00
parent 88bdbb969d
commit ac071a8cda
2 changed files with 102 additions and 19 deletions

View File

@@ -316,6 +316,7 @@ func (l *Luca) Login(company company.Company, month float64, year float64) error
}
func (l *Luca) BordroTableMaping(frame *rod.Page, b *LucaBordro) ([]BordroPageScript, error) {
scriptIndexArray = []BordroPageScript{}
table, err := frame.Elements("#scroll > div > table > tbody > tr > td > table > tbody > tr > td") //table kontrol et var mı yok mu diye
if err != nil {
return nil, err
@@ -647,6 +648,9 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error {
var elementInsertControl bool = true
var displayControl bool = true
tt := v.String()
if tt == "0" {
continue
}
if k == "Normal Gün" {
continue
}
@@ -677,8 +681,26 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error {
if err != nil {
return err
}
// //s ve g olunca i yi çalıştır n ve b olunca i+1 i
if hashValue == "S" || hashValue == "G" {
if (hashValue == "S" || hashValue == "G") && k != "ARGE-Destek ve Tasarım Faaliyeti" {
if rsp[i+1].Value != hashValue {
newBordroPage, err := frame3.Element("body > form > table > tbody > tr.altBar.alt-button-bar > th > table > tbody > tr > td:nth-child(1) > button:nth-child(4)")
newBordroPage.WaitLoad()
if err != nil {
return err
}
newBordroPage.Click(proto.InputMouseButtonLeft, 1)
err = WaitLoad(frame3)
if err != nil {
return err
}
err = ClickItem(frame3, "body > form > table > tbody > tr.altBar.alt-button-bar > th > table > tbody > tr > td:nth-child(1) > button:nth-child(3)", 1)
if err != nil {
return err
}
return errors.New(k + hashValue + "Sütun Bulunamadı")
}
el, err = frame3.Element("#" + rsp[i].Index)
if err != nil {
return err
@@ -711,6 +733,14 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error {
}
}
}
if k == "ARGE-Destek ve Tasarım Faaliyeti" {
if hashValue == "S" {
el, err = frame3.Element("#" + rsp[i+1].Index)
if err != nil {
return err
}
}
}
value := v.String()
if strings.Contains(value, ".") {
value = strings.Replace(value, ".", ",", -1)
@@ -775,10 +805,10 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error {
if err != nil {
return err
}
saveButtonMessage, err := ReceiveDOMMessages(frame3, ".alert-container", "innerText")
if err != nil {
return err
}
saveButtonMessage, _ := ReceiveDOMMessages(frame3, ".alert-container", "innerText")
// if err != nil {
// return err
// }
if saveButtonMessage != "Bordro hesaplanıyor." {
newBordroPage, err := frame3.Element("body > form > table > tbody > tr.altBar.alt-button-bar > th > table > tbody > tr > td:nth-child(1) > button:nth-child(4)")
newBordroPage.WaitLoad()

View File

@@ -118,6 +118,49 @@ func (s *Srv) Rpa(companyID float64, month float64, year float64, devMode bool)
}
// if rows[0][0] == "" {
// rows = rows[1:]
// }
// type hashtagValue struct {
// B string
// N string
// G string
// S string
// }
// checkHeader := make(map[string]*hashtagValue)
// for _, col := range rows[0] {
// if strings.Contains(col, "Cagatay") {
// fmt.Print("deneme")
// }
// var keySplitOne string
// hs := &hashtagValue{
// B: "",
// N: "",
// G: "",
// S: "",
// }
// key := col
// if strings.Contains(col, "#") {
// keySplit := strings.SplitN(col, " #", 2)
// key = strings.TrimSpace(keySplit[0])
// keySplitOne = strings.TrimSpace(keySplit[0])
// fmt.Print(keySplitOne)
// if existingHS, ok := checkHeader[key]; ok {
// hs = existingHS
// }
// // Burada keySplitOne değerine göre hs struct'ının hangi alanını dolduracağımızı belirliyoruz
// if keySplit[1] == "B" {
// hs.B = keySplit[1]
// } else if keySplit[1] == "N" {
// hs.N = keySplit[1]
// } else if keySplit[1] == "G" {
// hs.G = keySplit[1]
// } else if keySplit[1] == "S" {
// hs.S = keySplit[1]
// }
// }
// checkHeader[key] = hs
// }
var lastItem bool = false
// data := make([]*model.Bordro, 0) // []*Bordro türünde bir dilim oluştur
@@ -141,32 +184,42 @@ func (s *Srv) Rpa(companyID float64, month float64, year float64, devMode bool)
keySplitOne := strings.TrimSpace(keySplit[0])
tseK := strings.TrimSpace(keySplit[1])
fmt.Print(tseK)
for k, _ := range brd.Ucretler {
for k, d := range brd.Ucretler {
if strings.Contains(k, keySplitOne) { //k=olan
a := d.String()
fmt.Print(a)
if strings.Contains(k, "B") && strings.Contains(tseK, "N") {
emitLog("Şube : aynı anda B ve N Sütunu Girilemez ")
if col != "" && a != "0" {
emitLog(key + " : aynı anda B ve N Sütunu Girilemez ")
status = true
break
}
}
if strings.Contains(k, "N") && strings.Contains(tseK, "B") {
emitLog("Şube : aynı anda N ve B Sütunu Girilemez ")
if col != "" && a != "0" {
emitLog(key + " : aynı anda N ve B Sütunu Girilemez ")
status = true
break
}
}
if strings.Contains(k, "G") && strings.Contains(tseK, "S") {
emitLog("Şube : aynı anda G ve S Sütunu Girilemez ")
if col != "" && a != "0" {
emitLog(key + ": aynı anda G ve S Sütunu Girilemez ")
status = true
break
}
}
if strings.Contains(k, "S") && strings.Contains(tseK, "G") {
emitLog("Şube : aynı anda S ve G Sütunu Girilemez ")
if col != "" && a != "0" {
emitLog(key + ": aynı anda S ve G Sütunu Girilemez ")
status = true
break
}
}
}
}
@@ -191,7 +244,7 @@ func (s *Srv) Rpa(companyID float64, month float64, year float64, devMode bool)
}
}
if status {
break
continue
}
if i == len(rows)-1 {
lastItem = true