<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<activity id="__nIpjBPlPExuh0iLCdtY">
  <name>保存并返回</name>
  <parentId>__ul2Y0ecczgBlwMae9Xi</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <type>11</type>
  <onActionFlow></onActionFlow>
  <onActionPrint></onActionPrint>
  <colorType>default</colorType>
  <beforeActionScript><![CDATA[//判断表单某字段不能为空
#include "sysfunction";
(function(){
  var attention = getItemValueAsString("attention"); 
  var isComputerExam= getItemValueAsString("isComputerExam"); 
  var isStamina= getItemValueAsString("isStamina"); 
  var examStandard = getItemValueAsString("examStandard"); 
  var writtenPassScore = getItemValueAsString("writtenPassScore"); 
  var operatePassScore = getItemValueAsString("operatePassScore"); 
  if(!"00".equals(examStandard)){
    println("examStandard------------"+examStandard)
    if(examStandard > 100){
      return "成绩合格分数不得大于100！"
    }
  }
  if(!"00".equals(writtenPassScore)){
    println("writtenPassScore------------"+writtenPassScore)
    if(writtenPassScore > 100){
      return "理论考试合格分数不得大于100！"
    }
  }
  if(!"00".equals(operatePassScore)){
    println("operatePassScore------------"+operatePassScore)
    if(operatePassScore > 100){
      return "﻿实操考试合格分数不得大于100！"
    }
  }
  if("0".equals(isComputerExam) && "0".equals(isStamina)){
    return "是否理论考试和是否实操考试不能均为否！！！"
  }
  var isComputerExam= getItemValueAsString("isComputerExam"); 
  var isStamina= getItemValueAsString("isStamina"); 
  var examRules= getItemValueAsString("examRules"); 

  var theoreticalAddress = getItemValueAsString("theoreticalAddress"); 
  var computerStartDate= getItemValueAsDate("computerStartDate"); 
  var computerEndDate= getItemValueAsDate("computerEndDate"); 
  var staminaAddress = getItemValueAsString("staminaAddress"); 
  var staminaStartDate= getItemValueAsDate("staminaStartDate"); 
  var staminaEndDate= getItemValueAsDate("staminaEndDate"); 
  var writtenRatio = getItemValueAsInt("writtenRatio"); 
  var operateRatio= getItemValueAsInt("operateRatio"); 
  var examStandard= getItemValueAsInt("examStandard"); 
  var writtenPassScore = getItemValueAsInt("writtenPassScore"); 
  var operatePassScore= getItemValueAsInt("operatePassScore"); 
  if(!isNotNull(attention)){return "注意事项必须填写!";}
  if("1".equals(isComputerExam) && "0".equals(isStamina) ){
    if(!isNotNull(theoreticalAddress)){return "理论考试地址必须填写!";}
    if(!isNotNull(computerStartDate)){return "理论考试开始时间必须填写!";}
    if(!isNotNull(computerEndDate)){return "理论考试结束时间必须填写!";}
    if(examStandard == 0){return "成绩合格分数必须填写!";}
  }else if("0".equals(isComputerExam) && "1".equals(isStamina) ){
    if(!isNotNull(staminaAddress)){return "体能考试地址必须填写!";}
    if(!isNotNull(staminaStartDate)){return "体能考试开始时间必须填写!";}
    if(!isNotNull(staminaEndDate)){return "体能考试结束时间必须填写!";}
  }else if("1".equals(isComputerExam) && "1".equals(isStamina)){
    if(!isNotNull(theoreticalAddress)){return "理论考试地址必须填写!";}
    if(!isNotNull(computerStartDate)){return "理论考试开始时间必须填写!";}
    if(!isNotNull(computerEndDate)){return "理论考试结束时间必须填写!";}
    if(!isNotNull(staminaAddress)){return "体能考试地址必须填写!";}
    if(!isNotNull(staminaStartDate)){return "体能考试开始时间必须填写!";}
    if(!isNotNull(staminaEndDate)){return "体能考试结束时间必须填写!";}
    if(!isNotNull(examRules)){return "成绩考核规则必须填写!";}
      println("时间结果--》"+format(computerStartDate,"yyyy-MM-dd HH:mm:ss") < format(staminaEndDate,"yyyy-MM-dd HH:mm:ss"))
   if(format(staminaStartDate,"yyyy-MM-dd HH:mm:ss") <= format(computerEndDate,"yyyy-MM-dd HH:mm:ss") && format(staminaEndDate,"yyyy-MM-dd HH:mm:ss")>=format(computerStartDate,"yyyy-MM-dd HH:mm:ss")){
    return "理论与实操考试时间存在冲突"
    }
    var practical_fail_up = getItemValueAsString("practical_fail_up"); 
    println("practical_fail_up--L>"+practical_fail_up)
    if(format(computerStartDate,"yyyy-MM-dd HH:mm:ss") < format(staminaEndDate,"yyyy-MM-dd HH:mm:ss") && "0".equals(practical_fail_up)){
    return "实操考试时间应该在理论考试时间之前"
    }
    if("0".equals(examRules)){
      if(writtenRatio == 0){return "理论考试占比必须填写!";}
      if(operateRatio == 0){return "体能考试占比必须填写!";}
      if(examStandard == 0){return "成绩合格分数必须填写!";}
    }else{
      if(writtenPassScore == 0){return "理论考试合格分数必须填写!";}
      if(operatePassScore == 0){return "体能考试合格分数必须填写!";}
    }
  }

  var newDoc = getCurrentDocument();



})()]]></beforeActionScript>
  <afterActionScript><![CDATA[(function(){
  var doc=getCurrentDocument();
  var process = getDocumentProcess();
  var personId = getItemValueAsString("person");
  var results="";
  if(isNotNull(personId)){
    var persons = personId.split(";");
    for (var i=0;i<persons.length;i++){
      var sql3 = "select name "+
          " from obpm2.t_user  where id = '"+persons[i]+"' ";
      var datas3 = queryByDSName("tms",sql3);
      if(datas3.size()>0){
        for(var iterator = datas3.iterator();iterator.hasNext();){
          var map1 = iterator.next();//取值
          var name= map1.get("name");
          results+=name+";"
        }
      }
    }
  }
  doc.findItem("personName").setValue(results);
process.doUpdate(doc)
})()
]]></afterActionScript>
  <retractBeforeActionScript><![CDATA[]]></retractBeforeActionScript>
  <retractAfterActionScript><![CDATA[]]></retractAfterActionScript>
  <hiddenScript><![CDATA[]]></hiddenScript>
  <readonlyScript><![CDATA[          
(function() {         
var examState=getItemValueAsString("examState");    
if("0".equals(examState)){
  return false;
}else{
  return true;
}
})();]]></readonlyScript>
  <startFlowScript><![CDATA[]]></startFlowScript>
  <editMode>0</editMode>
  <fileNameScript><![CDATA[]]></fileNameScript>
  <iconurl></iconurl>
  <orderno>0</orderno>
  <stateToShow></stateToShow>
  <parentForm>__ul2Y0ecczgBlwMae9Xi</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>0</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>