Exemplo n.º 1
0
def manager1():  #숫자코드 - 구분 등록/삭제
    Logger.info("Entered manager1")
    cur = g.db.cursor().execute(
        'SELECT A.CODE, A.COM_NUMBER, C.COM_NM FROM NUMBER_CODE A LEFT JOIN COMPOSITION C ON A.COM_ID = C.COM_ID ORDER BY A.CODE'
    )
    rows = cur.fetchall()
    datas = []
    for r in rows:
        check = False

        for d in datas:
            if r[0] == d.code:
                check = True
                d.addComposition(r[1], r[2])
                break

        if not check:
            codeData = CodeData(r[0])
            codeData.addComposition(r[1], r[2])
            datas.append(codeData)

    result_data = []
    for d in datas:
        result_data.append(d.getSpreadData())

    cur = g.db.cursor().execute(
        'SELECT COM_NM FROM COMPOSITION ORDER BY COM_ID')
    rows = cur.fetchall()
    rows = [r[0] for r in rows]

    return render_template("admin1.html", datas=datas, options=rows, layout=1)
	def send(self,data):
		try:
			proxy = xmlrpclib.Server('http://localhost:8000/xmlrpc')
			
			#Intento mandar los datos que quedaron pendientes por errores de conectividad
			f = open("/home/gustavo/workspace/QRDecodedApp/store/store.txt")
			#Leo el archivo y agrego cada linea del archivo a una lista
			l = []
			while True:
				line = f.readline()
				if not line: break
				l.append(line)
				#pprint(proxy.Interpreter.readData(line))
			f.close()
			
			countLine = 0
			for i in l:
				pprint(proxy.Interpreter.readData(i))
				del l[0]
				countLine = countLine + 1
			
			f = open("/home/gustavo/workspace/QRDecodedApp/store/store.txt","w")
			auxCount = 0
			while auxCount < countLine:
				f.write("")
				auxCount = auxCount +1
					
			#Luego mando el dato mas nuevo capturado
			pprint(proxy.Interpreter.readData(data))
		except:
			Logger.info("Error de conexion al servidor")
			f = open("/home/gustavo/workspace/QRDecodedApp/store/store.txt","a")
			f.write(data + "\n")
			f.close()
Exemplo n.º 3
0
    def ecountLogin(self):
        Logger.info("ecountLogin")
        url = 'https://oapi.ecounterp.com/OAPI/V2/Zone'
        Logger.debug("COM_CODE : " + self.config.ecountComCode)
        headers = {'Content-Type': 'application/json; charset=utf-8'}
        post = {'COM_CODE': self.config.ecountComCode}

        try:
            response = requests.post(url,
                                     data=json.dumps(post),
                                     headers=headers)
        except:
            Logger.error("ecount 로그인 중 네트워크 연결에 문제가 있습니다. ")
            sys.exit()

        Logger.debug("response" + response.text)
        Logger.debug("Data : " + response.json()["Data"]["ZONE"])
        self.ZONE = response.json()["Data"]["ZONE"]

        url = 'https://oapi{ZONE}.ecounterp.com/OAPI/V2/OAPILogin'.format(
            ZONE=self.ZONE)
        post = {
            'COM_CODE': self.config.ecountComCode,
            'USER_ID': self.config.ecountId,
            'API_CERT_KEY': self.config.ecountApiKey,
            'LAN_TYPE': 'ko-KR',
            'ZONE': self.ZONE
        }
        response = requests.post(url, data=json.dumps(post), headers=headers)

        self.SESSION_ID = response.json()["Data"]["Datas"]["SESSION_ID"]
Exemplo n.º 4
0
    def registrationList(self, dataList):
        Logger.info("CarriageData List Registraion")
        Logger.debug("regist Data List : " + str(dataList))
        check_resp = []
        c = False
        for d in dataList:
            a = self.registration(d)
            if not a[0]:
                check_resp.append(
                    str(a[1]) + "data : " + str(d.CUST_DES) + " : " +
                    str(d.PROD_DES))

        msg = QMessageBox()
        if len(check_resp) > 0:
            msg.setWindowTitle("판매 등록 실패")
            msg.setIcon(QMessageBox.Critical)
            msg.setText("판매 등록에 실패 했습니다. 아래 리스트를 확인해주세요.\n" +
                        "\n".join(check_resp))
        else:
            msg.setWindowTitle("판매 등록 성공")
            msg.setIcon(QMessageBox.Information)
            msg.setText("판매 등록에 성공 했습니다.")

        msg.setDefaultButton(QMessageBox.Escape)
        msg.exec_()
