<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<activity id="__6foK73W42FNkFGgtQf9">
  <name>保存</name>
  <parentId>__cUYvTnlTPT3XycJoMyz</parentId>
  <type>13</type>
  <onActionForm></onActionForm>
  <onActionView></onActionView>
  <onActionFlow></onActionFlow>
  <onActionPrint></onActionPrint>
  <colorType>default</colorType>
  <beforeActionScript><![CDATA[//在表单控件值脚本中获取当前文档对象
(function(){
var doc=getCurrentDocument();
var trainRuleName = getItemValueAsString("trainRuleName");
var trainType = getItemValueAsString("trainType");
var trainOnlineType = getItemValueAsString("trainOnlineType");
var onlineLessonType = getItemValueAsString("onlineLessonType");
var onlineLessonName = getItemValueAsString("onlineLessonName");
var onlineLessonPrice = getItemValueAsInt("onlineLessonPrice");
var timingVerifyType = getItemValueAsString("timingVerifyType");
var timingVerifyInterval = getItemValueAsInt("timingVerifyInterval");
var collectPictureType = getItemValueAsString("collectPictureType");
var collectPictureInterval = getItemValueAsInt("collectPictureInterval");
var trainOfflineType = getItemValueAsString("trainOfflineType");
var practiceType = getItemValueAsString("practiceType");
var practiceCompleteType = getItemValueAsString("practiceCompleteType");
var practiceMinDay = getItemValueAsInt("practiceMinDay");
var practiceMaxDay = getItemValueAsInt("practiceMaxDay");
var practiceMinHour = getItemValueAsInt("practiceMinHour");
var practiceMaxHour = getItemValueAsInt("practiceMaxHour");
var practiceCheckType = getItemValueAsString("practiceCheckType");
var openClassType = getItemValueAsString("openClassType");
var openClassCompleteType = getItemValueAsString("openClassCompleteType");
var informStudentType = getItemValueAsString("informStudentType");

if(trainRuleName==null || trainRuleName.trim().length()<=0) {
    return "培训名称必须填写！";
}
if(trainType==null || trainType.trim().length()<=0) {
    return "培训分类必须填写！";
}

if(trainOnlineType == '1' && onlineLessonType == '1'){
  if(onlineLessonName==null || onlineLessonName.trim().length()<=0) {
    return "在线课程必须选择！";
  }
  if(onlineLessonPrice==0) {
    return "课程价格必须填写！";
  }
  if(timingVerifyType == "1" && timingVerifyInterval == 0){
  	return "定时观看确认间隔必须填写！";
  }
  if(collectPictureType == "1" && collectPictureInterval == 0){
  	return "随机人脸识别间隔必须填写！";
  }
}

if(trainOfflineType == '1' && practiceType == '1'){
  if(practiceMinDay==0) {
    return "实习合格最小天数必须填写！";
  }
  if(practiceMaxDay==0) {
    return "实习合格最大天数必须填写！";
  }
  if(practiceMinHour==0) {
    return "实习合格最小小时数必须填写！";
  }
  if(practiceMaxHour==0) {
    return "实习合格最大小时数必须填写！";
  }

}

})()
]]></beforeActionScript>
  <afterActionScript><![CDATA[]]></afterActionScript>
  <retractBeforeActionScript><![CDATA[]]></retractBeforeActionScript>
  <retractAfterActionScript><![CDATA[]]></retractAfterActionScript>
  <hiddenScript><![CDATA[]]></hiddenScript>
  <readonlyScript><![CDATA[]]></readonlyScript>
  <startFlowScript><![CDATA[							]]></startFlowScript>
  <editMode>0</editMode>
  <flowShowType>表单中显示流程操作</flowShowType>
  <fileNameScript><![CDATA[]]></fileNameScript>
  <orderno>1</orderno>
  <stateToShow></stateToShow>
  <parentView></parentView>
  <parentForm>__cUYvTnlTPT3XycJoMyz</parentForm>
  <impmappingconfigid>__7tkXQ8UWGSqrTJkHtCB</impmappingconfigid>
  <jumpType>0</jumpType>
  <expSub>false</expSub>
  <icon></icon>
  <disableFlowNode>true</disableFlowNode>
  <changeFlowOperator>true</changeFlowOperator>
  <changeFlowCc>true</changeFlowCc>
  <multiLanguageLabel></multiLanguageLabel>
  <dispatcherMode>0</dispatcherMode>
  <dispatcherUrl><![CDATA[]]></dispatcherUrl>
  <dispatcherParams><![CDATA[]]></dispatcherParams>
  <jumpMode>0</jumpMode>
  <jumpActOpenType>0</jumpActOpenType>
  <withOld>false</withOld>
  <actionType>1</actionType>
  <actionDispatcherUrlScript><![CDATA[]]></actionDispatcherUrlScript>
  <actionSelection>0</actionSelection>
  <relatedFormId>选择</relatedFormId>
  <actionScript><![CDATA[//在表单控件值脚本中获取当前文档对象
#include "getDsName"
(function(){
var trainRuleId = getId();
var trainRuleName = getItemValueAsString("trainRuleName");
var trainType = getItemValueAsString("trainType");
var trainOnlineType = getItemValueAsString("trainOnlineType");
var onlineLessonType = getItemValueAsString("onlineLessonType");
var onlineLessonId = getItemValueAsString("onlineLessonId");
var onlineLessonName = getItemValueAsString("onlineLessonName");
var onlineLessonPrice = getItemValueAsInt("onlineLessonPrice");
var studyRequireType = getItemValueAsString("studyRequireType");
var speedPlayType = getItemValueAsString("speedPlayType");
var multiplierSpeedPlayType = getItemValueAsString("multiplierSpeedPlayType");
var timingVerifyType = getItemValueAsString("timingVerifyType");
var timingVerifyInterval = getItemValueAsInt("timingVerifyInterval");
var collectPictureType = getItemValueAsString("collectPictureType");
var collectPictureInterval = getItemValueAsInt("collectPictureInterval");
var faceRecognitionType = getItemValueAsString("faceRecognitionType");
var liveType = getItemValueAsString("liveType");
var trainOfflineType = getItemValueAsString("trainOfflineType");
var practiceType = getItemValueAsString("practiceType");
var practiceCompleteType = getItemValueAsString("practiceCompleteType");
var practiceMinDay = getItemValueAsInt("practiceMinDay");
var practiceMaxDay = getItemValueAsInt("practiceMaxDay");
var practiceMinHour = getItemValueAsInt("practiceMinHour");
var practiceMaxHour = getItemValueAsInt("practiceMaxHour");
var practiceCheckType = getItemValueAsString("practiceCheckType");
var openClassType = getItemValueAsString("openClassType");
var openClassCompleteType = getItemValueAsString("openClassCompleteType");
var informStudentType = getItemValueAsString("informStudentType");

var userName= getWebUser().getName(); 
var dsName = getDsName();
try {
  var process = getDocumentProcess();            
  var formProcess = getFormProcess();            
  var trainRuleInfo = formProcess.doView("__sxOMFKLcaDLFnzK6oYQ");            
  var trainRuleInfoDoc = process.doNew(trainRuleInfo,getWebUser(),createParamsTable());            
  trainRuleInfoDoc.addStringItem("trainRuleName",trainRuleName);            
  trainRuleInfoDoc.addStringItem("trainType",trainType);
  trainRuleInfoDoc.addStringItem("CREATEDUSER",userName);
  var trainRuleId = trainRuleInfoDoc.getId();
  
  var trainLessonInfo = formProcess.doView("__ILyZVlpk7e94X1iodmu");            
  var trainLessonInfoDoc = process.doNew(trainLessonInfo,getWebUser(),createParamsTable());            
  trainLessonInfoDoc.addStringItem("trainRuleID",trainRuleId);
  trainLessonInfoDoc.addStringItem("onlineLessonId",onlineLessonId);
  trainLessonInfoDoc.addStringItem("onlineLessonName",onlineLessonName);
  trainLessonInfoDoc.addIntItem("onlineLessonPrice",onlineLessonPrice);


  var trainOnlineInfo = formProcess.doView("__8Hbv2mCR0CqkNxwiI69");            
  var trainOnlineInfoDoc = process.doNew(trainOnlineInfo,getWebUser(),createParamsTable());     
  trainOnlineInfoDoc.addStringItem("trainRuleID",trainRuleId);
  trainOnlineInfoDoc.addStringItem("trainOnlineType",trainOnlineType);
  trainOnlineInfoDoc.addStringItem("onlineLessonType",onlineLessonType);
  trainOnlineInfoDoc.addStringItem("studyRequireType",studyRequireType);
  trainOnlineInfoDoc.addStringItem("speedPlayType",speedPlayType);
  trainOnlineInfoDoc.addStringItem("multiplierSpeedPlayType",multiplierSpeedPlayType);
  trainOnlineInfoDoc.addStringItem("timingVerifyType",timingVerifyType);
  trainOnlineInfoDoc.addIntItem("timingVerifyInterval",timingVerifyInterval);
  trainOnlineInfoDoc.addStringItem("collectPictureType",collectPictureType);
  trainOnlineInfoDoc.addIntItem("collectPictureInterval",collectPictureInterval);
  trainOnlineInfoDoc.addStringItem("faceRecognitionType",faceRecognitionType);
  trainOnlineInfoDoc.addStringItem("liveType",liveType);


  var trainOfflineInfo = formProcess.doView("__G0B6BIOjIXAjrjUF6oU");            
  var trainOfflineInfoDoc = process.doNew(trainOfflineInfo,getWebUser(),createParamsTable());   
  trainOfflineInfoDoc.addStringItem("trainRuleID",trainRuleId);
  trainOfflineInfoDoc.addStringItem("trainOfflineType",trainOfflineType);
  trainOfflineInfoDoc.addStringItem("practiceType",practiceType);
  trainOfflineInfoDoc.addStringItem("practiceCompleteType",practiceCompleteType);
  trainOfflineInfoDoc.addIntItem("practiceMinDay",practiceMinDay);
  trainOfflineInfoDoc.addIntItem("practiceMaxDay",practiceMaxDay);
  trainOfflineInfoDoc.addIntItem("practiceMinHour",practiceMinHour);
  trainOfflineInfoDoc.addIntItem("practiceMaxHour",practiceMaxHour);
  trainOfflineInfoDoc.addStringItem("practiceCheckType",practiceCheckType);
  trainOfflineInfoDoc.addStringItem("openClassType",openClassType);
  trainOfflineInfoDoc.addStringItem("openClassCompleteType",openClassCompleteType);
  trainOfflineInfoDoc.addStringItem("informStudentType",informStudentType);

  var ruleObjectInfo = formProcess.doView("__YnNdVeJNx5aI7TOvQBR");            
  var ruleObjectInfoDoc = process.doNew(ruleObjectInfo,getWebUser(),createParamsTable());            
  ruleObjectInfoDoc.addStringItem("RULEID",trainRuleId);
  ruleObjectInfoDoc.addStringItem("RULETYPE","1");
  
  beginTransaction(dsName);  
  process.doCreate(trainRuleInfoDoc); 
  process.doCreate(trainLessonInfoDoc); 
  process.doCreate(trainOnlineInfoDoc); 
  process.doCreate(trainOfflineInfoDoc); 
  process.doCreate(ruleObjectInfoDoc);
  commitTransaction(dsName);                       
} catch(e) {
  println("异常信息==>" + e);
  rollbackTransaction(dsName);     
  return "保存失败，请稍后重试！";    
}   
})()]]></actionScript>
  <workFlowType>0</workFlowType>
  <isneedcomment>0</isneedcomment>
  <contextMenu>true</contextMenu>
  <showInToolbar>true</showInToolbar>
  <transpond>选择</transpond>
  <targetList>__pv8pd9ykExqgVfGcWYM|</targetList>
  <label><![CDATA[]]></label>
</activity>