<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<activity id="__RNa3GurIiSaqFkNXYbM">
  <name>确认添加</name>
  <parentId>__QkLCjmHNVTLRZelpi7Z</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <type>13</type>
  <onActionFlow></onActionFlow>
  <onActionPrint></onActionPrint>
  <colorType>default</colorType>
  <beforeActionScript><![CDATA[(function(){
  var domainId = getDomainid();
  var classId= getItemValueAsString("classId"); 
  var idcardno = getItemValueAsString("idcardno");
  var classPersonId= getItemValueAsString("classPersonId"); 
  //println("classId==>" + classId);
  var arrto1 = splitText(idcardno,";");
  var person = "";
  var msg2 = "";
  var arrto2 = splitText(classPersonId,";");
  for(var i=0;i<arrto1.length;i++){
    var personid = arrto1[i];
    var applyid = arrto2[i];
    println("applyid-----------"+applyid);
    //var sql = "select item_name from tlk_grade_registration where ITEM_IDCARDNO = '"+personid+"' and (ITEM_REVIEWSTATUS in('0','2') or ITEM_REVIEWRESULT in ('2','4')) GROUP BY item_name; "
    var sql = "select item_name from tlk_grade_registration where ITEM_IDCARDNO = '"+personid+"' and ITEM_REVIEWRESULT in ('2','4') GROUP BY item_name; "
    println("sql围墙二无群二---------------"+sql);
    var datas = queryByDSName("tms",sql);
    if(datas!=null){
      for(var iterator = datas.iterator();iterator.hasNext();){
        var map1 = iterator.next();//取值
        var name= map1.get("item_name");
        person+=name;
        person+=";";
      }
    }
    var sqlgg = "select item_name from tlk_apply_person_refund where item_applyid='"+applyid+"' and item_refundState = '0'";
    println("sqlgg---------------"+sqlgg);
    var datas = queryByDSName("tms",sqlgg);
    if(!"[]".equals(datas)){
      for(var iterator = datas.iterator();iterator.hasNext();){
        var map1 = iterator.next();//取值
        var name= map1.get("item_name");
        msg2+=name;
        msg2+=";";
      }
    }
  }
  println("person--------------"+person);
  println("msg2--------------"+msg2);
  if(isNotNull(person)){
    person = person.substring(0,person.length-1);
    return person+"以上人员抽查状态不符合要求";
  }
  if(isNotNull(msg2)){
    msg2 = msg2.substring(0,msg2.length-1);
    return msg2+"以上人员已申请退款，请到退款审核，审核该记录！！";
  }
  var classPersonId = getItemValueAsString("classPersonId"); 
  var arrto = splitText(classPersonId,";"); 
  var process = getDocumentProcess();            
  var formProcess = getFormProcess();            
  var subform = formProcess.doView("__TTLL6anXeEmwkn6UvAO");//表单id    
  for(var i=0;i<arrto.length;i++){
    var applyId = arrto[i];

    var applyInfoDoc = findDocument(applyId);

    var doc = process.doNew(subform,getWebUser(),createParamsTable()); 
    //var sql= "select '"+domainId+"' as domainid,"+
    //"COUNT( a.ITEM_IDCARDNO ) AS ITEM_INTERNSHIPDAYS,"+
    //"SUM( a.ITEM_INTERNSHIPDURATION ) AS ITEM_INTERNSHIPTIME"+
    // FROM "+
    //"organizationauth.tlk_grade_card_internship_record a "+
    //" GROUP BY a.ITEM_IDCARDNO";
    // println(sql);
    //var datas  = queryByDSName("organizationAuth",sql);
    //if(datas !=null){
    //  for(var iterator = datas.iterator();iterator.hasNext();){
    // doc = iterator.next();
    //   var day = doc.getItemValueAsString("item_INTERNSHIPDAYS");   
    // var time = doc.getItemValueAsString("item_INTERNSHIPTIME");
    //  var doc = process.doNew(subform,getWebUser(),createParamsTable()); 
    doc.addStringItem("classId",classId);     
    doc.addStringItem("idCardNo",applyInfoDoc.findItem("idCardNo").getValue());     
    doc.addStringItem("name",applyInfoDoc.findItem("name").getValue()); 
    doc.addStringItem("securityId",applyInfoDoc.findItem("securityId").getValue());  
    doc.addStringItem("scoreState","0");
    doc.addStringItem("cardState","0");
    doc.addStringItem("applyId",applyInfoDoc.getId()); 
    doc.addIntItem("sumScore",0);
    doc.addStringItem("noticeState","0");//默认状态为0 未通知
    doc.addStringItem("signin","0")
    // 			println("day------------------------"+day)
    doc.addStringItem("company",applyInfoDoc.findItem("learnName").getValue()); 
    doc.addStringItem("phone",applyInfoDoc.findItem("phone").getValue()); 
    println(doc)
    //    doc.addStringItem("INTERNSHIPDAYS",day); 
    //    doc.addStringItem("INTERNSHIPTIME",time); 
    process.doCreate(doc);   
    //    } 
    //}


  }



})()]]></beforeActionScript>
  <afterActionScript><![CDATA[]]></afterActionScript>
  <retractBeforeActionScript><![CDATA[]]></retractBeforeActionScript>
  <retractAfterActionScript><![CDATA[]]></retractAfterActionScript>
  <hiddenScript><![CDATA[]]></hiddenScript>
  <readonlyScript><![CDATA[]]></readonlyScript>
  <startFlowScript><![CDATA[]]></startFlowScript>
  <editMode>0</editMode>
  <fileNameScript><![CDATA[]]></fileNameScript>
  <iconurl></iconurl>
  <orderno>0</orderno>
  <stateToShow></stateToShow>
  <parentForm>__QkLCjmHNVTLRZelpi7Z</parentForm>
  <jumpType>0</jumpType>
  <expSub>false</expSub>
  <icon></icon>
  <disableFlowNode>false</disableFlowNode>
  <changeFlowOperator>false</changeFlowOperator>
  <changeFlowCc>false</changeFlowCc>
  <multiLanguageLabel></multiLanguageLabel>
  <dispatcherMode>0</dispatcherMode>
  <dispatcherUrl><![CDATA[]]></dispatcherUrl>
  <dispatcherParams><![CDATA[[{"paramKey":"","paramValue":""}]]]></dispatcherParams>
  <jumpMode>0</jumpMode>
  <jumpActOpenType>0</jumpActOpenType>
  <withOld>false</withOld>
  <actionType>2</actionType>
  <actionDispatcherUrlScript><![CDATA[]]></actionDispatcherUrlScript>
  <actionSelection>0</actionSelection>
  <relatedFormId></relatedFormId>
  <actionScript><![CDATA[]]></actionScript>
  <workFlowType>0</workFlowType>
  <contextMenu>false</contextMenu>
  <showInToolbar>true</showInToolbar>
  <transpond></transpond>
  <targetList>|</targetList>
  <label><![CDATA[]]></label>
</activity>