Exemplo n.º 5
0
    def __init__(self):
        config = configparser.ConfigParser()
        try:
            config.read(self.configFilePath)
            if (self.lozenHeader in config):
                self.lozenId = config[self.lozenHeader][self.lozenIdKey]
                self.lozenPwd = config[self.lozenHeader][self.lozenPwdKey]
            else:
                Logger.error("LOZEN 로그인 정보 불러오기 실패 : " + self.configFilePath +
                             " 설정을 불러오는데 실패했습니다.")

            Logger.info("ecount login")
            config.read(self.ecountId)
            if (self.ecountHeader in config):
                self.ecountId = config[self.ecountHeader][self.ecountIdKey]
                self.ecountPwd = config[self.ecountHeader][self.ecountPwdKey]
                self.ecountComCode = config[self.ecountHeader][
                    self.ecountComKey]
                self.ecountApiKey = config[self.ecountHeader][
                    self.ecountApiKeyKey]

                Logger.debug("apikey: " + self.ecountApiKey)

            else:
                Logger.error("ECOUNT 로그인 정보 불러오기 실패 : " + self.configFilePath +
                             " 설정을 불러오는데 실패했습니다.")
        except:
            Logger.error("로그인 정보 불러오기 실패 : " + self.configFilePath +
                         " 설정을 불러오는데 실패했습니다.")
Exemplo n.º 6
0
def manager2():
    Logger.info("Entered manager2")
    cur = g.db.cursor().execute(
        'SELECT C.COM_NM, A.DESC_ID, A.DESCRIPT FROM DESCRIPTION A LEFT JOIN COMPOSITION C ON A.COM_ID = C.COM_ID ORDER BY C.COM_ID'
    )
    rows = cur.fetchall()
    datas = []
    for r in rows:
        check = False

        for d in datas:
            if r[0] == d.composition:
                check = True
                d.addDescription(r[1], r[2])
                break

        if not check:
            composData = CompositionData(r[0])
            composData.addDescription(r[1], r[2])
            datas.append(composData)

    result_data = []
    for d in datas:
        result_data.append(d.getSpreadData())

    return render_template("admin2.html", datas=datas, layout=2)
Exemplo n.º 7
0
def result():
    Logger.info("Result Chat Page")
    if request.method == 'POST':
        code = -1
        code = request.form['code']
        cur = g.db.cursor().execute(f'''SELECT B.DESCRIPT FROM NUMBER_CODE A
LEFT JOIN DESCRIPTION B ON B.COM_ID = A.COM_ID
WHERE A.CODE = {code}
ORDER BY A.COM_NUMBER, B.DESC_ID''')
        rows = cur.fetchall()
        tempString = ''
        if rows:
            tempString = '[{name: \'TEST_NAME\',avatar: null,messages: ['
            for i, row in enumerate(rows):
                if i != 0:
                    tempString = tempString + ','
                tempString = tempString + '{message: \'' + str(
                    row[0]) + '\',sender: false}'

            tempString = tempString + ',{message: \'\',sender: false}]}];'

        return render_template("result.html",
                               resultString=tempString,
                               wrongway=False)
    else:
        rows = []
        return render_template("result.html", wrongway=True)
Exemplo n.º 8
0
 def __init__(self, ZONE, SESSION_ID):
     Logger.info("CarriageRegister.init")
     self.ZONE = ZONE
     self.SESSION_ID = SESSION_ID
     self.registrationUrl = self.registrationUrl.format(
         ZONE=self.ZONE, SESSION_ID=self.SESSION_ID)
     self.inquiryUrl = self.inquiryUrl.format(ZONE=self.ZONE,
                                              SESSION_ID=self.SESSION_ID)
