1、
PxeUtils .java
package com.hkwx.manager; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; import cn.com.hikvision.www.datacenter.pxe_server.wsdl.IVMSTime; import cn.com.hikvision.www.datacenter.pxe_server.wsdl.PxeTestLogInfo; public class PxeUtils implements Comparator { /** * 工具类 */ public static IVMSTime changeTime(String time,String format){ //暂时用不到,不需要打开注释 IVMSTime iVMSTime = new IVMSTime(); SimpleDateFormat simple = new SimpleDateFormat(format); Date date = null; try { date = simple.parse(time); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } //将日期转为iVMSTime类型 iVMSTime.setYear(date.getYear()); iVMSTime.setMonth(date.getMonth()); iVMSTime.setDay(date.getDay()); iVMSTime.setHour(date.getHours()); iVMSTime.setMin(date.getMinutes()); iVMSTime.setSecond(date.getSeconds()); return iVMSTime; } //倒序 @Override public int compare(Object o1, Object o2) { PxeTestLogInfo pxeTestLogInfo0 = (PxeTestLogInfo)o1; PxeTestLogInfo pxeTestLogInfo1 = (PxeTestLogInfo)o2; int flag = String.valueOf(pxeTestLogInfo0.getBuildtime()).compareTo(String.valueOf(pxeTestLogInfo0.getBuildtime())); return flag; } //将ibms转为string public static String iVMSTimeToStr(IVMSTime ivmsTime){ String date = ""; if(ivmsTime.getYear()!=0){ date+=ivmsTime.getYear(); } if(ivmsTime.getMonth()!=0){ if(ivmsTime.getMonth()<10){ date=date+0+ivmsTime.getMonth(); }else{ date+=ivmsTime.getMonth(); } } if(ivmsTime.getDay()!=0){ if(ivmsTime.getDay()<10){ date=date+0+ivmsTime.getDay(); }else{ date+=ivmsTime.getDay(); } } if(ivmsTime.getHour()!=0){ if(ivmsTime.getHour()<10){ date=date+0+ivmsTime.getHour(); }else{ date+=ivmsTime.getHour(); } } if(ivmsTime.getMin()!=0){ if(ivmsTime.getMin()<10){ date=date+0+ivmsTime.getMin(); }else{ date+=ivmsTime.getMin(); } } if(ivmsTime.getSecond()!=0){ if(ivmsTime.getSecond()<10){ date=date+0+ivmsTime.getSecond(); }else{ date+=ivmsTime.getSecond(); } } return date; } //测试排序类 public static void main(String[] args) { PxeUtils px = new PxeUtils(); IVMSTime ivmsTime0 = new IVMSTime(2016, 10, 10, 10, 10, 10, 0); IVMSTime ivmsTime1 = new IVMSTime(2016, 9, 10, 10, 10, 10, 0); IVMSTime ivmsTime2 = new IVMSTime(2016, 12, 10, 10, 10, 10, 0); PxeTestLogInfo pxeTestLogInfo0 = new PxeTestLogInfo(); PxeTestLogInfo pxeTestLogInfo1 = new PxeTestLogInfo(); PxeTestLogInfo pxeTestLogInfo2 = new PxeTestLogInfo(); pxeTestLogInfo0.setBuildtime(ivmsTime0); pxeTestLogInfo1.setBuildtime(ivmsTime1); pxeTestLogInfo2.setBuildtime(ivmsTime2); List<PxeTestLogInfo> list = new ArrayList<PxeTestLogInfo>(); list.add(pxeTestLogInfo0); list.add(pxeTestLogInfo1); list.add(pxeTestLogInfo2); Collections.sort(list,px); //排序 for (int i = 0; i < list.size(); i++) { IVMSTime ivmsTimes = list.get(i).getBuildtime(); System.out.println(list.size()); } } }
2、
PositivesSort .java
package com.hkwx.manager; import java.util.Comparator; import cn.com.hikvision.www.datacenter.pxe_server.wsdl.PxeTestLogInfo; public class PositivesSort implements Comparator { @Override public int compare(Object o1, Object o2) { PxeTestLogInfo pxeTestLogInfo0 = (PxeTestLogInfo)o1; PxeTestLogInfo pxeTestLogInfo1 = (PxeTestLogInfo)o2; int flag = String.valueOf(pxeTestLogInfo1.getBuildtime()).compareTo(String.valueOf(pxeTestLogInfo0.getBuildtime())); return flag; } }
3、
configurationAction.java
package com.hkwx.controll; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.lang.reflect.Field; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSONObject; import com.hkwx.manager.ExcelHelper; import com.hkwx.manager.FileOperateUtil; import cn.com.hikvision.www.datacenter.pxe_server.wsdl.PxeConfigFileContent; @Controller public class configurationAction { // private pxeClient client = new pxeClient("127.0.0.1"); // private PxeUpgradeStatus upgrade; // 展示首页 @RequestMapping("/page/managePlatfrom") public ModelAndView login(ModelAndView mv) throws Exception { mv.setViewName("/managePlatfrom"); return mv; } //导入excel @RequestMapping("/page/importExcel") public void importExcel(ModelAndView mv, HttpServletRequest request,HttpServletResponse response) throws Exception { init(request); mv.setViewName("/managePlatfrom"); String filePath = ""; try { filePath = FileOperateUtil.upload(mv,request); } catch (Exception e) { } if (!filePath.equals("")) { //获取字段值 List<String> list = ExcelHelper.exportListFromExcel(new File(filePath), 0); PxeConfigFileContent pxeConfigFileContent= new PxeConfigFileContent(); //是用反射,将值放进去 Class FileContent =pxeConfigFileContent.getClass(); Field[] Fields = FileContent.getDeclaredFields(); for (int i = 0; i < list.size(); i++) { String temp[] = list.get(i).split("\\|"); Field field = FileContent.getDeclaredField(temp[1]); field.setAccessible(true); if(field.getType().getName().equals("int")){ field.set(pxeConfigFileContent,(int)Double.parseDouble(temp[2])); continue; } if(field.getType().getName().equals("cn.com.hikvision.www.datacenter.pxe_server.wsdl.PxeRaidCardStatus")){ continue; } if(field.getType().getName().equals("cn.com.hikvision.www.datacenter.pxe_server.wsdl.PxeSFPCardStatus")){ continue; } else{ field.set(pxeConfigFileContent,temp[2]); continue; } } String str = JSONObject.toJSONString(pxeConfigFileContent); JSONObject json = JSONObject.parseObject(str); responseAjax(response, json); } } //保存 @RequestMapping("/page/save") public ModelAndView save(ModelAndView mv,HttpServletRequest request,@RequestParam("PxeConfigFileContent") PxeConfigFileContent FileConten) throws Exception { mv.setViewName("/managePlatfrom"); String filename = request.getParameter("filename"); //获取当前登录的用户名 String user = (String) request.getSession().getAttribute("username"); FileOperateUtil.saveFile(mv,filename,user,FileConten); mv.addObject("excelMap", FileConten); mv.addObject("filename", filename); return mv; } //创建 @RequestMapping("/page/create") public void create(ModelAndView mv,HttpServletRequest request) throws Exception { //获取当前登录的用户名 FileOperateUtil.create(request); } //导出,另存为 @RequestMapping("/page/download") public void download(ModelAndView mv,HttpServletRequest request,HttpServletResponse response) throws Exception { try { String downloadfFileName = request.getParameter("filename"); downloadfFileName = new String(downloadfFileName.getBytes("iso-8859-1"),"utf-8"); String fileName = downloadfFileName.substring(downloadfFileName.indexOf("_")+1); String userAgent = request.getHeader("User-Agent"); byte[] bytes = userAgent.contains("MSIE") ? fileName.getBytes() : fileName.getBytes("UTF-8"); fileName = new String(bytes, "ISO-8859-1"); response.setHeader("Content-disposition", String.format("attachment; filename=\"%s\"", fileName)); FileOperateUtil.download(downloadfFileName, response.getOutputStream()); } catch (IOException e) { e.printStackTrace(); } } //搜索 @RequestMapping("/page/search") public void search(ModelAndView mv,HttpServletRequest request,HttpServletResponse response) throws Exception { FileOperateUtil.search(request,response); } //读取文件内容 @RequestMapping("/page/readFile") public ModelAndView readFile(ModelAndView mv,HttpServletRequest request) throws Exception { mv = FileOperateUtil.readFile(mv,request); return mv; } //初始化请求 获取上传的路径 private void init(HttpServletRequest request) { if (FileOperateUtil.FILEDIR == null) { FileOperateUtil.FILEDIR = request.getSession().getServletContext().getRealPath("/") + "file/"; } } public void responseAjax(HttpServletResponse response, Object message) { response.setContentType("application/json"); response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setCharacterEncoding("UTF-8"); PrintWriter out = null; try { out = response.getWriter(); } catch (IOException e) { e.printStackTrace(); } out.print(message); out.flush(); out.close(); } }
4、configurationPlatform.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all"> <script src="js/jquery-1.11.3.min.js"></script> <script src="js/jquery-form.js"></script> <link href="css/style.css" rel="stylesheet" type="text/css" media="all"/> <base href="<%=basePath%>"> <title>My JSP ‘hello.jsp‘ starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> </head> </head> <body>> <div class="header"> <div class="container"> <div class="header-main"> <div class="clearfix"><h1 style="text-align: center;">PXE配置管理平台</h1> </div> </div> </div> </div> <div class="top-navg-main"> <div class="container"> <div class="top-navg"> <span class="menu"> <img src="images/icon.png" /></span> <ul class="res"> <li><a href="${pageContext.request.contextPath}/page/managePlatfrom" class="active hvr-sweep-to-bottom">配置平台</a></li> <li><a href="${pageContext.request.contextPath}/page/textPlatfrom" class="hvr-sweep-to-bottom" href="about.html">测试平台</a></li> <li><a href="${pageContext.request.contextPath}/page/montiorPlatfrom" class="hvr-sweep-to-bottom" href="services.html">监控平台</a></li> <li><a href="${pageContext.request.contextPath}/page/userPlatfrom" class="hvr-sweep-to-bottom" href="typo.html">用户管理</a></li> </ul> </div> </div> </div> <div class="top-navg-main" > <div class="container"> <div class="top-navg"> 配置平台页面 <div id = "seachAre"> <input name="searchText" id="searchText" type="text"> <input type="button" name="search" id="search" value=搜索"> <div id = "searchResult" style="border:1;"> </div> </div> <form action="page/importExcel"method="post" id ="form" enctype="multipart/form-data"> <div> <input type="file" class="file" name="file" id = "file" value ="${filename}"> </div> </form> <form action="page/save" method="post" id ="form2" > <!-- 保存显示 --> <input type = "text" value="${filename}" id ="filename2" > <table style="display: block;" id = "table1"> <tr><td> <span>cp:</span><span id ="cp"></span> </td></tr> <tr><td> <span>ct:</span><span id ="ct"></span> </td></tr> <tr><td> <span>pn:</span><span id ="pn"></span> </td></tr> <tr><td> <span>pm:</span><span id ="pm"></span> </td></tr> <tr><td> <span>pv:</span><span id ="pv"></span> </td></tr> </table> <!-- 修改显示 --> <table style="display:none;" id = "table2"> <tr><td> <span>mode:</span><input type ="text" id = "cp2" name="cp" ></input> </td></tr> <tr><td> <span>code:</span><input type ="text" id = "ct2" name="ct" ></input> </td></tr> <tr><td> <span>version:</span><input type ="text" id = "pn2" name="pn" ></input> </td></tr> <tr><td> <span>BMCversion:</span><input type ="text" id = "pm2" name="pm" ></input> </td></tr> <tr><td> <span>PCIDid:</span><input type ="text" id = "pv2" name="pv"></input> </td></tr> </table> <input type ="text" id = "filename" style="display: none;" name="filename"></input> <input type="button" id = "save" value="保存"> <input type="button" id = "modify" value="修改"> <input type="button" id = "create" value="创建"> <input type="button" onclick="JavaScript:window.location=‘page/download?filename=${filename}‘" value="导出"> </form> </div> </div> </div> <script type="text/javascript"> $(function(){ if(‘${message}‘!=""){ alert(‘${message}‘); } }); $("#create").click(function(){ var fileName = prompt(‘请输入文件名‘); $("#form2").ajaxSubmit({ type: "post", url: "page/create", data: {}, //1表示点击事件 dataType: "json", success: function(data){ alert("创建成功"); } }); alert("创建成功") }); $("#file").change(function(){ alert(1); $("#form").ajaxSubmit({ type: ‘post‘, // 提交方式 get/post url: ‘page/importExcel‘, // 需要提交的 url dataType: "json", data: {}, success: function(data) { // data 保存提交后返回的数据,一般为 json 数据 // 此处可对 data 作相关处理 $("#cp").text(data.cp); $("#ct").text(data.ct); $("#pn").text(data.pn); $("#pm").text(data.pm); $("#pv").text(data.pv); $("#cp2").val(data.cp); $("#ct2").val(data.ct); $("#pn2").val(data.pn); $("#pm2").val(data.pm); $("#pv2").val(data.pv); } }); }); $("#save").click(function(){ var isNeed = confirm(‘是否进行保存‘); if(isNeed="true"){ $("#table1").show(); $("#table2").hide(); $("#form2").submit(); }else{ return; } }); $("#modify").click(function(){ $("#table2").show(); $("#table1").hide(); }); $("#search").click(function(){ $("#searchResult").html(""); var text = $("#searchText").val(); $.ajax({ type: "post", url: "search", data: {condition:text,type:1}, //1表示点击事件 dataType: "json", success: function(data){ re = new RegExp("#fileName", "g"); for (var i = 0; i < data.length; i++) { var html = $("#hrefTem").html(); html = html.replace(re,data[i]); $("#searchResult").append(html); } } }); }); //添加键盘点击事件 $("#searchText").keydown(function(event){ $("#searchResult").html(""); var text = $("#searchText").val(); $.ajax({ type: "post", url: "search", data: {condition:text,type:2},//2表示点击键盘事件 dataType: "json", success: function(data){ re = new RegExp("#fileName", "g"); for (var i = 0; i < data.length; i++) { var html = $("#hrefTem").html(); html = html.replace(re,data[i]); $("#searchResult").append(html); } } }); }); </script> <!-- 代码模版用于动态生成 --> <script id="hrefTem" type="text/template"> <a href =<%=basePath%>readFile?fileName=#fileName>#fileName</a><br> </script> </body> </html>
5、textPlatfrom.js
var TestType = ""; var tableContent = ""; //记录 //页面加载时执行 $(function(){ tableContent=$("#tableContent").html(); //给重置按钮绑定重置方法 $("#ResetButton").click(reset); //给单选框绑定事件 $(":radio").click(useFunction); $("#buildTime").click(searchInfo); //绑定排序 //每个30秒刷新一次监控平台 setInterval("PxeGetTestingLog()",3000); }); //重置方法 function reset(){ $("#modelNo").val(""); $("#serialNo").val(""); $("#mac1").val(""); $("#mac2").val(""); } //判断当前使用的服务 ,1表示软件升级,2表示T1测试 3表示老化测试,4表示终检测试 function useFunction(){ var testType = $(‘input[name="test"]:checked‘).val(); if(testType == 1){ $("#ResetButton").click();//重置按钮 bindUpgraded(); } if(testType== 2){ alert("进入T1测试 模块,请确定是否接入工装"); $("#ResetButton").click();//重置按钮 bindT1Test(); } if(testType == 3){ alert("进老化测试模块,请确定是否接入工装"); $("#ResetButton").click();//重置按钮 bindBurninTest(); } } //进入升级模块 function bindUpgraded(){ //设置这三个文本框不可输入 $("#serialNo").attr("disabled",true); $("#mac1").attr("disabled",true); $("#mac2").attr("disabled",true); TestType = "upgrade" //设置测试类型 //当文本框失去焦点,默认输入完毕,输入完毕判断是否需要输入BMC MAC $("#modelNo").blur(checkUpgraded); $("#serialNo").blur(checkIsUpgradedStart); } //进入T1测试模块 function bindT1Test(){ //设置这三个文本框不可输入 $("#serialNo").attr("disabled",true); $("#mac1").attr("disabled",true); $("#mac2").attr("disabled",true); TestType = "pretest" //设置测试类型 //当文本框失去焦点,默认输入完毕,输入完毕判断是否需要输入BMC MAC $("#modelNo").keyup(function(){ if(event.keyCode == 13){ //这里写你要执行的事件; checkT1NeedBmcMac(); } }); $("#serialNo").blur(checkIsTestStart); $("#mac1").blur(checkIsTestStart); $("#mac2").blur(checkIsTestStart); } //进入老化测试模块 function bindBurninTest(){ //设置这三个文本框不可输入 $("#serialNo").attr("disabled",true); $("#mac1").attr("disabled",true); $("#mac2").attr("disabled",true); TestType = "burnin" //设置测试类型为老化 //当文本框失去焦点,默认输入完毕,输入完毕判断是否需要输入BMC MAC $("#modelNo").blur(checkBurninNeedBmcMac); $("#serialNo").blur(checkIsTestStart); $("#mac1").blur(checkIsTestStart); $("#mac2").blur(checkIsTestStart); } //检查T1测试是否需要BMC MAC function checkT1NeedBmcMac(){ var bomname= $("#modelNo").val(); $.ajax({ type: "post", url: "page/checkT1NeedBmcMac", data: {bomname:bomname}, dataType: "text", success: function(data){ //需要,则mac2文本框需要输入,并且其他输入框都可以输入 if(data =="need"){ $("#mac2").attr("disabled",false); $("#serialNo").attr("disabled",false); $("#mac1").attr("disabled",false); } //不输入,mac2文本框变为不可输入 if(data =="no_need"){ $("#mac2").attr("disabled",true); $("#serialNo").attr("disabled",false); $("#mac1").attr("disabled",false); } } }); } //检查老化测试是否需要BMC MAC function checkBurninNeedBmcMac(){ var bomname= $("#modelNo").val(); $.ajax({ type: "post", url: "page/checkBurninNeedBmcMac", data: {bomname:bomname}, dataType: "text", success: function(data){ //需要,则mac2文本框需要输入,并且其他输入框都可以输入 if(data =="need"){ $("#mac2").attr("disabled",false); $("#serialNo").attr("disabled",false); $("#mac1").attr("disabled",false); } //不输入,mac2文本框变为不可输入 if(data =="no_need"){ $("#mac2").attr("disabled",true); $("#serialNo").attr("disabled",false); $("#mac1").attr("disabled",false); } } }); } //检查是否开始测试 function checkIsTestStart(){ var serialNo = $("#serialNo").val(); var mac1 = $("#mac1").val(); var mac2 = $("#mac2").val(); var bomname= $("#modelNo").val(); //如果mac2为disabled,则不需要 if($("#mac2").attr("disabled")=="disabled"){ if(mac1!=""&&serialNo!=""){ checkTestStatus(bomname,serialNo,mac1,null); } }else{ if(mac1!=""&&serialNo!=""&&mac2!=""){ checkTestStatus(bomname,serialNo,mac1,mac2); } } } //检查是否开始升级 function checkIsUpgradedStart(){ var serialNo = $("#serialNo").val(); var bomname= $("#modelNo").val(); if( $("#serialNo").attr("disabled")=="disabled"){ }else{ if(serialNo!=""){ checkTestStatus(bomname,serialNo,null,null); } } } // function checkTestStatus(bomname,serialNo,mac1,mac2){ //檔serialNo和mac1部位空的時候,執行是否升級 var username= $("#modelNo").val(); $.ajax({ type: "post", url: "page/checkTestStatus", data: {serialNo:serialNo,mac1:mac1,bomname:bomname}, dataType: "text", success: function(data){ if(data.indexOf("message")){ alert(data); }else{ if(data=="testing"){ alert("正在测试") }else{ if(TestType=="pretest"){ TextT1Begin(serialNo,mac1,mac2,bomname);//开始进行T1测试 } if(TestType=="burnin"){ TextBurninBegin(serialNo,mac1,mac2,bomname);//开始进行老化测试 } if(TestType=="upgrade"){ UpgradedBegin(serialNo,mac1,mac2,bomname);//开始进行老化测试 } } } } }); } //检查是否需要升级 function checkUpgraded(){ var bomname= $("#modelNo").val(); //检查需要升级时 if(checkUpdate(bomname) =="need"){ //判断是否已经成功升级过 $("#serialNo").attr("disabled",false); }else{ alert("不需要升级") } } function UpgradedBegin(serialNo,mac1,mac2,bomname){ var UpgradedStatus = checkUpgradedStatus(bomname, serialNo, mac2); if(UpgradedStatus=="not_need"){ var isNeed = confirm(‘已经升级过,是否继续升级?‘); if(isNeed="true"){ var message = pxeTestStart(bomname, serialNo, mac1, mac2); alert(message) }else{ return; } }if(UpgradedStatus=="need"){//不需要升级的时候 pxeTestStart(bomname, serialNo, mac1, mac2); PxeGetTestingLog(); } } //T1测试开始 function TextT1Begin(serialNo,mac1,mac2,bomname){ //检查需要升级时 if(checkUpdate(bomname) =="need"){ //判断是否已经成功升级过 var UpgradedStatus = checkUpgradedStatus(bomname, serialNo, mac2); if(UpgradedStatus=="need"){ alert("请先升级") }if(UpgradedStatus=="not_need"){//不需要升级的时候 //检查是否已经pretest过 if(checkPretestedStatus(bomname,serialNo,mac2)=="pass"){ var isNeed = confirm(‘已经pre测试过,是否继续测试?‘); if(isNeed="true"){ var message = pxeTestStart(bomname, serialNo, mac1, mac2); alert(message) }else{ return; } }else{//开始进行升级 pxeTestStart(serialNo,mac1,mac2,bomname); PxeGetTestingLog(); alert("开始升级") } } } //检查不需要升级时 if(checkUpdate(bomname) =="not_need"){ //检查是否已经pretest过 if(checkPretestedStatus(bomname,serialNo,mac2)=="pass"){ var isNeed = confirm(‘已经pre测试过,是否继续测试?‘); if(isNeed="true"){ var message = pxeTestStart(bomname, serialNo, mac1, mac2); PxeGetTestingLog(); alert(message) }else{ return; } }else{//开始进行升级 var message = pxeTestStart(bomname, serialNo, mac1, mac2); PxeGetTestingLog(); alert(message); } } } //老化测试开始 function TextBurninBegin(serialNo,mac1,mac2,bomname,username,TestType){ //检查是否已经pretest过 if(checkPretestedStatus(bomname,serialNo,mac2)=="passed"){ if(checkBurninedStatus(bomname,serialNo,mac2)=="passed"){//已经老化测试过 //对话框 var isNeed = confirm(‘已经老化测试过,是否继续测试?‘); if(isNeed="true"){ var message = pxeTestStart(bomname, serialNo, mac1, mac2); PxeGetTestingLog(); alert( message); }else{ return; } }else{ var message = pxeTestStart(bomname, serialNo, mac1, mac2); //开始测试 PxeGetTestingLog(); alert( message) } }else{//没有进行预测试,要先进行预测试 alert("设备需要preTest过后才可以进行buninTest"); } } //检查是否需要升级 function checkUpdate(bomname){ var result = ""; //檔serialNo和mac1部位空的時候,執行是否升級 if(mac1!=""&&serialNo!=""){ var bomname= $("#modelNo").val(); $.ajax({ async:false, type: "post", url: "page/checkUpdate", data: {bomname:bomname}, dataType: "text", success: function(data){ result = data; } }); } return result; } //检查是否已经pretext过 function checkPretestedStatus(bomname,serialNo,mac2){ var result = ""; //檔serialNo和mac1部位空的時候,執行是否升級 if(mac1!=""&&serialNo!=""){ var bomname= $("#modelNo").val(); $.ajax({ async:false, type: "post", url: "page/checkPretestedStatus", data: {bomname:bomname,serialNo:serialNo,mac2:mac2}, dataType: "text", success: function(data){ result = data; } }); } return result; } //检查是否已经老化测试过 function checkBurninedStatus(bomname,serialNo,mac2){ var result = ""; //檔serialNo和mac1部位空的時候,執行是否升級 if(mac1!=""&&serialNo!=""){ var bomname= $("#modelNo").val(); $.ajax({ async:false, type: "post", url: "page/checkBurninedStatus", data: {bomname:bomname,serialNo:serialNo,mac2:mac2}, dataType: "text", success: function(data){ result = data; } }); } return result; } //检查是否已经成功升级过 function checkUpgradedStatus(bomname,serialNo,mac2){ var result = ""; //檔serialNo和mac1部位空的時候,執行是否升級 if(mac1!=""&&serialNo!=""){ var bomname= $("#modelNo").val(); $.ajax({ async:false, type: "post", url: "page/checkUpgradedStatus", data: {bomname:bomname,serialNo:serialNo,mac2:mac2}, dataType: "text", success: function(data){ result = data; } }); } return result; } //开始测试 function pxeTestStart(bomname,serialNo,mac1,mac2){ var username = bomname; //取当前登陆用户名 var result = ""; //檔serialNo和mac1部位空的時候,執行是否升級 $.ajax({ async:false, type: "post", url: "page/pxeTestStart", data: {bomname:bomname,serialNo:serialNo,mac2:mac2,mac1:mac1,username:username,type:TestType}, dataType: "text", success: function(data){ result =data; } }); return result; } //获取正在测试列表 function PxeGetTestingLog(){ var Content = tableContent; var sortType = $("#buildTime").attr("name"); //檔serialNo和mac1部位空的時候,執行是否升級 $.ajax({ async:false, type: "post", url: "page/PxeGetTestingLog", data: {sortType:sortType}, dataType: "json", success: function(data){ if(data!=null){ //先清空 $("#tableContent").html(""); //获取html模版 for (var i = 0; i < data.length; i++) { var html = $("#htmlTem").html(); html = html.replace("#buildtime",data[i].buildtime); html = html.replace("#bomnumber",data[i].bmcmac); html = html.replace("#serialnumber",data[i].serialnumber); html = html.replace("#type",data[i].operator); Content = Content+html $("#tableContent").html(Content); } } } }); } //绑定搜索事件 function searchInfo(){ //取文本框的值 var Content = tableContent; var buildTime= $("#buildTime").val(); var modeNo= $("#modeNo").val(); var serNo= $("#serNo").val(); var testing= $("#testing").val(); var testType= $("#testType").val(); var testStutas= $("#testStutas").val(); var useTime= $("#useTime").val(); $.ajax({ async:false, type: "post", url: "page/pxeSearchTestingLog", data: {buildTime:buildTime,modeNo:modeNo,serNo:serNo,testing:testing,testType:testType,testStutas:testStutas,useTime:useTime}, dataType: "json", success: function(data){ if(data!=null){ //先清空 $("#tableContent").html(""); //获取html模版 for (var i = 0; i < data.length; i++) { var html = $("#htmlTem").html(); html = html.replace("#buildtime",data[i].buildtime); html = html.replace("#bomnumber",data[i].bmcmac); html = html.replace("#serialnumber",data[i].serialnumber); html = html.replace("#type",data[i].operator); Content = Content+html $("#tableContent").html(Content); } } } }); //绑定排序事件 function sort(){ //记录当前排序类型 var sortType = $("#buildTime").attr("name"); if(sortType ==1 ){ $("#buildTime").attr("name","2"); }else{ $("#buildTime").attr("name","1"); } $.ajax({ async:false, type: "post", url: "page/PxeGetTestingLog", data: {sortType:sortType}, dataType: "json", success: function(data){ if(data!=null){ //先清空 $("#tableContent").html(""); //获取html模版 for (var i = 0; i < data.length; i++) { var html = $("#htmlTem").html(); html = html.replace("#buildtime",data[i].buildtime); html = html.replace("#bomnumber",data[i].bmcmac); html = html.replace("#serialnumber",data[i].serialnumber); html = html.replace("#type",data[i].operator); Content = Content+html $("#tableContent").html(Content); } } } }); } }
时间: 2024-10-13 21:51:49