<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<column id="__m3i1fps5ZHztVV6M3Wa">
  <name>确认成绩</name>
  <parentId>__Xq3r3eKoddb3a49Mrrg</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <width></width>
  <valueScript><![CDATA[]]></valueScript>
  <hiddenScript><![CDATA[true]]></hiddenScript>
  <beforeScript><![CDATA[]]></beforeScript>
  <parentView>__Xq3r3eKoddb3a49Mrrg</parentView>
  <type>COLUMN_TYPE_OPERATE</type>
  <fieldName></fieldName>
  <flowReturnCss>false</flowReturnCss>
  <imageName>01</imageName>
  <fontColor></fontColor>
  <orderno>411111111</orderno>
  <sum>false</sum>
  <total>false</total>
  <isOrderByField>false</isOrderByField>
  <orderType>ASC</orderType>
  <multiLanguageLabel></multiLanguageLabel>
  <actionScript><![CDATA[#include "sysfunction";
(function(){
var doc=getCurrentDocument();
println(""+doc);
var docId=doc.getId();
var errorStr = "";
var classStatus = getItemValueAsString("classStatus"); //班级状态
var testResultConfirmationStatus = getItemValueAsString("testResultConfirmationStatus"); //确认状态
println(""+classStatus)
println(""+(!"1".equals(classStatus)))
if(!"1".equals(classStatus)){  
  return createAlert("班级状态为审核通过才能确认成绩！"); 
}
  if("1".equals(testResultConfirmationStatus)){  
  return createAlert("班级确认状态已确认，请勿重复提交！"); 
}


var sql = "select * from tms.tlk_level_class_student where ITEM_CLASSID='"+docId+"'";
//println("sql----------------"+sql);
 var query = queryBySQL(sql);
//println("--------------"+query);
if(query == "[]"){
  return createAlert("班级没有学员！"); 
}else{
  for(var iterator = query.iterator();iterator.hasNext();){
    doc = iterator.next();
    var graduationTestResults = doc.getItemValueAsString("graduationTestResults"); //结业考试结果
   // println("---------------------------");
    var identificationTestResults = doc.getItemValueAsString("identificationTestResults"); //鉴定考试结果
    var name = doc.getItemValueAsString("name"); 
    if("0".equals(graduationTestResults)){
    	errorStr += name + " 没有结业考试成绩，请核实！";
    }
     var idCardNo = doc.getItemValueAsString("idCardNo"); 
    var UUserCard = doc.getItemValueAsString("idCardNo"); 
     var birthDay = UUserCard.substring(6, 10) + "-" + UUserCard.substring(10, 12) + "-" + UUserCard.substring(12, 14);
   var sqlR="select * from tlk_grade_registration where ITEM_IDCARDNO='"+idCardNo+"'";
 var datas = queryByDSName(sysfunction.DS_TMS,sqlR);
if(datas!=null){
   for(var iterator = datas.iterator();iterator.hasNext();){
       var map1 = iterator.next();//取值
      var personId= map1.get("id");
     // var birthDay= format(map1.get("ITEM_BIRTHDAY"),"yyyy-MM-dd");
      var avatar= map1.get("ITEM_AVATAR");
     var today=format(getToday(),"yyyy-MM-dd");
     var cultivateCompany=map1.get("ITEM_TRAINNAME");
      var CompanyNameToGet=map1.get("ITEM_LEARNNAME");
      var cultivateCompanyCode=map1.get("ITEM_TRAINID");
      var CompanyNameToGetCode=map1.get("ITEM_LEARNID");
var sqlr = "select "+
    "'"+getDomainid()+"' as DOMAINID,"+
    "ID,"+ 
    "ID as item_ID,"+
    "ITEM_REGISTERADDRESSID," +
    "ITEM_REGISTERADDRESS" +
    " from "+sysfunction.DS_FLOW+".tlk_setsupervise"+
    " where ITEM_DOMAIN_ID='"+getDomainid()+"'";
println(sqlr);
var datass = queryByDSName("tms",sqlr);
println(datass);
if(datass!=null){
   for(var iterator = datass.iterator();iterator.hasNext();){
       var map1 = iterator.next();//取值
      var ss=map1.get("item_registeraddress");
       var OFFICEPOLICEADDRESSS= splitText(ss,"市");
    for(var i=0;i<OFFICEPOLICEADDRESSS.length;i++){                  
  var OFFICEPOLICEADDRESS = OFFICEPOLICEADDRESSS[i]+"市公安局"; 
    }
       var OFFICEADDRESSID = map1.get("ITEM_REGISTERADDRESSID"); 
     println(OFFICEADDRESSID);
    }}
var ResultCodeJsonObject =new Packages.cn.myapps.util.serial.number.GenerateSerialNumber(); 
println("ResultCodeJsonObject---------:" + ResultCodeJsonObject);
var numberr=ResultCodeJsonObject.getSerialNumber("bapx");
println("numberr---------:" + numberr);
     var process = getDocumentProcess();               
           var formProcess = getFormProcess();               
           var subform = formProcess.doView("__JPHvq5gsbT0nuFotaqq");               
           var doc = process.doNew(subform,getWebUser(),createParamsTable());  
           doc.addStringItem("name",name);    
           doc.addStringItem("idCardType","1");  
           doc.addStringItem("idCardNo",UUserCard);
           doc.addStringItem("certificateType","2");
           doc.addStringItem("certificateNO","湘"+numberr); 
           doc.addStringItem("confirmDate",today); 
           doc.addStringItem("certificateFrom",OFFICEPOLICEADDRESS); 
     	   doc.addStringItem("certificateFromNO",OFFICEADDRESSID);
           doc.addStringItem("certificateDate",today);          
           doc.addStringItem("status",1)//datart.getItemValueAsString("ID_NUMBER"));             
           doc.addStringItem("cultivateCompany",cultivateCompany);  
           doc.addStringItem("CompanyNameToGet",CompanyNameToGet); 
           doc.addStringItem("cultivateCompanyCode",cultivateCompanyCode);
           doc.addStringItem("CompanyNameToGetCode",CompanyNameToGetCode);
           doc.addStringItem("oneInchPhoto",avatar);        
           doc.addStringItem("birthday",birthDay);  
           //doc.addIntItem("progress",0);   
           println("doc==>" + doc);
           process.doCreate(doc); 
   
  }
}  }}

if(!"".equals(errorStr)){
  return createAlert(errorStr);
}else{
var classInfoDoc=findDocument(docId); 
var process = getDocumentProcess();   
classInfoDoc.findItem("testResultConfirmationStatus").setValue("1");
classInfoDoc.findItem("classStatus").setValue("4");
 
  process.doUpdate(classInfoDoc);
}
})()]]></actionScript>
  <clickSorting>true</clickSorting>
  <sortStandard>00</sortStandard>
  <jumpMapping></jumpMapping>
  <mappingform>__ApOFiTWdSoVEmTPouiH</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>__RQzjq1wghqSfYUWCas6</templateForm>
  <icon></icon>
  <showType>01</showType>
  <mappingField></mappingField>
  <showMoon>false</showMoon>
  <showAsLabel>false</showAsLabel>
  <showAsButton>false</showAsButton>
  <displayType>00</displayType>
  <displayLength></displayLength>
  <showTitle>false</showTitle>
  <isFilter>false</isFilter>
</column>