Exemplo n.º 9
0
    def progressing(self):
        Logger.info("startProgressing")
        self.is_progressing = True

        pgDialog = Ui_Form()
        pgDialog.setupUi()
        pgDialog.progLabel.setText("데이터 크롤링 중..")
        # process = False

        Logger.info("stopProgressing")
Exemplo n.º 10
0
def deleteDesc():
    Logger.info("deleteDesc")
    Logger.info(str(request.form))
    if request.method == 'POST':
        code = request.form['code']
        if code:
            # g.db.cursor().execute(f'DELETE FROM NUMBER_CODE WHERE CODE = {code}')
            # g.db.commit()
            pass

    return redirect("/manager2")
Exemplo n.º 11
0
    def run(self):
        Logger.info("run")
        self.lozenLogin()
        self.ecountLogin()

        if self.lozenLoginData1 == "" or self.lozenLoginData2 == "" or self.ZONE == "" or self.SESSION_ID == "":
            returnVal = (False)
        else:
            returnVal = (True, self.lozenLoginData1, self.lozenLoginData2,
                         self.ZONE, self.SESSION_ID)
        return returnVal
Exemplo n.º 12
0
def checkCode():
    Logger.info("checkCode")
    Logger.info(str(request.form))
    check = False
    if request.method == 'POST':
        code = request.form['code']
        cur = g.db.cursor().execute(
            f'select * from NUMBER_CODE where CODE = {code}')
        row = cur.fetchall()

        if len(row) != 0:
            check = True

    return jsonify({'check': check}), 200
Exemplo n.º 13
0
def decoded(zbar, data):
    """callback invoked when a barcode is decoded by the zbar widget.
    displays the decoded data in the text box
    """
    buf = results.props.buffer
    end = buf.get_end_iter()
    # Get de type code
    qrType = data.split(":")[0]
    if qrType == "QR-Code":
        cd = ContentData(data)
        buf.insert(end, "Bienvenido " + cd.name + " " + cd.surname + ".\n")
        results.scroll_to_iter(end, 0)
    else:
        buf.insert(end, "Codigo incorrecto.\n")
        Logger.info("Codigo invalido: " + data)
Exemplo n.º 14
0
    def lozenLogin(self):
        Logger.info("lozenLogin")

        url = 'http://203.247.141.92:8080/SmartLogen/UserLogin'
        post = {'userid': self.config.lozenId, 'userpw': self.config.lozenPwd}
        try:
            response = self.login_session.post(url,
                                               data=post,
                                               headers=self.headers_common)
        except:
            Logger.error("lozen 로그인 중 네트워크 연결에 문제가 있습니다. ")
            sys.exit()
        Logger.debug("response" + response.text)
        login_data = response.text.split('Ξ')
        self.lozenLoginData1 = login_data[1]
        self.lozenLoginData2 = login_data[3]
Exemplo n.º 15
0
    def reflash(self):
        Logger.info("reflash")
        #TODO: start progress
        # pg = Thread(target=self.progressing)
        # pg.start()
        #크롤링
        crawler = Parser(self.lozenLoginData1, self.lozenLoginData2,
                         self.lozenLoginSession)

        ddate = str(self.fromDateEdit.date().toPyDate())
        fromDate = "".join(ddate.split("-"))

        ddate = str(self.toDateEdit.date().toPyDate())
        toDate = "".join(ddate.split("-"))
        self.dataList = crawler.parse(fromDate, toDate)

        self.spreadData(self.dataList)
Exemplo n.º 16
0
    def clickRegistrationButton(self):
        Logger.info("pressed RegistryButton")
        register = Register(self.ZONE, self.SESSION_ID)
        # model = self.tableView.model()
        # print("model : ", model)
        data = []
        print("!@#!@# rowCount : ", self.tableView.rowCount())
        if self.tableView.rowCount() > 0:
            for row in range(self.tableView.rowCount()):
                print("!@#!@# check . ", row, ":",
                      self.tableView.item(row, 0).text())
                if (self.tableView.item(row, 0).text() == "0"):
                    print("!@#!@# continue")
                    continue
                else:
                    print("!@#!@# self.dataList[row] : ", self.dataList[row])
                    self.dataList[row].checkValue = "2"
                    data.append(self.dataList[row])

        register.registrationList(data)
Exemplo n.º 17
0
def notify(abnormal, hostname, ip_address, options, subject):
    log = Logger().get_logger()

    if "mail" in options:
        ps_names = "<br>".join(abnormal)
        mail = Mail()
        mail.send_mail("<>", get_emails(), [],
                       "[" + ip_address + "] " + subject, ps_names, None)
        log.info("[mail] %s %s %s %s" %
                 (get_emails(), ip_address, subject, ps_names))

    if "syslog" in options:
        ps_names = ",".join(abnormal)
        message = '%shostname=%s\tprocess=%s\t' % (make_header(ip_address),
                                                   hostname, ps_names)
        log.info('[syslog] %shostname=%s\tprocess=%s\t' %
                 (make_header(ip_address), hostname, ps_names))
        send_qradar(message)

    if "db" in options:
        insert_db = importlib.import_module("insert_db")
        ps_names = ",".join(abnormal)
        message = 'hostname=%s\tip=%s\tprocess=%s\t' % (hostname, ip_address,
                                                        ps_names)
        log.info('[db] hostname=%s\tip=%s\tprocess=%s\t' %
                 (hostname, ip_address, ps_names))
        insert_db.insert_db(message)
Exemplo n.º 18
0
def insertDesc():
    Logger.info("insertDesc")
    Logger.info(str(request.form))
    if request.method == 'POST':
        compos = request.form['compos']
        desc_list = []
        for i in range(1, 11):
            try:
                desc_list.append(request.form['desc' + str(i)])
            except KeyError:
                Logger.info("[WARN] It Does not exists key")

        if compos and not '' == compos:
            for i, desc in enumerate(desc_list):
                if desc != '':
                    cur = g.db.cursor().execute(
                        f'select COM_ID FROM COMPOSITION WHERE COM_NM=\'{compos}\''
                    )
                    row = cur.fetchall()
                    if row:
                        row = row[0][0]
                        g.db.cursor().execute(
                            f'insert or replace into DESCRIPTION(COM_ID, DESC_ID, DESCRIPT) values({row},{i}+1,\'{desc}\')'
                        )
                    else:
                        cur = g.db.cursor().execute(
                            f'select MAX(COM_ID) FROM COMPOSITION')
                        row = cur.fetchall()
                        if row:
                            row = row[0][0]
                            g.db.cursor().execute(
                                f'insert into COMPOSITION(COM_ID, COM_NM) values({row}+1,\'{compos}\')'
                            )
                            g.db.cursor().execute(
                                f'insert or replace into DESCRIPTION(COM_ID, DESC_ID, DESCRIPT) values({row}+1,{i}+1,\'{desc}\')'
                            )
                        else:
                            g.db.cursor().execute(
                                f'insert or replace into DESCRIPTION(COM_ID, DESC_ID, DESCRIPT) values(1,{i}+1,\'{desc}\')'
                            )

                    g.db.commit()

    return redirect("/manager2")
Exemplo n.º 19
0
def insertCode():
    Logger.info("insertCode")
    Logger.info(str(request.form))
    if request.method == 'POST':
        code = request.form['code']
        compos_list = []
        for i in range(1, 11):
            try:
                compos_list.append(request.form['compos' + str(i)])
            except KeyError:
                Logger.info("[WARN] It Does not exists key")

        if code and not '' == code:
            for i, compos in enumerate(compos_list):
                if compos != '':
                    g.db.cursor().execute(
                        f'insert or replace into NUMBER_CODE(CODE, COM_NUMBER, COM_ID) values({code},{i}+1,(select COM_ID FROM COMPOSITION WHERE COM_NM=\'{compos}\'))'
                    )
                    g.db.commit()

    return redirect("/manager1")
