Exemple #1
0
def SettingLoad():
    s_title = ''
    _data = []
    if request.method == 'POST':
        data = request.json
        s_title = data["title"]
        res = {"title": s_title}

        _data.append(res)

        s_sql = "select * from AIS_Setting where AST_Setting = N'" + s_title + "'"
        # print(s_sql)
        msg, data_rows, errFlag = db.exec_query(engine, s_sql)
        if data_rows is not None:
            rows = data_rows.to_json(orient='records')
            json_rows = json.loads(rows)

            for r in json_rows:
                _data.append({"Setting": r["AST_Setting"]})
                _data.append({"ScheduleType": r["AST_ScheduleType"]})
                _data.append({"ScheduleTime": r["AST_ScheduleTime"]})
                _data.append({"ScheduleTimeType": r["AST_ScheduleTimeType"]})

    # print(_data)
    json_string = json.dumps(_data, ensure_ascii=False)
    print(json_string)
    #creating a Response object to set the content type and the encoding
    response = Response(json_string,
                        content_type="application/json; charset=utf-8")
    return response
Exemple #2
0
def LoadInvPayment():
    #os.system('"E:\setupinterface\WS\libs\SAPB1Interface.exe"')
    s_sql = "select * from AIS_Monitoring where AMT_Setting = 'Invoice/Payment' and AMT_LogMsg = 'Idle'"
    msg, data_rows, errFlag = db.exec_query(engine, s_sql)
    if data_rows is not None:
        subprocess.call([
            "E:\setupinterface\WS\libs\SAPB1Interface.exe", 'Invoice/Payment'
        ])
Exemple #3
0
def LoadCNDN():
    s_sql = "select * from AIS_Monitoring where AMT_Setting = 'CN/DN' and AMT_LogMsg = 'Idle'"
    #print(s_sql)
    msg, data_rows, errFlag = db.exec_query(engine, s_sql)
    if data_rows is not None:
        # print(data_rows)
        subprocess.call(
            ["E:\setupinterface\WS\libs\SAPB1Interface.exe", 'CN/DN'])
Exemple #4
0
    def generate():
        # x = 0
        # while x < 100:
        #     print (x)
        #     x = x + 10
        #     time.sleep(0.2)
        #     yield "data:" + str(x) + "\n\n"
        log_msg = "Idle"
        while 1 == 1:
            log_msg = "Idle"
            s_sql = "select * from AIS_Monitoring where AMT_Setting = 'Invoice'"
            # print(s_sql)
            msg, data_rows, errFlag = db.exec_query(engine, s_sql)
            if data_rows is not None:
                rows = data_rows.to_json(orient='records')
                json_rows = json.loads(rows)

                for r in json_rows:
                    log_msg = r["AMT_LogMsg"]

            yield "data:" + log_msg + "\n\n"
Exemple #5
0
    #print(s_sql)
    msg, data_rows, errFlag = db.exec_query(engine, s_sql)
    if data_rows is not None:
        # print(data_rows)
        subprocess.call(
            ["E:\setupinterface\WS\libs\SAPB1Interface.exe", 'CN/DN'])


# schedule.every(10).minutes.do(job)
# schedule.every().hour.do(job)
# schedule.every().day.at("22:17").do(job)
# schedule.every(6).seconds.do(job)

s_sql = "select * from AIS_Setting"
# print(s_sql)
msg, data_rows, errFlag = db.exec_query(engine, s_sql)
if data_rows is not None:
    rows = data_rows.to_json(orient='records')
    json_rows = json.loads(rows)

    for r in json_rows:
        s_Setting = r["AST_Setting"]
        s_ScheduleType = r["AST_ScheduleType"]
        n_ScheduleTime = r["AST_ScheduleTime"]
        s_ScheduleTimeType = r["AST_ScheduleTimeType"]
        s_DailyTime = "08:30"

        print("setting " + s_Setting + " schedule")
        # MasterData
        if s_Setting == "MasterData":
            if s_ScheduleType == 1: