def init_PROCESS(self): self.v_json["UNIT_IN_TEST"]["PROCESS"]["@Process"] = VS.GET_RM( "Process", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["PROCESS"]["@StartTime"] = VS.GET_RM( "StartTime", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["PROCESS"]["@StartTimeUTC"] = VS.GET_RM( "StartTimeUTC", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["PROCESS"]["@FinishTime"] = VS.GET_RM( "FinishTime", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["PROCESS"]["@Status"] = VS.GET_RM( "Status", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["PROCESS"]["@Cell"] = VS.GET_RM( "Cell", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["PROCESS"]["@Cal"] = VS.GET_RM( "StartTime", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["PROCESS"]["@DCRev"] = VS.GET_RM( "DCRev", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["PROCESS"]["@SWVer"] = VS.GET_RM( "SWVer", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["PROCESS"]["@OperatorID"] = "" self.v_json["UNIT_IN_TEST"]["PROCESS"]["@RunType"] = "Full" self.v_json["UNIT_IN_TEST"]["PROCESS"]["@Retest"] = "0" self.v_json["UNIT_IN_TEST"]["PROCESS"]["@Latest"] = "1" self.v_json["UNIT_IN_TEST"]["PROCESS"]["@SeqComplete"] = VS.GET_RM( "SeqComplete", "CAR_INFO")
def append_process_trace_file(self): self.trace_file_title = VS.GET_RM("LOG_NAME", "CAR_INFO") week_number = datetime.now().isocalendar()[1] if int(week_number) > 9: week_str = str(week_number) else: week_str = '0' + str(week_number) year_number = datetime.now().isocalendar()[0] self.trace_file_path = "/VCATSTRACEFILES/" + str( year_number) + "/WK" + week_str + "/" + VS.GET_RM( "LOG_NAME", "CAR_INFO") + "\\" + VS.GET_RM( "LOG_NAME", "CAR_INFO") + ".log" self.v_json["UNIT_IN_TEST"]["PROCESS"]["TRACE_FILES"]["TRACE_FILE"][ "@FileTitle"] = self.trace_file_title self.v_json["UNIT_IN_TEST"]["PROCESS"]["TRACE_FILES"]["TRACE_FILE"][ "@FilePath"] = self.trace_file_path
def creat_vcats_xml(save_json): test_json = set_process_test(save_json) vj = Vcats_Json() vj.test = test_json vj.init_UNIT_IN_TEST() vj.init_PROCESS() vj.append_process_test() vj.append_process_trace_file() xml_path = VS.Config["proj_path"] + VS.Config["result"]["vcats_path"] log_time = datetime.now().strftime("%Y%m%d_%H%M%S") file_name = VS.GET_RM("VIN", "CAR_INFO") + "_" + log_time + "_" + VS.GET_RM( "Cell", "CAR_INFO") + ".xml" xml_path = xml_path + '/' + file_name jsondic_to_xml(vj.v_json, xml_path) VS.set_file_readonly(xml_path) if VS.GV("TEST_MODE") > 0: logname = VS.GV('LOG_NAME') logpath = VS.Config["proj_path"] + VS.Config["DEVICE"]["ftp_log"][ "upload_path"] log_tt = logpath + '/' + logname + '.log' log_finish = logpath + '/' + logname + '_finish' + '.log' os.rename(log_tt, log_finish) VS.set_file_readonly(log_finish)
def init_UNIT_IN_TEST(self): self.v_json["UNIT_IN_TEST"]["@VIN"] = VS.GET_RM("VIN", "CAR_INFO") self.v_json["UNIT_IN_TEST"]["@BuildCode"] = VS.GET_RM( "BROADCAST", "CAR_INFO")