using System; using BP.DA; using BP.En; using BP.Sys; namespace BP.WF.Template.SFlow { /// /// 子流程模式 /// public enum SubFlowModel { /// /// 下级 /// SubLevel, /// /// 同级 /// SameLevel } /// /// 子流程类型 /// public enum SubFlowType { /// /// 手动的子流程 /// HandSubFlow = 0, /// /// 自动触发的子流程 /// AutoSubFlow = 1, /// /// 延续子流程 /// YanXuFlow = 2 } /// /// 父子流程控件状态 /// public enum FrmSubFlowSta { /// /// 不可用 /// Disable, /// /// 可用 /// Enable, /// /// 只读 /// Readonly } /// /// 父子流程 /// public class FrmSubFlowAttr : EntityNoNameAttr { /// /// 标签 /// public const string SFLab = "SFLab"; /// /// 状态 /// public const string SFSta = "SFSta"; /// /// H /// public const string SF_H = "SF_H"; /// /// 应用类型 /// public const string SFType = "SFType"; /// /// 附件 /// public const string SFAth = "SFAth"; /// /// 显示方式. /// public const string SFShowModel = "SFShowModel"; /// /// 轨迹图是否显示? /// public const string SFTrackEnable = "SFTrackEnable"; /// /// 历史审核信息是否显示? /// public const string SFListEnable = "SFListEnable"; /// /// 是否显示所有的步骤? /// public const string SFIsShowAllStep = "SFIsShowAllStep"; /// /// 默认审核信息 /// public const string SFDefInfo = "SFDefInfo"; /// /// 标题 /// public const string SFCaption = "SFCaption"; /// /// 如果用户未审核是否按照默认意见填充? /// public const string SFIsFullInfo = "SFIsFullInfo"; /// /// 操作名词(审核,审定,审阅,批示) /// public const string SFOpLabel = "SFOpLabel"; /// /// 操作人是否显示数字签名 /// public const string SigantureEnabel = "SigantureEnabel"; /// /// 操作字段 /// public const string SFFields = "SFFields"; /// /// 显示控制方式 /// public const string SFShowCtrl = "SFShowCtrl"; /// /// 查看类型 /// public const string SFOpenType = "SFOpenType"; /// /// 所有子流程完成后父流程自动发送 /// public const string AllSubFlowOverRole = "AllSubFlowOverRole"; } /// /// 父子流程 /// public class FrmSubFlow : Entity { #region 属性 /// /// 标签 /// public string SFLab { get { return this.GetValStringByKey(FrmSubFlowAttr.SFLab); } } /// /// 编号 /// public string No { get { return "ND" + this.NodeID; } set { string nodeID = value.Replace("ND", ""); this.NodeID = int.Parse(nodeID); } } public AllSubFlowOverRole AllSubFlowOverRole { get { return (AllSubFlowOverRole)this.GetValIntByKey(FrmSubFlowAttr.AllSubFlowOverRole); } } /// /// 节点ID /// public int NodeID { get { return this.GetValIntByKey(NodeAttr.NodeID); } set { this.SetValByKey(NodeAttr.NodeID, value); } } /// /// 字段列 /// public string SFFields { get { return this.GetValStringByKey(FrmSubFlowAttr.SFFields); } set { this.SetValByKey(FrmSubFlowAttr.SFFields, value); } } /// /// 状态 /// public FrmSubFlowSta HisFrmSubFlowSta { get { return (FrmSubFlowSta)this.GetValIntByKey(FrmSubFlowAttr.SFSta); } set { this.SetValByKey(FrmSubFlowAttr.SFSta, (int)value); } } /// /// 显示控制方式 /// public SFShowCtrl SFShowCtrl { get { return (SFShowCtrl)this.GetValIntByKey(FrmSubFlowAttr.SFShowCtrl); } set { this.SetValByKey(FrmSubFlowAttr.SFShowCtrl, (int)value); } } /// /// 显示格式(0=表格,1=自由.) /// public FrmWorkShowModel HisFrmWorkShowModel { get { return (FrmWorkShowModel)this.GetValIntByKey(FrmSubFlowAttr.SFShowModel); } set { this.SetValByKey(FrmSubFlowAttr.SFShowModel, (int)value); } } /// /// 控件状态 /// public FrmSubFlowSta SFSta { get { return (FrmSubFlowSta)this.GetValIntByKey(FrmSubFlowAttr.SFSta); } set { this.SetValByKey(FrmSubFlowAttr.SFSta, (int)value); } } /// /// 显示方式 /// public FrmWorkShowModel SFShowModel { get { return (FrmWorkShowModel)this.GetValIntByKey(FrmSubFlowAttr.SFShowModel); } set { this.SetValByKey(FrmSubFlowAttr.SFShowModel, (int)value); } } /// /// 打开类型 /// public int SFOpenType { get { return this.GetValIntByKey(FrmSubFlowAttr.SFOpenType); } set { this.SetValByKey(FrmSubFlowAttr.SFOpenType, value); } } /// /// H /// public float SF_H { get { return this.GetValFloatByKey(FrmSubFlowAttr.SF_H); } set { this.SetValByKey(FrmSubFlowAttr.SF_H, value); } } /// /// 轨迹图是否显示? /// public bool SFTrackEnable { get { return this.GetValBooleanByKey(FrmSubFlowAttr.SFTrackEnable); } set { this.SetValByKey(FrmSubFlowAttr.SFTrackEnable, value); } } /// /// 历史审核信息是否显示? /// public bool SFListEnable { get { return this.GetValBooleanByKey(FrmSubFlowAttr.SFListEnable); } set { this.SetValByKey(FrmSubFlowAttr.SFListEnable, value); } } /// /// 在轨迹表里是否显示所有的步骤? /// public bool SFIsShowAllStep { get { return this.GetValBooleanByKey(FrmSubFlowAttr.SFIsShowAllStep); } set { this.SetValByKey(FrmSubFlowAttr.SFIsShowAllStep, value); } } /// /// 如果用户未审核是否按照默认意见填充? /// public bool SFIsFullInfo { get { return this.GetValBooleanByKey(FrmSubFlowAttr.SFIsFullInfo); } set { this.SetValByKey(FrmSubFlowAttr.SFIsFullInfo, value); } } /// /// 默认审核信息 /// public string SFDefInfo { get { return this.GetValStringByKey(FrmSubFlowAttr.SFDefInfo); } set { this.SetValByKey(FrmSubFlowAttr.SFDefInfo, value); } } /// /// 节点名称. /// public string Name { get { return this.GetValStringByKey("Name"); } } /// /// 标题,如果为空则取节点名称. /// public string SFCaption { get { string str = this.GetValStringByKey(FrmSubFlowAttr.SFCaption); if (str == "") str = "启动子流程"; return str; } set { this.SetValByKey(FrmSubFlowAttr.SFCaption, value); } } /// /// 操作名词(审核,审定,审阅,批示) /// public string SFOpLabel { get { return this.GetValStringByKey(FrmSubFlowAttr.SFOpLabel); } set { this.SetValByKey(FrmSubFlowAttr.SFOpLabel, value); } } /// /// 是否显示数字签名? /// public bool SigantureEnabel { get { return this.GetValBooleanByKey(FrmSubFlowAttr.SigantureEnabel); } set { this.SetValByKey(FrmSubFlowAttr.SigantureEnabel, value); } } #endregion #region 构造方法 /// /// 控制 /// public override UAC HisUAC { get { UAC uac = new UAC(); uac.OpenForSysAdmin(); uac.IsDelete = false; uac.IsInsert = false; return uac; } } /// /// 重写主键 /// public override string PK { get { return "NodeID"; } } /// /// 父子流程 /// public FrmSubFlow() { } /// /// 父子流程 /// /// public FrmSubFlow(string mapData) { if (mapData.Contains("ND") == false) { this.HisFrmSubFlowSta = FrmSubFlowSta.Disable; return; } string mapdata = mapData.Replace("ND", ""); if (DataType.IsNumStr(mapdata) == false) { this.HisFrmSubFlowSta = FrmSubFlowSta.Disable; return; } try { this.NodeID = int.Parse(mapdata); } catch { return; } this.Retrieve(); } /// /// 父子流程 /// /// public FrmSubFlow(int nodeID) { this.NodeID = nodeID; this.Retrieve(); } /// /// EnMap /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("WF_Node", "父子流程"); map.AddGroupAttr("父子流程"); map.AddTBIntPK(NodeAttr.NodeID, 0, "节点ID", true, true); map.AddTBString(NodeAttr.Name, null, "节点名称", true, true, 0, 100, 10); map.AddTBString(FrmSubFlowAttr.SFLab, "子流程", "显示标签", true, false, 0, 200, 10, true); map.AddDDLSysEnum(FrmSubFlowAttr.SFSta,0, "组件状态", true, true, FrmSubFlowAttr.SFSta, "@0=禁用@1=启用@2=只读"); map.SetHelperUrl(FrmSubFlowAttr.SFSta, "https://gitee.com/opencc/JFlow/wikis/pages/preview?sort_id=3982372&doc_id=31094"); map.AddDDLSysEnum(FrmSubFlowAttr.SFShowModel, 0, "显示方式", true, true, FrmSubFlowAttr.SFShowModel, "@0=表格方式@1=自由模式"); //此属性暂时没有用. map.AddDDLSysEnum(FrmSubFlowAttr.SFShowCtrl, 0, "显示控制方式", true, true, FrmSubFlowAttr.SFShowCtrl, "@0=可以看所有的子流程@1=仅仅可以看自己发起的子流程"); //此属性暂时没有用. map.SetHelperAlert(FrmSubFlowAttr.SFShowCtrl, "是对当前节点,一个流程实例下启动的所有子流程的数据权限查看控制。"); map.AddDDLSysEnum(FrmSubFlowAttr.AllSubFlowOverRole, 0, "所有子流程结束规则", true, true, FrmSubFlowAttr.AllSubFlowOverRole, "@0=不处理@1=当前流程自动运行下一步@2=结束当前流程"); map.AddTBString(FrmSubFlowAttr.SFCaption, "启动子流程", "连接标题", true, false, 0, 100, 10, true); map.AddTBString(FrmSubFlowAttr.SFDefInfo, null, "可启动的子流程编号(多个用逗号分开)", false, false, 0, 50, 10, true); map.AddTBString(FrmSubFlowAttr.SFFields, null, "审批格式字段", true, false, 0, 50, 10, true); map.AddDDLSysEnum(FrmSubFlowAttr.SFOpenType, 0, "打开子流程显示", true, true, FrmSubFlowAttr.SFOpenType, "@0=工作查看器@1=流程轨迹"); //此属性暂时没有用. map.SetHelperAlert(FrmSubFlowAttr.SFOpenType, "点击子流程(一个子流程实例)的时候要打开的页面。\t\n1.工作查看器可以看到表单. \t\n2.流程轨迹看到流程运行图,时间轴. "); map.AddTBFloat(FrmSubFlowAttr.SF_H, 300, "高度", true, false); RefMethod rm = new RefMethod(); rm.Title = "手动启动子流程"; rm.ClassMethodName = this.ToString() + ".DoSubFlowHand"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "自动触发子流程"; rm.ClassMethodName = this.ToString() + ".DoSubFlowAuto"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); rm = new RefMethod(); rm.Title = "延续子流程"; rm.ClassMethodName = this.ToString() + ".DoSubFlowYanXu"; rm.RefMethodType = RefMethodType.RightFrameOpen; map.AddRefMethod(rm); this._enMap = map; return this._enMap; } } #endregion #region 子流程。 /// /// 自动触发 /// /// public string DoSubFlowAuto() { return "../../Admin/AttrNode/SubFlow/SubFlowAuto.htm?FK_Node=" + this.NodeID + "&tk=" + new Random().NextDouble(); } /// /// 手动启动子流程 /// /// public string DoSubFlowHand() { return "../../Admin/AttrNode/SubFlow/SubFlowHand.htm?FK_Node=" + this.NodeID + "&tk=" + new Random().NextDouble(); } /// /// 延续子流程 /// /// public string DoSubFlowYanXu() { return "../../Admin/AttrNode/SubFlow/SubFlowYanXu.htm?FK_Node=" + this.NodeID + "&tk=" + new Random().NextDouble(); } #endregion 子流程。 #region 重写方法. protected override bool beforeUpdateInsertAction() { return base.beforeUpdateInsertAction(); } protected override void afterUpdate() { //清空缓存,重新查数据 Node nd = new Node(this.NodeID); nd.RetrieveFromDBSources(); Cash2019.UpdateRow(nd.ToString(), this.NodeID.ToString(), nd.Row); GroupField gf = new GroupField(); if (this.SFSta == FrmSubFlowSta.Disable) { gf.Delete(GroupFieldAttr.CtrlID, "SubFlow" + this.No); } else { if (gf.IsExit(GroupFieldAttr.CtrlID, "SubFlow" + this.No) == false) { gf = new GroupField(); gf.FrmID = "ND" + this.NodeID; gf.CtrlID = "SubFlow" + this.No; gf.CtrlType = GroupCtrlType.SubFlow; gf.Lab = "父子流程组件"; gf.Idx = 0; gf.Insert(); //插入. } } base.afterUpdate(); } #endregion 重写方法. } /// /// 父子流程s /// public class FrmSubFlows : Entities { #region 构造 /// /// 父子流程s /// public FrmSubFlows() { } /// /// 父子流程s /// /// s public FrmSubFlows(string fk_mapdata) { if (BP.Difference.SystemConfig.IsDebug) this.Retrieve("No", fk_mapdata); else this.RetrieveFromCash("No", (object)fk_mapdata); } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new FrmSubFlow(); } } #endregion #region 为了适应自动翻译成java的需要,把实体转换成List /// 转化成 java list,C#不能调用. /// /// List public System.Collections.Generic.IList ToJavaList() { return (System.Collections.Generic.IList)this; } /// /// 转化成list /// /// List public System.Collections.Generic.List Tolist() { System.Collections.Generic.List list = new System.Collections.Generic.List(); for (int i = 0; i < this.Count; i++) { list.Add((FrmSubFlow)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }