Esempio n. 1
0
def GetUrunStratejisi(stokkodu):
    DB()
    _urun: list[dbUrunlerModel] = DB.select("select * from Urunler where stokkodu = '{}'".format(stokkodu))
    assert len(_urun) == 1, "Aranılan stokkodu bulunamadı."
    grupId = _urun[0].GrupId
    import Business.GrupBusiness as GrupBus
    return GrupBus.GetGrupStratejileri(grupId)
Esempio n. 2
0
def GrupStrateji(grupId):
    if IsAllow(request, Roller.TumHesaplar):
        try:
            return json_dumps(GrupBusiness.GetGrupStratejileri(grupId))
        except Exception:
            FailedError()
    else:
        UnauthorizedError()
Esempio n. 3
0
def UsttenKalitimAl(grupId):
    if IsAllow(request, Roller.Admin):
        try:
            GrupBusiness.UsttenKalitimAl(grupId)
        except AssertionError as hata:
            UserError(hata.__str__())
        except Exception as hata:
            FailedError()
    else:
        UnauthorizedError()
Esempio n. 4
0
def GrupStratejiOran(grupId):
    if IsAllow(request, Roller.TumHesaplar):
        try:
            return json_dumps(GrupBusiness.GetGrupStratejiOran(grupId))
        except AssertionError as error:
            UserError(error.__str__())
        except Exception:
            FailedError()
    else:
        UnauthorizedError()
Esempio n. 5
0
def Gruplar(ustGrupid):
    if IsAllow(request, Roller.TumHesaplar):
        try:
            TEST("MalzemeGrupları gruplar:", ustGrupid)
            return json_dumps(GrupBusiness.getGruplar(ustGrupid))
        except AssertionError as error:
            UserError(error.__str__())
        except Exception:
            FailedError()
    else:
        UnauthorizedError()
Esempio n. 6
0
def StratejiBelirle():
    if IsAllow(request, Roller.Admin):
        try:
            id = request.json.get("id")
            assert id is not None, "id bilgisi girilmemiş."
            tip = request.json.get("tip")
            assert tip in ["grup", "ürün"], "Geçersiz tip"
            data = request.json.get("data")
            assert type(data) is list, "data verisi yanlış girilmiş."
            GrupBusiness.PostStratejiBelirle(id, tip, data)
        except AssertionError as hata:
            UserError(hata.__str__())
        except Exception as hata:
            FailedError()
    else:
        UnauthorizedError()