Merge remote-tracking branch 'origin/dev' into test

yun-zuoyi
jenkins 6 years ago
commit ed474fe112

@ -2102,4 +2102,88 @@ public class WmsEnumUtil {
return tmp;
}
}
/**
*
* 10=20=30=40=JOB50=
*/
public enum SCRIPT_TYPE {
MODUAL(10,"Modual","组件脚本"),
FORM(20,"Form","表单脚本"),
REPORT(30,"Report","报表脚本"),
JOB(40,"Job","JOB脚本"),
OTHER(50,"Other","其他脚本");
private String description;
private int value;
private String code;
SCRIPT_TYPE(int value, String code, String description) {
this.description = description;
this.value = value;
this.code = code;
}
public String getCode() {
return this.code;
}
public int getIndex() {
return this.value;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
}
/**
*
* 10=Groovy, 20=Jython, 30=JavaScript, 40=Scala, 50=JRuby
*/
public enum LANGUAGE_TYPE {
GROOVY(1,"Groovy", 10),
PYTHON(2,"Python", 20),
JS(3,"JavaScript", 30);
// 下面这2种语言没人会写暂不支持
//SCALA(40,"scala"),
//JRUBY(50,"jruby");
private int index;
private String description;
private int value;
private LANGUAGE_TYPE(int index, String description, int value) {
this.index = index;
this.description = description;
this.value = value;
}
public String getDescription() {
return description;
}
public int getIndex() {
return this.index;
}
public int getValue() {
return value;
}
// 根据枚举编号获取语言代码
public static String getCodeByIndex(int index) {
for (LANGUAGE_TYPE languageType : LANGUAGE_TYPE.values()) {
if (languageType.getIndex() == index) {
return languageType.getDescription();
}
}
return null;
}
}
}

@ -4,11 +4,15 @@ import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import javax.script.CompiledScript;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptException;
/**
*
@ -20,6 +24,7 @@ import javax.script.CompiledScript;
@Entity
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table(name = "SCRIPT_PERSISTENCE")
@Api("系统动态脚本")
@ -27,30 +32,34 @@ public class EngineScriptPersistence extends BaseBean {
// 脚本调用的唯一编号例如WMS_PDA_0001
@Column(name = "SCRIPT_NO", length = 50)
private String scriptNo;
// 脚本的中文名称
@Column(name = "SCRIPT_NAME", length = 50)
private String scriptName;
// 10=组件脚本20=表单脚本30=报表脚本40=JOB脚本50=其他脚本
@Column(name = "SCRIPT_TYPE")
private int scriptType;
private Integer scriptType;
// 脚本编写的语言
// 10=Groovy, 20=Jython, 30=JavaScript, 40=Scala, 50=JRuby
@Column(name = "LANGUAGE_TYPE")
private int languageType;
private Integer languageType;
// 脚本的具体内容
@Column(name = "SCRIPT_CONTENT", columnDefinition = "TEXT")
private String scriptContent;
// 脚本的描述,包含脚本的用法,参数说明等
@Column(name = "SCRIPT_REMARK", length = 2000)
private String scriptRemark;
// 编译后的脚本内容,通过预编译加快脚本的运行速度
@Transient
private CompiledScript compiledScript;
public EngineScriptPersistence() {}
private Object compiledScript;
// 构造方法,便于批量创建数据
public EngineScriptPersistence(long id, String scriptNo, String scriptName, int scriptType, int languageType,
public EngineScriptPersistence(Long id, String scriptNo, String scriptName, Integer scriptType, Integer languageType,
String scriptContent, String scriptRemark) {
this.id = id;
this.scriptNo = scriptNo;

@ -7,6 +7,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.WmsEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
import cn.estsh.i3plus.pojo.wms.bean.*;
import cn.estsh.i3plus.pojo.wms.engine.rule.EngineRulePersistence;
import cn.estsh.i3plus.pojo.wms.engine.script.EngineScriptPersistence;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Strings;
@ -1536,19 +1537,19 @@ public class WmsHqlPack {
* @param wmsDataAuth
* @return
*/
public static String packHqlWmsDataAuthFind(WmsDataAuth wmsDataAuth) {
StringBuffer result = new StringBuffer();
public static DdlPackBean packHqlWmsDataAuthFind(WmsDataAuth wmsDataAuth) {
DdlPackBean result = new DdlPackBean();
if (!Strings.isNullOrEmpty(wmsDataAuth.getRoleCode())) {
HqlPack.getStringEqualPack(wmsDataAuth.getRoleCode(), "roleCode", result);
DdlPreparedPack.getStringEqualPack(wmsDataAuth.getRoleCode(), "roleCode", result);
}
if (!Strings.isNullOrEmpty(wmsDataAuth.getDataObj())) {
HqlPack.getStringEqualPack(wmsDataAuth.getDataObj(), "dataObj", result);
DdlPreparedPack.getStringEqualPack(wmsDataAuth.getDataObj(), "dataObj", result);
}
if (!Strings.isNullOrEmpty(wmsDataAuth.getDataObjValue())) {
HqlPack.getStringRightLikerPack(wmsDataAuth.getDataObjValue(), "dataObjValue", result);
DdlPreparedPack.getStringRightLikerPack(wmsDataAuth.getDataObjValue(), "dataObjValue", result);
}
getStringBuilderPack(wmsDataAuth, result);
return result.toString();
return result;
}
/**
@ -1557,11 +1558,11 @@ public class WmsHqlPack {
* @param taskDetails
* @return
*/
public static String packHqlWmsTaskDetails(WmsTaskDetails taskDetails) {
StringBuffer result = new StringBuffer();
HqlPack.getStringEqualPack(taskDetails.getOrderNo(), "orderNo", result);
public static DdlPackBean packHqlWmsTaskDetails(WmsTaskDetails taskDetails) {
DdlPackBean result = new DdlPackBean();
DdlPreparedPack.getStringEqualPack(taskDetails.getOrderNo(), "orderNo", result);
getStringBuilderPack(taskDetails, result);
return result.toString();
return result;
}
/**
@ -1663,6 +1664,24 @@ public class WmsHqlPack {
}
/**
*
*
* @return
*/
public static DdlPackBean packEngineRulePersistence(EngineRulePersistence rulePersistence) {
DdlPackBean packBean = new DdlPackBean();
DdlPreparedPack.getStringEqualPack(rulePersistence.getRuleNo(), "ruleNo", packBean);
DdlPreparedPack.getStringRightLikerPack(rulePersistence.getRuleName(), "ruleName", packBean);
DdlPreparedPack.getNumEqualPack(rulePersistence.getRuleContent(), "ruleContent", packBean);
getStringBuilderPack(rulePersistence, packBean);
DdlPreparedPack.getOrderByPack(new Object[]{2}, new String[]{"createDatetime"}, packBean);
return packBean;
}
/**
* ()
*
* @param wmsCSOrderMaster

Loading…
Cancel
Save