jflow-core 代码

Survive by day and develop by night.
talk for import biz , show your perfect code,full busy,skip hardness,make a better result,wait for change,challenge Survive.
happy for hardess to solve denpendies.

目录

在这里插入图片描述

概述

是一个非常常见的需求。

需求:

设计思路

package bp.ccbill;


/** 
 单据状态
*/
public enum BillState
{
	/** 
	 空白
	*/
	None(0),
	/** 
	 草稿
	*/
	Draft(1),
	/** 
	 编辑中
	*/
	Editing(2),
	/** 
	 归档
	*/
	Over(100);

	public static final int SIZE = java.lang.Integer.SIZE;

	private int intValue;
	private static java.util.HashMap<Integer, BillState> mappings;
	private static java.util.HashMap<Integer, BillState> getMappings()  {
		if (mappings == null)
		{
			synchronized (BillState.class)
			{
				if (mappings == null)
				{
					mappings = new java.util.HashMap<Integer, BillState>();
				}
			}
		}
		return mappings;
	}

	private BillState(int value)
	{intValue = value;
		getMappings().put(value, this);
	}

	public int getValue() {
		return intValue;
	}

	public static BillState forValue(int value)
	{return getMappings().get(value);
	}
}
package bp.ccbill;

import bp.da.*;
import bp.en.*;
import bp.wf.*;
import bp.sys.*;

/** 
 数据源实体
*/
public class DBList extends EntityNoName
{

		///#region 权限控制.
	@Override
	public UAC getHisUAC()  {
		UAC uac = new UAC();
		uac.OpenForAppAdmin();
		uac.IsDelete = false;
		uac.IsInsert = false;
		return uac;
	}

		///#endregion 权限控制.


		///#region 属性
	/** 
	 物理表
	*/
	public final String getPTable()  {
		String s = this.GetValStrByKey(MapDataAttr.PTable);
		if (DataType.IsNullOrEmpty(s) == true)
		{
			return this.getNo();
		}
		return s;
	}
	public final void setPTable(String value)
	 {
		this.SetValByKey(MapDataAttr.PTable, value);
	}
	/** 
	 实体类型:@0=单据@1=编号名称实体@2=树结构实体
	*/
	public final EntityType getEntityType()  {
		return EntityType.forValue(this.GetValIntByKey(DBListAttr.EntityType));
	}
	public final void setEntityType(EntityType value)
	 {
		this.SetValByKey(DBListAttr.EntityType, value.getValue());
	}
	/** 
	 表单类型 (0=傻瓜,2=自由 ...)
	*/
	public final FrmType getFrmType()  {
		return FrmType.forValue(this.GetValIntByKey(MapDataAttr.FrmType));
	}
	public final void setFrmType(FrmType value)
	 {
		this.SetValByKey(MapDataAttr.FrmType, value.getValue());
	}
	/** 
	 表单树
	*/
	public final String getFKFormTree()
	{
		return this.GetValStrByKey(MapDataAttr.FK_FormTree);
	}
	public final void setFK_FormTree(String value)
	 {
		this.SetValByKey(MapDataAttr.FK_FormTree, value);
	}
	/** 
	 新建模式 @0=表格模式@1=卡片模式@2=不可用
	*/
	public final int getBtnNewModel()
	{
		return this.GetValIntByKey(DBListAttr.BtnNewModel);
	}
	public final void setBtnNewModel(int value)
	 {
		this.SetValByKey(DBListAttr.BtnNewModel, value);
	}
	/** 
	 单据格式(流水号4)
	*/
	public final String getBillNoFormat()  {
		String str = this.GetValStrByKey(DBListAttr.BillNoFormat);
		if (DataType.IsNullOrEmpty(str) == true)
		{
			str = "{LSH4}";
		}
		return str;
	}
	public final void setBillNoFormat(String value)
	 {
		this.SetValByKey(DBListAttr.BillNoFormat, value);
	}
	/** 
	 单据编号生成规则
	*/
	public final String getTitleRole()  {
		String str = this.GetValStrByKey(DBListAttr.TitleRole);
		if (DataType.IsNullOrEmpty(str) == true)
		{
			str = "@WebUser.FK_DeptName @WebUser.Name @RDT";
		}
		return str;
	}
	public final void setTitleRole(String value)
	 {
		this.SetValByKey(DBListAttr.BillNoFormat, value);
	}
	/** 
	 新建标签
	*/
	public final String getBtnNewLable()
	{
		return this.GetValStrByKey(DBListAttr.BtnNewLable);
	}
	/** 
	 删除标签
	*/
	public final String getBtnDelLable()
	{
		return this.GetValStrByKey(DBListAttr.BtnDelLable);
	}
	/** 
	 保存标签
	*/
	public final String getBtnSaveLable()
	{
		return this.GetValStrByKey(DBListAttr.BtnSaveLable);
	}
	/** 
	 提交标签
	*/
	public final String getBtnSubmitLable()
	{
		return this.GetValStrByKey(DBListAttr.BtnSubmitLable);
	}
	/** 
	 查询标签
	*/
	public final String getBtnSearchLabel()
	{
		return this.GetValStrByKey(DBListAttr.BtnSearchLabel);
	}
	/** 
	 数据快照
	*/
	public final String getBtnDataVer()
	{
		return this.GetValStrByKey(DBListAttr.BtnDataVer);
	}
	/** 
	 分组按钮
	*/
	public final boolean getBtnGroupEnable()
	{
		return this.GetValBooleanByKey(DBListAttr.BtnGroupEnable);
	}
	public final String getBtnGroupLabel()
	{
		return this.GetValStrByKey(DBListAttr.BtnGroupLabel);
	}
	/** 
	 打印HTML按钮
	*/
	public final boolean getBtnPrintHtmlEnable()
	{
		return this.GetValBooleanByKey(DBListAttr.BtnPrintHtmlEnable);
	}
	public final String getBtnPrintHtml()
	{
		return this.GetValStrByKey(DBListAttr.BtnPrintHtml);
	}
	/** 
	 打印PDF按钮
	*/
	public final boolean getBtnPrintPDFEnable()
	{
		return this.GetValBooleanByKey(DBListAttr.BtnPrintPDFEnable);
	}
	public final String getBtnPrintPDF()
	{
		return this.GetValStrByKey(DBListAttr.BtnPrintPDF);
	}
	/** 
	 打印RTF按钮
	*/
	public final boolean getBtnPrintRTFEnable()
	{
		return this.GetValBooleanByKey(DBListAttr.BtnPrintRTFEnable);
	}
	public final String getBtnPrintRTF()
	{
		return this.GetValStrByKey(DBListAttr.BtnPrintRTF);
	}
	/** 
	 打印CCWord按钮
	*/
	public final boolean getBtnPrintCCWordEnable()
	{
		return this.GetValBooleanByKey(DBListAttr.BtnPrintCCWordEnable);
	}
	public final String getBtnPrintCCWord()
	{
		return this.GetValStrByKey(DBListAttr.BtnPrintCCWord);
	}
	/** 
	 数据源类型
	*/
	public final int getDBType()
	{
		return this.GetValIntByKey(MapDataAttr.DBType);
	}
	public final String getDBSrc()
	{
		return this.GetValStrByKey(MapDataAttr.DBSrc);
	}
	public final void setDBSrc(String value)
	 {
		this.SetValByKey(MapDataAttr.DBSrc, value);
	}
	public final String getExpEn()
	{
		return this.GetValStrByKey(MapDataAttr.ExpEn);
	}
	public final void setExpEn(String value)
	 {
		this.SetValByKey(MapDataAttr.ExpEn, value);
	}
	public final String getExpList()
	{
		return this.GetValStrByKey(MapDataAttr.ExpList);
	}
	public final void setExpList(String value)
	 {
		this.SetValByKey(MapDataAttr.ExpList, value);
	}
	public final String getExpCount()
	{
		return this.GetValStrByKey(MapDataAttr.ExpCount);
	}
	public final void setExpCount(String value)
	 {
		this.SetValByKey(MapDataAttr.ExpCount, value);
	}
	public final String getMainTable()
	{
		return this.GetValStrByKey(DBListAttr.MainTable);
	}
	public final void setMainTable(String value)
	 {
		this.SetValByKey(DBListAttr.MainTable, value);
	}
	public final String getMainTablePK()
	{
		return this.GetValStrByKey(DBListAttr.MainTablePK);
	}
	public final void setMainTablePK(String value)
	 {
		this.SetValByKey(DBListAttr.MainTablePK, value);
	}

		///#endregion


		///#region 构造方法
	/** 
	 数据源实体
	*/
	public DBList()  {
	}
	/** 
	 数据源实体
	 
	 param no 映射编号
	*/
	public DBList(String no) throws Exception {
		super(no);
	}
	/** 
	 EnMap
	*/
	@Override
	public bp.en.Map getEnMap()  {
		if (this.get_enMap() != null)
		{
			return this.get_enMap();
		}
		Map map = new Map("Sys_MapData", "数据源实体");

		map.setCodeStruct("4");


		///#region 基本属性.
		map.AddGroupAttr("基本属性");
		map.AddTBStringPK(MapDataAttr.No, null, "表单编号", true, true, 1, 190, 20);
		map.SetHelperAlert(MapDataAttr.No, "也叫表单ID,系统唯一.");

		map.AddDDLSysEnum(MapDataAttr.FrmType, 0, "表单类型", true, true, "BillFrmType", "@0=傻瓜表单@1=自由表单@8=开发者表单");
			//  map.AddTBString(MapDataAttr.PTable, null, "存储表", false, false, 0, 500, 20, true);
			// map.SetHelperAlert(MapDataAttr.PTable, "存储的表名,如果您修改一个不存在的系统将会自动创建一个表.");
		map.AddTBString(MapDataAttr.Name, null, "表单名称", true, false, 0, 200, 20, true);
			// map.AddDDLEntities(MapDataAttr.FK_FormTree, "01", "表单类别", new SysFormTrees(), false);

			///#endregion 基本属性.


			///#region 数据源.
		map.AddGroupAttr("数据源");
		map.AddTBInt(MapDataAttr.DBType, 0, "数据源类型", true, true);
		map.AddTBString(MapDataAttr.DBSrc, null, "数据源", false, false, 0, 600, 20);

		map.AddTBString(MapDataAttr.ExpEn, null, "实体数据源", false, false, 0, 600, 20, true);
		map.AddTBString(MapDataAttr.ExpList, null, "列表数据源", false, false, 0, 600, 20, true);

		map.AddTBString(DBListAttr.MainTable, null, "列表数据源主表", false, false, 0, 50, 20, false);
		map.AddTBString(DBListAttr.MainTablePK, null, "列表数据源主表主键", false, false, 0, 50, 20, false);
		map.AddTBString(MapDataAttr.ExpCount, null, "列表总数", false, false, 0, 600, 20, true);

			///#endregion 数据源.

		///#region 外观.
		map.AddGroupAttr("外观");
		map.AddDDLSysEnum(FrmAttr.RowOpenModel, 2, "行记录打开模式", true, true, "RowOpenMode", "@0=新窗口打开@1=在本窗口打开@2=弹出窗口打开,关闭后不刷新列表@3=弹出窗口打开,关闭后刷新列表");
		String cfg = "@0=MyDictFrameWork.htm 实体与实体相关功能编辑器";
		cfg += "@1=MyDict.htm 实体编辑器";
		cfg += "@2=MyBill.htm 单据编辑器";
		cfg += "@9=自定义URL";
		map.AddDDLSysEnum("SearchDictOpenType", 0, "双击行打开内容", true, true, "SearchDictOpenType", cfg);
		map.AddTBString(EnCfgAttr.UrlExt, null, "要打开的Url", true, false, 0, 500, 60, true);
		map.AddTBInt(FrmAttr.PopHeight, 500, "弹窗高度", true, false);
		map.AddTBInt(FrmAttr.PopWidth, 760, "弹窗宽度", true, false);

		map.AddDDLSysEnum(MapDataAttr.TableCol, 0, "表单显示列数", true, true, "傻瓜表单显示方式", "@0=4列@1=6列@2=上下模式3列");

		map.AddDDLSysEnum(FrmAttr.EntityEditModel, 0, "编辑模式", true, true, FrmAttr.EntityEditModel, "@0=表格@1=行编辑");
		map.SetHelperAlert(FrmAttr.EntityEditModel, "用什么方式打开实体列表进行编辑0=只读查询模式SearchDict.htm,1=行编辑模式SearchEditer.htm");

			///#endregion 外观.


			///#region 数据源实体.
		map.AddDDLSysEnum(DBListAttr.EntityType, 0, "业务类型", true, false, DBListAttr.EntityType, "@0=独立表单@1=单据@2=编号名称实体@3=树结构实体");
		map.SetHelperAlert(DBListAttr.EntityType, "该实体的类型,@0=单据@1=编号名称实体@2=树结构实体.");

		map.AddTBString(DBListAttr.BillNoFormat, null, "实体编号规则", true, false, 0, 100, 20, true);
		map.SetHelperAlert(DBListAttr.BillNoFormat, "\t\n实体编号规则: \t\n 2标识:01,02,03等, 3标识:001,002,003,等..");
		map.AddTBString(FrmBillAttr.SortColumns, null, "排序字段", true, false, 0, 100, 20, true);
		map.AddTBString(FrmBillAttr.ColorSet, null, "颜色设置", true, false, 0, 100, 20, true);
		map.AddTBString(FrmBillAttr.FieldSet, null, "字段求和求平均设置", true, false, 0, 100, 20, true);

			//字段格式化函数.
		map.AddTBString("ForamtFunc", null, "字段格式化函数", true, false, 0, 200, 60, true);
		String msg = "对字段的显示使用函数进行处理";
		msg += "\t\n 1. 对于字段内容需要处理后在输出出来.";
		msg += "\t\n 2. 比如:原字段内容 @zhangsa,张三@lisi,李四 显示的内容为 张三,李四";
		msg += "\t\n 3. 配置格式: 字段名@函数名; 比如:  FlowEmps@DealFlowEmps; ";
		msg += "\t\n 4. 函数写入到 \\DataUser\\JSLibData\\SearchSelf.js";
		map.SetHelperAlert("ForamtFunc", msg);

			///#endregion 数据源实体.
			//增加参数字段.
		map.AddTBAtParas(4000);


			///#region 基本功能.
		RefMethod rm = new RefMethod();

		rm = new RefMethod();
		rm.Title = "步骤1: 设置数据源."; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoDBSrc";
		rm.Icon = "../../WF/Img/Event.png";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);