Exemplo n.º 20
0
    def registration(self, data):
        Logger.info("CarriageData Registraion")

        print("!@#!@# data : ", data)

        post = """{
                    "SaleList": ["""
        for i in range(len(data.PROD_CD)):
            post += """
                        {{
                            "Line": "0",
                            "BulkDatas": {{
                            "IO_DATE": "{IO_DATE}",
                            "UPLOAD_SER_NO": "",
                            "CUST": "{CUST}",
                            "CUST_DES": "{CUST_DES2}",
                            "WH_CD": "00002",
                            "PROD_CD": "{PROD_CD}",
                            "PROD_DES": "{PROD_DES}",
                            "QTY": "{QTY}",
                            "U_MEMO3": "{CUST_DES1} / {PHONE}",
                            "U_MEMO4": "{ADDRESS}",
                            "U_MEMO5": "{ECT}",
                            }}
                        }}
                        """.format(
                IO_DATE=data.IO_DATE,
                CUST=data.CUST,
                CUST_DES2=data.CUST_DES if str(data.CUST) != "TRA2008008" else
                "택배발송",  # UPLOAD_SER_NO=data.UPLOAD_SER_NO
                CUST_DES1=data.CUST_DES,
                PROD_CD=data.PROD_CD[i],
                PROD_DES=data.PROD_DES[i],
                QTY=data.QTY[i],
                PHONE=data.phoneNumber,
                ADDRESS=data.address,
                ECT="")
            if (i != len(data.PROD_CD) - 1):
                post += """,
                        """

        post += """]
                }"""

        post = post.encode("utf-8")
        Logger.debug("post: " + str(post))
        response = requests.post(self.registrationUrl,
                                 data=post,
                                 headers=self.headers)
        Logger.debug("response : " + response.text)
        status = response.json()["Status"]
        success_cnt = ""
        fail_cnt = ""
        error_msg = ""

        if (status == "200"):
            success_cnt = response.json()["Data"]["SuccessCnt"]
            fail_cnt = response.json()["Data"]["FailCnt"]
            if (fail_cnt == 0):
                return (True, success_cnt)
            else:
                return (
                    False,
                    response.json()["Data"]["ResultDetails"][0]["TotalError"])
        else:
            error_msg = response.json()["Error"]["Message"]
            return (False, error_msg)
Exemplo n.º 21
0
            msg.setIcon(QMessageBox.Information)
            msg.setText("판매 등록에 성공 했습니다.")

        msg.setDefaultButton(QMessageBox.Escape)
        msg.exec_()

    def inquiryProduct(self, prodNm):
        return 0


if __name__ == "__main__":
    ZONE = "CC"
    SESSION_ID = "36363532357c50415243454c:CC-AN16HBmxKKJ49"
    reg = Register(ZONE, SESSION_ID)

    data = Data()
    data.UPLOAD_SER_NO = "0"
    data.WH_CD = '00002'
    data.carriageNumber = "0"
    data.IO_DATE = '20200816'
    data.CUST_DES = '테스트고객정보'
    data.phoneNumber = '000-0000-0000'
    data.address = '주소'
    data.item = '품목'
    data.QTY = '5'

    # print(data.__dict__)

    Logger.info(data.toJson())
    reg.registration(data)
    # reg.registration(data)
