Пример #1
0
 def on_loginButton_clicked(self):
     '''登录按钮'''
     if self.serverIp.text().__str__() == 'single':
         #单机登录,不带服务器的
         SESSION["testorRole"] = "SUPER_TESTOR" if self.testor.text(
         ).__str__() == 'super' else 'TESTOR'
         SESSION["testor"] = u"单机"
         SESSION["isMend"] = True
         self.__initSession()
         PARAM.dumpParameterToLocalFile()
         GLOBAL["logUi"].log(u"单机登录,即将测试[%s]产品的[%s]" %
                             (SESSION["product"], SESSION["testsuite"]))
         self.hide()
         self.parent().setUiInfoFromSession()
     else:
         if not self.__verifyInput():
             return
         with ServerBusiness(self.serverIp.text().__str__()) as sb:
             user = sb.login(
                 workbay=self.workbay.text().__str__(),
                 username=self.testor.text().__str__(),
                 password=encryPassword(self.password.text().__str__()),
                 product=self.product.currentText().__str__(),
                 testSuite=self.testsuite.currentText().__str__())
             SESSION["testorRole"] = user["role"]
             SESSION["testor"] = user["username"]
             self.__initSession()
             PARAM.dumpParameterToLocalFile()
             GLOBAL["logUi"].log(u"检测员[%s]登录成功,即将测试[%s]产品的[%s]" %
                                 (SESSION["testor"], SESSION["product"],
                                  SESSION["testsuite"]))
             self.hide()
             self.parent().setUiInfoFromSession()
Пример #2
0
def T_01_paramSetting_M(product):
    u'''参数设置-首次运行进行参数设置'''
    if "configed" not in SESSION:
        __paramSetting()
        __checkTid()
        PARAM.dumpParameterToLocalFile()
    showDashboardMessage(u"固定写入EPC内容:\n%s\n不镭雕,USER区长度:%d字"%(PARAM["fixEpc"],PARAM["gs15userLength"]))
Пример #3
0
def finalFun(product):
    if product.finishSmoothly and product.testResult:
        #正常完成,则递增镭雕序列号
        oldC = product.param["PID"][2:]
        PARAM["carvingCode"] = ("%." + str(len(oldC)) + "d") % (int(oldC) + 1)
        PARAM.dumpParameterToLocalFile()
        writeProductToLocalDb(product)  #保存到本地数据库
    uhf_card_overall.finalFun(product)
Пример #4
0
def T_04_laserCarve_M(product):
    u'''镭雕卡面编号-自动镭雕卡面顺序编号'''
    carvingCode = PARAM["carvingCode"]
    #    print carvingCode
    rs = __carveTest(carvingCode, product)
    #    rs = None
    PARAM["carvingCode"] = __getNextCarvingCode(carvingCode)
    PARAM.dumpParameterToLocalFile()
    return rs
def T_01_paramSetting_M(product):
    u'''参数设置-首次运行进行参数设置'''
    if "configed" not in SESSION:
        SESSION["nowTimes"] = 0 #当前这个EPC已经写入了几次了
        uhf_tag_fixepc_without_carve.__paramSetting()
        __paramSetting()
        PARAM.dumpParameterToLocalFile()
    SESSION["toWriteEpc"] = __nextEpc()
    showDashboardMessage(u"即将写入EPC内容:%s\n第%d次/共%d次,不镭雕。\nUSER区长度:%d字"%  \
                         (SESSION["toWriteEpc"],SESSION["nowTimes"],PARAM["repeatTimes"],PARAM["gs15userLength"]))
Пример #6
0
def T_01_paramSetting_M(product):
    u'''参数设置-首次运行进行参数设置'''
    if "configed" not in SESSION:
        uhf_tag_fixepc_without_carve.__paramSetting()
        #        uhf_tag_fixepc_without_carve.__checkTid()
        __paramSetting()
        PARAM.dumpParameterToLocalFile()
    showDashboardMessage(u"即将写入EPC内容:%s\n\
                                                即将镭雕的内容:TID,%d-%d位。\nUSER区长度:%d字"                                                                                 %  \
                         (PARAM["fixEpc"],PARAM["carvingTidStart"],PARAM["carvingTidEnd"],PARAM["gs15userLength"]))