		rm = new RefMethod();
		rm.Title = "步骤2: 实体数据"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoExpEn";
		rm.Icon = "../../WF/Img/Event.png";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "步骤3: 列表数据"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoExpList";
		rm.Icon = "../../WF/Img/Event.png";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);

			//rm = new RefMethod();
			//rm.Title = "步骤4: 总数数据"; // "设计表单";
			//rm.ClassMethodName = this.ToString() + ".DoExpCount";
			//rm.Icon = "../../WF/Img/Event.png";
			//rm.Visable = true;
			//rm.refMethodType = RefMethodType.RightFrameOpen;
			//rm.Target = "_blank";
			//map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "步骤4: 测试"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoDBList";
		rm.Icon = "../../WF/Img/Event.png";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);


		rm = new RefMethod();
		rm.Title = "查询条件"; // "设计表单";
							   //   rm.GroupName = "高级选项";
		rm.ClassMethodName = this.toString() + ".DoSearch";
		rm.Icon = "../../WF/Img/Event.png";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "视频教程"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoVideo";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.LinkeWinOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);


			///#endregion 基本功能.

		this.set_enMap(map);
		return this.get_enMap();
	}

		///#endregion

	public final String DoVideo()  {
		return "https://www.bilibili.com/video/BV15P4y1p7Sj";
	}


	public final String DoDBSrc()  {
		return "../../Comm/RefFunc/EnOnly.htm?EnName=BP.CCBill.DBListDBSrc&No=" + this.getNo();
	}

	public final String DoExpEn()  {
		return "../../CCBill/Admin/DBList/FieldsORM.htm?s=34&FrmID=" + this.getNo() + "&ExtType=PageLoadFull&RefNo=ss3";
	}
	public final String DoExpList()  {
		return "../../CCBill/Admin/DBList/ListDBSrc.htm?s=34&FrmID=" + this.getNo() + "&ExtType=PageLoadFull&RefNo=ss3";
	}
	public final String DoExpCount()  {
		return "../../CCBill/Admin/DBList/ListDBCount.htm?s=34&FrmID=" + this.getNo() + "&ExtType=PageLoadFull&RefNo=ss3";
	}
	public final String DoDBList()  {
		return "../../CCBill/SearchDBList.htm?FrmID=" + this.getNo();
	}
	public final String DoSearch()  {
		return "../../CCBill/Admin/Collection/SearchCond.htm?s=34&FrmID=" + this.getNo() + "&ExtType=PageLoadFull&RefNo=ss3";
	}

	@Override
	protected void afterInsertUpdateAction() throws Exception {
		super.afterInsertUpdateAction();
	}

	/** 
	 检查enittyNoName类型的实体
	*/
	public final void CheckEnityTypeAttrsFor_EntityNoName() throws Exception {
		//取出来全部的属性.
		MapAttrs attrs = new MapAttrs(this.getNo());


			///#region 补充上流程字段到 NDxxxRpt.
		if (attrs.contains(this.getNo() + "_" + GERptAttr.OID) == false)
		{
			/* WorkID */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setKeyOfEn("OID");
			attr.setName("主键ID");
			attr.setMyDataType(DataType.AppInt);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setDefVal( "0");
			attr.setEditType(EditType.Readonly);
			attr.Insert();
		}
		if (attrs.contains(this.getNo() + "_" + GERptAttr.BillNo) == false)
		{
			/* 单据编号 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn(GERptAttr.BillNo);
			attr.setName("编号"); //  单据编号
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(true);
			attr.setUIIsEnable(false);
			attr.setUIIsLine(false);
			attr.setMinLen(0);
			attr.setMaxLen(100);
			attr.setIdx( -100);
			attr.Insert();
		}

		if (attrs.contains(this.getNo() + "_" + GERptAttr.Title) == false)
		{
			/* 名称 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn(GERptAttr.Title); // "FlowEmps";
			attr.setName("名称"); //   单据模式, ccform的模式.
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(true);
			attr.setUIIsEnable(true);
			attr.setUIIsLine(true);
			attr.setMinLen(0);
			attr.setMaxLen(400);
			attr.setIdx( -90);
			attr.Insert();
		}
		if (attrs.contains(this.getNo() + "_BillState") == false)
		{
			/* 单据状态 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("BillState"); // "FlowEmps";
			attr.setName("单据状态");
			attr.setMyDataType(DataType.AppInt);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setUIIsLine(true);
			attr.setMinLen(0);
			attr.setMaxLen(10);
			attr.setIdx( -98);
			attr.Insert();
		}

		if (attrs.contains(this.getNo() + "_Starter") == false)
		{
			/* 发起人 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("Starter");
			attr.setName("创建人");
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);

			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setMinLen(0);
			attr.setMaxLen(32);
			attr.setIdx( -1);
			attr.Insert();
		}
		if (attrs.contains(this.getNo() + "_StarterName") == false)
		{
			/* 创建人名称 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("StarterName");
			attr.setName("创建人名称");
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);

			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setMinLen(0);
			attr.setMaxLen(32);
			attr.setIdx( -1);
			attr.Insert();
		}

		if (attrs.contains(this.getNo() + "_" + GERptAttr.AtPara) == false)
		{
			/* 参数 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn(GERptAttr.AtPara);
			attr.setName("参数"); // 单据编号
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setUIIsLine(false);
			attr.setMinLen(0);
			attr.setMaxLen(4000);
			attr.setIdx( -99);
			attr.Insert();
		}

		if (attrs.contains(this.getNo() + "_RDT") == false)
		{
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("RDT");
			attr.setName("创建时间");
			attr.setMyDataType(DataType.AppDateTime);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setUIIsLine(false);
			attr.setIdx( -97);
			attr.Insert();
		}
		if (attrs.contains(this.getNo() + "_FK_Dept") == false)
		{
			/* 创建人部门 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("FK_Dept");
			attr.setName("创建人部门");
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);

			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setMinLen(0);
			attr.setMaxLen(100);
			attr.setIdx( -1);
			attr.Insert();
		}
		if (attrs.contains(this.getNo() + "_OrgNo") == false)
		{
			/* 创建人名称 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("OrgNo");
			attr.setName("创建人所在的组织");
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);

			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setMinLen(0);
			attr.setMaxLen(32);
			attr.setIdx( -1);
			attr.Insert();
		}

			///#endregion 补充上流程字段。

	}
}
package bp.ccbill;
	
	
	/** 
	 数据源实体 - Attr
	*/
	public class DBListAttr extends FrmAttr
	{
		public static final String MainTable = "MainTable";
		public static final String MainTablePK = "MainTablePK";
	}
package bp.ccbill;

import bp.en.*;
import bp.sys.*;

/** 
 数据源实体
*/
public class DBListDBSrc extends EntityNoName
{

		///#region 权限控制.
	@Override
	public UAC getHisUAC()  {
		UAC uac = new UAC();
		uac.OpenForAppAdmin();
		uac.IsDelete = false;
		uac.IsInsert = false;
		return uac;
	}


	/** 
	 数据源实体
	*/
	public DBListDBSrc()  {
	}
	/** 
	 数据源实体
	 
	 param no 映射编号
	*/
	public DBListDBSrc(String no) throws Exception {
		super(no);
	}
	public final int getDBType()
	{
		return this.GetValIntByKey(MapDataAttr.DBType);
	}
	/** 
	 EnMap
	*/
	@Override
	public bp.en.Map getEnMap() {
		if (this.get_enMap() != null)
		{
			return this.get_enMap();
		}

		Map map = new Map("Sys_MapData", "数据源实体");

		map.setCodeStruct("4");


			///#region 基本属性.
		map.AddTBStringPK(MapDataAttr.No, null, "表单编号", true, true, 1, 190, 20);

			///#endregion 基本属性.


			///#region 数据源.
		map.AddDDLSysEnum(MapDataAttr.DBType, 0, "数据源类型", true, true, "DBListDBType", "@0=数据库查询SQL@1=执行Url返回Json@2=执行存储过程");
		map.AddDDLEntities(MapDataAttr.DBSrc, null, "数据源", new SFDBSrcs(), true);
		map.SetHelperAlert(MapDataAttr.DBSrc, "您可以在系统管理中新建SQL数据源.");

			///#endregion 数据源.

		this.set_enMap(map);
		return this.get_enMap();
	}

		///#endregion
	@Override
	protected boolean beforeUpdate() throws Exception {
		DBList db = new DBList(this.getNo());
		if (db.getDBType() != this.getDBType())
		{
			db.setExpEn("");
			db.setExpList("");
			db.setExpCount("");
			db.Update();
		}
		return super.beforeUpdate();
	}
}
package bp.ccbill;

import bp.en.*;
import java.util.*;

/** 
 数据源实体s
*/
public class DBListDBSrcs extends EntitiesNoName
{

		///#region 构造
	/** 
	 数据源实体s
	*/
	public DBListDBSrcs() throws Exception {
	}
	/** 
	 得到它的 Entity
	*/
	@Override
	public Entity getGetNewEntity()  {
		return new DBListDBSrc();
	}

		///#endregion


		///#region 为了适应自动翻译成java的需要,把实体转换成List.
	/** 
	 转化成 java list,C#不能调用.
	 
	 @return List
	*/
	public final java.util.List<DBListDBSrc> ToJavaList() {
		return (java.util.List<DBListDBSrc>)(Object)this;
	}
	/** 
	 转化成list
	 
	 @return List
	*/
	public final ArrayList<DBListDBSrc> Tolist()  {
		ArrayList<DBListDBSrc> list = new ArrayList<DBListDBSrc>();
		for (int i = 0; i < this.size(); i++)
		{
			list.add((DBListDBSrc)this.get(i));
		}
		return list;
	}

		///#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
package bp.ccbill;

import bp.tools.DateUtils;
import bp.tools.StringHelper;
import bp.wf.*;
import bp.en.*;
import bp.da.*;
import bp.web.*;
import bp.sys.*;
import bp.*;
import java.util.*;
import java.time.*;
import java.util.Map;

/** 
 接口调用
*/
public class Dev2Interface
{
	/** 
	 增加日志
	 
	 param at
	 param frmID
	 param at
	 param msg
	 @return 
	*/

	public static void Dict_AddTrack(String frmID, String frmWorkID, String at, String msg, String paras, String flowNo, String flowName, int nodeID, long workIDOfFlow) throws Exception {
		Dict_AddTrack(frmID, frmWorkID, at, msg, paras, flowNo, flowName, nodeID, workIDOfFlow, "");
	}

	public static void Dict_AddTrack(String frmID, String frmWorkID, String at, String msg, String paras, String flowNo, String flowName, int nodeID) throws Exception {
		Dict_AddTrack(frmID, frmWorkID, at, msg, paras, flowNo, flowName, nodeID, 0, "");
	}

	public static void Dict_AddTrack(String frmID, String frmWorkID, String at, String msg, String paras, String flowNo, String flowName) throws Exception {
		Dict_AddTrack(frmID, frmWorkID, at, msg, paras, flowNo, flowName, 0, 0, "");
	}

	public static void Dict_AddTrack(String frmID, String frmWorkID, String at, String msg, String paras, String flowNo) throws Exception {
		Dict_AddTrack(frmID, frmWorkID, at, msg, paras, flowNo, null, 0, 0, "");
	}

	public static void Dict_AddTrack(String frmID, String frmWorkID, String at, String msg, String paras) throws Exception {
		Dict_AddTrack(frmID, frmWorkID, at, msg, paras, null, null, 0, 0, "");
	}

	public static void Dict_AddTrack(String frmID, String frmWorkID, String at, String msg) throws Exception {
		Dict_AddTrack(frmID, frmWorkID, at, msg, null, null, null, 0, 0, "");
	}

//ORIGINAL LINE: public static void Dict_AddTrack(string frmID, string frmWorkID, string at, string msg, string paras = null, string flowNo = null, string flowName = null, int nodeID = 0, Int64 workIDOfFlow = 0, string frmName = "")
	public static void Dict_AddTrack(String frmID, String frmWorkID, String at, String msg, String paras, String flowNo, String flowName, int nodeID, long workIDOfFlow, String frmName) throws Exception {
		bp.ccbill.Track tk = new bp.ccbill.Track();
		tk.setWorkID(frmWorkID);
		tk.setFrmID(frmID);
		tk.setFrmName(frmName);
		tk.setActionType(at);

		switch (at)
		{
			case FrmActionType.BBS:
				tk.setActionTypeText("评论");
				break;
			case FrmActionType.Create:
				tk.setActionTypeText("创建");
				break;
			case FrmActionType.DataVerReback:
				tk.setActionTypeText("数据版本");
				break;
			case FrmActionType.Save:
				tk.setActionTypeText("保存");
				break;
			case FrmActionType.StartFlow:
				tk.setActionTypeText("发起流程");
				break;
			default:
				tk.setActionTypeText("其他");
				break;
		}

		tk.setRec(WebUser.getNo());
		tk.setRecName(WebUser.getName());
		tk.setDeptNo(WebUser.getFK_Dept());
		tk.setDeptName(WebUser.getFK_DeptName());

		// 流程信息。
		tk.setWorkIDOfFlow(workIDOfFlow);
		tk.setNodeID(nodeID);
		if (flowName != null)
		{
			tk.setFlowName(flowName);
		}
		if (flowNo != null)
		{
			tk.setFlowNo(flowNo);
		}

		//tk.setMyPK(tk.FrmID + "_" + tk.WorkID + "_" + tk.Rec + "_" + (int)BP.CCBill.FrmActionType.BBS;
		tk.setMsg(msg);
		tk.setRDT(DataType.getCurrentDataTime());

		流程信息.
		//tk.NodeID = nodeID;
		//tk.NodeName = nodeName;
		//tk.FlowNo = flowNo;
		//tk.FlowName = flowName;
		//tk.FID = fid;
		tk.Insert();
	}


	/** 
	 创建单据的WorkID
	 
	 param frmID
	 param userNo
	 param htParas
	 param pDictFrmID
	 @return 
	*/

	public static long CreateBlankBillID(String frmID, String userNo, java.util.Hashtable htParas, String pDictFrmID) throws Exception {
		return CreateBlankBillID(frmID, userNo, htParas, pDictFrmID, 0);
	}

	public static long CreateBlankBillID(String frmID, String userNo, java.util.Hashtable htParas) throws Exception {
		return CreateBlankBillID(frmID, userNo, htParas, null, 0);
	}

	public static long CreateBlankBillID(String frmID, String userNo) throws Exception {
		return CreateBlankBillID(frmID, userNo, null, null, 0);
	}

	public static long CreateBlankBillID(String frmID) throws Exception {
		return CreateBlankBillID(frmID, null, null, null, 0);
	}

//ORIGINAL LINE: public static Int64 CreateBlankBillID(string frmID, string userNo = null, Hashtable htParas = null, string pDictFrmID = null, Int64 pDictWorkID = 0)
	public static long CreateBlankBillID(String frmID, String userNo, Hashtable htParas, String pDictFrmID, long pDictWorkID) throws Exception {
		if (userNo == null)
		{
			userNo = WebUser.getNo();
		}

		GenerBill gb = new GenerBill();
		int i = gb.Retrieve(GenerBillAttr.FrmID, frmID, GenerBillAttr.Starter, userNo, GenerBillAttr.BillState, 0);
		if (i == 1)
		{
			GERpt rpt1 = new GERpt(frmID);
			rpt1.setOID(gb.getWorkID());
			int count = rpt1.RetrieveFromDBSources();

			if (htParas != null)
			{
				rpt1.Copy(htParas);
			}

			rpt1.SetValByKey("BillState", 0);
			rpt1.SetValByKey("Starter", gb.getStarter());
			rpt1.SetValByKey("StarterName", gb.getStarterName());
			rpt1.SetValByKey("FK_Dept", WebUser.getFK_Dept());
			rpt1.SetValByKey("RDT", gb.getRDT());
			rpt1.SetValByKey("Title", gb.getTitle());
			rpt1.SetValByKey("BillNo", gb.getBillNo());
			if (pDictFrmID != null)
			{
				rpt1.SetValByKey("PWorkID", pDictWorkID);
				rpt1.SetValByKey("PFrmID", pDictFrmID);
			}
			if (count == 0)
			{
				rpt1.InsertAsOID(gb.getWorkID());
			}
			else
			{
				rpt1.Update();
			}
			return gb.getWorkID();
		}


		FrmBill fb = new FrmBill(frmID);
		gb.setWorkID(DBAccess.GenerOID("WorkID"));
		gb.setBillState(BillState.None); //初始化状态.
		gb.setStarter(WebUser.getNo());
		gb.setStarterName(WebUser.getName());
		gb.setFrmName(fb.getName()); //单据名称.
		gb.setFrmID(fb.getNo()); //单据ID

		//if (DataType.IsNullOrEmpty(billNo) == false)
		//    gb.BillNo = billNo; //BillNo
		gb.setFK_Dept(WebUser.getFK_Dept());
		gb.setDeptName(WebUser.getFK_DeptName());
		gb.setFKFrmTree(fb.getFKFormTree()); //单据类别.
		gb.setRDT(DataType.getCurrentDataTime());
		gb.setNDStep(1);
		gb.setNDStepName("启动");

		//父字典信息.
		if (pDictFrmID != null)
		{
			gb.setPFrmID(pDictFrmID);
			gb.setPWorkID(pDictWorkID);
		}


		//创建rpt.
		GERpt rpt = new GERpt(frmID);

		//设置标题.
		if (fb.getEntityType() == EntityType.FrmBill)
		{
			gb.setTitle(Dev2Interface.GenerTitle(fb.getTitleRole(), rpt));
			//if (DataType.IsNullOrEmpty(billNo) == false)
			//    gb.BillNo = billNo;
			//else
			gb.setBillNo(bp.ccbill.Dev2Interface.GenerBillNo(fb.getBillNoFormat(), gb.getWorkID(), null, frmID));
		}

		if (fb.getEntityType() == EntityType.EntityTree || fb.getEntityType() == EntityType.FrmDict)
		{
			rpt.getEnMap().setCodeStruct(fb.getEnMap().getCodeStruct());
			//if (DataType.IsNullOrEmpty(billNo) == false)
			//    gb.BillNo = billNo;
			//else
			gb.setBillNo(rpt.GenerNewNoByKey("BillNo", null));
			// BP.CCBill.Dev2Interface.GenerBillNo(fb.BillNoFormat, gb.WorkID, null, frmID);
			gb.setTitle("");
		}

		gb.DirectInsert(); //执行插入.

		//如果.
		if (htParas != null)
		{
			rpt.Copy(htParas);
		}

		//更新基础的数据到表单表.
		// rpt = new BP.WF.GERpt(frmID);
		rpt.SetValByKey("BillState", gb.getBillState().getValue());
		rpt.SetValByKey("Starter", gb.getStarter());
		rpt.SetValByKey("StarterName", gb.getStarterName());
		rpt.SetValByKey("FK_Dept", WebUser.getFK_Dept());
		rpt.SetValByKey("RDT", gb.getRDT());
		rpt.SetValByKey("Title", gb.getTitle());
		rpt.SetValByKey("BillNo", gb.getBillNo());
		if (pDictFrmID != null)
		{
			rpt.SetValByKey("PWorkID", pDictWorkID);
			rpt.SetValByKey("PFrmID", pDictFrmID);
		}



		rpt.setOID(gb.getWorkID());
		rpt.InsertAsOID(gb.getWorkID());

		bp.ccbill.Dev2Interface.Dict_AddTrack(frmID, String.valueOf(rpt.getOID()), FrmActionType.Create, "创建记录");

		return gb.getWorkID();
	}
	/** 
	 创建一个实体ID
	 
	 param frmID 实体ID
	 param userNo 用户编号
	 param htParas 参数
	 @return 一个实例的workid
	*/
	public static long CreateBlankDictID(String frmID, String userNo, Hashtable htParas) throws Exception {
		if (userNo == null)
		{
			userNo = WebUser.getNo();
		}

		// 创建一个实体, 先检查一下是否有空白的数据.
		GERpt rpt = new GERpt(frmID);
		int i = rpt.Retrieve("Starter", userNo, "BillState", 0);
		if (i >= 1)
		{
			if (htParas != null)
			{
				rpt.Copy(htParas);
			}

			rpt.SetValByKey("RDT", DataType.getCurrentDate());
			rpt.Update();
			return rpt.getOID(); //如果有空白的数据,就返回给他.
		}


		//执行copy数据.
		if (htParas != null)
		{
			rpt.Copy(htParas);
		}

		FrmBill fb = new FrmBill(frmID);


		//更新基础的数据到表单表.
		rpt.SetValByKey("BillState", 0);
		rpt.SetValByKey("Starter", WebUser.getNo());
		rpt.SetValByKey("StarterName", WebUser.getName());
		rpt.SetValByKey("FK_Dept", WebUser.getFK_Dept());
		rpt.SetValByKey("RDT", DataType.getCurrentDate());

		//设置编号生成规则.
		rpt.getEnMap().setCodeStruct(fb.getBillNoFormat());

		//rpt.SetValByKey("Title", gb.Title);
		rpt.SetValByKey("BillNo", rpt.GenerNewNoByKey("BillNo", null));
		rpt.setOID(DBAccess.GenerOID("WorkID"));
		rpt.InsertAsOID(rpt.getOID());


		bp.ccbill.Dev2Interface.Dict_AddTrack(frmID, String.valueOf(rpt.getOID()), FrmActionType.Create, "创建记录");

		return rpt.getOID();
	}
	/** 
	 保存实体数据
	 
	 param frmID 表单ID
	 param workid 工作ID
	 param htParas 参数数据
	 @return 
	*/
	public static void SaveDictWork(String frmID, long workid, Hashtable htParas) throws Exception {
		// 创建一个实体, 先检查一下是否有空白的数据.
		GERpt rpt = new GERpt(frmID);
		rpt.setOID(workid);
		if (rpt.RetrieveFromDBSources() == 0)
		{
			if (htParas != null)
			{
				rpt.Copy(htParas);
			}

			//设置编号生成规则.
			FrmBill fb = new FrmBill(frmID);
			rpt.getEnMap().setCodeStruct(fb.getBillNoFormat());
			rpt.SetValByKey("BillNo", rpt.GenerNewNoByKey("BillNo", null));
			rpt.InsertAsOID(workid);
		}
		else
		{
			//执行copy数据.
			if (htParas != null)
			{
				rpt.Copy(htParas);
			}
		}

		//更新基础的数据到表单表.
		rpt.SetValByKey("BillState", 100);
		rpt.SetValByKey("Starter", WebUser.getNo());
		rpt.SetValByKey("StarterName", WebUser.getName());
		rpt.SetValByKey("FK_Dept", WebUser.getFK_Dept());
		rpt.SetValByKey("RDT", DataType.getCurrentDate());
		rpt.Update();

		bp.ccbill.Dev2Interface.Dict_AddTrack(frmID, String.valueOf(workid), FrmActionType.Save, "执行保存");

	}

	/** 
	 保存
	 
	 param frmID 表单ID
	 param workID 工作ID
	 @return 返回保存结果
	*/
	public static String SaveBillWork(String frmID, long workID) throws Exception {
		FrmBill fb = new FrmBill(frmID);

		GenerBill gb = new GenerBill();
		gb.setWorkID(workID);
		int i = gb.RetrieveFromDBSources();
		if (i == 0)
		{
			return "";
		}

		gb.setBillState(BillState.Editing);

		//创建rpt.
		GERpt rpt = new GERpt(gb.getFrmID(), workID);

		if (fb.getEntityType() == EntityType.EntityTree || fb.getEntityType() == EntityType.FrmDict)
		{

			gb.setTitle(rpt.getTitle());
			gb.Update();
			return "保存成功...";
		}

		//单据编号.
		if (DataType.IsNullOrEmpty(gb.getBillNo()) == true && !(fb.getEntityType() == EntityType.EntityTree || fb.getEntityType() == EntityType.FrmDict))
		{
			gb.setBillNo(bp.ccbill.Dev2Interface.GenerBillNo(fb.getBillNoFormat(), workID, null, fb.getPTable()));
			//更新单据里面的billNo字段.
			if (DBAccess.IsExitsTableCol(fb.getPTable(), "BillNo") == true)
			{
				DBAccess.RunSQL("UPDATE " + fb.getPTable() + " SET BillNo='" + gb.getBillNo() + "' WHERE OID=" + workID);
			}
		}

		//标题.
		if (DataType.IsNullOrEmpty(gb.getTitle()) == true && !(fb.getEntityType() == EntityType.EntityTree || fb.getEntityType() == EntityType.FrmDict))
		{
			gb.setTitle(Dev2Interface.GenerTitle(fb.getTitleRole(), rpt));
			//更新单据里面的 Title 字段.
			if (DBAccess.IsExitsTableCol(fb.getPTable(), "Title") == true)
			{
				DBAccess.RunSQL("UPDATE " + fb.getPTable() + " SET Title='" + gb.getTitle() + "' WHERE OID=" + workID);
			}
		}

		gb.Update();

		//把通用的字段更新到数据库.
		rpt.setTitle(gb.getTitle());
		rpt.setBillNo(gb.getBillNo());
		rpt.Update();

		bp.ccbill.Dev2Interface.Dict_AddTrack(frmID, String.valueOf(rpt.getOID()), FrmActionType.Save, "保存");

		return "保存成功...";
	}

	/** 
	 提交
	 
	 param frmID 表单ID
	 param workID 工作ID
	 @return 返回保存结果
	*/
	public static String SubmitWork(String frmID, long workID) throws Exception {
		FrmBill fb = new FrmBill(frmID);

		GenerBill gb = new GenerBill();
		gb.setWorkID(workID);
		int i = gb.RetrieveFromDBSources();
		if (i == 0)
		{
			return "";
		}

		//设置为归档状态.
		gb.setBillState(BillState.Over);

		//创建rpt.
		GERpt rpt = new GERpt(gb.getFrmID(), workID);

		if (fb.getEntityType() == EntityType.EntityTree || fb.getEntityType() == EntityType.FrmDict)
		{
			gb.setTitle(rpt.getTitle());
			gb.Update();
			return "提交成功...";
		}

		//单据编号.
		if (DataType.IsNullOrEmpty(gb.getBillNo()) == true && !(fb.getEntityType() == EntityType.EntityTree || fb.getEntityType() == EntityType.FrmDict))
		{
			gb.setBillNo(bp.ccbill.Dev2Interface.GenerBillNo(fb.getBillNoFormat(), workID, null, fb.getPTable()));
			//更新单据里面的billNo字段.
			if (DBAccess.IsExitsTableCol(fb.getPTable(), "BillNo") == true)
			{
				DBAccess.RunSQL("UPDATE " + fb.getPTable() + " SET BillNo='" + gb.getBillNo() + "' WHERE OID=" + workID);
			}
		}

		//标题.
		if (DataType.IsNullOrEmpty(gb.getTitle()) == true && !(fb.getEntityType() == EntityType.EntityTree || fb.getEntityType() == EntityType.FrmDict))
		{
			gb.setTitle(Dev2Interface.GenerTitle(fb.getTitleRole(), rpt));
			//更新单据里面的 Title 字段.
			if (DBAccess.IsExitsTableCol(fb.getPTable(), "Title") == true)
			{
				DBAccess.RunSQL("UPDATE " + fb.getPTable() + " SET Title='" + gb.getTitle() + "' WHERE OID=" + workID);
			}
		}

		gb.Update();

		//把通用的字段更新到数据库.
		rpt.setTitle(gb.getTitle());
		rpt.setBillNo(gb.getBillNo());
		rpt.Update();

		bp.ccbill.Dev2Interface.Dict_AddTrack(frmID, String.valueOf(workID), FrmActionType.Submit, "执行提交.");


		return "提交成功...";
	}
	/** 
	 保存
	 
	 param frmID 表单ID
	 param workID 工作ID
	 @return 返回保存结果
	*/
	public static String SaveAsDraft(String frmID, long workID) throws Exception {
		GenerBill gb = new GenerBill(workID);
		if (gb.getBillState() != BillState.None)
		{
			return "err@只有在None的模式下才能保存草稿。";
		}

		if (gb.getBillState() != BillState.Editing)
		{
			gb.setBillState(BillState.Editing);
			gb.Update();
		}
		return "保存成功...";
	}
	/** 
	 删除单据
	 
	 param frmID
	 param workID
	 @return 
	*/
	public static String MyBill_Delete(String frmID, long workID) throws Exception {
		FrmBill fb = new FrmBill(frmID);
		String sqls = "DELETE FROM Frm_GenerBill WHERE WorkID=" + workID;
		sqls += "@DELETE FROM " + fb.getPTable() + " WHERE OID=" + workID;
		DBAccess.RunSQLs(sqls);
		return "删除成功.";
	}

	public static String MyBill_DeleteBills(String frmID, String workIds) throws Exception {
		FrmBill fb = new FrmBill(frmID);
		String sqls = "DELETE FROM Frm_GenerBill WHERE WorkID in (" + workIds + ")";
		sqls += "@DELETE FROM " + fb.getPTable() + " WHERE OID in (" + workIds + ")";
		DBAccess.RunSQLs(sqls);
		return "删除成功.";
	}

	/** 
	 删除实体
	 
	 param frmID
	 param workID
	 @return 
	*/
	public static String MyDict_Delete(String frmID, long workID) throws Exception {
		FrmBill fb = new FrmBill(frmID);
		String sql = "@DELETE FROM " + fb.getPTable() + " WHERE OID=" + workID;
		DBAccess.RunSQLs(sql);
		return "删除成功.";
	}


	/** 
	 删除实体单据
	 
	 param frmID
	 param workIds
	 @return 
	*/
	public static String MyDict_DeleteDicts(String frmID, String workIds) throws Exception {
		FrmBill fb = new FrmBill(frmID);
		String sql = "DELETE FROM " + fb.getPTable() + " WHERE OID in (" + workIds + ")";
		DBAccess.RunSQLs(sql);
		return "删除成功.";
	}
	/** 
	 删除树形结构的实体表单
	 
	 param frmID
	 param billNo
	 @return 
	*/
	public static String MyEntityTree_Delete(String frmID, String billNo) throws Exception {
		FrmBill fb = new FrmBill(frmID);
		String sql = "DELETE FROM " + fb.getPTable() + " WHERE BillNo='" + billNo + "' OR ParentNo='" + billNo + "'";
		DBAccess.RunSQLs(sql);
		return "删除成功.";
	}

	/** 
	 复制单据数据
	 
	 param frmID
	 param workID
	 @return 
	*/
	public static String MyBill_Copy(String frmID, long workID) throws Exception {
		//获取单据的属性
		FrmBill fb = new FrmBill(frmID);

		GenerBill gb = new GenerBill();
		gb.setWorkID(DBAccess.GenerOID("WorkID"));
		gb.setBillState(BillState.Editing); //初始化状态.
		gb.setStarter(WebUser.getNo());
		gb.setStarterName(WebUser.getName());
		gb.setFrmName(fb.getName()); //单据名称.
		gb.setFrmID(fb.getNo()); //单据ID

		gb.setFKFrmTree(fb.getFKFormTree()); //单据类别.
		gb.setRDT(DataType.getCurrentDateTime());
		gb.setNDStep(1);
		gb.setNDStepName("启动");

		//创建rpt.
		GERpt rpt = new GERpt(frmID, workID);

		//设置标题.
		gb.setTitle(Dev2Interface.GenerTitle(fb.getTitleRole(), rpt));
		gb.setBillNo(bp.ccbill.Dev2Interface.GenerBillNo(fb.getBillNoFormat(), gb.getWorkID(), null, frmID));

		gb.DirectInsert(); //执行插入.

		//更新基础的数据到表单表.
		rpt.SetValByKey("BillState", gb.getBillState().getValue());
		rpt.SetValByKey("Starter", gb.getStarter());
		rpt.SetValByKey("StarterName", gb.getStarterName());
		rpt.SetValByKey("RDT", gb.getRDT());
		rpt.SetValByKey("Title", gb.getTitle());
		rpt.SetValByKey("BillNo", gb.getBillNo());
		rpt.setOID(gb.getWorkID());
		rpt.InsertAsOID(gb.getWorkID());

			///#region 复制其他数据.

		//复制明细。
		MapDtls dtls = new MapDtls(frmID);
		if (!dtls.isEmpty())
		{
			for (MapDtl dtl : dtls.ToJavaList())
			{
				if (dtl.getIsCopyNDData() == false)
				{
					continue;
				}

				//new 一个实例.
				GEDtl dtlData = new GEDtl(dtl.getNo());

				GEDtls dtlsFromData = new GEDtls(dtl.getNo());
				dtlsFromData.Retrieve(GEDtlAttr.RefPK, workID, null);
				for (GEDtl geDtlFromData : dtlsFromData.ToJavaList())
				{
					//是否启用多附件
					FrmAttachmentDBs dbs = null;
					if (dtl.getIsEnableAthM() == true)
					{
						//根据从表的OID 获取附件信息
						dbs = new FrmAttachmentDBs();
						dbs.Retrieve(FrmAttachmentDBAttr.RefPKVal, geDtlFromData.getOID(), null);
					}

					dtlData.Copy(geDtlFromData);
					dtlData.setRefPK(String.valueOf(rpt.getOID()));
					dtlData.InsertAsNew();
					if (dbs != null && !dbs.isEmpty())
					{
						//复制附件信息
						FrmAttachmentDB newDB = new FrmAttachmentDB();
						for (FrmAttachmentDB db : dbs.ToJavaList())
						{
							newDB.Copy(db);
							newDB.setRefPKVal(String.valueOf(dtlData.getOID()));
							newDB.setFID(dtlData.getOID());
							newDB.setMyPK(DBAccess.GenerGUID(0, null, null));
							newDB.Insert();
						}
					}

				}
			}

		}

		//获取附件组件、
		FrmAttachments athDecs = new FrmAttachments(frmID);
		//复制附件数据。
		if (!athDecs.isEmpty())
		{
			for (FrmAttachment athDec : athDecs.ToJavaList())
			{
				FrmAttachmentDBs aths = new FrmAttachmentDBs();
				aths.Retrieve(FrmAttachmentDBAttr.FK_FrmAttachment, athDec.getMyPK(), FrmAttachmentDBAttr.RefPKVal, workID, null);
				for (FrmAttachmentDB athDB : aths.ToJavaList())
				{
					FrmAttachmentDB athDB_N = new FrmAttachmentDB();
					athDB_N.Copy(athDB);
					athDB_N.setRefPKVal ( String.valueOf(rpt.getOID()));
					athDB_N.setMyPK(DBAccess.GenerGUID(0, null, null));
					athDB_N.Insert();
				}
			}
		}

			///#endregion 复制表单其他数据.

		bp.ccbill.Dev2Interface.Dict_AddTrack(frmID, String.valueOf(workID), "复制", "执行复制");


		return "复制成功.";
	}

	/** 
	 获得发起列表
	 
	 param empID
	 @return 
	*/
	public static DataSet DB_StartBills(String empID) throws Exception {
		//定义容器.
		DataSet ds = new DataSet();

		//单据类别.
		FrmTrees ens = new FrmTrees();
		ens.RetrieveAll();

		DataTable dtSort = ens.ToDataTableField("Sort");
		dtSort.TableName = "Sort";
		ds.Tables.add(dtSort);

		//查询出来单据运行模式的.
		FrmBills bills = new FrmBills();
		bills.RetrieveAll();

		//bills.Retrieve(FrmBillAttr.EntityType, 0); //实体类型.

		DataTable dtStart = bills.ToDataTableField("dt");
		dtStart.TableName = "Start";
		ds.Tables.add(dtStart);
		return ds;
	}
	/** 
	 获得待办列表
	 
	 param empID
	 @return 
	*/
	public static DataTable DB_Todolist(String empID)
	{
		return new DataTable();
	}
	/** 
	 草稿列表
	 
	 param frmID 单据ID
	 param empID 操作员
	 @return 
	*/
	public static DataTable DB_Draft(String frmID, String empID) throws Exception {
		if (DataType.IsNullOrEmpty(empID) == true)
		{
			empID = WebUser.getNo();
		}

		GenerBills bills = new GenerBills();
		bills.Retrieve(GenerBillAttr.FrmID, frmID, GenerBillAttr.Starter, empID, null);

		return bills.ToDataTableField("dt");
	}

	public static String GenerTitle(String titleRole, Entity wk)
	{
		if (DataType.IsNullOrEmpty(titleRole))
		{
			// 为了保持与ccflow4.5的兼容,从开始节点属性里获取.
			Attr myattr = wk.getEnMap().getAttrs().GetAttrByKey("Title");
			if (myattr == null)
			{
				myattr = wk.getEnMap().getAttrs().GetAttrByKey("Title");
			}

			if (myattr != null)
			{
				titleRole = myattr.getDefaultVal().toString();
			}

			if (DataType.IsNullOrEmpty(titleRole) || titleRole.contains("@") == false)
			{
				titleRole = "@WebUser.FK_DeptName-@WebUser.No,@WebUser.Name在@RDT发起.";
			}
		}

		if (titleRole.equals("@OutPara") || DataType.IsNullOrEmpty(titleRole) == true)
		{
			titleRole = "@WebUser.FK_DeptName-@WebUser.No,@WebUser.Name在@RDT发起.";
		}


		titleRole = titleRole.replace("@WebUser.No", WebUser.getNo());
		titleRole = titleRole.replace("@WebUser.Name", WebUser.getName());
		titleRole = titleRole.replace("@WebUser.FK_DeptNameOfFull", WebUser.getFK_DeptNameOfFull());
		titleRole = titleRole.replace("@WebUser.FK_DeptName", WebUser.getFK_DeptName());
		titleRole = titleRole.replace("@WebUser.FK_Dept", WebUser.getFK_Dept());
		titleRole = titleRole.replace("@RDT", DataType.getCurrentDateByFormart("yy年MM月dd日HH时mm分"));
		if (titleRole.contains("@"))
		{
			Attrs attrs = wk.getEnMap().getAttrs();

			// 优先考虑外键的替换,因为外键文本的字段的长度相对较长。
			for (Attr attr : attrs.ToJavaList())
			{
				if (titleRole.contains("@") == false)
				{
					break;
				}
				if (attr.getIsRefAttr() == false)
				{
					continue;
				}
				titleRole = titleRole.replace("@" + attr.getKey(), wk.GetValStrByKey(attr.getKey()));
			}

			//在考虑其它的字段替换.
			for (Attr attr : attrs.ToJavaList())
			{
				if (titleRole.contains("@") == false)
				{
					break;
				}

				if (attr.getIsRefAttr() == true)
				{
					continue;
				}
				titleRole = titleRole.replace("@" + attr.getKey(), wk.GetValStrByKey(attr.getKey()));
			}
		}
		titleRole = titleRole.replace('~', '-');
		titleRole = titleRole.replace("'", "”");

		// 为当前的工作设置title.
		wk.SetValByKey("Title", titleRole);
		return titleRole;
	}
	/** 
	 生成单据编号
	 
	 param billNo 单据编号规则
	 param workid 工作ID
	 param en 实体类
	 param frmID 表单ID
	 @return 生成的单据编号
	*/
	public static String GenerBillNo(String billNo, long workid, Entity en, String frmID) throws Exception {
		if (DataType.IsNullOrEmpty(billNo))
		{
			billNo = "3";
		}

		if (billNo.contains("@"))
		{
			billNo = bp.wf.Glo.DealExp(billNo, en, null);
		}

		/*如果,Bill 有规则 */
		billNo = billNo.replace("{YYYY}", DataType.getCurrentDateByFormart("yyyy"));
		billNo = billNo.replace("{yyyy}", DataType.getCurrentDateByFormart("yyyy"));

		billNo = billNo.replace("{yy}", DataType.getCurrentDateByFormart("yy"));
		billNo = billNo.replace("{YY}", DataType.getCurrentDateByFormart("yy"));

		billNo = billNo.replace("{MM}", DataType.getCurrentDateByFormart("MM"));
		billNo = billNo.replace("{mm}", DataType.getCurrentDateByFormart("MM"));

		billNo = billNo.replace("{DD}", DateUtils.format(new Date(), "dd"));
		billNo = billNo.replace("{dd}", DateUtils.format(new Date(), "dd"));
		billNo = billNo.replace("{HH}", DateUtils.format(new Date(),"HH"));
		billNo = billNo.replace("{hh}", DateUtils.format(new Date(),"HH"));

		billNo = billNo.replace("{LSH}", String.valueOf(workid));
		billNo = billNo.replace("{WorkID}", String.valueOf(workid));
		billNo = billNo.replace("{OID}", String.valueOf(workid));

		if (billNo.contains("@WebUser.DeptZi"))
		{
			String val = DBAccess.RunSQLReturnStringIsNull("SELECT Zi FROM Port_Dept WHERE No='" + WebUser.getFK_Dept() + "'", "");
			billNo = billNo.replace("@WebUser.DeptZi", val.toString());
		}

		String sql = "";
		int num = 0;
		String supposeBillNo = billNo; //假设单据号,长度与真实单据号一致
		ArrayList<java.util.Map.Entry<Integer, Integer>> loc = new java.util.ArrayList<java.util.Map.Entry<Integer, Integer>>(); //流水号位置,流水号位数
		String lsh; //流水号设置码
		int lshIdx = -1; //流水号设置码所在位置
		java.util.Map<Integer, Integer>  map = new HashMap<Integer, Integer>();
		for (int i = 2; i < 9; i++)
		{
			lsh = "{LSH" + i + "}";

			if (!supposeBillNo.contains(lsh))
			{
				continue;
			}

			while (supposeBillNo.contains(lsh))
			{
				//查找流水号所在位置
				lshIdx = supposeBillNo.indexOf(lsh);
				//将找到的流水号码替换成假设的流水号
				supposeBillNo = (lshIdx == 0 ? "" : supposeBillNo.substring(0, lshIdx)) + StringHelper.padLeft("", i, '_') + (lshIdx + 6 < supposeBillNo.length() ? supposeBillNo.substring(lshIdx + 6) : "");
				//保存当前流程号所处位置,及流程号长度,以便之后使用替换成正确的流水号
				map.put(lshIdx, i);
			}
		}
		Iterator<Map.Entry<Integer, Integer>> iterator = map.entrySet().iterator();
		while (iterator.hasNext()) {
			Map.Entry<Integer, Integer> entry = iterator.next();
			loc.add(entry);
		}
		//数据库中查找符合的单据号集合,NOTE:此处需要注意,在LIKE中带有左广方括号时,要使用一对广播号将其转义
		sql = "SELECT BillNo FROM Frm_GenerBill WHERE BillNo LIKE '" + supposeBillNo.replace("[", "[[]") + "'" + " AND WorkID <> " + workid + " AND FrmID ='" + frmID + "' " + " ORDER BY BillNo DESC ";

		String maxBillNo = DBAccess.RunSQLReturnString(sql);
		int ilsh = 0;

		if (DataType.IsNullOrEmpty(maxBillNo))
		{
			//没有数据,则所有流水号都从1开始
			for (java.util.Map.Entry<Integer, Integer> kv : loc)
			{
				supposeBillNo = (kv.getKey() == 0 ? "" : supposeBillNo.substring(0, kv.getKey())) + StringHelper.padLeft("1", kv.getValue(), '0') + (kv.getKey() + kv.getValue() < supposeBillNo.length() ? supposeBillNo.substring(kv.getKey() + kv.getValue()) : "");
			}
		}
		else
		{
			//有数据,则从右向左开始判断流水号,当右侧的流水号达到最大值,则左侧的流水号自动加1
			HashMap<Integer, Integer> mlsh = new HashMap<Integer, Integer>();
			int plus1idx = -1;

			for (int i = loc.size() - 1; i >= 0; i--)
			{
				//获取单据号中当前位的流水码数
				ilsh = Integer.parseInt(StringHelper.substring(maxBillNo, loc.get(i).getKey(), loc.get(i).getValue()));

				if (plus1idx >= 0)
				{
					//如果当前码位被置为+1,则+1,同时将标识置为-1
					ilsh++;
					plus1idx = -1;
				}
				else
				{
					mlsh.put(loc.get(i).getKey(), i == loc.size() - 1 ? ilsh + 1 : ilsh);
					continue;
				}

				if (ilsh >= Integer.parseInt(StringHelper.padLeft("", loc.get(i).getValue(), '9')))
				{
					//右侧已经达到最大值
					if (i > 0)
					{
						//记录前位的码
						mlsh.put(loc.get(i).getKey(), 1);
					}
					else
					{
						supposeBillNo = "单据号超出范围";
						break;
					}

					//则将前一个流水码位,标记为+1
					plus1idx = i - 1;
				}
				else
				{
					mlsh.put(loc.get(i).getKey(), ilsh + 1);
				}
			}

			if (supposeBillNo.equals("单据号超出范围"))
			{
				return supposeBillNo;
			}

			//拼接单据号
			for (Map.Entry<Integer, Integer> kv : loc)
			{
				supposeBillNo = (kv.getKey() == 0 ? "" : supposeBillNo.substring(0, kv.getKey())) + StringHelper.padLeft(mlsh.get(kv.getKey()).toString(), kv.getValue(), '0') + (kv.getKey() + kv.getValue() < supposeBillNo.length() ? supposeBillNo.substring(kv.getKey() + kv.getValue()) : "");
			}
		}

		billNo = supposeBillNo;

		return billNo;
	}
}
package bp.ccbill;

import bp.*;

/** 
 表单活动类型
*/
public class FrmActionType
{
	/** 
	 创建
	*/
	public static final String Create = "Create";
	/** 
	保存 
	*/
	public static final String Save = "Save";
	/** 
	 提交
	*/
	public static final String Submit = "Submit";
	/** 
	 评论
	*/
	public static final String BBS = "BBS";
	/** 
	 打开
	*/
	public static final String View = "View";
	/** 
	 回滚数据
	*/
	public static final String DataVerReback = "DataVerReback";
	/** 
	 发起流程
	*/
	public static final String StartFlow = "StartFlow";
	/** 
	 发起注册流程
	*/
	public static final String StartRegFlow = "StartRegFlow";
	/** 
	 其他
	*/
	public static final String Etc = "Etc";
}
package bp.ccbill;

import bp.*;

/** 
 实体表单 - Attr
*/
public class FrmAttr extends bp.en.EntityOIDNameAttr
{

		///#region 基本属性
	/** 
	 工作模式
	*/
	public static final String FrmDictWorkModel = "FrmDictWorkModel";
	/** 
	 实体类型
	*/
	public static final String EntityType = "EntityType";
	/** 
	 展示模式
	*/
	public static final String EntityShowModel = "EntityShowModel";
	/** 
	 单据编号生成规则
	*/
	public static final String BillNoFormat = "BillNoFormat";
	/** 
	 单据编号生成规则
	*/
	public static final String TitleRole = "TitleRole";
	/** 
	 排序字段
	*/
	public static final String SortColumns = "SortColumns";
	/** 
	 字段颜色设置
	*/
	public static final String ColorSet = "ColorSet";
	/** 
	 按照指定字段的颜色显示表格行的颜色
	*/
	public static final String RowColorSet = "RowColorSet";
	/** 
	 字段求和求平均设置
	*/
	public static final String FieldSet = "FieldSet";
	/** 
	 关联单据
	*/
	public static final String RefBill = "RefBill";

		///#endregion


		///#region 隐藏属性.
	/** 
	 要显示的列
	*/
	public static final String ShowCols = "ShowCols";

		///#endregion 隐藏属性


		///#region 按钮信息.
	/** 
	 按钮New标签
	*/
	public static final String BtnNewLable = "BtnNewLable";
	/** 
	 按钮New启用规则
	*/
	public static final String BtnNewModel = "BtnNewModel";
	/** 
	 按钮Save标签
	*/
	public static final String BtnSaveLable = "BtnSaveLable";
	/** 
	 按钮save启用规则
	*/
	public static final String BtnSaveEnable = "BtnSaveEnable";

	public static final String BtnSubmitLable = "BtnSubmitLable";
	public static final String BtnSubmitEnable = "BtnSubmitEnable";


	/** 
	 保存andclose
	*/
	public static final String BtnSaveAndCloseLable = "BtnSaveAndCloseLable";
	/** 
	 保存并关闭.
	*/
	public static final String BtnSaveAndCloseEnable = "BtnSaveAndCloseEnable";

	/** 
	 按钮del标签
	*/
	public static final String BtnDelLable = "BtnDelLable";
	/** 
	 数据版本
	*/
	public static final String BtnDataVer = "BtnDataVer";
	/** 
	 按钮del启用规则
	*/
	public static final String BtnDelEnable = "BtnDelEnable";
	/** 
	 按钮del标签
	*/
	public static final String BtnStartFlowLable = "BtnStartFlowLable";
	/** 
	 按钮del启用规则
	*/
	public static final String BtnStartFlowEnable = "BtnStartFlowEnable";
	/** 
	 查询
	*/
	public static final String BtnSearchLabel = "BtnSearchLabel";
	/** 
	 查询
	*/
	public static final String BtnSearchEnable = "BtnSearchEnable";
	/** 
	 分析
	*/
	public static final String BtnGroupLabel = "BtnGroupLabel";
	/** 
	 分析
	*/
	public static final String BtnGroupEnable = "BtnGroupEnable";

		///#endregion


		///#region 打印
	public static final String BtnPrintHtml = "BtnPrintHtml";
	public static final String BtnPrintHtmlEnable = "BtnPrintHtmlEnable";

	public static final String BtnPrintPDF = "BtnPrintPDF";
	public static final String BtnPrintPDFEnable = "BtnPrintPDFEnable";

	public static final String BtnPrintRTF = "BtnPrintRTF";
	public static final String BtnPrintRTFEnable = "BtnPrintRTFEnable";

	public static final String BtnPrintCCWord = "BtnPrintCCWord";
	public static final String BtnPrintCCWordEnable = "BtnPrintCCWordEnable";

		///#endregion


		///#region 按钮.
	/** 
	 导出zip文件
	*/
	public static final String BtnExpZip = "BtnExpZip";
	/** 
	 是否可以启用?
	*/
	public static final String BtnExpZipEnable = "BtnExpZipEnable";
	/** 
	 关联单据
	*/
	public static final String BtnRefBill = "BtnRefBill";
	/** 
	 关联单据是否可用
	*/
	public static final String RefBillRole = "RefBillRole";

		///#endregion 按钮.



		///#region 集合的操作.
	/** 
	 导入Excel
	*/
	public static final String BtnImpExcel = "BtnImpExcel";
	/** 
	 是否启用导入
	*/
	public static final String BtnImpExcelEnable = "BtnImpExcelEnable";
	/** 
	 导出Excel
	*/
	public static final String BtnExpExcel = "BtnExpExcel";
	/** 
	 导出excel
	*/
	public static final String BtnExpExcelEnable = "BtnExpExcelEnable";

		///#endregion 集合的操作.

	/** 
	 行打开模式
	*/
	public static final String RowOpenModel = "RowOpenModel";

	public static final String PopHeight = "PopHeight";
	public static final String PopWidth = "PopWidth";
	public static final String Tag0 = "Tag0";
	public static final String Tag1 = "Tag1";
	public static final String Tag2 = "Tag2";
	/** 
	 实体编辑模式
	*/
	public static final String EntityEditModel = "EntityEditModel";
}
package bp.ccbill;

import bp.da.*;
import bp.en.*;

/** 
 评论组件
*/
public class FrmBBS extends EntityNoName
{

		///#region 字段属性.
	/** 
	 参数数据.
	*/
	public final String getDocs() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.Docs);
	}
	public final void setDocs(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.Docs, value);
	}
	/** 
	 表单ID
	*/
	public final String getFrmID() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.FrmID);
	}
	public final void setFrmID(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.FrmID, value);
	}
	/** 
	 表单名称
	*/
	public final String getFrmName() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.FrmName);
	}
	public final void setFrmName(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.FrmName, value);
	}
	/** 
	 记录日期
	*/
	public final String getRDT() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.RDT);
	}
	public final void setRDT(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.RDT, value);
	}

	/** 
	 工作ID
	*/
	public final long getWorkID() throws Exception
	{
		return this.GetValInt64ByKey(FrmBBSAttr.WorkID);
	}
	public final void setWorkID(long value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.WorkID, value);
	}

	/** 
	 活动名称
	*/
	public final String getActionTypeText() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.ActionTypeText);
	}
	public final void setActionTypeText(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.ActionTypeText, value);
	}
	/** 
	 记录人
	*/
	public final String getRec() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.Rec);
	}
	public final void setRec(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.Rec, value);
	}
	/** 
	 记录人名字
	*/
	public final String getRecName() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.RecName);
	}
	public final void setRecName(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.RecName, value);
	}
	/** 
	 消息
	*/
	public final String getMsg() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.Msg);
	}
	public final void setMsg(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.Msg, value);
	}
	/** 
	 消息
	*/
	public final String getMsgHtml() throws Exception
	{
		return this.GetValHtmlStringByKey(FrmBBSAttr.Msg);
	}

		///#endregion attrs


		///#region 流程属性.
	public final String getDeptNo() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.DeptNo);
	}
	public final void setDeptNo(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.DeptNo, value);
	}
	public final String getDeptName() throws Exception
	{
		return this.GetValStringByKey(FrmBBSAttr.DeptName);
	}
	public final void setDeptName(String value)  throws Exception
	 {
		this.SetValByKey(FrmBBSAttr.DeptName, value);
	}

		///#endregion 流程属性.


		///#region 构造.
	/** 
	 表单评论组件表
	*/
	@Override
	public bp.en.Map getEnMap()  {
		if (this.get_enMap() != null)
		{
			return this.get_enMap();
		}

		Map map = new Map("Frm_BBS", "表单评论组件表");


			///#region 基本字段.

		map.AddTBStringPK(FrmBBSAttr.No, null, "No", true, false, 0, 50, 200);

		map.AddTBString(FrmBBSAttr.Name, null, "标题", true, false, 0, 4000, 200);
		map.AddTBString(FrmBBSAttr.ParentNo, null, "父节点", true, false, 0, 50, 200);
		map.AddTBString(FrmBBSAttr.WorkID, null, "工作ID/OID", true, false, 0, 50, 200);

		map.AddTBString(FrmBBSAttr.Docs, null, "内容", true, false, 0, 50, 200);

			//map.AddTBInt(FrmBBSAttr.ActionType, 0, "类型", true, false);
			// map.AddTBString(FrmBBSAttr.ActionTypeText, null, "类型(名称)", true, false, 0, 30, 100);

		map.AddTBString(FrmBBSAttr.Rec, null, "记录人", true, false, 0, 200, 100);
		map.AddTBString(FrmBBSAttr.RecName, null, "名称", true, false, 0, 200, 100);
		map.AddTBDateTime(FrmBBSAttr.RDT, null, "记录日期时间", true, false);

		map.AddTBString(FrmBBSAttr.DeptNo, null, "部门编号", true, false, 0, 200, 100);
		map.AddTBString(FrmBBSAttr.DeptName, null, "名称", true, false, 0, 200, 100);

			///#endregion 基本字段


		map.AddTBString(FrmBBSAttr.FrmID, null, "表单ID", true, false, 0, 50, 200);
		map.AddTBString(FrmBBSAttr.FrmName, null, "表单名称(可以为空)", true, false, 0, 200, 200);
		map.AddMyFile(null, null, null);
		this.set_enMap(map);
		return this.get_enMap();
	}
	/** 
	 评论组件
	*/
	public FrmBBS()  {
	}
	public FrmBBS(String no) throws Exception {
		this.setNo(no);
		this.Retrieve();
	}

		///#endregion 构造.

	@Override
	protected boolean beforeInsert() throws Exception {
		this.setNo(DBAccess.GenerGUID(0, null, null));

		this.SetValByKey(FrmBBSAttr.Rec, bp.web.WebUser.getNo());
		this.SetValByKey(FrmBBSAttr.RecName, bp.web.WebUser.getName());
		this.SetValByKey(FrmBBSAttr.RDT, DataType.getCurrentDateTime());

		this.SetValByKey(FrmBBSAttr.DeptNo, bp.web.WebUser.getFK_Dept());
		this.SetValByKey(FrmBBSAttr.DeptName, bp.web.WebUser.getFK_DeptName());

		return super.beforeInsert();
	}
	@Override
	protected void afterDelete() throws Exception {
		FrmBBSs ens = new FrmBBSs();
		ens.Delete(FrmBBSAttr.ParentNo, this.getNo());
		super.afterDelete();
	}
}
package bp.ccbill;

