<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<column id="__ORfguXhk3uv2l1v2Cvx">
  <name>考试记录单</name>
  <parentId>__92Y8bF5fV66YwF3mCvU</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <width></width>
  <valueScript><![CDATA[]]></valueScript>
  <hiddenScript><![CDATA[]]></hiddenScript>
  <beforeScript><![CDATA[]]></beforeScript>
  <parentView>__92Y8bF5fV66YwF3mCvU</parentView>
  <type>COLUMN_TYPE_OPERATE</type>
  <fieldName></fieldName>
  <flowReturnCss>false</flowReturnCss>
  <imageName></imageName>
  <fontColor></fontColor>
  <orderno>13</orderno>
  <sum>false</sum>
  <total>false</total>
  <isOrderByField>false</isOrderByField>
  <orderType>ASC</orderType>
  <multiLanguageLabel></multiLanguageLabel>
  <actionScript><![CDATA[(function(){
  var Security = new Packages.cn.myapps.common.util.Security();
  var accessToken = Security.getToken(getWebUser().getId());
  //req是整体参数，里面有data，htmPath，pdfPath
  var req = new Packages.java.util.HashMap(); 
  var data = new Packages.java.util.HashMap(); 
  var trainName=""
  var planName=""
  var planType=""
  var examName=""
  var examTime=""
  var examAddress=""
  var examId=getId();
  var examInfo=findDocument(examId);
  var sitesql="select e.domainid,e.item_plan,type.item_point_type,e.item_exam_name,e.item_computer_address,DATE_FORMAT(e.item_computer_start_date, '%Y-%m-%d %H:%i:%s') as item_computer_start_date,DATE_FORMAT(e.item_computer_end_date, '%Y-%m-%d %H:%i:%s') as item_computer_end_date from tlk_train_exam e left join tlk_train_point_type type on type.id = e.item_point_type where e.id='"+examId+"' limit 1" 
  var sitedatas = queryByDSName("tms",sitesql);
  if(sitedatas.size()>0){
    for(var siteiterator = sitedatas.iterator();siteiterator.hasNext();){
      var sitemap = siteiterator.next();//取值
      var domainid= sitemap.get("domainid");
      var domainprocess = getDomainProcess();//获取企业域对象 
      var domainDao=domainprocess.doView(domainid);
      var trainName = domainDao.getName();
      var planName = sitemap.get("item_plan");
      var planType = sitemap.get("item_point_type");
      var examName = sitemap.get("item_exam_name");
      var examAddress = sitemap.get("item_computer_address");
      var examTime = sitemap.get("item_computer_start_date")+"至"+sitemap.get("item_computer_end_date")
      }
  }

  var countsql="select 1 from tlk_train_exam_person where item_exam_id='"+examId+"' "
  var countdatas = queryByDSName("tms",countsql);
  var examPNum=countdatas.size()
  var persons = new Packages.java.util.ArrayList();
  var selectsql="select item_person_name,item_seat,item_idcard_no from tlk_train_exam_person where item_exam_id='"+examId+"' order by CONVERT(item_seat, SIGNED) "
  var selectdatas = queryByDSName("tms",selectsql);
  if(selectdatas.size()>0){
    for(var iterator = selectdatas.iterator();iterator.hasNext();){
      var map1 = iterator.next();//取值
      var name= map1.get("item_person_name");
      var zw = map1.get("item_seat");
      var idCardNo = map1.get("item_idcard_no");
      var row = new Packages.java.util.LinkedHashMap(); 
      row.put("number", splitText(zw, ".")[0]);
      row.put("name", name);
      row.put("idcard", idCardNo);
      row.put("remark", "");
      persons.add(row)
    }
  }
  data.put("trainName", trainName);
  data.put("planName", planName);
  data.put("planType", planType);
  data.put("examTime", examTime);
  data.put("examName", examName);
  data.put("examAddress", examAddress);
  data.put("examPNum", parseInt(examPNum)+"人");
  data.put("persons", persons);
  var htmPath="/uploads/templates/行业考试记录单.html"
  var prefix="行业考试记录单"+examId.substring(0, 6)
  var code = getLastCount(prefix);
  if(code<=0){
    var filenam=countNext2(prefix,true,true,true,2); 
  }else{
    var filenam =getLastCount2(prefix,true,true,true,2); //自动编号的最后编号
  }
  var pdfPath="/uploads/resource/"+filenam+".pdf"
  req.put("data",data)
  req.put("htmPath",htmPath)
  req.put("pdfPath",pdfPath)
  var request = $WEB.getParamsTable().getHttpRequest();
  var refererUrl = request.getHeader("Referer");
  var url = new Packages.java.net.URL(refererUrl);
  var protocol = url.getProtocol(); // 获取协议部分
  var host = url.getHost(); // 获取主机名部分
  var port = url.getPort(); // 获取端口号，如果未指定端口则返回 -1
  var serverAndPort="";
  if (port != -1) {
    serverAndPort = protocol + "://" + host + ":" + port; // 拼接带端口的服务器部分
  } else {
    serverAndPort = protocol + "://" + host; // 拼接不带端口的服务器部分
  }
  if (serverAndPort.indexOf("localhost")>0){
    serverAndPort="https://v5qy.te.baibaodun.com.cn";
  }
  var Url=serverAndPort+"/kms/api/kms/convert/htmlToDoc"
  try{
    var header = new Packages.java.util.HashMap();
    header.put("Content-Type","application/json")
    header.put("accessToken",accessToken);
    req = Packages.com.alibaba.fastjson.JSON.toJSONString(req);
    println("Url-->"+Url)
    println("header-->"+header)
    println("req-->"+req)
    var response = Packages.cn.hutool.http.HttpUtil.createPost(Url).addHeaders(header).body(req).execute().body();
    println("response-->"+response)
  }catch(e){println("e=="+e); return e};

  var process = getDocumentProcess();
  examInfo.findItem("record_url").setValue(pdfPath);
  process.doUpdate(examInfo);
})()
]]></actionScript>
  <clickSorting>true</clickSorting>
  <sortStandard>00</sortStandard>
  <jumpMapping></jumpMapping>
  <mappingform></mappingform>
  <formatType>simple</formatType>
  <decimalsNum>1</decimalsNum>
  <thouSign>false</thouSign>
  <decimalsCurr>1</decimalsCurr>
  <currType>zh_CN</currType>
  <color>rgba(0, 0, 0, 1)</color>
  <fontSize>12</fontSize>
  <groundColor>rgba(255, 255, 255, 0)</groundColor>
  <showIcon>false</showIcon>
  <iconMapping></iconMapping>
  <buttonType>04</buttonType>
  <buttonName>生成考试记录单</buttonName>
  <visible>true</visible>
  <visible4ExpExcel>false</visible4ExpExcel>
  <visible4Print>true</visible4Print>
  <visible4PagePrint>false</visible4PagePrint>
  <templateForm></templateForm>
  <icon></icon>
  <showType>01</showType>
  <mappingField></mappingField>
  <showMoon>false</showMoon>
  <showAsLabel>false</showAsLabel>
  <showAsButton>false</showAsButton>
  <displayType>00</displayType>
  <displayLength></displayLength>
  <showTitle>true</showTitle>
  <isFilter>false</isFilter>
</column>