Exemplo n.º 22
0
    def spreadData(self, datas):
        Logger.info("spreadData")

        # self.model = QStandardItemModel()
        # self.model.setColumnCount(5)
        # self.model.setHorizontalHeaderLabels(["","주문번호","운송장번호", "날짜", "상호", "전화번호", "상품", "수량", "주소"])

        self.tableView.setColumnCount(8)
        self.tableView.setRowCount(len(datas))
        self.tableView.clicked.connect(self.clickTable)

        #크롤링 된 데이터를 tableView에 뿌릴 model 생성

        rowSet = []

        tempDate = ""
        upload_count = 0

        for index, data in enumerate(datas):

            # 등록된 데이터 체크해서 Enabled 시키키
            item = self.MyQTableWidgetItemCheckBox()
            self.tableView.setItem(index, 0, item)
            chbox = self.MyCheckBox(item)
            self.tableView.setCellWidget(index, 0, chbox)

            for i, d in enumerate(data.toArray()):
                # if(i == 0):
                #     if tempDate != data.IO_DATE:
                #         tempDate = data.IO_DATE
                #         upload_count=1
                #     else :
                #         upload_count+=1

                #     data.UPLOAD_SER_NO = tempDate+"_"+str(upload_count)
                #     d = data.UPLOAD_SER_NO
                if (i == 2):
                    try:
                        code = self.customCodeData[d]
                    except KeyError:
                        code = "TRA2008008"  #택배

                    data.CUST = code
                elif (i == 4):
                    rowSet.append((index, d.count('\n')))
                    data.PROD_DES = data.PROD_DES.split('\n')
                    code = []
                    for idx, prodNm in enumerate(data.PROD_DES):
                        try:
                            code.append(self.prodCodeData[prodNm])
                        except KeyError:
                            print("!@#!@# 품목 데이터 없음 : ", prodNm)
                            try:
                                code.append(self.prodSearchData[prodNm])
                                data.PROD_DES[idx] = self.prodSearchDict[
                                    prodNm]
                            except:
                                print("!@#!@# 품목 검색 데이터 없음 : ", prodNm)
                                code.append("ECO14_05_04")

                    print("!@#!@# 품목코드 : ", code)
                    data.PROD_CD = code
                    data.QTY = data.QTY.split('\n')

                item = QTableWidgetItem(d)
                self.tableView.setItem(index, i + 1, item)

        #품목 개수에 따라 행 높이 조절
        for row in rowSet:
            self.tableView.setRowHeight(row[0], 40 + (row[1] * 20))
Exemplo n.º 23
0
 def clickInquiryButton(self):
     Logger.info("pressed InquiryButton")
     self.reflash()
Exemplo n.º 24
0
 def clickTable(self):
     Logger.info("click table view")