import bp.da.*;
import bp.en.*;
import bp.wf.*;
import bp.wf.template.*;
import bp.sys.*;
import bp.ccbill.template.*;

/** 
 单据属性
*/
public class FrmBill extends EntityNoName
{

		///#region 权限控制.
	@Override
	public UAC getHisUAC()  {
		UAC uac = new UAC();
		uac.OpenForAppAdmin();
		uac.IsDelete = false;
		uac.IsInsert = false;
		return uac;
	}

		///#endregion 权限控制.


		///#region 属性
	/** 
	 物理表
	*/
	public final String getPTable()  {
		String s = this.GetValStrByKey(MapDataAttr.PTable);
		if (DataType.IsNullOrEmpty(s) == true)
		{
			return this.getNo();
		}
		return s;
	}
	public final void setPTable(String value)
	 {
		this.SetValByKey(MapDataAttr.PTable, value);
	}
	/** 
	 实体类型:@0=单据@1=编号名称实体@2=树结构实体
	*/
	public final EntityType getEntityType()  {
		return EntityType.forValue(this.GetValIntByKey(FrmBillAttr.EntityType));
	}
	public final void setEntityType(EntityType value)
	 {
		this.SetValByKey(FrmBillAttr.EntityType, value.getValue());
	}
	/** 
	 表单类型 (0=傻瓜,2=自由 ...)
	*/
	public final FrmType getFrmType()  {
		return FrmType.forValue(this.GetValIntByKey(MapDataAttr.FrmType));
	}
	public final void setFrmType(FrmType value)
	 {
		this.SetValByKey(MapDataAttr.FrmType, value.getValue());
	}
	/** 
	 表单树
	*/
	public final String getFKFormTree()
	{
		return this.GetValStrByKey(MapDataAttr.FK_FormTree);
	}
	public final void setFK_FormTree(String value)
	 {
		this.SetValByKey(MapDataAttr.FK_FormTree, value);
	}
	/** 
	 单据格式
	*/
	public final String getBillNoFormat()  {
		String str = this.GetValStrByKey(FrmBillAttr.BillNoFormat);
		if (DataType.IsNullOrEmpty(str) == true)
		{
			str = "{LSH4}";
		}
		return str;
	}
	public final void setBillNoFormat(String value)
	 {
		this.SetValByKey(FrmBillAttr.BillNoFormat, value);
	}
	/** 
	 单据编号生成规则
	*/
	public final String getTitleRole()  {
		String str = this.GetValStrByKey(FrmBillAttr.TitleRole);
		if (DataType.IsNullOrEmpty(str) == true)
		{
			str = "@WebUser.FK_DeptName @WebUser.Name @RDT";
		}
		return str;
	}
	public final void setTitleRole(String value)
	 {
		this.SetValByKey(FrmBillAttr.BillNoFormat, value);
	}