def T_01_paramSetting_M(product):
    u'''参数设置-首次运行进行参数设置'''
    if "configed" not in SESSION:
        SESSION["nowTimes"] = 0
        SESSION["nowCarveTimes"] = 0
        __loadCsvFile()
        lineStart = askForSomething(u"从哪一行开始操作?",
                                    u"您需要从该文件的哪一行开始操作?",
                                    autoCommit=False,
                                    defaultValue='1')
        SESSION["currentLineInFile"] = int(lineStart)
        nn, ee = __readEpcAndCarveCodeFromFile()
        while not manulCheck(title=u"请确认即将开始的内容",
                             content=u"镭雕码:%s\nEPC:%s\n是否确认" % (nn, ee)):
            global g_csvFile, currentLine
            g_csvFile.close()
            currentLine = -1
            __loadCsvFile()
            lineStart = askForSomething(u"从哪一行开始操作?",
                                        u"您需要从该文件的哪一行开始操作?",
                                        autoCommit=False,
                                        defaultValue='1')
            SESSION["currentLineInFile"] = int(lineStart)
            nn, ee = __readEpcAndCarveCodeFromFile()
            SESSION["nowVariableCarve"], SESSION[
                "toWriteEpc"] = __readEpcAndCarveCodeFromFile()
        PARAM["repeatTimes"] = int(
            askForSomething(u"同EPC写入次数",
                            u"同一EPC重复多少标签?例如4表示,待同一个EPC写够4个标签后,再进位到下一个EPC",
                            autoCommit=False,
                            defaultValue=PARAM["repeatTimes"]))
        PARAM["gs15userLength"] = int(
            askForSomething(u"USER区长度设置",
                            u"请输入USER区长度,单位:字(WORD,1WORD = 2Byte = 16bit)",
                            autoCommit=False,
                            defaultValue=PARAM["gs15userLength"]))
        SESSION["nowTimes"] = 1
        PARAM.dumpParameterToLocalFile()

        SESSION["nowVariableCarve"], SESSION["toWriteEpc"] = nn, ee
        SESSION["configed"] = True

    if SESSION["nowTimes"] > PARAM["repeatTimes"]:
        SESSION["nowTimes"] = 1
        SESSION["nowVariableCarve"], SESSION[
            "toWriteEpc"] = __readEpcAndCarveCodeFromFile()

    showDashboardMessage(u"即将写入EPC内容:%s\n    \
                    即将镭雕的内容:%s,第%d次/共%d次\n\
                    USER区长度:%d字"                                %  \
                         (SESSION["toWriteEpc"],
                          SESSION["nowVariableCarve"],
                          SESSION["nowTimes"],PARAM["repeatTimes"],
                          PARAM["gs15userLength"]))
    SESSION["nowTimes"] += 1
 def on_saveButton_clicked(self):
     for item in self.paramList:
         value = item["valueWidget"].text().__str__()
         if item["type"] == "int":
             value = int(value)
         elif item["type"] == "float":
             value = float(value)
         PARAM[item["name"]] = value
     PARAM.dumpParameterToLocalFile()
     QMessageBox.information(None, u"修改参数", u"参数修改完成!")
     self.hide()
def T_01_paramSetting_M(product):
    u'''参数设置-首次运行进行参数设置'''
    if "configed" not in SESSION:
        uhf_tag_fixepc_without_carve.__paramSetting()
        uhf_tag_fixepc_without_carve.__checkTid()
        __paramSetting()
        PARAM.dumpParameterToLocalFile()

    __getNextCarvingCode()
    showDashboardMessage(u"即将写入EPC内容:%s\n\
                                                即将镭雕的内容:%s,第%d次/共%d次。\nUSER区长度:%d字"                                                                                   %  \
                         (PARAM["fixEpc"],SESSION["nowVariableCarve"],SESSION["nowCarveTimes"],PARAM["repeatTimes"],PARAM["gs15userLength"]))
Пример #10
0
def __processCliParam():
    '''处理命令行参数'''
    opts, args = getopt.getopt(sys.argv[1:], "f:w:")
    argSet = set()
    for op, value in opts:
        if op == "-f":
            PARAM.__init__(value)
        if op == '-w':
            GLOBAL["WINDOW_MODE"] = (int(value))
        argSet.add(op)
    #以下处理默认参数
    if "-f" not in argSet:
        PARAM.__init__("hhplt/config.json")  #如果命令行里没有指定配置文件,则使用此默认配置文件
    if "-w" not in argSet:
        GLOBAL["WINDOW_MODE"] = 0
def __getInitEpc():
    '''初始EPC值,保证不重复,依据2015-5-26魏博邮件中要求的编码规则,不出现字母逻辑如下:
        [1][YYYYMMDD][工位编号][登录顺序号][补齐其余位数字]
    '''
    global epcGenerateContainer
    if epcGenerateContainer["loginNumber"] == 0:
        epcGenerateContainer["loginNumber"] = PARAM["loginSerialNumber"] + 1
        PARAM["loginSerialNumber"] = epcGenerateContainer["loginNumber"]
        PARAM.dumpParameterToLocalFile()
        epcGenerateContainer["workbayId"] = int(PARAM["workbay"][-1:])
    epcGenerateContainer["serialNum"] = epcGenerateContainer["serialNum"] + 1
    serHex = "%d" % epcGenerateContainer["serialNum"]
    prefix = "1%s0000%.1d%d" % (time.strftime(
        '%Y%m%d', time.localtime(
            time.time())), epcGenerateContainer["workbayId"] % 10,
                                epcGenerateContainer["loginNumber"] % 100)
    return prefix + (PARAM["gs15epcLength"] * 4 - len(prefix) -
                     len(serHex)) * '0' + serHex
 def dumpToParam(self):
     PARAM["currentMac"] = "%.8x"%self.currentMac
     PARAM.dumpParameterToLocalFile()
Пример #13
0
 def __getDefaultSaveFilename(self):
     filenameSerial = PARAM["exportCsvSerial"] + 1
     PARAM["exportCsvSerial"] = filenameSerial
     PARAM.dumpParameterToLocalFile()
     return "TagPreEnter_%s_%.3d.csv" % (time.strftime(
         '%Y%m%d', time.localtime(time.time())), filenameSerial)