Exemplo n.º 25
0
    def run(self):
        # try:
        Logger.debug("downloadPath : " + self.downloadPath)
        options = webdriver.ChromeOptions()

        options.add_argument("headless")
        options.add_argument("disable-gpu")
        options.add_argument("lang=ko_KR")  # 한국어!
        options.add_argument(
            "user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
        )

        options.add_experimental_option(
            "prefs", {
                "download.default_directory": self.downloadPath,
                "download.prompt_for_download": False,
                "download.directory_upgrade": True,
                "safebrowsing.enabled": True
            })

        driver = webdriver.Chrome("./lib/chromedriver.exe",
                                  chrome_options=options)

        driver.get(
            "https://logincc.ecounterp.com/ECERP/LOGIN/ERPLogin?vrqa=mMQ%2Bk8KPqxYEwADSAix%2FmA%3D%3D&vrqb=5456564d5d47535b5b465b4d504d5b4c0f1053535c400f4c5d025d450a4c06545c175d4d005609405a40555b584c4044&vrqc=1"
        )

        driver.implicitly_wait(5)

        #로그인

        driver.find_element_by_xpath(
            "/html/body/div[6]/form/div[1]/div/div[2]/div[1]/div[1]/input"
        ).send_keys(self.config.ecountComCode)

        driver.find_element_by_xpath(
            "/html/body/div[6]/form/div[1]/div/div[2]/div[1]/div[2]/input"
        ).send_keys(self.config.ecountId)

        driver.find_element_by_xpath(
            "/html/body/div[6]/form/div[1]/div/div[2]/div[1]/div[3]/input[1]"
        ).send_keys(self.config.ecountPwd)

        driver.find_element_by_id("save").click()

        driver.implicitly_wait(1)
        try:
            #로그인정보 등록안함 클릭
            driver.find_element_by_xpath(
                "/html/body/div[7]/div[2]/div/div[3]/div/button[2]").click()
        except:
            Logger.warn("로그인 정보 등록 되어있음")

        driver.implicitly_wait(5)

        #재고1 -> 기초등록 -> 품목등록

        Logger.debug("재고1 클릭")
        driver.find_element_by_xpath(
            "/html/body/div[7]/div/div[2]/div[2]/div[1]/ul/li[4]/a").click()

        driver.implicitly_wait(1)
        Logger.debug("기초등록 클릭")
        driver.find_element_by_xpath(
            "/html/body/div[7]/div/div[2]/div[2]/div[2]/ul[4]/li[1]/a").click(
            )

        time.sleep(3)
        Logger.debug("품목등록 클릭")
        driver.find_element_by_xpath(
            "/html/body/div[7]/div/div[2]/div[2]/div[3]/ul/li[4]/a").click()

        driver.implicitly_wait(5)
        time.sleep(3)

        Logger.debug("엑셀 클릭")
        excelElement = driver.find_element_by_xpath(
            "/html/body/div[8]/div/div[4]/div[3]/div/div[1]/div[8]/div/button")
        driver.execute_script("arguments[0].click();", excelElement)

        driver.implicitly_wait(5)

        Logger.debug("거래처 등록 클릭")
        driver.find_element_by_xpath(
            "/html/body/div[7]/div/div[2]/div[2]/div[3]/ul/li[1]/a").click()

        driver.implicitly_wait(5)
        time.sleep(8)

        Logger.debug("엑셀 클릭")
        excelElement = driver.find_element_by_xpath(
            "/html/body/div[8]/div/div[4]/div[3]/div/div[1]/div[6]/div/button[1]"
        )
        driver.execute_script("arguments[0].click();", excelElement)

        driver.implicitly_wait(5)
        time.sleep(5)

        driver.close()

        customDataFilePath = Path(self.downloadPath).joinpath(
            self.customDataFileName)
        Logger.debug(customDataFilePath)
        check_file = customDataFilePath.is_file()
        Logger.debug(check_file)

        prodDataFilePath = Path(self.downloadPath).joinpath(
            self.prodDataFileName)
        Logger.debug(prodDataFilePath)
        check_file = check_file and prodDataFilePath.is_file()
        Logger.debug(check_file)

        if check_file:
            Logger.info("read excel")
            df = pd.read_excel(customDataFilePath,
                               sheet_name='거래처등록',
                               header=1,
                               index_col='거래처명',
                               dtype={'거래처코드': str})

            Logger.debug("df.A : " + str(df['거래처코드']))

            self.customData = df['거래처코드']

            df = pd.read_excel(prodDataFilePath,
                               sheet_name='품목등록',
                               header=1,
                               index_col='품목명',
                               dtype={'품목코드': str})

            Logger.debug("df.A : " + str(df['품목코드']))

            self.prodData = df['품목코드']

            print("!@#!@# prodData : ", self.prodData)
            tempSearchKey = df['검색창내용']
            tempV = []
            tempI = []

            self.searchDict = {}

            for idx, value in tempSearchKey.items():

                if (type(value) == type('')):
                    for key in value.split(' '):
                        tempV.append(self.prodData[idx])
                        tempI.append(key)

                        self.searchDict[key] = idx
                        # self.prodData.append(pd.Series([self.prodData[idx]], index=[key]))
            self.searchData = pd.Series(tempV, index=tempI)

            customDataFilePath.unlink()
            prodDataFilePath.unlink()

            if type(self.customData) == type(None) or type(
                    self.prodData) == type(None):
                Logger.error("품목, 거래처 목록을 다운로드 중 문제가 발생하였습니다.")
                return False
            else:
                return True
        else:
            customDataFilePath.unlink()
            prodDataFilePath.unlink()
            Logger.error("다운로드 실패 : " + self.customDataFileName + ", " +
                         self.prodDataFileName)
            return False
Exemplo n.º 26
0
        help='path to synonym file that needs to be included in output export',
        default=None)

    _input_arguments = parser.parse_args()

    ## controller function

    args = dict()
    args['input_file_path'] = _input_arguments.file_path
    args['syn_file_path'] = _input_arguments.synonyms_file_path
    #args['type']=_input_arguments.type
    args['operation'] = _input_arguments.operation
    args['newFaqFile'] = _input_arguments.newFaqFile
    #args['new_ques_file_type']=_input_arguments.newFaqFile_type

    oa.info("Started the Execution of KG Util")
    if not args['input_file_path'] == '':
        backup_inputKG(args['input_file_path'])
    else:
        print("check the input args file")

    if '.json' in args['input_file_path']:

        args['output_file_path'] = 'output_file.json'

        if args['operation'] == 'edit':
            question = cleaninput(str(input("Enter a quesiton to edit: ")))
            replacement = cleaninput(
                str(input("\n Enter the replacement question: ")))

            if question == '' or replacement == '':