	public final String getSortColumns()
	{
		return this.GetValStrByKey(FrmBillAttr.SortColumns);
	}
	public final void setSortColumns(String value)
	 {
		this.SetValByKey(FrmBillAttr.SortColumns, value);
	}

	public final String getFieldSet()
	{
		return this.GetValStrByKey(FrmBillAttr.FieldSet);
	}
	public final void setFieldSet(String value)
	 {
		this.SetValByKey(FrmBillAttr.FieldSet, value);
	}

	public final String getRefDict()
	{
		return this.GetValStrByKey(FrmBillAttr.RefDict);
	}
	public final void setRefDict(String value)
	 {
		this.SetValByKey(FrmBillAttr.RefDict, value);
	}

		///#endregion


		///#region 构造方法
	/** 
	 单据属性
	*/
	public FrmBill()  {
	}
	/** 
	 单据属性
	 
	 param no 映射编号
	*/
	public FrmBill(String no) throws Exception {
		super(no);
	}
	/** 
	 EnMap
	*/
	@Override
	public bp.en.Map getEnMap()  {
		if (this.get_enMap() != null)
		{
			return this.get_enMap();
		}

		Map map = new Map("Sys_MapData", "单据属性");



			///#region 基本属性.
		map.AddGroupAttr("基本属性");
		map.AddTBStringPK(MapDataAttr.No, null, "表单编号", true, true, 1, 190, 20);
		map.AddDDLSysEnum(MapDataAttr.FrmType, 0, "表单类型", true, true, "BillFrmType", "@0=傻瓜表单@1=自由表单@8=开发者表单");
			//map.AddDDLSysEnum(MapDataAttr.FrmModel, 0, "单据模板", true, true, "BillFrmModel", "@0=系统预置@1=用户新增");
		map.AddTBString(MapDataAttr.PTable, null, "存储表", true, false, 0, 500, 20, true);
		map.AddTBString(MapDataAttr.Name, null, "表单名称", true, false, 0, 500, 20, true);

		if (CCBPMRunModel.SAAS == bp.difference.SystemConfig.getCCBPMRunModel())
		{
			String sql = "SELECT No,Name FROM WF_FlowSort WHERE OrgNo='" + bp.web.WebUser.getOrgNo() + "' AND No!='" + bp.web.WebUser.getOrgNo() + "'";
			map.AddDDLSQL(MapDataAttr.FK_FormTree, null, "表单类别", sql, true);
				//map.AddDDLEntities(MapDataAttr.FK_FormTree, "01", "表单类别", new SysFormTrees(), true);
		}
		else
		{
			map.AddDDLEntities(MapDataAttr.FK_FormTree, "01", "表单类别", new SysFormTrees(), true);
		}

		map.AddDDLSysEnum(MapDataAttr.TableCol, 0, "表单显示列数", true, true, "傻瓜表单显示方式", "@0=4列@1=6列@2=上下模式3列");

		map.AddDDLSysEnum(FrmAttr.RowOpenModel, 0, "行记录打开模式", true, true, "RowOpenMode", "@0=新窗口打开@1=在本窗口打开@2=弹出窗口打开,关闭后不刷新列表@3=弹出窗口打开,关闭后刷新列表");
		String cfg = "@0=MyDictFrameWork.htm 实体与实体相关功能编辑器";
		cfg += "@1=MyDict.htm 实体编辑器";
		cfg += "@2=MyBill.htm 单据编辑器";
		cfg += "@9=自定义URL";
		map.AddDDLSysEnum("SearchDictOpenType", 0, "双击行打开内容", true, true, "SearchDictOpenType", cfg);
		map.AddTBString(EnCfgAttr.UrlExt, null, "要打开的Url", true, false, 0, 500, 60, true);

			///#endregion 基本属性.


			///#region 单据属性.
		map.AddGroupAttr("单据属性");
			//map.AddDDLSysEnum(FrmBillAttr.FrmBillWorkModel, 0, "工作模式", true, false, FrmBillAttr.FrmBillWorkModel,
			//    "@0=独立表单@1=单据工作模式");
		map.AddDDLSysEnum(FrmBillAttr.EntityType, 0, "业务类型", true, false, FrmBillAttr.EntityType, "@0=独立表单@1=单据@2=编号名称实体@3=树结构实体");
		map.SetHelperAlert(FrmBillAttr.EntityType, "该实体的类型,@0=单据@1=编号名称实体@2=树结构实体.");

			//map.AddDDLSysEnum(MapDataAttr.FrmType, 0, "表单类型", true, true, "", "@0=独立表单@1=单据工作模式@2=流程工作模式");

		map.AddTBString(FrmBillAttr.BillNoFormat, null, "单号规则", true, false, 0, 100, 20, true);
		map.AddTBString(FrmBillAttr.TitleRole, null, "标题生成规则", true, false, 0, 100, 20, true);
		map.AddTBString(FrmBillAttr.SortColumns, null, "排序字段", true, false, 0, 100, 20, true);
		map.AddTBString(FrmBillAttr.ColorSet, null, "颜色设置", true, false, 0, 100, 20, true);
		String msg = "对字段的颜色处理";
		msg += "\t\n @Age:From=0,To=18,Color=green;From=19,To=30,Color=red";
		map.SetHelperAlert(FrmBillAttr.ColorSet, msg);

		map.AddTBString(FrmBillAttr.RowColorSet, null, "表格行颜色设置", true, false, 0, 100, 20, true);
		map.SetHelperAlert(FrmBillAttr.RowColorSet, "按照指定字段存储的颜色设置表格行的背景色");

		map.AddTBString(FrmBillAttr.FieldSet, null, "字段求和求平均设置", true, false, 0, 100, 20, true);
		map.AddTBString(FrmBillAttr.RefDict, null, "单据关联的实体", false, true, 0, 190, 20, true);

			///#endregion 单据属性.


			///#region 按钮权限.
			//map.AddTBString(FrmBillAttr.BtnNewLable, "新建", "新建", true, false, 0, 50, 20);
			//map.AddDDLSysEnum(FrmDictAttr.BtnNewModel, 0, "新建模式", true, true, FrmDictAttr.BtnNewModel,
			//  "@0=表格模式@1=卡片模式@2=不可用", true);


			//map.AddTBString(FrmBillAttr.BtnSaveLable, "保存", "保存", true, false, 0, 50, 20);
			map.AddBoolean(FrmBillAttr.BtnSaveEnable, true, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnSubmitLable, "提交", "提交", true, false, 0, 50, 20);

			//map.AddTBString(FrmBillAttr.BtnDelLable, "删除", "删除", true, false, 0, 50, 20);
			map.AddBoolean(FrmBillAttr.BtnDelEnable, true, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnSearchLabel, "列表", "列表", true, false, 0, 50, 20);
			map.AddBoolean(FrmBillAttr.BtnSearchEnable, true, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnGroupLabel, "分析", "分析", true, false, 0, 50, 20);
			//map.AddBoolean(FrmBillAttr.BtnGroupEnable, false, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnPrintHtml, "打印Html", "打印Html", true, false, 0, 50, 20);
			//map.AddBoolean(FrmBillAttr.BtnPrintHtmlEnable, false, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnPrintPDF, "打印PDF", "打印PDF", true, false, 0, 50, 20);
			//map.AddBoolean(FrmBillAttr.BtnPrintPDFEnable, false, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnPrintRTF, "打印RTF", "打印RTF", true, false, 0, 50, 20);
			//map.AddBoolean(FrmBillAttr.BtnPrintRTFEnable, false, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnPrintCCWord, "打印CCWord", "打印CCWord", true, false, 0, 50, 20);
			//map.AddBoolean(FrmBillAttr.BtnPrintCCWordEnable, false, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnExpZip, "导出zip文件", "导出zip文件", true, false, 0, 50, 20);
			//map.AddBoolean(FrmBillAttr.BtnExpZipEnable, false, "是否可用?", true, true);


		map.AddTBString(FrmBillAttr.BtnRefBill, "关联单据", "关联单据", true, false, 0, 50, 20);

		map.AddDDLSysEnum(FrmAttr.RefBillRole, 0, "关联单据工作模式", true, true, "RefBillRole", "@0=不启用@1=非必须选择关联单据@2=必须选择关联单据");

		map.AddTBString(FrmBillAttr.RefBill, null, "关联单据ID", true, false, 0, 100, 20, true);
		map.SetHelperAlert(FrmBillAttr.RefBill, "请输入单据编号,多个单据编号用逗号分开.\t\n比如:Bill_Sale,Bill_QingJia");

			///#endregion 按钮权限.


			///#region 查询按钮权限.

			//map.AddTBString(FrmBillAttr.BtnImpExcel, "导入", "导入Excel文件", true, false, 0, 50, 20);
			//map.AddBoolean(FrmBillAttr.BtnImpExcelEnable, true, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnExpExcel, "导出", "导出Excel文件", true, false, 0, 50, 20);
			//map.AddBoolean(FrmBillAttr.BtnExpExcelEnable, true, "是否可用?", true, true);

			//map.AddTBString(FrmBillAttr.BtnGroupLabel, "分析", "分析", true, false, 0, 50, 20);
			//map.AddBoolean(FrmBillAttr.BtnGroupEnable, true, "是否可用?", true, true);


			///#endregion 查询按钮权限.


			///#region 设计者信息.
		map.AddGroupAttr("设计者信息");
		map.AddTBString(MapDataAttr.Designer, null, "设计者", true, false, 0, 500, 20);
		map.AddTBString(MapDataAttr.DesignerContact, null, "联系方式", true, false, 0, 500, 20);
		map.AddTBString(MapDataAttr.DesignerUnit, null, "单位", true, false, 0, 500, 20, true);
		map.AddTBString(MapDataAttr.GUID, null, "GUID", true, true, 0, 128, 20, false);
		map.AddTBString(MapDataAttr.Ver, null, "版本号", true, true, 0, 30, 20);
		map.AddTBStringDoc(MapDataAttr.Note, null, "备注", true, false, true);
		map.AddTBInt(MapDataAttr.Idx, 100, "顺序号", false, false);

			///#endregion 设计者信息.


			///#region 扩展参数.
		map.AddTBString(FrmDictAttr.Tag0, null, "Tag0", false, false, 0, 500, 20);
		map.AddTBString(FrmDictAttr.Tag1, null, "Tag1", false, false, 0, 4000, 20);
		map.AddTBString(FrmDictAttr.Tag2, null, "Tag2", false, false, 0, 500, 20);

			///#endregion 扩展参数.

		map.AddTBAtParas(800); //参数属性.


			///#region 基本功能.
		map.AddGroupMethod("基本设置");
		RefMethod rm = new RefMethod();

		rm = new RefMethod();
		rm.Title = "按钮权限"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".ToolbarSetting";
		rm.Icon = "../../WF/Img/Event.png";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "设计表单"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoDesigner";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.LinkeWinOpen;
		rm.Target = "_blank";
			//rm.GroupName = "开发接口";
			//map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "单据url的API"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoAPI";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
			//rm.GroupName = "开发接口";
		   // map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "打开单据数据"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoOpenBill";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.LinkeWinOpen;
		rm.Target = "_blank";
			//rm.GroupName = "开发接口";
		map.AddRefMethod(rm);


		rm = new RefMethod();
		rm.Title = "绑定到菜单目录"; // "设计表单";
		rm.getHisAttrs().AddDDLSQL("MENUNo", null, "选择菜单目录", "SELECT No,Name FROM GPM_Menu WHERE MenuType=3", true);
		rm.getHisAttrs().AddTBString("Name", "@Name", "菜单名称", true, false, 0, 100, 100);
		rm.ClassMethodName = this.toString() + ".DoBindMenu";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.Func;
		rm.Target = "_blank";
			//rm.GroupName = "开发接口";
		map.AddRefMethod(rm);


		rm = new RefMethod();
		rm.Title = "装载填充"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoPageLoadFull";
		rm.Icon = "../../WF/Img/FullData.png";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "表单事件"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoEvent";
		rm.Icon = "../../WF/Img/Event.png";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);

			//rm = new RefMethod();
			//rm.Title = "执行方法"; // "设计表单";
			//rm.ClassMethodName = this.ToString() + ".DoMethod";
			//rm.Icon = "../../WF/Img/Event.png";
			//rm.Visable = true;
			//rm.refMethodType = RefMethodType.RightFrameOpen;
			//rm.Target = "_blank";
			//map.AddRefMethod(rm);

			///#endregion 基本功能.


			///#region 权限规则.
		map.AddGroupMethod("权限规则");
		rm = new RefMethod();
		rm.Title = "创建规则"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoCreateRole";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.LinkModel;
		rm.RefAttrKey = FrmBillAttr.BtnNewLable;
		rm.GroupName = "权限规则";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "保存规则"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoSaveRole";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.LinkModel;
		rm.RefAttrKey = FrmBillAttr.BtnSaveLable;
		rm.GroupName = "权限规则";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "提交规则"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoSubmitRole";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.LinkModel;
		rm.RefAttrKey = FrmBillAttr.BtnSubmitLable;
		rm.GroupName = "权限规则";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "删除规则"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoDeleteRole";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.LinkModel;
		rm.RefAttrKey = FrmBillAttr.BtnDelLable;
		rm.GroupName = "权限规则";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "查询权限"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoSearchRole";
		rm.Visable = true;
		rm.refMethodType = RefMethodType.LinkModel;
		rm.RefAttrKey = FrmBillAttr.BtnSearchLabel;
		rm.GroupName = "权限规则";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.Title = "数据查询权限规则";
		rm.ClassMethodName = this.toString() + ".DoSearchDataRole()";
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.GroupName = "权限规则";
		map.AddRefMethod(rm);


			///#endregion


			///#region 报表定义.
		map.AddGroupMethod("报表定义");
		rm = new RefMethod();
		rm.GroupName = "报表定义";
		rm.Title = "设置显示的列"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoRpt_ColsChose";
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.GroupName = "报表定义";
		rm.Title = "设置多表头"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoRptMTitle";
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.GroupName = "报表定义";
		rm.Title = "列的顺序"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoRpt_ColsIdxAndLabel";
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
			//   map.AddRefMethod(rm);

		rm = new RefMethod();
		rm.GroupName = "报表定义";
		rm.Title = "查询条件"; // "设计表单";
		rm.ClassMethodName = this.toString() + ".DoRpt_SearchCond";
		rm.refMethodType = RefMethodType.RightFrameOpen;
		rm.Target = "_blank";
		map.AddRefMethod(rm);

			//rm = new RefMethod();
			//rm.GroupName = "报表定义";
			//rm.Title = "页面展示设置"; // "设计表单";
			//rm.ClassMethodName = this.ToString() + ".DoRpt_Setting";
			//rm.refMethodType = RefMethodType.RightFrameOpen;
			//rm.Target = "_blank";
			//map.AddRefMethod(rm);


			///#endregion 报表定义.

		this.set_enMap(map);
		return this.get_enMap();
	}
	public final void InsertToolbarBtns() throws Exception {
		//表单的工具栏权限
		ToolbarBtn btn = new ToolbarBtn();
		btn.setFrmID(this.getNo());
		btn.setBtnID("New");
		btn.setBtnLab("新建");
		btn.setMyPK(btn.getFrmID() + "_" + btn.getBtnID());
		btn.SetValByKey("Idx", 0);
		btn.Insert();


		btn = new ToolbarBtn();
		btn.setFrmID(this.getNo());
		btn.setBtnID("Save");
		btn.setBtnLab("保存");
		btn.setMyPK(btn.getFrmID() + "_" + btn.getBtnID());
		btn.SetValByKey("Idx", 1);
		btn.Insert();


		//单据增加提交的功能
		btn = new ToolbarBtn();
		btn.setFrmID(this.getNo());
		btn.setBtnID("Submit");
		btn.setBtnLab("提交");
		btn.setMyPK(btn.getFrmID() + "_" + btn.getBtnID());
		btn.SetValByKey("Idx", 1);
		btn.Insert();


		btn = new ToolbarBtn();
		btn.setFrmID(this.getNo());
		btn.setBtnID("Delete");
		btn.setBtnLab("删除");
		btn.setMyPK(btn.getFrmID() + "_" + btn.getBtnID());
		btn.SetValByKey("Idx", 2);
		btn.Insert();

		btn = new ToolbarBtn();
		btn.setFrmID(this.getNo());
		btn.setBtnID("PrintHtml");
		btn.setBtnLab("打印Html");
		btn.setMyPK(btn.getFrmID() + "_" + btn.getBtnID());
		btn.setEnable(false);
		btn.SetValByKey("Idx", 3);
		btn.Insert();

		btn = new ToolbarBtn();
		btn.setFrmID(this.getNo());
		btn.setBtnID("PrintPDF");
		btn.setBtnLab("打印PDF");
		btn.setMyPK(btn.getFrmID() + "_" + btn.getBtnID());
		btn.setEnable(false);
		btn.SetValByKey("Idx", 4);
		btn.Insert();

		btn = new ToolbarBtn();
		btn.setFrmID(this.getNo());
		btn.setBtnID("PrintRTF");
		btn.setBtnLab("打印RTF");
		btn.setMyPK(btn.getFrmID() + "_" + btn.getBtnID());
		btn.setEnable(false);
		btn.SetValByKey("Idx", 5);
		btn.Insert();

		btn = new ToolbarBtn();
		btn.setFrmID(this.getNo());
		btn.setBtnID("PrintCCWord");
		btn.setBtnLab("打印CCWord");
		btn.setMyPK(btn.getFrmID() + "_" + btn.getBtnID());
		btn.setEnable(false);
		btn.SetValByKey("Idx", 6);
		btn.Insert();

		btn = new ToolbarBtn();
		btn.setFrmID(this.getNo());
		btn.setBtnID("ExpZip");
		btn.setBtnLab("导出Zip包");
		btn.setMyPK(btn.getFrmID() + "_" + btn.getBtnID());
		btn.setEnable(false);
		btn.SetValByKey("Idx", 7);
		btn.Insert();

		//列表权限
		//查询
		Collection collection = new Collection();
		collection.setFrmID(this.getNo());
		collection.setMethodID("Search");
		collection.setName("查询");
		collection.setMethodModel("Search");
		collection.setMark("Search");
		collection.setNo(collection.getFrmID() + "_" + collection.getMethodID());
		collection.SetValByKey("Idx", 0);
		collection.Insert();


		//新建
		collection = new Collection();
		collection.setFrmID(this.getNo());
		collection.setMethodID("New");
		collection.setName("新建");
		collection.setMethodModel("New");
		collection.setMark("New");
		collection.setNo(collection.getFrmID() + "_" + collection.getMethodID());
		collection.SetValByKey("Idx", 1);
		collection.Insert();

		//删除
		collection = new Collection();
		collection.setFrmID(this.getNo());
		collection.setMethodID("Delete");
		collection.setName("删除");
		collection.setMethodModel("Delete");
		collection.setMark("Delete");
		collection.setNo(collection.getFrmID() + "_" + collection.getMethodID());
		collection.SetValByKey("Idx", 2);
		collection.Insert();

		collection = new Collection();
		collection.setFrmID(this.getNo());
		collection.setMethodID("Group");
		collection.setName("分析");
		collection.setMethodModel("Group");
		collection.setMark("Group");
		collection.setNo(collection.getFrmID() + "_" + collection.getMethodID());
		collection.SetValByKey("Idx", 3);
		collection.SetValByKey("IsEnable", false);
		collection.Insert();

		//导出
		collection = new Collection();
		collection.setFrmID(this.getNo());
		collection.setMethodID("ExpExcel");
		collection.setName("导出Excel");
		collection.setMethodModel("ExpExcel");
		collection.setMark("ExpExcel");
		collection.setNo(collection.getFrmID() + "_" + collection.getMethodID());
		collection.SetValByKey("Idx", 4);
		collection.Insert();

		//导入
		collection = new Collection();
		collection.setFrmID(this.getNo());
		collection.setMethodID("ImpExcel");
		collection.setName("导入Excel");
		collection.setMethodModel("ImpExcel");
		collection.setMark("ImpExcel");
		collection.setNo(collection.getFrmID() + "_" + collection.getMethodID());
		collection.SetValByKey("Idx", 5);
		collection.Insert();
	}

	@Override
	protected void afterInsert() throws Exception {
		InsertToolbarBtns();
		CheckEnityTypeAttrsFor_Bill();

		super.afterInsertUpdateAction();
	}

		///#endregion



		///#region 权限控制.
	public final String DoSaveRole()  {
		return "../../CCBill/Admin/BillRole.htm?s=34&FrmID=" + this.getNo() + "&CtrlObj=BtnSave";
	}
	/** 
	 提交权限规则
	 
	 @return 
	*/
	public final String DoSubmitRole()  {
		return "../../CCBill/Admin/BillRole.htm?s=34&FrmID=" + this.getNo() + "&CtrlObj=BtnSubmit";
	}

	/** 
	 创建权限
	 
	 @return 
	*/
	public final String DoCreateRole()  {
		return "../../CCBill/Admin/BillRole.htm?s=34&FrmID=" + this.getNo() + "&CtrlObj=BtnNew";
	}
	/** 
	 查询权限
	 
	 @return 
	*/
	public final String DoSearchRole()  {
		return "../../CCBill/Admin/BillRole.htm?s=34&FrmID=" + this.getNo() + "&CtrlObj=BtnSearch";
	}
	/** 
	 删除规则.
	 
	 @return 
	*/
	public final String DoDeleteRole()  {
		return "../../CCBill/Admin/BillRole.htm?s=34&FrmID=" + this.getNo() + "&CtrlObj=BtnDelete";
	}

	/** 
	 数据查询权限规则
	 
	 @return 
	*/
	public final String DoSearchDataRole()  {
		return "../../CCBill/Admin/SearchDataRole.htm?s=34&FrmID=" + this.getNo();
	}

		///#endregion 权限控制.



		///#region 报表定义
	/** 
	 选择显示的列
	 
	 @return 
	*/
	public final String DoRpt_ColsChose()  {
		return "../../CCBill/Admin/ColsChose.htm?FrmID=" + this.getNo();
	}
	/** 
	 设置多表头
	 
	 @return 
	*/
	public final String DoRptMTitle()  {
		return "../../Comm/Sys/MultiTitle.htm?EnsName=" + this.getNo() + "&DoType=Bill";
	}
	/** 
	 列的顺序
	 
	 @return 
	*/
	public final String DoRpt_ColsIdxAndLabel()  {
		return "../../CCBill/Admin/ColsIdxAndLabel.htm?FrmID=" + this.getNo();
	}
	/** 
	 查询条件
	 
	 @return 
	*/
	public final String DoRpt_SearchCond()  {
		return "../../CCBill/Admin/SearchCond.htm?FrmID=" + this.getNo();
	}

	public final String DoRpt_Setting()  {
		return "../Sys/SearchSetting.htm?EnsName=" + this.getNo() + "&SettingType=1";
	}

		///#endregion 报表定义.

	public final String ToolbarSetting()  {
		return "../../CCBill/Admin/ToolbarSetting.htm?s=34&FrmID=" + this.getNo();
	}
	public final String DoPageLoadFull()  {
		return "../../Admin/FoolFormDesigner/MapExt/PageLoadFull.htm?s=34&FK_MapData=" + this.getNo() + "&ExtType=PageLoadFull&RefNo=";
	}
	/** 
	 表单事件
	 
	 @return 
	*/
	public final String DoEvent()  {
		return "../../Admin/CCFormDesigner/Action.htm?FK_MapData=" + this.getNo() + "&T=sd&FK_Node=0";
	}

	/** 
	 检查检查实体类型
	*/

	public final void CheckEnityTypeAttrsFor_Bill() throws Exception {
		CheckEnityTypeAttrsFor_Bill(false);
	}

//ORIGINAL LINE: public void CheckEnityTypeAttrsFor_Bill(bool isHavePFrmID=false)
	public final void CheckEnityTypeAttrsFor_Bill(boolean isHavePFrmID) throws Exception {
		//取出来全部的属性.
		MapAttrs attrs = new MapAttrs(this.getNo());


			///#region 补充上流程字段到 NDxxxRpt.
		if (attrs.contains(this.getNo() + "_" + GERptAttr.Title) == false)
		{
			/* 标题 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn(GERptAttr.Title); // "FlowEmps";
			attr.setName("标题"); //   单据模式, ccform的模式.
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(true);
			attr.setUIIsEnable(false);
			attr.setUIIsLine(true);
			attr.setMinLen(0);
			attr.setMaxLen(400);
			attr.setIdx(-100);
			attr.Insert();
		}

		if (attrs.contains(this.getNo() + "_" + GERptAttr.OID) == false)
		{
			/* WorkID */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setKeyOfEn("OID");
			attr.setName("主键ID");
			attr.setMyDataType(DataType.AppInt);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setDefVal( "0");
			attr.setEditType(EditType.Readonly);
			attr.Insert();
		}
		if (attrs.contains(this.getNo() + "_" + GERptAttr.BillNo) == false)
		{
			/* 单据编号 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn(GERptAttr.BillNo);

			attr.setName("单据编号"); //  单据编号
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(true);
			attr.setUIIsEnable(false);
			attr.setUIIsLine(false);
			attr.setMinLen(0);
			attr.setMaxLen(100);
			attr.setIdx(-100);
			attr.Insert();
		}

		if (attrs.contains(this.getNo() + "_" + GERptAttr.AtPara) == false)
		{
			/* 参数 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn(GERptAttr.AtPara);
			attr.setName("参数"); // 单据编号
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setUIIsLine(false);
			attr.setMinLen(0);
			attr.setMaxLen(4000);
			attr.setIdx( -99);
			attr.Insert();
		}

		if (attrs.contains(this.getNo() + "_BillState") == false)
		{
			/* 单据状态 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("BillState"); // "FlowEmps";
			attr.setName("单据状态");
			attr.setMyDataType(DataType.AppInt);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setUIIsLine(true);
			attr.setMinLen(0);
			attr.setMaxLen(10);
			attr.setIdx( -98);
			attr.Insert();
		}

		if (attrs.contains(this.getNo() + "_Starter") == false)
		{
			/* 发起人 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("Starter");
			attr.setName("创建人");
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);

			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setMinLen(0);
			attr.setMaxLen(32);
			attr.setIdx( -1);
			attr.Insert();
		}
		if (attrs.contains(this.getNo() + "_StarterName") == false)
		{
			/* 创建人名称 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("StarterName");
			attr.setName("创建人名称");
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);

			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setMinLen(0);
			attr.setMaxLen(32);
			attr.setIdx( -1);
			attr.Insert();
		}

		if (attrs.contains(this.getNo() + "_RDT") == false)
		{
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("RDT");
			attr.setName("创建时间");
			attr.setMyDataType(DataType.AppDateTime);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);
			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setUIIsLine(false);
			attr.setIdx( -97);
			attr.Insert();
		}
		if (attrs.contains(this.getNo() + "_FK_Dept") == false)
		{
			/* 创建人部门 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("FK_Dept");
			attr.setName("创建人部门");
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);

			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setMinLen(0);
			attr.setMaxLen(32);
			attr.setIdx( -1);
			attr.Insert();
		}
		if (attrs.contains(this.getNo() + "_OrgNo") == false)
		{
			/* 创建人名称 */
			MapAttr attr = new MapAttr();
			attr.setFK_MapData(this.getNo());
			attr.setHisEditType( EditType.UnDel);
			attr.setKeyOfEn("OrgNo");
			attr.setName("创建人所在的组织");
			attr.setMyDataType(DataType.AppString);
			attr.setUIContralType(UIContralType.TB);
			attr.setLGType(FieldTypeS.Normal);

			attr.setUIVisible(false);
			attr.setUIIsEnable(false);
			attr.setMinLen(0);
			attr.setMaxLen(32);
			attr.setIdx( -1);
			attr.Insert();
		}
		if (isHavePFrmID == true)
		{
			if (attrs.contains(this.getNo() + "_PWorkID") == false)
			{
				MapAttr attr = new MapAttr();
				attr.setFK_MapData(this.getNo());
				attr.setHisEditType( EditType.UnDel);
				attr.setKeyOfEn("PWorkID");
				attr.setName("实体发起的单据");
				attr.setMyDataType(DataType.AppInt);
				attr.setUIContralType(UIContralType.TB);
				attr.setLGType(FieldTypeS.Normal);

				attr.setUIVisible(false);
				attr.setUIIsEnable(false);
				attr.setMinLen(0);
				attr.setMaxLen(50);
				attr.setIdx( -1);
				attr.Insert();
			}

			if (attrs.contains(this.getNo() + "_PFrmID") == false)
			{
				MapAttr attr = new MapAttr();
				attr.setFK_MapData(this.getNo());
				attr.setHisEditType( EditType.UnDel);
				attr.setKeyOfEn("PFrmID");
				attr.setName("实体名称");
				attr.setMyDataType(DataType.AppString);
				attr.setUIContralType(UIContralType.TB);
				attr.setLGType(FieldTypeS.Normal);

				attr.setUIVisible(false);
				attr.setUIIsEnable(false);
				attr.setMinLen(0);
				attr.setMaxLen(200);
				attr.setIdx( -1);
				attr.Insert();
			}

		}

			///#endregion 补充上流程字段。
	}
	/** 
	 绑定菜单树
	 
	 @return 返回执行结果.
	*/
	public final String DoBindMenu(String menumDirNo, String menuName)
	{
		String sql = "SELECT FK_App FROM GPM_Menu WHERE No='" + menumDirNo + "'";
		String app = DBAccess.RunSQLReturnString(sql);

		String guid = DBAccess.GenerGUID(0, null, null);

		String url = "../WF/CCBill/Search.htm?FrmID=" + this.getNo();
		sql = "INSERT INTO GPM_Menu (No, Name, ParentNo, Idx, MenuType, FK_App, Url, OpenWay,Icon,MenuCtrlWay) VALUES ('" + guid + "', '" + menuName + "', '" + menumDirNo + "', 1, 4, '" + app + "', '" + url + "',  0,'',1)";
		DBAccess.RunSQL(sql);
		return "加入成功,如何<a href='En.htm?EnName=BP.GPM.Menu&No=" + guid + "'>控制权限请转GPM.</a>";
	}


		///#region 业务逻辑.
	public final String CreateBlankWorkID() throws Exception {
		return String.valueOf(bp.ccbill.Dev2Interface.CreateBlankBillID(this.getNo(), bp.web.WebUser.getNo(), null));
	}

		///#endregion 业务逻辑.


		///#region 方法操作.
	/** 
	 打开单据
	 
	 @return 
	*/
	public final String DoOpenBill()  {
		return "../../CCBill/SearchBill.htm?FrmID=" + this.getNo() + "&t=" + DataType.getCurrentDataTime();
	}
	public final String DoAPI()  {
		return "../../Admin/FoolFormDesigner/Bill/API.htm?FrmID=" + this.getNo() + "&t=" + DataType.getCurrentDataTime();
	}

		///#endregion 方法操作.
}
package bp.ccfast;

import bp.web.*;
import bp.en.*;

/** 
 独立运行流程设置
*/
public class StandAloneFlow extends EntityNoName
{

		///#region 基本属性
	/** 
	 组织编号
	*/
	public final String getOrgNo()
	{
		return this.GetValStrByKey(StandAloneFlowAttr.OrgNo);
	}
	public final void setOrgNo(String value)
	 {
		this.SetValByKey(StandAloneFlowAttr.OrgNo, value);
	}
	/** 
	 记录人
	*/
	public final String getRec()
	{
		return this.GetValStrByKey(StandAloneFlowAttr.Rec);
	}
	public final void setRec(String value)
	 {
		this.SetValByKey(StandAloneFlowAttr.Rec, value);
	}
	/** 
	 记录日期
	*/
	public final String getRDT()
	{
		return this.GetValStrByKey(StandAloneFlowAttr.RDT);
	}
	public final void setRDT(String value)
	 {
		this.SetValByKey(StandAloneFlowAttr.RDT, value);
	}
	/** 
	 年月
	*/
	public final String getNianYue()
	{
		return this.GetValStrByKey(StandAloneFlowAttr.NianYue);
	}
	public final void setNianYue(String value)
	 {
		this.SetValByKey(StandAloneFlowAttr.NianYue, value);
	}

		///#endregion


		///#region 构造方法
	/** 
	 权限控制
	*/
	@Override
	public UAC getHisUAC()  {
		UAC uac = new UAC();
		if (WebUser.getIsAdmin())
		{
			uac.IsUpdate = true;
			return uac;
		}
		return super.getHisUAC();
	}
	/** 
	 独立运行流程设置
	*/
	public StandAloneFlow()  {
	}
	public StandAloneFlow(String mypk)throws Exception
	{
		this.setNo(mypk);
		this.Retrieve();
	}
	/** 
	 重写基类方法
	*/
	@Override
	public bp.en.Map getEnMap() {
		if (this.get_enMap() != null)
		{
			return this.get_enMap();
		}

		Map map = new Map("WF_Flow", "独立运行流程设置");

		map.AddTBStringPK(StandAloneFlowAttr.No, null, "流程编号", true, true, 0, 100, 10);
		map.AddTBString(StandAloneFlowAttr.Name, null, "流程名称", true, false, 0, 300, 10);

			//  map.AddBoolean(StandAloneFlowAttr.IsStar, false, "是否标星", false, false);

			//map.AddTBString(StandAloneFlowAttr.Is, null, "流程名称", true, false, 0, 300, 10);
			//map.AddTBStringDoc(StandAloneFlowAttr.Docs, null, "内容", true, false);
			//map.AddTBString(StandAloneFlowAttr.OrgNo, null, "OrgNo", false, false, 0, 100, 10);
			//map.AddTBString(StandAloneFlowAttr.Rec, null, "记录人", false, false, 0, 100, 10, true);
			//map.AddTBDateTime(StandAloneFlowAttr.RDT, null, "记录时间", false, false);
			//map.AddTBString(StandAloneFlowAttr.NianYue, null, "NianYue", false, false, 0, 10, 10);
			//map.AddTBInt(StandAloneFlowAttr.IsStar, 0, "是否标星", false, false);

		this.set_enMap(map);
		return this.get_enMap();
	}

		///#endregion


		///#region 执行方法.
	@Override
	protected boolean beforeInsert() throws Exception {
		throw new RuntimeException("err@");
		//return super.beforeInsert();
	}

		///#endregion 执行方法.
}
package bp.ccfast;

import bp.en.*;

/** 
 独立运行流程设置 属性
*/
public class StandAloneFlowAttr extends EntityNoNameAttr
{
	/** 
	 名称
	*/
	public static final String Name = "Name";
	/** 
	 功能ID
	*/
	public static final String Docs = "Docs";
	/** 
	 组织编号
	*/
	public static final String OrgNo = "OrgNo";
	/** 
	 记录人
	*/
	public static final String Rec = "Rec";
	/** 
	 记录日期
	*/
	public static final String RDT = "RDT";
	/** 
	 年月
	*/
	public static final String NianYue = "NianYue";
	public static final String IsStar = "IsStar";
}
package bp.ccfast;

import bp.en.*;
import java.util.*;

/** 
 独立运行流程设置 s
*/
public class StandAloneFlows extends EntitiesNoName
{
	/** 
	 独立运行流程设置
	*/
	public StandAloneFlows() {
	}
	/** 
	 得到它的 Entity 
	*/
	@Override
	public Entity getGetNewEntity() {
		return new StandAloneFlow();
	}

		///#region 为了适应自动翻译成java的需要,把实体转换成List.
	/** 
	 转化成 java list,C#不能调用.
	 
	 @return List
	*/
	public final java.util.List<StandAloneFlow> ToJavaList() {
		return (java.util.List<StandAloneFlow>)(Object)this;
	}
	/** 
	 转化成list
	 
	 @return List
	*/
	public final ArrayList<StandAloneFlow> Tolist()  {
		ArrayList<StandAloneFlow> list = new ArrayList<StandAloneFlow>();
		for (int i = 0; i < this.size(); i++)
		{
			list.add((StandAloneFlow)this.get(i));
		}
		return list;
	}

		///#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}

实现思路分析

设计规范

package bp.ccoa;

import bp.da.*;
import bp.web.*;
import bp.en.*;
/** 
 记事本
*/
public class Notepad extends EntityMyPK
{

		///#region 基本属性
	/** 
	 组织编号
	*/
	public final String getOrgNo()
	{
		return this.GetValStrByKey(NotepadAttr.OrgNo);
	}
	public final void setOrgNo(String value)
	 {
		this.SetValByKey(NotepadAttr.OrgNo, value);
	}
	/** 
	 记录人
	*/
	public final String getRec()
	{
		return this.GetValStrByKey(NotepadAttr.Rec);
	}
	public final void setRec(String value)
	 {
		this.SetValByKey(NotepadAttr.Rec, value);
	}
	/** 
	 记录日期
	*/
	public final String getRDT()
	{
		return this.GetValStrByKey(NotepadAttr.RDT);
	}
	public final void setRDT(String value)
	 {
		this.SetValByKey(NotepadAttr.RDT, value);
	}
	/** 
	 年月
	*/
	public final String getNianYue()
	{
		return this.GetValStrByKey(NotepadAttr.NianYue);
	}
	public final void setNianYue(String value)
	 {
		this.SetValByKey(NotepadAttr.NianYue, value);
	}

		///#endregion


		///#region 构造方法
	/** 
	 权限控制
	*/
	@Override
	public UAC getHisUAC() {
		UAC uac = new UAC();
		if (WebUser.getIsAdmin())
		{
			uac.IsUpdate = true;
			return uac;
		}
		return super.getHisUAC();
	}
	/** 
	 记事本
	*/
	public Notepad()  {
	}
	public Notepad(String mypk)throws Exception
	{
		this.setMyPK(mypk);
		this.Retrieve();
	}
	/** 
	 重写基类方法
	*/
	@Override
	public bp.en.Map getEnMap() {
		if (this.get_enMap() != null)
		{
			return this.get_enMap();
		}

		Map map = new Map("OA_Notepad", "记事本");

		map.AddMyPK(true);
		map.AddTBString(NotepadAttr.Name, null, "标题", true, false, 0, 300, 10, true);

		map.AddTBStringDoc(NotepadAttr.Docs, null, "内容", true, false);

		map.AddTBString(NotepadAttr.OrgNo, null, "OrgNo", false, false, 0, 100, 10);
		map.AddTBString(NotepadAttr.Rec, null, "记录人", false, false, 0, 100, 10, true);
		map.AddTBDateTime(NotepadAttr.RDT, null, "记录时间", false, false);
		map.AddTBString(NotepadAttr.NianYue, null, "NianYue", false, false, 0, 10, 10);

		map.AddTBInt(NotepadAttr.IsStar, 0, "是否标星", false, false);



			//RefMethod rm = new RefMethod();
			//rm.Title = "方法参数"; // "设计表单";
			//rm.ClassMethodName = this.ToString() + ".DoParas";
			//rm.Visable = true;
			//rm.refMethodType = RefMethodType.RightFrameOpen;
			//rm.Target = "_blank";
			rm.GroupName = "开发接口";
			  map.AddRefMethod(rm);

			//rm = new RefMethod();
			//rm.Title = "方法内容"; // "设计表单";
			//rm.ClassMethodName = this.ToString() + ".DoDocs";
			//rm.Visable = true;
			//rm.refMethodType = RefMethodType.RightFrameOpen;
			//rm.Target = "_blank";
			rm.GroupName = "开发接口";
			//map.AddRefMethod(rm);

		this.set_enMap(map);
		return this.get_enMap();
	}

		///#endregion


		///#region 执行方法.
	@Override
	protected boolean beforeInsert() throws Exception {
		this.setMyPK(DBAccess.GenerGUID(0, null, null));
		this.setRec(WebUser.getNo());
		this.setRDT(DataType.getCurrentDateTime());

		this.setNianYue(DataType.getCurrentYearMonth());


		return super.beforeInsert();
	}

		///#endregion 执行方法.
}

参考资料和推荐阅读

  1. 暂无

欢迎阅读,各位老铁,如果对你有帮助,点个赞加个关注呗!~
如有侵权,请联系删除之

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

执于代码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值