/// <summary> /// 生成实体 /// </summary> /// <param name="ds"></param> /// <returns></returns> public GEEntity GenerGEEntityByDataSet(DataSet ds) { // New 它的实例. GEEntity en = this.HisGEEn; // 它的table. DataTable dt = ds.Tables[this.No]; //装载数据. en.Row.LoadDataTable(dt, dt.Rows[0]); // dtls. MapDtls dtls = this.MapDtls; foreach (MapDtl item in dtls) { DataTable dtDtls = ds.Tables[item.No]; GEDtls dtlsEn = new GEDtls(item.No); foreach (DataRow dr in dtDtls.Rows) { // 产生它的Entity data. GEDtl dtl = (GEDtl)dtlsEn.GetNewEntity; dtl.Row.LoadDataTable(dtDtls, dr); //加入这个集合. dtlsEn.AddEntity(dtl); } //加入到他的集合里. en.Dtls.Add(dtDtls); } return(en); }
/// <summary> /// 保存它 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btn_SavePageLoadFull_Click(object sender, EventArgs e) { MapExt me = new MapExt(); me.MyPK = this.FK_MapData + "_" + MapExtXmlList.PageLoadFull; me.FK_MapData = this.FK_MapData; me.ExtType = MapExtXmlList.PageLoadFull; me.RetrieveFromDBSources(); me.Tag = this.Pub1.GetTextBoxByID("TB_" + MapExtAttr.Tag).Text; string sql = ""; MapDtls dtls = new MapDtls(this.FK_MapData); foreach (MapDtl dtl in dtls) { sql += "*" + dtl.No + "=" + this.Pub1.GetTextBoxByID("TB_" + dtl.No).Text; } me.Tag1 = sql; me.MyPK = this.FK_MapData + "_" + MapExtXmlList.PageLoadFull; string info = me.Tag1 + me.Tag; if (string.IsNullOrEmpty(info)) { me.Delete(); } else { me.Save(); } }
protected void Page_Load(object sender, EventArgs e) { MapDtls dtls = new MapDtls("ND" + int.Parse(this.FK_Flow) + "Rpt"); if (dtls.Count == 0) { this.WinCloseWithMsg("该流程下没有从表。"); return; } if (dtls.Count == 1) { this.Response.Redirect("../Comm/Search.aspx?EnsName=" + dtls[0].GetValStrByKey("No"), true); return; } this.Pub1.AddFieldSet("请选择您要查看的从表。"); this.Pub1.AddUL(); foreach (MapDtl dtl in dtls) { this.Pub1.AddLi("../Comm/Search.aspx?EnsName=" + dtls[0].GetValStrByKey("No"), dtl.Name); } this.Pub1.AddULEnd(); this.Pub1.AddFieldSetEnd(); }
void btn_del_Click(object sender, EventArgs e) { MapAttrs attrs = new MapAttrs(); attrs.Retrieve(MapAttrAttr.GroupID, this.RefOID); foreach (MapAttr attr in attrs) { if (attr.HisEditType != EditType.Edit) { continue; } if (attr.KeyOfEn == "FID") { continue; } attr.Delete(); } MapDtls dtls = new MapDtls(); dtls.Retrieve(MapDtlAttr.GroupID, this.RefOID); foreach (MapDtl dtl in dtls) { dtl.Delete(); } GroupField gf = new GroupField(this.RefOID); gf.Delete(); this.WinClose();// ("删除成功。"); }
protected void Btn_Save_Click(object sender, EventArgs e) { MapExt myme = new MapExt(this.MyPK); MapDtls dtls = new MapDtls(myme.FK_MapData); string info = ""; string error = ""; foreach (MapDtl dtl in dtls) { if (this.TB_SQL.Text.Trim() == "") { continue; } info += "$" + dtl.No + ":" + this.TB_SQL.Text; } if (error != "") { throw new Exception("设置错误,请更正:<br/>" + error + ""); } myme.Tag1 = info; myme.Update(); }
public string AutoFullDtlField_Init() { DataSet ds = new DataSet(); // 加载mapext 数据. MapExt me = new MapExt(); int i = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.AutoFullDtlField, MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.AttrOfOper, this.KeyOfEn); if (i == 0) { me.FK_MapData = this.FK_MapData; me.AttrOfOper = this.KeyOfEn; me.FK_DBSrc = "local"; } if (me.FK_DBSrc == "") { me.FK_DBSrc = "local"; } //去掉 ' 号. me.SetValByKey("Doc", me.Doc); DataTable dt = me.ToDataTableField(); dt.TableName = "Sys_MapExt"; ds.Tables.Add(dt); //把从表放入里面. MapDtls dtls = new MapDtls(this.FK_MapData); ds.Tables.Add(dtls.ToDataTableField("Dtls")); //把从表的字段放入. foreach (MapDtl dtl in dtls) { string sql = "SELECT KeyOfEn as \"No\",Name as \"Name\" FROM Sys_MapAttr WHERE FK_MapData='" + dtl.No + "' AND (MyDataType=2 OR MyDataType=3 OR MyDataType=5 OR MyDataType=8) "; sql += " AND KeyOfEn !='OID' AND KeyOfEn!='FID' AND KeyOfEn!='RefPK' "; //把从表增加里面去. DataTable mydt = DBAccess.RunSQLReturnTable(sql); mydt.TableName = dtl.No; ds.Tables.Add(mydt); } //把主表的字段放入 string mainsql = "SELECT KeyOfEn as \"No\",Name as \"Name\" FROM Sys_MapAttr WHERE FK_MapData='" + this.FK_MapData + "' AND MyDataType=1 AND UIIsEnable = 0 "; mainsql += " AND KeyOfEn !='OID' AND KeyOfEn!='FID' AND KeyOfEn!='WorkID' AND KeyOfEn!='NodeID' AND KeyOfEn!='RefPK' AND KeyOfEn!='RDT' AND KeyOfEn!='Rec' "; //把从表增加里面去. DataTable maindt = DBAccess.RunSQLReturnTable(mainsql); maindt.TableName = "main_Attr"; ds.Tables.Add(maindt); return(BP.Tools.Json.ToJson(ds)); }
public string TBFullCtrlDtl_Save() { MapDtls dtls = new MapDtls(this.FK_MapData); MapExt me = new MapExt(this.MyPK); string str = ""; foreach (MapDtl dtl in dtls) { string sql = this.GetRequestVal("TB_" + dtl.No); sql = sql.Trim(); if (sql == "" || sql == null) { continue; } if (sql.Contains("@Key") == false) { return("err@在配置从表:" + dtl.No + " sql填写错误, 必须包含@Key列, @Key就是当前文本框输入的值. "); } str += "$" + dtl.No + ":" + sql; } me.Tag1 = str; me.Update(); return("保存成功."); }
void mybtn_SaveAutoFullDtl_Click(object sender, EventArgs e) { var btn = sender as LinkBtn; if (btn.ID == NamesOfBtn.Cancel) { this.Response.Redirect("TBFullCtrl.aspx?FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&MyPK=" + this.MyPK + "&RefNo=" + this.RefNo, true); return; } MapExt myme = new MapExt(this.MyPK); MapDtls dtls = new MapDtls(myme.FK_MapData); string info = ""; string error = ""; foreach (MapDtl dtl in dtls) { TextBox tb = this.Pub1.GetTextBoxByID("TB_" + dtl.No); if (tb.Text.Trim() == "") { continue; } try { //DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(tb.Text); //MapAttrs attrs = new MapAttrs(dtl.No); //string err = ""; //foreach (DataColumn dc in dt.Columns) //{ // if (attrs.IsExits(MapAttrAttr.KeyOfEn, dc.ColumnName) == false) // { // err += "<br>列" + dc.ColumnName + "不能与从表 属性匹配."; // } //} //if (err != "") //{ // error += "在为("+dtl.Name+")检查sql设置时出现错误:"+err; //} } catch (Exception ex) { this.Alert("SQL ERROR: " + ex.Message); return; } info += "$" + dtl.No + ":" + tb.Text; } if (error != "") { this.Pub1.AddEasyUiPanelInfo("错误", "设置错误,请更正:<br />" + error, "icon-no"); //this.Pub1.AddMsgOfWarning("设置错误,请更正:", error); return; } myme.Tag1 = info; myme.Update(); this.Response.Redirect("TBFullCtrl.aspx?FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&MyPK=" + this.MyPK + "&RefNo=" + this.RefNo, true); }
/// <summary> /// 删除主表数据也要删除它的明细数据 /// </summary> protected override void afterDelete() { MapDtls dtls = this.HisNode.MapData.MapDtls; foreach (MapDtl dtl in dtls) { DBAccess.RunSQL("DELETE " + dtl.PTable + " WHERE RefPK=" + this.OID); } base.afterDelete(); }
/// <summary> /// 填充从表 /// </summary> /// <returns></returns> public string TBFullCtrlDtl_Init() { MapExt me = new MapExt(this.MyPK); string[] strs = me.Tag1.Split('$'); // 格式为: $ND101Dtl2:SQL. MapDtls dtls = new MapDtls(); dtls.Retrieve(MapDtlAttr.FK_MapData, me.FK_MapData); foreach (string str in strs) { if (DataType.IsNullOrEmpty(str) || str.Contains(":") == false) { continue; } string[] kvs = str.Split(':'); string fk_mapdtl = kvs[0]; string sql = kvs[1]; foreach (MapDtl dtl in dtls) { if (dtl.No != fk_mapdtl) { continue; } dtl.MTR = sql.Trim(); } } foreach (MapDtl dtl in dtls) { string cols = ""; MapAttrs attrs = new MapAttrs(dtl.No); foreach (MapAttr item in attrs) { if (item.KeyOfEn == "OID" || item.KeyOfEn == "RefPKVal" || item.KeyOfEn == "RefPK") { continue; } cols += item.KeyOfEn + ","; } dtl.Alias = cols; //把ptable作为一个数据参数. } return(dtls.ToJson()); }
private string GetChildDtlCount(string fk_flow, string fk_node) { FrmNodes fns = new FrmNodes(fk_flow, int.Parse(fk_node)); List <TempEntity> list = new List <TempEntity>(); foreach (FrmNode fn in fns) { MapDtls mdtls = new MapDtls(fn.FK_Frm); foreach (MapDtl single in mdtls) { list.Add(new TempEntity() { Name = single.PTable }); } } return(JsonConvert.SerializeObject(list)); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { MapExt myme = new MapExt(this.MyPK); MapDtls dtls = new MapDtls(myme.FK_MapData); string[] strs = myme.Tag1.Split('$'); foreach (MapDtl dtl in dtls) { foreach (string s in strs) { if (s == null) { continue; } if (s.Contains(dtl.No + ":") == false) { continue; } string[] ss = s.Split(':'); this.TB_SQL.Text = ss[1]; } this.LabNo.Text = dtl.No; //编号显示 this.LabName.Text = dtl.Name; //名称显示 MapAttrs attrs = new MapAttrs(dtl.No); foreach (MapAttr item in attrs) { if (item.KeyOfEn == "OID" || item.KeyOfEn == "RefPKVal") { continue; } this.LabZD.Text += item.KeyOfEn + ",";//可填充的字段显示 } } } }
/// <summary> /// 执行旧版本的兼容性检查. /// </summary> public string DoCheckFixFrmForUpdateVer() { // 更新状态. DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlType='' WHERE CtrlType IS NULL"); DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL"); DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL"); //删除重影数据. DBAccess.RunSQL("DELETE FROM Sys_GroupField WHERE CtrlType='FWC' and CTRLID is null"); //一直遇到遇到自动变长的问题, 强制其修复过来. DBAccess.RunSQL("UPDATE Sys_Mapattr SET colspan=3 WHERE UIHeight<=38 AND colspan=4"); string str = ""; //处理失去分组的字段. string sql = "SELECT MyPK FROM Sys_MapAttr WHERE FK_MapData='" + this.No + "' AND GroupID NOT IN (SELECT OID FROM Sys_GroupField WHERE FrmID='" + this.No + "' AND ( CtrlType='' OR CtrlType IS NULL) ) OR GroupID IS NULL "; MapAttrs attrs = new MapAttrs(); attrs.RetrieveInSQL(sql); if (attrs.Count != 0) { GroupField gf = null; GroupFields gfs = new GroupFields(this.No); foreach (GroupField mygf in gfs) { if (mygf.CtrlID == "") { gf = mygf; } } if (gf == null) { gf = new GroupField(); gf.Lab = "基本信息"; gf.FrmID = this.No; gf.Insert(); } //设置GID. foreach (MapAttr attr in attrs) { attr.Update(MapAttrAttr.GroupID, gf.OID); } } //从表. MapDtls dtls = new MapDtls(this.No); foreach (MapDtl dtl in dtls) { GroupField gf = new GroupField(); int i = gf.Retrieve(GroupFieldAttr.CtrlID, dtl.No, GroupFieldAttr.FrmID, this.No); if (i == 1) { continue; } //GroupField gf = new GroupField(); //if (gf.IsExit(GroupFieldAttr.CtrlID, dtl.No) == true && !DataType.IsNullOrEmpty(gf.CtrlType)) // continue; gf.Lab = dtl.Name; gf.CtrlID = dtl.No; gf.CtrlType = "Dtl"; gf.FrmID = dtl.FK_MapData; gf.DirectSave(); str += "@为从表" + dtl.Name + " 增加了分组."; } // 框架. MapFrames frams = new MapFrames(this.No); foreach (MapFrame fram in frams) { GroupField gf = new GroupField(); int i = gf.Retrieve(GroupFieldAttr.CtrlID, fram.MyPK, GroupFieldAttr.FrmID, this.No); if (i == 1) { continue; } gf.Lab = fram.Name; gf.CtrlID = fram.MyPK; gf.CtrlType = "Frame"; gf.EnName = fram.FK_MapData; gf.Insert(); str += "@为框架 " + fram.Name + " 增加了分组."; } // 附件. FrmAttachments aths = new FrmAttachments(this.No); foreach (FrmAttachment ath in aths) { if (ath.IsVisable == false) { continue; } GroupField gf = new GroupField(); int i = gf.Retrieve(GroupFieldAttr.CtrlID, ath.MyPK, GroupFieldAttr.FrmID, this.No); if (i == 1) { continue; } gf.Lab = ath.Name; gf.CtrlID = ath.MyPK; gf.CtrlType = "Ath"; gf.FrmID = ath.FK_MapData; gf.Insert(); str += "@为附件 " + ath.Name + " 增加了分组."; } if (this.IsNodeFrm == true) { FrmNodeComponent conn = new FrmNodeComponent(this.NodeID); conn.Update(); } //删除重复的数据, 比如一个从表显示了多个分组里. 增加此部分. if (SystemConfig.AppCenterDBType == DBType.Oracle) { sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) WHERE Num > 1"; } else { sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) AS A WHERE A.Num > 1"; } DataTable dt = DBAccess.RunSQLReturnTable(sql); foreach (DataRow dr in dt.Rows) { string enName = dr[0].ToString(); string ctrlID = dr[1].ToString(); string ctrlType = dr[2].ToString(); GroupFields gfs = new GroupFields(); gfs.Retrieve(GroupFieldAttr.FrmID, enName, GroupFieldAttr.CtrlID, ctrlID, GroupFieldAttr.CtrlType, ctrlType); if (gfs.Count <= 1) { continue; } foreach (GroupField gf in gfs) { gf.Delete(); //删除其中的一个. break; } } if (str == "") { return("检查成功."); } return(str + ", @@@ 检查成功。"); }
/// <summary> /// 递归删除两个节点之间的数据 /// </summary> /// <param name="nds">到达的节点集合</param> public void DeleteToNodesData(Nodes nds) { /*开始遍历到达的节点集合*/ foreach (Node nd in nds) { Work wk = nd.HisWork; wk.OID = this.WorkID; if (wk.Delete() == 0) { wk.FID = this.WorkID; if (wk.Delete(WorkAttr.FID, this.WorkID) == 0) { continue; } } #region 除当前节点数据,删除附件信息。 // 删除明细表信息。 MapDtls dtls = new MapDtls("ND" + nd.NodeID); foreach (MapDtl dtl in dtls) { ps = new Paras(); ps.SQL = "DELETE " + dtl.PTable + " WHERE RefPK=" + dbStr + "WorkID"; ps.Add("WorkID", this.WorkID.ToString()); BP.DA.DBAccess.RunSQL(ps); } // 删除表单附件信息。 BP.DA.DBAccess.RunSQL("DELETE FROM Sys_FrmAttachmentDB WHERE RefPKVal=" + dbStr + "WorkID AND FK_MapData=" + dbStr + "FK_MapData ", "WorkID", this.WorkID.ToString(), "FK_MapData", "ND" + nd.NodeID); // 删除签名信息。 BP.DA.DBAccess.RunSQL("DELETE FROM Sys_FrmEleDB WHERE RefPKVal=" + dbStr + "WorkID AND FK_MapData=" + dbStr + "FK_MapData ", "WorkID", this.WorkID.ToString(), "FK_MapData", "ND" + nd.NodeID); #endregion 除当前节点数据。 /*说明:已经删除该节点数据。*/ DBAccess.RunSQL("DELETE WF_GenerWorkerList WHERE (WorkID=" + dbStr + "WorkID1 OR FID=" + dbStr + "WorkID2 ) AND FK_Node=" + dbStr + "FK_Node", "WorkID1", this.WorkID, "WorkID2", this.WorkID, "FK_Node", nd.NodeID); if (nd.IsFL) { /* 如果是分流 */ GenerWorkerLists wls = new GenerWorkerLists(); QueryObject qo = new QueryObject(wls); qo.AddWhere(GenerWorkerListAttr.FID, this.WorkID); qo.addAnd(); string[] ndsStrs = nd.HisToNDs.Split('@'); string inStr = ""; foreach (string s in ndsStrs) { if (s == "" || s == null) { continue; } inStr += "'" + s + "',"; } inStr = inStr.Substring(0, inStr.Length - 1); if (inStr.Contains(",") == true) { qo.AddWhere(GenerWorkerListAttr.FK_Node, int.Parse(inStr)); } else { qo.AddWhereIn(GenerWorkerListAttr.FK_Node, "(" + inStr + ")"); } qo.DoQuery(); foreach (GenerWorkerList wl in wls) { Node subNd = new Node(wl.FK_Node); Work subWK = subNd.GetWork(wl.WorkID); subWK.Delete(); //删除分流下步骤的节点信息. DeleteToNodesData(subNd.HisToNodes); } DBAccess.RunSQL("DELETE WF_GenerWorkFlow WHERE FID=" + dbStr + "WorkID", "WorkID", this.WorkID); DBAccess.RunSQL("DELETE WF_GenerWorkerList WHERE FID=" + dbStr + "WorkID", "WorkID", this.WorkID); DBAccess.RunSQL("DELETE WF_GenerFH WHERE FID=" + dbStr + "WorkID", "WorkID", this.WorkID); } DeleteToNodesData(nd.HisToNodes); } }
/// <summary> /// 合流点向子线程退回 /// </summary> private string ExeReturn3_4() { GenerWorkFlow gwf = new GenerWorkFlow(this.WorkID); gwf.FK_Node = this.ReurnToNode.NodeID; gwf.WFState = WFState.Runing; gwf.Update(); string info = "@工作已经成功的退回到(" + ReurnToNode.Name + ")退回给:"; GenerWorkerLists gwls = new GenerWorkerLists(); gwls.Retrieve(GenerWorkerListAttr.WorkID, this.WorkID, GenerWorkerListAttr.FK_Node, this.ReurnToNode.NodeID); string toEmp = ""; string toEmpName = ""; foreach (GenerWorkerList item in gwls) { item.IsPass = false; item.IsRead = false; item.Update(); info += item.FK_Emp + "," + item.FK_EmpText; toEmp = item.FK_Emp; toEmpName = item.FK_EmpText; } //删除已经发向合流点的汇总数据. MapDtls dtls = new MapDtls("ND" + this.HisNode.NodeID); foreach (MapDtl dtl in dtls) { /*如果是合流数据*/ if (dtl.IsHLDtl) { BP.DA.DBAccess.RunSQL("DELETE " + dtl.PTable + " WHERE OID=" + this.WorkID); } } // 记录退回轨迹。 ReturnWork rw = new ReturnWork(); rw.WorkID = this.WorkID; rw.ReturnToNode = this.ReurnToNode.NodeID; rw.ReturnNodeName = this.ReurnToNode.Name; rw.ReturnNode = this.HisNode.NodeID; // 当前退回节点. rw.ReturnToEmp = toEmp; //退回给。 rw.MyPK = DBAccess.GenerOIDByGUID().ToString(); rw.Note = Msg; rw.IsBackTracking = this.IsBackTrack; rw.Insert(); // 加入track. this.AddToTrack(ActionType.Return, toEmp, toEmpName, this.ReurnToNode.NodeID, this.ReurnToNode.Name, Msg); // 返回退回信息. return(info); }
/// <summary> /// 仅获取表单数据 /// </summary> /// <param name="frmID">表单ID</param> /// <param name="pkval">主键</param> /// <param name="atParas">参数</param> /// <param name="specDtlFrmID">指定明细表的参数,如果为空就标识主表数据,否则就是从表数据.</param> /// <returns>数据</returns> public static DataSet GenerDBForVSTOExcelFrmModel(string frmID, object pkval, string atParas, string specDtlFrmID = null) { //如果是一个实体类. if (frmID.Contains("BP.")) { // 执行map同步. Entities ens = BP.En.ClassFactory.GetEns(frmID + "s"); Entity en = ens.GetNewEntity; en.DTSMapToSys_MapData(); return(GenerDBForVSTOExcelFrmModelOfEntity(frmID, pkval, atParas, specDtlFrmID = null)); //上面这行代码的解释(2017-04-25): //若不加上这行,代码执行到“ MapData md = new MapData(frmID); ”会报错: //@没有找到记录[表单注册表 Sys_MapData, [ 主键=No 值=BP.LI.BZQX ]记录不存在,请与管理员联系, 或者确认输入错误.@在Entity(BP.Sys.MapData)查询期间出现错误@ 在 BP.En.Entity.Retrieve() 位置 D:\ccflow\Components\BP.En30\En\Entity.cs:行号 1051 //即使加上: //frmID = frmID.Substring(0, frmID.Length - 1); //也会出现该问题 //2017-04-25 15:26:34:new MapData(frmID)应传入“BZQX”,但考虑到 GenerDBForVSTOExcelFrmModelOfEntity()运行稳定,暂不采用『统一执行下方代码』的方案。 } //数据容器,就是要返回的对象. DataSet myds = new DataSet(); //映射实体. MapData md = new MapData(frmID); //实体. GEEntity wk = new GEEntity(frmID); wk.OID = int.Parse(pkval.ToString()); if (wk.RetrieveFromDBSources() == 0) { wk.Insert(); } //加载事件. md.DoEvent(FrmEventList.FrmLoadBefore, wk, null); //把参数放入到 En 的 Row 里面。 if (DataType.IsNullOrEmpty(atParas) == false) { AtPara ap = new AtPara(atParas); foreach (string key in ap.HisHT.Keys) { if (wk.Row.ContainsKey(key) == true) //有就该变. { wk.Row[key] = ap.GetValStrByKey(key); } else { wk.Row.Add(key, ap.GetValStrByKey(key)); //增加他. } } } //属性. MapExt me = null; DataTable dtMapAttr = null; MapExts mes = null; #region 表单模版信息.(含主、从表的,以及从表的枚举/外键相关数据). //增加表单字段描述. string sql = "SELECT * FROM Sys_MapData WHERE No='" + frmID + "' "; DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql); dt.TableName = "Sys_MapData"; myds.Tables.Add(dt); //增加表单字段描述. sql = "SELECT * FROM Sys_MapAttr WHERE FK_MapData='" + frmID + "' "; dt = BP.DA.DBAccess.RunSQLReturnTable(sql); dt.TableName = "Sys_MapAttr"; myds.Tables.Add(dt); //增加从表信息. sql = "SELECT * FROM Sys_MapDtl WHERE FK_MapData='" + frmID + "' "; dt = BP.DA.DBAccess.RunSQLReturnTable(sql); dt.TableName = "Sys_MapDtl"; myds.Tables.Add(dt); //主表的配置信息. sql = "SELECT * FROM Sys_MapExt WHERE FK_MapData='" + frmID + "'"; dt = BP.DA.DBAccess.RunSQLReturnTable(sql); dt.TableName = "Sys_MapExt"; myds.Tables.Add(dt); #region 加载 从表表单模版信息.(含 从表的枚举/外键相关数据) foreach (MapDtl item in md.MapDtls) { #region 返回指定的明细表的数据. if (DataType.IsNullOrEmpty(specDtlFrmID) == true) { } else { if (item.No != specDtlFrmID) { continue; } } #endregion 返回指定的明细表的数据. //明细表的主表描述 sql = "SELECT * FROM Sys_MapDtl WHERE No='" + item.No + "'"; dt = BP.DA.DBAccess.RunSQLReturnTable(sql); dt.TableName = "Sys_MapDtl_For_" + (string.IsNullOrWhiteSpace(item.Alias) ? item.No : item.Alias); myds.Tables.Add(dt); //明细表的表单描述 sql = "SELECT * FROM Sys_MapAttr WHERE FK_MapData='" + item.No + "'"; dtMapAttr = BP.DA.DBAccess.RunSQLReturnTable(sql); dtMapAttr.TableName = "Sys_MapAttr_For_" + (string.IsNullOrWhiteSpace(item.Alias) ? item.No : item.Alias); myds.Tables.Add(dtMapAttr); //明细表的配置信息. sql = "SELECT * FROM Sys_MapExt WHERE FK_MapData='" + item.No + "'"; dt = BP.DA.DBAccess.RunSQLReturnTable(sql); dt.TableName = "Sys_MapExt_For_" + (string.IsNullOrWhiteSpace(item.Alias) ? item.No : item.Alias); myds.Tables.Add(dt); #region 从表的 外键表/枚举 mes = new MapExts(item.No); foreach (DataRow dr in dtMapAttr.Rows) { string lgType = dr["LGType"].ToString(); //不是枚举/外键字段 if (lgType.Equals("0")) { continue; } string uiBindKey = dr["UIBindKey"].ToString(); var mypk = dr["MyPK"].ToString(); #region 枚举字段 if (lgType.Equals("1")) { // 如果是枚举值, 判断是否存在. if (myds.Tables.Contains(uiBindKey) == true) { continue; } string mysql = "SELECT IntKey AS No, Lab as Name FROM Sys_Enum WHERE EnumKey='" + uiBindKey + "' ORDER BY IntKey "; DataTable dtEnum = DBAccess.RunSQLReturnTable(mysql); dtEnum.TableName = uiBindKey; myds.Tables.Add(dtEnum); continue; } #endregion string UIIsEnable = dr["UIIsEnable"].ToString(); if (UIIsEnable.Equals("0")) //字段未启用 { continue; } #region 外键字段 // 检查是否有下拉框自动填充。 string keyOfEn = dr["KeyOfEn"].ToString(); #region 处理下拉框数据范围. for 小杨. me = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.AutoFullDLL, MapExtAttr.AttrOfOper, keyOfEn) as MapExt; if (me != null) //有范围限制时 { string fullSQL = me.Doc.Clone() as string; fullSQL = fullSQL.Replace("~", ","); fullSQL = BP.WF.Glo.DealExp(fullSQL, wk, null); dt = DBAccess.RunSQLReturnTable(fullSQL); dt.TableName = mypk; myds.Tables.Add(dt); continue; } #endregion 处理下拉框数据范围. else //无范围限制时 { // 判断是否存在. if (myds.Tables.Contains(uiBindKey) == true) { continue; } myds.Tables.Add(BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey)); } #endregion 外键字段 } #endregion 从表的 外键表/枚举 } #endregion 加载 从表表单模版信息.(含 从表的枚举/外键相关数据) #endregion 表单模版信息.(含主、从表的,以及从表的枚举/外键相关数据). #region 主表数据 if (BP.Sys.SystemConfig.IsBSsystem == true) { // 处理传递过来的参数。 foreach (string k in System.Web.HttpContext.Current.Request.QueryString.AllKeys) { wk.SetValByKey(k, System.Web.HttpContext.Current.Request.QueryString[k]); } } // 执行表单事件.. string msg = md.DoEvent(FrmEventList.FrmLoadBefore, wk); if (DataType.IsNullOrEmpty(msg) == false) { throw new Exception("err@错误:" + msg); } //重设默认值. wk.ResetDefaultVal(); //执行装载填充. me = new MapExt(); if (me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.PageLoadFull, MapExtAttr.FK_MapData, frmID) == 1) { //执行通用的装载方法. MapAttrs attrs = new MapAttrs(frmID); MapDtls dtls = new MapDtls(frmID); wk = BP.WF.Glo.DealPageLoadFull(wk, me, attrs, dtls) as GEEntity; } //增加主表数据. DataTable mainTable = wk.ToDataTableField(md.No); mainTable.TableName = "MainTable"; myds.Tables.Add(mainTable); #endregion 主表数据 #region 从表数据 foreach (MapDtl dtl in md.MapDtls) { #region 返回指定的明细表的数据. if (DataType.IsNullOrEmpty(specDtlFrmID) == true) { } else { if (dtl.No != specDtlFrmID) { continue; } } #endregion 返回指定的明细表的数据. GEDtls dtls = new GEDtls(dtl.No); QueryObject qo = null; try { qo = new QueryObject(dtls); switch (dtl.DtlOpenType) { case DtlOpenType.ForEmp: // 按人员来控制. qo.AddWhere(GEDtlAttr.RefPK, pkval); qo.addAnd(); qo.AddWhere(GEDtlAttr.Rec, WebUser.No); break; case DtlOpenType.ForWorkID: // 按工作ID来控制 qo.AddWhere(GEDtlAttr.RefPK, pkval); break; case DtlOpenType.ForFID: // 按流程ID来控制. qo.AddWhere(GEDtlAttr.FID, pkval); break; } } catch { dtls.GetNewEntity.CheckPhysicsTable(); } //条件过滤. if (dtl.FilterSQLExp != "") { string[] strs = dtl.FilterSQLExp.Split('='); qo.addAnd(); qo.AddWhere(strs[0], strs[1]); } //从表 DataTable dtDtl = qo.DoQueryToTable(); // 为明细表设置默认值. MapAttrs dtlAttrs = new MapAttrs(dtl.No); foreach (MapAttr attr in dtlAttrs) { //处理它的默认值. if (attr.DefValReal.Contains("@") == false) { continue; } foreach (DataRow dr in dtDtl.Rows) { dr[attr.KeyOfEn] = attr.DefVal; } } dtDtl.TableName = string.IsNullOrWhiteSpace(dtl.Alias) ? dtl.No : dtl.Alias; //edited by liuxc,2017-10-10.如果有别名,则使用别名,没有则使用No myds.Tables.Add(dtDtl); //加入这个明细表, 如果没有数据,xml体现为空. } #endregion 从表数据 #region 主表的 外键表/枚举 dtMapAttr = myds.Tables["Sys_MapAttr"]; mes = md.MapExts; foreach (DataRow dr in dtMapAttr.Rows) { string uiBindKey = dr["UIBindKey"].ToString(); string myPK = dr["MyPK"].ToString(); string lgType = dr["LGType"].ToString(); if (lgType.Equals("1")) { // 如果是枚举值, 判断是否存在., if (myds.Tables.Contains(uiBindKey) == true) { continue; } string mysql = "SELECT IntKey AS No, Lab as Name FROM Sys_Enum WHERE EnumKey='" + uiBindKey + "' ORDER BY IntKey "; DataTable dtEnum = DBAccess.RunSQLReturnTable(mysql); dtEnum.TableName = uiBindKey; myds.Tables.Add(dtEnum); continue; } if (lgType.Equals("2") == false) { continue; } string UIIsEnable = dr["UIIsEnable"].ToString(); if (UIIsEnable.Equals("0")) { continue; } // 检查是否有下拉框自动填充。 string keyOfEn = dr["KeyOfEn"].ToString(); string fk_mapData = dr["FK_MapData"].ToString(); #region 处理下拉框数据范围. for 小杨. me = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.AutoFullDLL, MapExtAttr.AttrOfOper, keyOfEn) as MapExt; if (me != null) { string fullSQL = me.Doc.Clone() as string; fullSQL = fullSQL.Replace("~", ","); fullSQL = BP.WF.Glo.DealExp(fullSQL, wk, null); dt = DBAccess.RunSQLReturnTable(fullSQL); dt.TableName = myPK; //可能存在隐患,如果多个字段,绑定同一个表,就存在这样的问题. myds.Tables.Add(dt); continue; } #endregion 处理下拉框数据范围. dt = BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey); dt.TableName = uiBindKey; myds.Tables.Add(dt); } #endregion 主表的 外键表/枚举 //返回生成的dataset. return(myds); }
/// <summary> /// 产生一个WorkNode /// </summary> /// <param name="fk_flow">流程编号</param> /// <param name="fk_node">节点ID</param> /// <param name="workID">工作ID</param> /// <param name="fid">FID</param> /// <param name="userNo">用户编号</param> /// <returns>返回dataset</returns> public static DataSet GenerWorkNode(string fk_flow, int fk_node, Int64 workID, Int64 fid, string userNo, string fromWorkOpt = "0") { //节点. if (fk_node == 0) { fk_node = int.Parse(fk_flow + "01"); } if (workID == 0) { workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow, null, null, userNo, null); } Node nd = new Node(fk_node); try { nd.WorkID = workID; //为获取表单ID提供参数. MapData md = new MapData(); md.No = nd.NodeFrmID; if (md.RetrieveFromDBSources() == 0) { throw new Exception("装载错误,该表单ID=" + md.No + "丢失,请修复一次流程重新加载一次."); } Work wk = nd.HisWork; wk.OID = workID; wk.RetrieveFromDBSources(); wk.ResetDefaultVal(); // 第1.2: 调用,处理用户定义的业务逻辑. string sendWhen = nd.HisFlow.DoFlowEventEntity(EventListOfNode.FrmLoadBefore, nd, wk, null); //获得表单模版. DataSet myds = BP.Sys.CCFormAPI.GenerHisDataSet(md.No, nd.Name); //移除MapAttr myds.Tables.Remove("Sys_MapAttr"); //移除. //获取表单的mapAttr //求出集合. MapAttrs mattrs = new MapAttrs(md.No); if (fk_node != null) { /*处理表单权限控制方案*/ FrmNode frmNode = new FrmNode(); int count = frmNode.Retrieve(FrmNodeAttr.FK_Frm, md.No, FrmNodeAttr.FK_Node, fk_node); if (count != 0 && frmNode.FrmSln != 0) { FrmFields fls = new FrmFields(md.No, frmNode.FK_Node); foreach (FrmField item in fls) { foreach (MapAttr attr in mattrs) { if (attr.KeyOfEn != item.KeyOfEn) { continue; } if (item.IsSigan) { item.UIIsEnable = false; } attr.UIIsEnable = item.UIIsEnable; attr.UIVisible = item.UIVisible; attr.IsSigan = item.IsSigan; attr.DefValReal = item.DefVal; } } } } DataTable Sys_MapAttr = mattrs.ToDataTableField("Sys_MapAttr"); myds.Tables.Add(Sys_MapAttr); //把流程信息表发送过去. GenerWorkFlow gwf = new GenerWorkFlow(); gwf.WorkID = workID; gwf.RetrieveFromDBSources(); //加入WF_Node. DataTable WF_Node = nd.ToDataTableField("WF_Node"); myds.Tables.Add(WF_Node); #region 加入组件的状态信息, 在解析表单的时候使用. BP.WF.Template.FrmNodeComponent fnc = new FrmNodeComponent(nd.NodeID); nd.WorkID = workID; //为获取表单ID提供参数. if (nd.NodeFrmID != "ND" + nd.NodeID && nd.HisFormType != NodeFormType.RefOneFrmTree) { /*说明这是引用到了其他节点的表单,就需要把一些位置元素修改掉.*/ int refNodeID = int.Parse(nd.NodeFrmID.Replace("ND", "")); BP.WF.Template.FrmNodeComponent refFnc = new FrmNodeComponent(refNodeID); fnc.SetValByKey(FrmWorkCheckAttr.FWC_H, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_H)); fnc.SetValByKey(FrmWorkCheckAttr.FWC_W, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_W)); fnc.SetValByKey(FrmWorkCheckAttr.FWC_X, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_X)); fnc.SetValByKey(FrmWorkCheckAttr.FWC_Y, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_Y)); if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_H) <= 10) { fnc.SetValByKey(FrmWorkCheckAttr.FWC_H, 500); } if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_W) <= 10) { fnc.SetValByKey(FrmWorkCheckAttr.FWC_W, 600); } if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_X) <= 10) { fnc.SetValByKey(FrmWorkCheckAttr.FWC_X, 200); } if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_Y) <= 10) { fnc.SetValByKey(FrmWorkCheckAttr.FWC_Y, 200); } fnc.SetValByKey(FrmSubFlowAttr.SF_H, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_H)); fnc.SetValByKey(FrmSubFlowAttr.SF_W, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_W)); fnc.SetValByKey(FrmSubFlowAttr.SF_X, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_X)); fnc.SetValByKey(FrmSubFlowAttr.SF_Y, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_Y)); fnc.SetValByKey(FrmThreadAttr.FrmThread_H, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_H)); fnc.SetValByKey(FrmThreadAttr.FrmThread_W, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_W)); fnc.SetValByKey(FrmThreadAttr.FrmThread_X, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_X)); fnc.SetValByKey(FrmThreadAttr.FrmThread_Y, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_Y)); fnc.SetValByKey(FrmTrackAttr.FrmTrack_H, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_H)); fnc.SetValByKey(FrmTrackAttr.FrmTrack_W, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_W)); fnc.SetValByKey(FrmTrackAttr.FrmTrack_X, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_X)); fnc.SetValByKey(FrmTrackAttr.FrmTrack_Y, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_Y)); fnc.SetValByKey(FTCAttr.FTC_H, refFnc.GetValFloatByKey(FTCAttr.FTC_H)); fnc.SetValByKey(FTCAttr.FTC_W, refFnc.GetValFloatByKey(FTCAttr.FTC_W)); fnc.SetValByKey(FTCAttr.FTC_X, refFnc.GetValFloatByKey(FTCAttr.FTC_X)); fnc.SetValByKey(FTCAttr.FTC_Y, refFnc.GetValFloatByKey(FTCAttr.FTC_Y)); #region 没有审核组件分组就增加上审核组件分组. @杜需要翻译&测试. if (md.HisFrmType == FrmType.FoolForm) { //判断是否是傻瓜表单,如果是,就要判断该傻瓜表单是否有审核组件groupfield ,没有的话就增加上. DataTable gf = myds.Tables["Sys_GroupField"]; bool isHave = false; foreach (DataRow dr in gf.Rows) { string cType = dr["CtrlType"] as string; if (cType == null) { continue; } if (cType.Equals("FWC") == true) { isHave = true; } } if (isHave == false) { DataRow dr = gf.NewRow(); nd.WorkID = workID; //为获取表单ID提供参数. dr[GroupFieldAttr.OID] = 100; dr[GroupFieldAttr.FrmID] = nd.NodeFrmID; dr[GroupFieldAttr.CtrlType] = "FWC"; dr[GroupFieldAttr.CtrlID] = "FWCND" + nd.NodeID; dr[GroupFieldAttr.Idx] = 100; dr[GroupFieldAttr.Lab] = "审核信息"; gf.Rows.Add(dr); myds.Tables.Remove("Sys_GroupField"); myds.Tables.Add(gf); //执行更新,就自动生成那个丢失的字段分组. refFnc.Update(); /* * //丢失了就插入新的. * BP.Sys.GroupField gfEn = new GroupField(); * gfEn.FrmID = nd.NodeFrmID; * gfEn.CtrlType = "FWC"; * gfEn.CtrlID = "FWCND" + nd.NodeID; * gfEn.Idx = 100; * gfEn.Lab = "审核信息"; * gfEn.Insert(); */ } } #endregion 没有审核组件分组就增加上审核组件分组. } #region 没有审核组件分组就增加上审核组件分组. @杜需要翻译&测试. if (nd.NodeFrmID == "ND" + nd.NodeID && nd.HisFormType != NodeFormType.RefOneFrmTree) { // Work wk1 = nd.HisWork; if (nd.FormType == NodeFormType.FoolForm) { //判断是否是傻瓜表单,如果是,就要判断该傻瓜表单是否有审核组件groupfield ,没有的话就增加上. DataTable gf = myds.Tables["Sys_GroupField"]; bool isHave = false; foreach (DataRow dr in gf.Rows) { string cType = dr["CtrlType"] as string; if (cType == null) { continue; } if (cType.Equals("FWC") == true) { isHave = true; } } if (isHave == false) { DataRow dr = gf.NewRow(); nd.WorkID = workID; //为获取表单ID提供参数. dr[GroupFieldAttr.OID] = 100; dr[GroupFieldAttr.FrmID] = nd.NodeFrmID; dr[GroupFieldAttr.CtrlType] = "FWC"; dr[GroupFieldAttr.CtrlID] = "FWCND" + nd.NodeID; dr[GroupFieldAttr.Idx] = 100; dr[GroupFieldAttr.Lab] = "审核信息"; gf.Rows.Add(dr); myds.Tables.Remove("Sys_GroupField"); myds.Tables.Add(gf); //更新,为了让其自动增加审核分组. BP.WF.Template.FrmNodeComponent refFnc = new FrmNodeComponent(nd.NodeID); refFnc.Update(); } } } #endregion 没有审核组件分组就增加上审核组件分组. myds.Tables.Add(fnc.ToDataTableField("WF_FrmNodeComponent")); #endregion 加入组件的状态信息, 在解析表单的时候使用. #region 增加 groupfields if (nd.FormType == NodeFormType.FoolTruck && nd.IsStartNode == false && DataType.IsNullOrEmpty(wk.HisPassedFrmIDs) == false) { #region 处理字段分组排序. //查询所有的分组, 如果是查看表单的方式,就不应该把当前的表单显示出来. string myFrmIDs = ""; if (fromWorkOpt.Equals("1") == true) { if (gwf.WFState == WFState.Complete) { myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'"; } else { myFrmIDs = wk.HisPassedFrmIDs; //流程未完成并且是查看表单的情况. } } else { myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'"; } GroupFields gfs = new GroupFields(); gfs.RetrieveIn(GroupFieldAttr.FrmID, "(" + myFrmIDs + ")"); //按照时间的顺序查找出来 ids . string sqlOrder = "SELECT OID FROM Sys_GroupField WHERE FrmID IN (" + myFrmIDs + ")"; if (BP.Sys.SystemConfig.AppCenterDBType == DBType.Oracle) { myFrmIDs = myFrmIDs.Replace("'", ""); sqlOrder += " ORDER BY INSTR('" + myFrmIDs + "',FrmID) , Idx"; } if (BP.Sys.SystemConfig.AppCenterDBType == DBType.MSSQL) { myFrmIDs = myFrmIDs.Replace("'", ""); sqlOrder += " ORDER BY CHARINDEX(FrmID, '" + myFrmIDs + "'), Idx"; } if (BP.Sys.SystemConfig.AppCenterDBType == DBType.MySQL) { myFrmIDs = myFrmIDs.Replace("'", ""); sqlOrder += " ORDER BY INSTR('" + myFrmIDs + "', FrmID ), Idx"; } DataTable dtOrder = DBAccess.RunSQLReturnTable(sqlOrder); //创建容器,把排序的分组放入这个容器. GroupFields gfsNew = new GroupFields(); //遍历查询出来的分组. foreach (DataRow dr in dtOrder.Rows) { string pkOID = dr[0].ToString(); var mygf = gfs.GetEntityByKey(pkOID); gfsNew.AddEntity(mygf); //把分组字段加入里面去. } DataTable dtGF = gfsNew.ToDataTableField("Sys_GroupField"); myds.Tables.Remove("Sys_GroupField"); myds.Tables.Add(dtGF); #endregion 处理字段分组排序. #region 处理 mapattrs //求当前表单的字段集合. MapAttrs attrs = new MapAttrs(); QueryObject qo = new QueryObject(attrs); qo.AddWhere(MapAttrAttr.FK_MapData, "ND" + nd.NodeID); qo.addOrderBy(MapAttrAttr.Idx); qo.DoQuery(); //计算累加的字段集合. MapAttrs attrsLeiJia = new MapAttrs(); qo = new QueryObject(attrsLeiJia); qo.AddWhere(MapAttrAttr.FK_MapData, " IN ", "(" + wk.HisPassedFrmIDs + ")"); qo.addOrderBy(MapAttrAttr.Idx); qo.DoQuery(); //把两个集合接起来. foreach (MapAttr item in attrsLeiJia) { item.UIIsEnable = false; //设置为只读的. attrs.AddEntity(item); } //替换掉现有的. myds.Tables.Remove("Sys_MapAttr"); //移除. myds.Tables.Add(attrs.ToDataTableField("Sys_MapAttr")); //增加. #endregion 处理mapattrs #region 把枚举放入里面去. myds.Tables.Remove("Sys_Enum"); myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'"; SysEnums enums = new SysEnums(); enums.RetrieveInSQL(SysEnumAttr.EnumKey, "SELECT UIBindKey FROM Sys_MapAttr WHERE FK_MapData in(" + myFrmIDs + ")"); // 加入最新的枚举. myds.Tables.Add(enums.ToDataTableField("Sys_Enum")); #endregion 把枚举放入里面去. #region MapExt . myds.Tables.Remove("Sys_MapExt"); // 把扩展放入里面去. myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'"; BP.Sys.MapExts exts = new MapExts(); qo = new QueryObject(exts); qo.AddWhere(MapExtAttr.FK_MapData, " IN ", "(" + myFrmIDs + ")"); qo.DoQuery(); // 加入最新的MapExt. myds.Tables.Add(exts.ToDataTableField("Sys_MapExt")); #endregion MapExt . } #endregion 增加 groupfields #region 流程设置信息. if (nd.IsStartNode == false) { BP.WF.Dev2Interface.Node_SetWorkRead(fk_node, workID); // @杜. if (gwf.TodoEmps.Contains(BP.Web.WebUser.Name + ";") == false) { gwf.TodoEmps += BP.Web.WebUser.No + "," + BP.Web.WebUser.Name; gwf.Update(); } } //增加转向下拉框数据. if (nd.CondModel == CondModel.SendButtonSileSelect) { if (nd.IsStartNode == true || gwf.TodoEmps.Contains(WebUser.No + ",") == true) { /*如果当前不是主持人,如果不是主持人,就不让他显示下拉框了.*/ /*如果当前节点,是可以显示下拉框的.*/ Nodes nds = nd.HisToNodes; DataTable dtToNDs = new DataTable(); dtToNDs.TableName = "ToNodes"; dtToNDs.Columns.Add("No", typeof(string)); //节点ID. dtToNDs.Columns.Add("Name", typeof(string)); //到达的节点名称. dtToNDs.Columns.Add("IsSelectEmps", typeof(string)); //是否弹出选择人的对话框? dtToNDs.Columns.Add("IsSelected", typeof(string)); //是否选择? #region 增加到达延续子流程节点。 NodeYGFlows ygflows = new NodeYGFlows(fk_node.ToString()); if (ygflows.Count > 1 && SystemConfig.CustomerNo.Equals("CZBank") == true) { dtToNDs.Rows.Clear(); //为浙商银行做的特殊判断,如果配置了延续流程,就不让其走分支节点. } foreach (NodeYGFlow item in ygflows) { DataRow dr = dtToNDs.NewRow(); dr["No"] = item.FK_Flow + "01"; dr["Name"] = "启动:" + item.FlowName; //if (item.HisDeliveryWay == DeliveryWay.BySelected) dr["IsSelectEmps"] = "1"; //else // dr["IsSelectEmps"] = "0"; //是不是,可以选择接受人. //设置默认选择的节点. //if (defalutSelectedNodeID == item.NodeID) // dr["IsSelected"] = "1"; //else // dr["IsSelected"] = "0"; dr["IsSelected"] = "0"; dtToNDs.Rows.Add(dr); } #endregion 增加到达延续子流程节点。 #region 到达其他节点. //上一次选择的节点. int defalutSelectedNodeID = 0; if (nds.Count > 1) { string mysql = ""; // 找出来上次发送选择的节点. if (SystemConfig.AppCenterDBType == DBType.MSSQL) { mysql = "SELECT top 1 NDTo FROM ND" + int.Parse(nd.FK_Flow) + "Track A WHERE A.NDFrom=" + fk_node + " AND ActionType=1 ORDER BY WorkID DESC"; } else if (SystemConfig.AppCenterDBType == DBType.Oracle) { mysql = "SELECT * FROM ( SELECT NDTo FROM ND" + int.Parse(nd.FK_Flow) + "Track A WHERE A.NDFrom=" + fk_node + " AND ActionType=1 ORDER BY WorkID DESC ) WHERE ROWNUM =1"; } else if (SystemConfig.AppCenterDBType == DBType.MySQL) { mysql = "SELECT NDTo FROM ND" + int.Parse(nd.FK_Flow) + "Track A WHERE A.NDFrom=" + fk_node + " AND ActionType=1 ORDER BY WorkID DESC limit 1,1"; } //获得上一次发送到的节点. defalutSelectedNodeID = DBAccess.RunSQLReturnValInt(mysql, 0); } #region 为天业集团做一个特殊的判断. if (SystemConfig.CustomerNo == "TianYe" && nd.Name.Contains("董事长") == true) { /*如果是董事长节点, 如果是下一个节点默认的是备案. */ foreach (Node item in nds) { if (item.Name.Contains("备案") == true && item.Name.Contains("待") == false) { defalutSelectedNodeID = item.NodeID; break; } } } #endregion 为天业集团做一个特殊的判断. foreach (Node item in nds) { DataRow dr = dtToNDs.NewRow(); dr["No"] = item.NodeID; dr["Name"] = item.Name; //if (item.hissel if (item.HisDeliveryWay == DeliveryWay.BySelected) { dr["IsSelectEmps"] = "1"; } else { dr["IsSelectEmps"] = "0"; //是不是,可以选择接受人. } //设置默认选择的节点. if (defalutSelectedNodeID == item.NodeID) { dr["IsSelected"] = "1"; } else { dr["IsSelected"] = "0"; } dtToNDs.Rows.Add(dr); } #endregion 到达其他节点。 //增加一个下拉框, 对方判断是否有这个数据. myds.Tables.Add(dtToNDs); } } // 节点数据. //string sql = "SELECT * FROM WF_Node WHERE NodeID=" + fk_node; //DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql); //dt.TableName = "WF_NodeBar"; //myds.Tables.Add(dt); //// 流程数据. //Flow fl = new Flow(fk_flow); //myds.Tables.Add(fl.ToDataTableField("WF_Flow")); #endregion 流程设置信息. #region 把主从表数据放入里面. //.工作数据放里面去, 放进去前执行一次装载前填充事件. //重设默认值. wk.ResetDefaultVal(); //@樊雷伟 把这部分代码搬到jflow上去. CCFlowAPI. 114行出. if (BP.Sys.SystemConfig.IsBSsystem == true) { // 处理传递过来的参数。 foreach (string k in System.Web.HttpContext.Current.Request.QueryString.AllKeys) { if (DataType.IsNullOrEmpty(k) == true) { continue; } wk.SetValByKey(k, System.Web.HttpContext.Current.Request.QueryString[k]); } // 处理传递过来的frm参数。 foreach (string k in System.Web.HttpContext.Current.Request.Form.AllKeys) { if (DataType.IsNullOrEmpty(k) == true) { continue; } wk.SetValByKey(k, System.Web.HttpContext.Current.Request.Form[k]); } //更新到数据库里. wk.DirectUpdate(); } // 执行表单事件.. string msg = md.DoEvent(FrmEventList.FrmLoadBefore, wk); if (DataType.IsNullOrEmpty(msg) == false) { throw new Exception("err@错误:" + msg); } // 执行FEE事件. string msgOfLoad = nd.HisFlow.DoFlowEventEntity(EventListOfNode.FrmLoadBefore, nd, wk, null); if (msgOfLoad != null) { wk.RetrieveFromDBSources(); } //执行装载填充. MapExt me = new MapExt(); if (me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.PageLoadFull, MapExtAttr.FK_MapData, wk.NodeFrmID) == 1) { //执行通用的装载方法. MapAttrs attrs = new MapAttrs(wk.NodeFrmID); MapDtls dtls = new MapDtls(wk.NodeFrmID); wk = BP.WF.Glo.DealPageLoadFull(wk, me, attrs, dtls) as Work; } //如果是累加表单,就把整个rpt数据都放入里面去. if (nd.FormType == NodeFormType.FoolTruck && nd.IsStartNode == false && DataType.IsNullOrEmpty(wk.HisPassedFrmIDs) == false) { GERpt rpt = new GERpt("ND" + int.Parse(nd.FK_Flow) + "Rpt", workID); // nd.HisFlow.HisGERpt; rpt.ResetDefaultVal(); //rpt.Copy(wk); //加入后就出现了错误. myds.Tables.Add(rpt.ToDataTableField("MainTable")); // myds.WriteXml("C:\\XX.xml"); } else { DataTable mainTable = wk.ToDataTableField(md.No); mainTable.TableName = "MainTable"; myds.Tables.Add(mainTable); } string sql = ""; DataTable dt = null; #endregion #region 把外键表加入DataSet DataTable dtMapAttr = myds.Tables["Sys_MapAttr"]; MapExts mes = md.MapExts; foreach (DataRow dr in dtMapAttr.Rows) { string lgType = dr["LGType"].ToString(); string uiBindKey = dr["UIBindKey"].ToString(); if (DataType.IsNullOrEmpty(uiBindKey) == true) { continue; //为空就continue. } if (lgType.Equals("1") == true) { continue; //枚举值就continue; } string uiIsEnable = dr["UIIsEnable"].ToString(); if (uiIsEnable.Equals("0") == true && lgType.Equals("1") == true) { continue; //如果是外键,并且是不可以编辑的状态. } if (uiIsEnable.Equals("1") == true && lgType.Equals("0") == true) { continue; //如果是外部数据源,并且是不可以编辑的状态. } // 检查是否有下拉框自动填充。 string keyOfEn = dr["KeyOfEn"].ToString(); string fk_mapData = dr["FK_MapData"].ToString(); #region 处理下拉框数据范围. for 小杨. me = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.AutoFullDLL, MapExtAttr.AttrOfOper, keyOfEn) as MapExt; if (me != null) { string fullSQL = me.Doc.Clone() as string; fullSQL = fullSQL.Replace("~", ","); fullSQL = BP.WF.Glo.DealExp(fullSQL, wk, null); dt = DBAccess.RunSQLReturnTable(fullSQL); //重构新表 DataTable dt_FK_Dll = new DataTable(); dt_FK_Dll.TableName = keyOfEn;//可能存在隐患,如果多个字段,绑定同一个表,就存在这样的问题. dt_FK_Dll.Columns.Add("No", typeof(string)); dt_FK_Dll.Columns.Add("Name", typeof(string)); foreach (DataRow dllRow in dt.Rows) { DataRow drDll = dt_FK_Dll.NewRow(); drDll["No"] = dllRow["No"]; drDll["Name"] = dllRow["Name"]; dt_FK_Dll.Rows.Add(drDll); } myds.Tables.Add(dt_FK_Dll); continue; } #endregion 处理下拉框数据范围. // 判断是否存在. if (myds.Tables.Contains(uiBindKey) == true) { continue; } if (BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey) != null) { myds.Tables.Add(BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey)); } } #endregion End把外键表加入DataSet #region 处理流程-消息提示. DataTable dtAlert = new DataTable(); dtAlert.TableName = "AlertMsg"; dtAlert.Columns.Add("Title", typeof(string)); dtAlert.Columns.Add("Msg", typeof(string)); dtAlert.Columns.Add("URL", typeof(string)); // string msg = ""; switch (gwf.WFState) { case WFState.AskForReplay: // 返回加签的信息. string mysql = "SELECT * FROM ND" + int.Parse(fk_flow) + "Track WHERE WorkID=" + workID + " AND " + TrackAttr.ActionType + "=" + (int)ActionType.ForwardAskfor; DataTable mydt = BP.DA.DBAccess.RunSQLReturnTable(mysql); foreach (DataRow dr in mydt.Rows) { string msgAskFor = dr[TrackAttr.Msg].ToString(); string worker = dr[TrackAttr.EmpFrom].ToString(); string workerName = dr[TrackAttr.EmpFromT].ToString(); string rdt = dr[TrackAttr.RDT].ToString(); DataRow drMsg = dtAlert.NewRow(); drMsg["Title"] = worker + "," + workerName + "回复信息:"; drMsg["Msg"] = DataType.ParseText2Html(msgAskFor) + "<br>" + rdt; dtAlert.Rows.Add(drMsg); } break; case WFState.Askfor: //加签. sql = "SELECT * FROM ND" + int.Parse(fk_flow) + "Track WHERE WorkID=" + workID + " AND " + TrackAttr.ActionType + "=" + (int)ActionType.AskforHelp; dt = BP.DA.DBAccess.RunSQLReturnTable(sql); foreach (DataRow dr in dt.Rows) { string msgAskFor = dr[TrackAttr.Msg].ToString(); string worker = dr[TrackAttr.EmpFrom].ToString(); string workerName = dr[TrackAttr.EmpFromT].ToString(); string rdt = dr[TrackAttr.RDT].ToString(); DataRow drMsg = dtAlert.NewRow(); drMsg["Title"] = worker + "," + workerName + "请求加签:"; drMsg["Msg"] = DataType.ParseText2Html(msgAskFor) + "<br>" + rdt + "<a href='./WorkOpt/AskForRe.htm?FK_Flow=" + fk_flow + "&FK_Node=" + fk_node + "&WorkID=" + workID + "&FID=" + fid + "' >回复加签意见</a> --"; dtAlert.Rows.Add(drMsg); //提示信息. // this.FlowMsg.AlertMsg_Info(worker + "," + workerName + "请求加签:", // DataType.ParseText2Html(msgAskFor) + "<br>" + rdt + " --<a href='./WorkOpt/AskForRe.aspx?FK_Flow=" + this.FK_Flow + "&FK_Node=" + this.FK_Node + "&WorkID=" + this.WorkID + "&FID=" + this.FID + "' >回复加签意见</a> --"); } // isAskFor = true; break; case WFState.ReturnSta: /* 如果工作节点退回了*/ ReturnWorks rws = new ReturnWorks(); rws.Retrieve(ReturnWorkAttr.ReturnToNode, fk_node, ReturnWorkAttr.WorkID, workID, ReturnWorkAttr.RDT); if (rws.Count != 0) { //string msgInfo = ""; //foreach (BP.WF.ReturnWork rw in rws) //{ // DataRow drMsg = dtAlert.NewRow(); // //drMsg["Title"] = "来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + " " + rw.RDT + " <a href='/DataUser/ReturnLog/" + fk_flow + "/" + rw.MyPK + ".htm' target=_blank>工作日志</a>"; // drMsg["Title"] = "来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + " " + rw.RDT; // drMsg["Msg"] = rw.BeiZhuHtml; // dtAlert.Rows.Add(drMsg); //} string msgInfo = ""; foreach (BP.WF.ReturnWork rw in rws) { //drMsg["Title"] = "来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + " " + rw.RDT + " <a href='/DataUser/ReturnLog/" + fk_flow + "/" + rw.MyPK + ".htm' target=_blank>工作日志</a>"; msgInfo += "\t\n来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + " " + rw.RDT; msgInfo += rw.BeiZhuHtml; } string str = nd.ReturnAlert; if (str != "") { str = str.Replace("~", "'"); str = str.Replace("@PWorkID", workID.ToString()); str = str.Replace("@PNodeID", nd.NodeID.ToString()); str = str.Replace("@FK_Node", nd.NodeID.ToString()); str = str.Replace("@PFlowNo", fk_flow); str = str.Replace("@FK_Flow", fk_flow); str = str.Replace("@PWorkID", workID.ToString()); str = str.Replace("@WorkID", workID.ToString()); str = str.Replace("@OID", workID.ToString()); DataRow drMsg = dtAlert.NewRow(); drMsg["Title"] = "退回信息"; drMsg["Msg"] = msgInfo + "\t\n" + str; dtAlert.Rows.Add(drMsg); } else { DataRow drMsg = dtAlert.NewRow(); drMsg["Title"] = "退回信息"; drMsg["Msg"] = msgInfo + "\t\n" + str; dtAlert.Rows.Add(drMsg); } } break; case WFState.Shift: /* 判断移交过来的。 */ ShiftWorks fws = new ShiftWorks(); BP.En.QueryObject qo = new QueryObject(fws); qo.AddWhere(ShiftWorkAttr.WorkID, workID); qo.addAnd(); qo.AddWhere(ShiftWorkAttr.FK_Node, fk_node); qo.addOrderBy(ShiftWorkAttr.RDT); qo.DoQuery(); if (fws.Count >= 1) { DataRow drMsg = dtAlert.NewRow(); drMsg["Title"] = "移交历史信息"; msg = ""; foreach (ShiftWork fw in fws) { string temp = "@移交人[" + fw.FK_Emp + "," + fw.FK_EmpName + "]。@接受人:" + fw.ToEmp + "," + fw.ToEmpName + "。<br>移交原因:-------------" + fw.NoteHtml; if (fw.FK_Emp == WebUser.No) { temp = "<b>" + temp + "</b>"; } temp = temp.Replace("@", "<br>@"); msg += temp + "<hr/>"; } drMsg["Msg"] = msg; dtAlert.Rows.Add(drMsg); } break; default: break; } #endregion #region 增加流程节点表单绑定信息. if (nd.HisFormType == NodeFormType.RefOneFrmTree) { /* 独立流程节点表单. */ nd.WorkID = workID; //为获取表单ID ( NodeFrmID )提供参数. FrmNode fn = new FrmNode(); fn.MyPK = nd.NodeFrmID + "_" + nd.NodeID + "_" + nd.FK_Flow; fn.Retrieve(); myds.Tables.Add(fn.ToDataTableField("FrmNode")); } #endregion 增加流程节点表单绑定信息. myds.Tables.Add(dtAlert); return(myds); } catch (Exception ex) { Log.DebugWriteError(ex.StackTrace); throw new Exception(ex.Message); } }
public void PrintBill() { BP.WF.Node nd = new BP.WF.Node(this.FK_Node); string path = ApplicationPath + "\\DataUser\\CyclostyleFile\\FlowFrm\\" + nd.FK_Flow + "\\" + nd.NodeID + "\\"; if (System.IO.Directory.Exists(path) == false) { } string[] fls = System.IO.Directory.GetFiles(path); string file = fls[int.Parse(this.BillIdx)]; file = file.Replace(ApplicationPath + @"DataUser\CyclostyleFile", ""); FileInfo finfo = new FileInfo(file); string tempName = finfo.Name.Split('.')[0]; string tempNameChinese = finfo.Name.Split('.')[1]; string toPath = ApplicationPath + @"DataUser\Bill\FlowFrm\" + DateTime.Now.ToString("yyyyMMdd") + "\\"; if (System.IO.Directory.Exists(toPath) == false) { System.IO.Directory.CreateDirectory(toPath); } string billFile = toPath + "\\" + tempName + "." + this.FID + ".doc"; BP.Rpt.RTF.RTFEngine engine = new BP.Rpt.RTF.RTFEngine(); if (tempName.ToLower() == "all") { FrmNodes fns = new FrmNodes(this.FK_Node); foreach (FrmNode fn in fns) { GEEntity ge = new GEEntity(fn.FK_Frm, this.WorkID); engine.AddEn(ge); MapDtls mdtls = new MapDtls(tempName); foreach (MapDtl dtl in mdtls) { GEDtls enDtls = dtl.HisGEDtl.GetNewEntities as GEDtls; enDtls.Retrieve(GEDtlAttr.RefPK, this.WorkID); engine.EnsDataDtls.Add(enDtls); } } // 增加主表. GEEntity myge = new GEEntity("ND" + nd.NodeID, this.WorkID); engine.AddEn(myge); MapDtls mymdtls = new MapDtls("ND" + nd.NodeID); foreach (MapDtl dtl in mymdtls) { GEDtls enDtls = dtl.HisGEDtl.GetNewEntities as GEDtls; enDtls.Retrieve(GEDtlAttr.RefPK, this.WorkID); engine.EnsDataDtls.Add(enDtls); } engine.MakeDoc(file, toPath, tempName + "." + this.WorkID + ".doc", null, false); } else { // 增加主表. GEEntity myge = new GEEntity(tempName, this.FID); engine.HisGEEntity = myge; engine.AddEn(myge); MapDtls mymdtls = new MapDtls(tempName); foreach (MapDtl dtl in mymdtls) { GEDtls enDtls = dtl.HisGEDtl.GetNewEntities as GEDtls; enDtls.Retrieve(GEDtlAttr.RefPK, this.WorkID); engine.EnsDataDtls.Add(enDtls); } engine.MakeDoc(file, toPath, tempName + "." + this.FID + ".doc", null, false); } BP.PubClass.OpenWordDocV2(billFile, tempNameChinese + ".doc"); }
public void PrintBill() { BP.WF.Node nd = new BP.WF.Node(this.FK_Node); string path = ApplicationPath + "\\DataUser\\CyclostyleFile\\FlowFrm\\" + nd.FK_Flow + "\\" + nd.NodeID + "\\"; if (System.IO.Directory.Exists(path) == false) { this.Pub1.AddMsgOfWarning("获取模版错误", "模版文件没有找到。" + path); return; } string[] fls = System.IO.Directory.GetFiles(path); string file = fls[int.Parse(this.BillIdx)]; file = file.Replace(ApplicationPath + @"DataUser\CyclostyleFile", ""); FileInfo finfo = new FileInfo(file); string tempName = finfo.Name.Split('.')[0]; string tempNameChinese = finfo.Name.Split('.')[1]; string toPath = ApplicationPath + @"DataUser\Bill\FlowFrm\" + DateTime.Now.ToString("yyyyMMdd") + "\\"; if (System.IO.Directory.Exists(toPath) == false) { System.IO.Directory.CreateDirectory(toPath); } // string billFile = toPath + "\\" + tempName + "." + this.FID + ".doc"; string billFile = toPath + "\\" + Server.UrlDecode(tempNameChinese) + "." + this.WorkID + ".doc"; BP.Pub.RTFEngine engine = new BP.Pub.RTFEngine(); if (tempName.ToLower() == "all") { /* 说明要从所有的流程表单上取数据.*/ FrmNodes fns = new FrmNodes(this.FK_Flow, this.FK_Node); foreach (FrmNode fn in fns) { GEEntity ge = new GEEntity(fn.FK_Frm, this.WorkID); engine.AddEn(ge); MapDtls mdtls = new MapDtls(fn.FK_Frm); foreach (MapDtl dtl in mdtls) { GEDtls enDtls = dtl.HisGEDtl.GetNewEntities as GEDtls; enDtls.Retrieve(GEDtlAttr.RefPK, this.WorkID); engine.EnsDataDtls.Add(enDtls); } } // 增加主表. GEEntity myge = new GEEntity("ND" + nd.NodeID, this.WorkID); engine.AddEn(myge); MapDtls mymdtls = new MapDtls("ND" + nd.NodeID); foreach (MapDtl dtl in mymdtls) { GEDtls enDtls = dtl.HisGEDtl.GetNewEntities as GEDtls; enDtls.Retrieve(GEDtlAttr.RefPK, this.WorkID); engine.EnsDataDtls.Add(enDtls); } // engine.MakeDoc(file, toPath, tempName + "." + this.WorkID + ".doc", null, false); engine.MakeDoc(file, toPath, Server.UrlDecode(tempNameChinese) + "." + this.WorkID + ".doc", null, false); } else { // 增加主表. GEEntity myge = new GEEntity(tempName, this.WorkID); engine.HisGEEntity = myge; engine.AddEn(myge); MapDtls mymdtls = new MapDtls(tempName); foreach (MapDtl dtl in mymdtls) { GEDtls enDtls = dtl.HisGEDtl.GetNewEntities as GEDtls; enDtls.Retrieve(GEDtlAttr.RefPK, this.WorkID); engine.EnsDataDtls.Add(enDtls); } //engine.MakeDoc(file, toPath, tempName + "." + this.FID + ".doc", null, false); engine.MakeDoc(file, toPath, Server.UrlDecode(tempNameChinese) + "." + this.WorkID + ".doc", null, false); } #region 保存单据,以方便查询. Bill bill = new Bill(); bill.MyPK = this.FID + "_" + this.WorkID + "_" + this.FK_Node + "_" + this.BillIdx; bill.WorkID = this.WorkID; bill.FK_Node = this.FK_Node; bill.FK_Dept = WebUser.FK_Dept; bill.FK_Emp = WebUser.No; bill.Url = "/DataUser/Bill/FlowFrm/" + DateTime.Now.ToString("yyyyMMdd") + "/" + Server.UrlDecode(tempNameChinese) + "." + this.WorkID + ".doc"; bill.FullPath = toPath + file; bill.RDT = DataType.CurrentDataTime; bill.FK_NY = DataType.CurrentYearMonth; bill.FK_Flow = this.FK_Flow; if (this.WorkID != 0) { GenerWorkFlow gwf = new GenerWorkFlow(); gwf.WorkID = this.WorkID; if (gwf.RetrieveFromDBSources() == 1) { bill.Emps = gwf.Emps; bill.FK_Starter = gwf.Starter; bill.StartDT = gwf.RDT; bill.Title = gwf.Title; bill.FK_Dept = gwf.FK_Dept; } } try { bill.Insert(); } catch { bill.Update(); } #endregion BP.Sys.PubClass.OpenWordDocV2(billFile, tempNameChinese + ".doc"); }
/// <summary> /// 生成要返回给page的Json数据. /// </summary> /// <param name="fk_md"></param> /// <param name="en"></param> public void LoadFrmData(string fk_md, Entity en) { var dictParams = new ReplaceFieldList(); //主表参数值集合 var fields = new List <string>(); // 主表参数名集合 dictParams.Add("No", WebUser.No, "string"); dictParams.Add("Name", WebUser.Name, "string"); dictParams.Add("FK_Dept", WebUser.FK_Dept, "string"); dictParams.Add("FK_DeptName", WebUser.FK_DeptName, "string"); var mes = new MapExts(fk_md); MapExt item = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.PageLoadFull) as MapExt; //把数据装载到表里,包括从表数据,主表数据未存储. MapDtls dtls = new MapDtls(fk_md); MapAttrs mattrs = new MapAttrs(fk_md); en = BP.WF.Glo.DealPageLoadFull(en, item, mattrs, dtls); // 处理表单装载数据. //MapData md=new MapData(this.FK_MapData); foreach (MapAttr mapattr in mattrs) { fields.Add(mapattr.KeyOfEn); dictParams.Add(mapattr.KeyOfEn, en.GetValStringByKey(mapattr.KeyOfEn), mapattr.IsSigan ? "sign" : "string"); } ReplaceParams += firsts[fk_md] ? GenerateParamsJsonString(dictParams) : "[]"; //生成json格式。 ReplaceFields += GenerateFieldsJsonString(fields); if (item == null || string.IsNullOrEmpty(item.Tag1) || item.Tag1.Length < 15) { ReplaceDtls += "[]"; ReplaceDtlNos += "[]"; return; } var replaceDtlNos = new List <string>(); DataSet ds = new DataSet(); DataTable table = null; var sql = string.Empty; var pk = GetPK(fk_md); // 填充从表. foreach (MapDtl dtl in dtls) { replaceDtlNos.Add(dtl.No); if (!firsts[fk_md]) { continue; } sql = "SELECT * FROM " + dtl.PTable + " WHERE RefPK='" + pk + "'"; table = BP.DA.DBAccess.RunSQLReturnTable(sql); table.TableName = dtl.No; ds.Tables.Add(table); } // 从表数据. ReplaceDtls += firsts[fk_md] ? BP.DA.DataTableConvertJson.Dataset2Json(ds) : "[]"; ReplaceDtlNos += GenerateFieldsJsonString(replaceDtlNos); }
public void InsertDtl() { string sql = "SELECT * FROM Sys_MapDtl WHERE FK_MapData LIKE '" + this.MyPK.Replace("Rpt", "") + "%'"; DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { this.WinCloseWithMsg("此流程中没有从表所以您不能插入。"); return; } Nodes nds = new Nodes(BP.WF.Glo.GenerFlowNo(this.MyPK)); this.Pub1.AddTable(); this.Pub1.AddCaptionLeft("请选择要插入的从表"); foreach (BP.WF.Node nd in nds) { if (nd.IsEndNode == false) { continue; } this.Pub1.AddTR(); this.Pub1.AddTDTitle("节点步骤:" + nd.Step + " 节点名称:" + nd.Name); this.Pub1.AddTREnd(); MapDtls dtls = new MapDtls("ND" + nd.NodeID); this.Pub1.AddTR(); this.Pub1.AddTDBegin(); foreach (MapDtl dtl in dtls) { CheckBox cb = new CheckBox(); cb.ID = "CB_" + dtl.No; cb.Text = dtl.Name; this.Pub1.Add(cb); #region 字段分组 DDL ddlGroup = new DDL(); ddlGroup.ID = "DDL_" + dtl.No; GroupFields gfs = new GroupFields(dtl.FK_MapData); ddlGroup.Bind(gfs, GroupFieldAttr.OID, GroupFieldAttr.Lab); this.Pub1.Add("插入位置"); this.Pub1.Add(ddlGroup); //this.Pub1.Add("查询条件:"); //MapAttrs attrs = new MapAttrs(dtl.No); //foreach (MapAttr attr in attrs) //{ // if (attr.UIContralType != UIContralType.DDL) // continue; // cb = new CheckBox(); // cb.ID = "CB_" + dtl.No + "_" + attr.KeyOfEn; // cb.Text = attr.Name; // this.Pub1.Add(cb); //} #endregion 字段分组 } this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); } this.Pub1.AddTRSum(); Button btn = new Button(); btn.ID = "Btn_Save"; btn.Text = "插入到报表"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_Click); this.Pub1.AddTD(btn); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
/// <summary> /// 生成所有表单元素. /// </summary> /// <returns></returns> public string CCForm_AllElements_ResponseJson() { try { DataSet ds = new DataSet(); MapData mapData = new MapData(this.FK_MapData); //属性. MapAttrs attrs = new MapAttrs(this.FK_MapData); attrs.Retrieve(MapAttrAttr.FK_MapData, this.FK_MapData, MapAttrAttr.UIVisible, 1); ds.Tables.Add(attrs.ToDataTableField("Sys_MapAttr")); FrmBtns btns = new FrmBtns(this.FK_MapData); ds.Tables.Add(btns.ToDataTableField("Sys_FrmBtn")); FrmRBs rbs = new FrmRBs(this.FK_MapData); ds.Tables.Add(rbs.ToDataTableField("Sys_FrmRB")); FrmLabs labs = new FrmLabs(this.FK_MapData); ds.Tables.Add(labs.ToDataTableField("Sys_FrmLab")); FrmLinks links = new FrmLinks(this.FK_MapData); ds.Tables.Add(links.ToDataTableField("Sys_FrmLink")); FrmImgs imgs = new FrmImgs(this.FK_MapData); ds.Tables.Add(imgs.ToDataTableField("Sys_FrmImg")); FrmImgAths imgAths = new FrmImgAths(this.FK_MapData); ds.Tables.Add(imgAths.ToDataTableField("Sys_FrmImgAth")); FrmAttachments aths = new FrmAttachments(this.FK_MapData); ds.Tables.Add(aths.ToDataTableField("Sys_FrmAttachment")); MapDtls dtls = new MapDtls(this.FK_MapData); ds.Tables.Add(dtls.ToDataTableField("Sys_MapDtl")); FrmLines lines = new FrmLines(this.FK_MapData); ds.Tables.Add(lines.ToDataTableField("Sys_FrmLine")); BP.Sys.FrmUI.MapFrameExts mapFrameExts = new BP.Sys.FrmUI.MapFrameExts(this.FK_MapData); ds.Tables.Add(mapFrameExts.ToDataTableField("Sys_MapFrame")); //组织节点组件信息. string sql = ""; if (this.FK_Node > 100) { sql += "select '轨迹图' AS Name,'FlowChart' AS No,FrmTrackSta Sta,FrmTrack_X X,FrmTrack_Y Y,FrmTrack_H H,FrmTrack_W W from WF_Node WHERE nodeid=" + SystemConfig.AppCenterDBVarStr + "nodeid"; sql += " union select '审核组件'AS Name, 'FrmCheck'AS No,FWCSta Sta,FWC_X X,FWC_Y Y,FWC_H H, FWC_W W from WF_Node WHERE nodeid=" + SystemConfig.AppCenterDBVarStr + "nodeid"; sql += " union select '子流程' AS Name,'SubFlowDtl'AS No,SFSta Sta,SF_X X,SF_Y Y,SF_H H, SF_W W from WF_Node WHERE nodeid=" + SystemConfig.AppCenterDBVarStr + "nodeid"; sql += " union select '子线程' AS Name, 'ThreadDtl'AS No,FrmThreadSta Sta,FrmThread_X X,FrmThread_Y Y,FrmThread_H H,FrmThread_W W from WF_Node WHERE nodeid=" + SystemConfig.AppCenterDBVarStr + "nodeid"; sql += " union select '流转自定义' AS Name,'FrmTransferCustom' AS No,FTCSta Sta,FTC_X X,FTC_Y Y,FTC_H H,FTC_W W FROM WF_Node WHERE nodeid=" + SystemConfig.AppCenterDBVarStr + "nodeid"; Paras ps = new Paras(); ps.SQL = sql; ps.Add("nodeid", this.FK_Node); DataTable dt = null; try { dt = DBAccess.RunSQLReturnTable(ps); } catch (Exception ex) { FrmSubFlow sb = new FrmSubFlow(); sb.CheckPhysicsTable(); TransferCustom tc = new TransferCustom(); tc.CheckPhysicsTable(); FrmThread ft = new FrmThread(); ft.CheckPhysicsTable(); FrmTrack ftd = new FrmTrack(); ftd.CheckPhysicsTable(); FrmTransferCustom ftd1 = new FrmTransferCustom(); ftd1.CheckPhysicsTable(); throw ex; } dt.TableName = "FigureCom"; if (SystemConfig.AppCenterDBType == DBType.Oracle || SystemConfig.AppCenterDBType == DBType.PostgreSQL) { // figureComCols = "Name,No,Sta,X,Y,H,W"; dt.Columns[0].ColumnName = "Name"; dt.Columns[1].ColumnName = "No"; dt.Columns[2].ColumnName = "Sta"; dt.Columns[3].ColumnName = "X"; dt.Columns[4].ColumnName = "Y"; dt.Columns[5].ColumnName = "H"; dt.Columns[6].ColumnName = "W"; } ds.Tables.Add(dt); } return(BP.Tools.Json.ToJson(ds)); } catch (Exception ex) { return("err@" + ex.Message); } }
public void DTS_Flow(BP.WF.Flow fl) { #region 读取数据. BP.Sys.MapExt me = new MapExt(); me.MyPK = "ND" + int.Parse(fl.No) + "01" + "_" + MapExtXmlList.StartFlow; int i = me.RetrieveFromDBSources(); if (i == 0) { BP.DA.Log.DefaultLogWriteLineError("没有为流程(" + fl.Name + ")的开始节点设置发起数据,请参考说明书解决."); return; } if (string.IsNullOrEmpty(me.Tag)) { BP.DA.Log.DefaultLogWriteLineError("没有为流程(" + fl.Name + ")的开始节点设置发起数据,请参考说明书解决."); return; } // 获取从表数据. DataSet ds = new DataSet(); string[] dtlSQLs = me.Tag1.Split('*'); foreach (string sql in dtlSQLs) { if (string.IsNullOrEmpty(sql)) { continue; } string[] tempStrs = sql.Split('='); string dtlName = tempStrs[0]; DataTable dtlTable = BP.DA.DBAccess.RunSQLReturnTable(sql.Replace(dtlName + "=", "")); dtlTable.TableName = dtlName; ds.Tables.Add(dtlTable); } #endregion 读取数据. #region 检查数据源是否正确. string errMsg = ""; // 获取主表数据. DataTable dtMain = BP.DA.DBAccess.RunSQLReturnTable(me.Tag); if (dtMain.Rows.Count == 0) { BP.DA.Log.DefaultLogWriteLineError("流程(" + fl.Name + ")此时无任务."); this.SetText("流程(" + fl.Name + ")此时无任务."); return; } this.SetText("@查询到(" + dtMain.Rows.Count + ")条任务."); if (dtMain.Columns.Contains("Starter") == false) { errMsg += "@配值的主表中没有Starter列."; } if (dtMain.Columns.Contains("MainPK") == false) { errMsg += "@配值的主表中没有MainPK列."; } if (errMsg.Length > 2) { this.SetText(errMsg); BP.DA.Log.DefaultLogWriteLineError("流程(" + fl.Name + ")的开始节点设置发起数据,不完整." + errMsg); return; } #endregion 检查数据源是否正确. #region 处理流程发起. string nodeTable = "ND" + int.Parse(fl.No) + "01"; int idx = 0; foreach (DataRow dr in dtMain.Rows) { idx++; string mainPK = dr["MainPK"].ToString(); string sql = "SELECT OID FROM " + nodeTable + " WHERE MainPK='" + mainPK + "'"; if (DBAccess.RunSQLReturnTable(sql).Rows.Count != 0) { this.SetText("@" + fl.Name + ",第" + idx + "条,此任务在之前已经完成。"); continue; /*说明已经调度过了*/ } string starter = dr["Starter"].ToString(); if (WebUser.No != starter) { BP.Web.WebUser.Exit(); BP.Port.Emp emp = new BP.Port.Emp(); emp.No = starter; if (emp.RetrieveFromDBSources() == 0) { this.SetText("@" + fl.Name + ",第" + idx + "条,设置的发起人员:" + emp.No + "不存在."); BP.DA.Log.DefaultLogWriteLineInfo("@数据驱动方式发起流程(" + fl.Name + ")设置的发起人员:" + emp.No + "不存在。"); continue; } WebUser.SignInOfGener(emp); } #region 给值. //System.Collections.Hashtable ht = new Hashtable(); Work wk = fl.NewWork(); string err = ""; #region 检查用户拼写的sql是否正确? foreach (DataColumn dc in dtMain.Columns) { string f = dc.ColumnName.ToLower(); switch (f) { case "starter": case "mainpk": case "refmainpk": case "tonode": break; default: bool isHave = false; foreach (Attr attr in wk.EnMap.Attrs) { if (attr.Key.ToLower() == f) { isHave = true; break; } } if (isHave == false) { err += " " + f + " "; } break; } } if (string.IsNullOrEmpty(err) == false) { throw new Exception("您设置的字段:" + err + "不存在开始节点的表单中,设置的sql:" + me.Tag); } #endregion 检查用户拼写的sql是否正确? foreach (DataColumn dc in dtMain.Columns) { wk.SetValByKey(dc.ColumnName, dr[dc.ColumnName].ToString()); } if (ds.Tables.Count != 0) { // MapData md = new MapData(nodeTable); MapDtls dtls = new MapDtls(nodeTable); foreach (MapDtl dtl in dtls) { foreach (DataTable dt in ds.Tables) { if (dt.TableName != dtl.No) { continue; } //删除原来的数据。 GEDtl dtlEn = dtl.HisGEDtl; dtlEn.Delete(GEDtlAttr.RefPK, wk.OID.ToString()); // 执行数据插入。 foreach (DataRow drDtl in dt.Rows) { if (drDtl["RefMainPK"].ToString() != mainPK) { continue; } dtlEn = dtl.HisGEDtl; foreach (DataColumn dc in dt.Columns) { dtlEn.SetValByKey(dc.ColumnName, drDtl[dc.ColumnName].ToString()); } dtlEn.RefPK = wk.OID.ToString(); dtlEn.OID = 0; dtlEn.Insert(); } } } } #endregion 给值. int toNodeID = 0; try { toNodeID = int.Parse(dr["ToNode"].ToString()); } catch { /*有可能在4.5以前的版本中没有tonode这个约定.*/ } // 处理发送信息. // Node nd =new Node(); string msg = ""; try { if (toNodeID == 0) { WorkNode wn = new WorkNode(wk, fl.HisStartNode); msg = wn.NodeSend().ToMsgOfText(); } if (toNodeID == fl.StartNodeID) { /* 发起后让它停留在开始节点上,就是为开始节点创建一个待办。*/ Int64 workID = BP.WF.Dev2Interface.Node_CreateStartNodeWork(fl.No, null, null, WebUser.No, null); if (workID != wk.OID) { throw new Exception("@异常信息:不应该不一致的workid."); } else { wk.Update(); } msg = "已经为(" + WebUser.No + ") 创建了开始工作节点. "; } BP.DA.Log.DefaultLogWriteLineInfo(msg); this.SetText("@" + fl.Name + ",第" + idx + "条,发起人员:" + WebUser.No + "-" + WebUser.Name + "已完成.\r\n" + msg); } catch (Exception ex) { this.SetText("@" + fl.Name + ",第" + idx + "条,发起人员:" + WebUser.No + "-" + WebUser.Name + "发起时出现错误.\r\n" + ex.Message); BP.DA.Log.DefaultLogWriteLineWarning(ex.Message); } } #endregion 处理流程发起. }
void btn_Copy_Click(object sender, EventArgs e) { BP.WF.Node nd = new BP.WF.Node(this.FK_Node); Node sNd = new Node(this.NodeOfSelect); BP.En.Attrs attrs = sNd.HisWork.EnMap.Attrs; BP.En.Attrs attrsCopy = nd.HisWork.EnMap.Attrs; // 开始copy 分组的节点。 GroupFields gfs = new GroupFields(this.NodeOfSelect); MapDtls dtls = new MapDtls(this.NodeOfSelect); MapM2Ms m2ms = new MapM2Ms(this.NodeOfSelect); MapFrames frms = new MapFrames(this.NodeOfSelect); foreach (GroupField gf in gfs) { CheckBox cb = this.Pub2.GetCBByID("CB" + gf.OID); if (cb.Checked == false) { continue; } // 生成一个分组实体. GroupField mygf = new GroupField(); mygf.Lab = gf.Lab; mygf.EnName = this.FK_Node; mygf.Idx = gf.Idx; mygf.Insert(); foreach (MapM2M m2m in m2ms) { if (m2m.GroupID != gf.OID) { continue; } MapM2M mym2m = new MapM2M(); mym2m.MyPK = m2m.MyPK.Replace(this.NodeOfSelect, this.FK_Node); // mym2m.FK_MapData =this if (mym2m.IsExits) { continue; } mym2m.Copy(m2m); mym2m.FK_MapData = this.FK_Node; mym2m.GroupID = mygf.OID; mym2m.MyPK = m2m.MyPK.Replace(this.NodeOfSelect, this.FK_Node); mym2m.Insert(); } foreach (MapFrame frm in frms) { if (frm.GroupID != gf.OID) { continue; } MapFrame myen = new MapFrame(); myen.MyPK = frm.MyPK.Replace(this.NodeOfSelect, this.FK_Node); if (myen.IsExits) { continue; } myen.Copy(frm); myen.FK_MapData = this.FK_Node; myen.GroupID = mygf.OID; myen.MyPK = frm.MyPK.Replace(this.NodeOfSelect, this.FK_Node); myen.Insert(); } // 复制从表. foreach (MapDtl dtl in dtls) { cb = this.Pub2.GetCBByID("CB_" + dtl.No + gf.OID); MapDtl dtlNew = new MapDtl(); dtlNew.No = dtl.No.Replace(this.NodeOfSelect, this.FK_Node); if (dtlNew.IsExits) { continue; } dtlNew.Copy(dtl); dtlNew.FK_MapData = this.FK_Node; dtlNew.No = dtl.No.Replace(this.NodeOfSelect, this.FK_Node); // dtlNew.No = this.FK_Node + "Dtl"; // dtlNew.No = dtl.No.Replace(this.FK_Node, this.NodeOfSelect); dtlNew.IsInsert = false; dtlNew.IsUpdate = false; dtlNew.IsDelete = false; dtlNew.GroupID = mygf.OID; dtlNew.PTable = dtlNew.No; dtlNew.Insert(); // 复制从表里面的明细。 int idx = 0; MapAttrs mattrs = new MapAttrs(dtl.No); foreach (MapAttr attr in mattrs) { MapAttr attrNew = new MapAttr(); attrNew.Copy(attr); attrNew.FK_MapData = dtlNew.No; attrNew.UIIsEnable = false; if (attrNew.DefVal.Contains("@")) { attrNew.DefVal = ""; } dtlNew.RowIdx = idx; attrNew.HisEditType = EditType.Edit; attrNew.Insert(); } } // copy his fields. MapAttrs willCopyAttrs = new MapAttrs(); willCopyAttrs.Retrieve(MapAttrAttr.GroupID, gf.OID, MapAttrAttr.Idx); int idx1 = 0; foreach (MapAttr attr in willCopyAttrs) { MapAttr attrNew = new MapAttr(); if (attrNew.IsExit(MapAttrAttr.FK_MapData, this.FK_Node, MapAttrAttr.KeyOfEn, attr.KeyOfEn) == true) { continue; } if (attr.UIVisible == false) { continue; } idx1++; attrNew.Copy(attr); attrNew.GroupID = mygf.OID; attrNew.FK_MapData = this.FK_Node; attrNew.UIIsEnable = false; attrNew.Idx = idx1; if (attrNew.KeyOfEn == "Title") { attrNew.HisEditType = EditType.Edit; } attrNew.HisEditType = EditType.Edit; attrNew.DefVal = ""; attrNew.Insert(); } } int GroupField = this.Pub2.GetDDLByID("DDL_GroupField").SelectedItemIntVal; foreach (Attr attr in attrs) { if (this.Pub2.IsExit(attr.Key) == false) { continue; } CheckBox cb = this.Pub2.GetCBByID(attr.Key); if (cb.Checked == false) { continue; } BP.Sys.MapAttr ma = new BP.Sys.MapAttr(); int i = ma.Retrieve(BP.Sys.MapAttrAttr.KeyOfEn, attr.Key, BP.Sys.MapAttrAttr.FK_MapData, this.NodeOfSelect); BP.Sys.MapAttr ma1 = new BP.Sys.MapAttr(); bool ishavle = ma1.IsExit(BP.Sys.MapAttrAttr.KeyOfEn, attr.Key, BP.Sys.MapAttrAttr.FK_MapData, this.FK_Node); if (ishavle) { continue; } ma1.Copy(ma); ma1.FK_MapData = this.FK_Node; ma1.KeyOfEn = ma.KeyOfEn; ma1.Name = ma.Name; ma1.GroupID = GroupField; ma1.UIIsEnable = false; ma1.HisEditType = EditType.Edit; if (ma1.DefVal != null && ma1.DefVal.Contains("@")) { ma1.DefVal = ""; } ma1.Insert(); } if (this.Pub2.IsExit("CB_Table")) { if (this.Pub2.GetCBByID("CB_Table").Checked) { MapData md1 = new MapData(this.NodeOfSelect); MapData md2 = new MapData(this.FK_Node); //md2.CellsX = md1.CellsX; //md2.CellsY = md1.CellsY; md2.Update(); //MapAttrs ma1 = md1.GenerHisTableCells; // 删除历史数据。 //ma1.Delete(MapAttrAttr.FK_MapData, this.FK_Node + "T"); //foreach (MapAttr attr in ma1) //{ // MapAttr attr2 = new MapAttr(); // attr2.Copy(attr); // // attr2.OID = 0; // attr2.GroupID = 0; // attr2.Idx = 0; // attr2.FK_MapData = this.FK_Node + "T"; // attr2.UIIsEnable = false; // attr2.Insert(); //} } } this.WinClose(); //this.WinCloseWithMsg("复制成功"); //this.Response.Redirect("MapDef.aspx?PK=" + this.FK_Node + "&NodeOfSelect=" + this.NodeOfSelect); }
protected void Page_Load(object sender, EventArgs e) { this.Title = "字段复制"; BP.WF.Node nd = new BP.WF.Node(this.FK_Node); BP.WF.Nodes nds = new BP.WF.Nodes(nd.FK_Flow); Node sNd = new Node(this.NodeOfSelect); MapAttrs attrs = new MapAttrs(this.NodeOfSelect); MapAttrs attrsCopy = new MapAttrs(this.FK_Node); this.Pub1.AddFieldSet("选择节点"); this.Pub1.AddUL("Main"); foreach (BP.WF.Node en in nds) { if (this.NodeOfSelect == en.NodeID.ToString()) { this.Pub1.AddLiB("CopyFieldFromNode.aspx?FK_Node=" + this.FK_Node + "&NodeOfSelect=ND" + en.NodeID, "步骤:" + en.Step + ",名称:" + en.Name); } else { this.Pub1.AddLi("CopyFieldFromNode.aspx?FK_Node=" + this.FK_Node + "&NodeOfSelect=ND" + en.NodeID, "步骤:" + en.Step + ",名称:" + en.Name); } } this.Pub1.AddULEnd(); this.Pub1.AddFieldSetEnd(); this.Pub2.AddTable("width='500px'"); //this.Pub2.AddTR(); //this.Pub2.AddTDTitle(this.ToE("Field", "字段")); ////this.Pub2.AddTDTitle("描述"); ////this.Pub2.AddTDTitle("类型"); ////this.Pub2.AddTDTitle(this.ToE("Show", "显示")); //this.Pub2.AddTREnd(); GroupFields gfs = new GroupFields(this.NodeOfSelect); MapDtls dtls = new MapDtls(this.NodeOfSelect); MapM2Ms m2ms = new MapM2Ms(this.NodeOfSelect); MapFrames frms = new MapFrames(this.NodeOfSelect); bool isHave = false; foreach (GroupField gf in gfs) { this.Pub2.AddTRSum(); CheckBox cb = new CheckBox(); cb.ID = "CB" + gf.OID; cb.Text = "<b>" + gf.Lab + "</b>"; this.Pub2.AddTD(cb); this.Pub2.AddTREnd(); foreach (MapDtl dtl in dtls) { if (dtl.GroupID != gf.OID) { continue; } this.Pub2.AddTR(); cb = new CheckBox(); cb.ID = "CB" + dtl.No + "_" + dtl.GroupID; cb.Text = "从表:" + dtl.Name; this.Pub2.AddTD(cb); this.Pub2.AddTREnd(); } foreach (MapM2M m2m in m2ms) { if (m2m.GroupID != gf.OID) { continue; } this.Pub2.AddTR(); cb = new CheckBox(); cb.ID = "CB" + m2m.MyPK + "_" + m2m.GroupID; cb.Text = "多选" + ":" + m2m.Name; this.Pub2.AddTD(cb); this.Pub2.AddTREnd(); } foreach (MapFrame frm in frms) { if (frm.GroupID != gf.OID) { continue; } this.Pub2.AddTR(); cb = new CheckBox(); cb.ID = "CB" + frm.MyPK + "_" + frm.GroupID; cb.Text = "框架" + ":" + frm.Name; this.Pub2.AddTD(cb); this.Pub2.AddTREnd(); } this.Pub2.AddTR(); this.Pub2.AddTDBigDocBegain(); foreach (MapAttr attr in attrs) { if (gf.OID != attr.GroupID) { continue; } switch (attr.KeyOfEn) { case BP.WF.GEStartWorkAttr.CDT: case BP.WF.GEStartWorkAttr.Emps: case BP.WF.GEStartWorkAttr.FID: case BP.WF.GEStartWorkAttr.OID: case BP.WF.GEStartWorkAttr.RDT: case BP.WF.GEStartWorkAttr.Rec: case BP.WF.GEStartWorkAttr.FK_NY: case BP.WF.GEStartWorkAttr.WFState: case BP.WF.GEStartWorkAttr.MyNum: case BP.WF.GEStartWorkAttr.FK_Dept: case BP.WF.GEStartWorkAttr.FK_DeptText: continue; default: break; } cb = new CheckBox(); cb.ID = attr.KeyOfEn; cb.Text = attr.KeyOfEn + " " + attr.Name; if (attrsCopy.Contains(MapAttrAttr.KeyOfEn, attr.KeyOfEn)) { cb.Enabled = false; } else { cb.Enabled = true; } isHave = true; this.Pub2.Add(cb); } this.Pub2.AddTDEnd(); this.Pub2.AddTREnd(); } this.Pub2.AddTableEndWithBR(); Button btn = new Button(); btn.CssClass = "Btn"; if (isHave == false) { return; } this.Pub2.Add("到分组:"); gfs = new GroupFields(this.FK_Node); BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL(); ddl.ID = "DDL_GroupField"; ddl.Bind(gfs, GroupFieldAttr.OID, GroupFieldAttr.Lab); ddl.SetSelectItem(this.GroupField); this.Pub2.Add(ddl); btn.ID = "Btn_OK"; btn.Text = " 复制 "; btn.UseSubmitBehavior = false; btn.OnClientClick = "this.disabled=true;"; //this.disabled='disabled'; return true;"; // btn.Attributes["onclick"] = " return confirm('您确定要复制选择的字段到 [" + nd.Name + "]表单中吗?');"; // btn.Attributes["onclick"] = " return confirm('" + this.ToE("AYS", "您确定要复制选择的字段到 [" + nd.Name + "]表单中吗?") + "');"; btn.Click += new EventHandler(btn_Copy_Click); this.Pub2.Add(btn); }
/// <summary> /// 新建文本框自动完成 /// </summary> public void EditAutoFullDtl_TB() { MapExt myme = new MapExt(this.MyPK); MapDtls dtls = new MapDtls(myme.FK_MapData); if (dtls.Count == 0) { this.Pub1.Clear(); Pub1.AddEasyUiPanelInfo("设置自动填充从表", "<p>该表单下没有从表,所以您不能为从表设置自动填充。<a href='?ExtType=" + this.ExtType + "&MyPK=" + this.MyPK + "&FK_MapData=" + this.FK_MapData + "&RefNo=" + this.RefNo + "'>返回</a></p>"); return; } Pub1.AddTableNormal(); Pub1.AddTRGroupTitle("设置自动填充从表. <a href='?ExtType=" + this.ExtType + "&MyPK=" + this.MyPK + "&FK_MapData=" + this.FK_MapData + "&RefNo=" + this.RefNo + "'>返回</a>"); string[] strs = myme.Tag1.Split('$'); foreach (MapDtl dtl in dtls) { TextBox tb = new TextBox(); tb.ID = "TB_" + dtl.No; tb.Columns = 70; tb.Style.Add("width", "100%"); tb.Rows = 5; tb.TextMode = TextBoxMode.MultiLine; foreach (string s in strs) { if (s == null) { continue; } if (s.Contains(dtl.No + ":") == false) { continue; } string[] ss = s.Split(':'); tb.Text = ss[1]; } //this.Pub1.AddFieldSet("编号:" + dtl.No + ",名称:" + dtl.Name); Pub1.AddTR(); Pub1.AddTDBegin(); Pub1.Add("编号:" + dtl.No + ",名称:" + dtl.Name); Pub1.AddBR(); Pub1.Add(tb); Pub1.AddBR(); string fs = "可填充的字段:"; MapAttrs attrs = new MapAttrs(dtl.No); foreach (MapAttr item in attrs) { if (item.KeyOfEn == "OID" || item.KeyOfEn == "RefPKVal") { continue; } fs += item.KeyOfEn + ","; } this.Pub1.Add(fs.Substring(0, fs.Length - 1)); //this.Pub1.AddFieldSetEnd(); Pub1.AddTDEnd(); Pub1.AddTREnd(); } //this.Pub1.AddHR(); Pub1.AddTableEnd(); Pub1.AddBR(); //Button mybtn = new Button(); var mybtn = new LinkBtn(false, NamesOfBtn.Save, "保存"); mybtn.Click += new EventHandler(mybtn_SaveAutoFullDtl_Click); this.Pub1.Add(mybtn); Pub1.AddSpace(1); mybtn = new LinkBtn(false, NamesOfBtn.Cancel, "取消"); mybtn.Click += new EventHandler(mybtn_SaveAutoFullDtl_Click); this.Pub1.Add(mybtn); Pub1.AddBR(); //this.Pub1.AddFieldSetEnd(); //this.Pub1.AddFieldSet("帮助:"); Pub1.AddEasyUiPanelInfoBegin("帮助", "icon-help"); this.Pub1.Add("在这里您需要设置一个查询语句"); this.Pub1.AddBR("例如:SELECT XLMC AS suozaixianlu, bustype as V_BusType FROM [V_XLVsBusType] WHERE jbxx_htid='@Key'"); this.Pub1.AddBR("这个查询语句要与从表的列对应上就可以在文本框的值发生改变时而自动填充。"); this.Pub1.AddBR("注意:"); this.Pub1.AddBR("1,@Key 是主表字段传递过来的变量。"); this.Pub1.AddBR("2,从表列字段字名,与填充sql列字段大小写匹配。"); //this.Pub1.AddFieldSetEnd(); Pub1.AddEasyUiPanelInfoEnd(); }
/// <summary> /// 执行 /// </summary> /// <returns>返回执行结果</returns> public override object Do() { if (BP.Web.WebUser.No != "admin") { return("非法的用户执行。"); } //DBAccess.RunSQL("DELETE FROM WF_CHOfFlow"); DBAccess.RunSQL("DELETE FROM WF_Bill"); DBAccess.RunSQL("DELETE FROM WF_GenerWorkerlist"); DBAccess.RunSQL("DELETE FROM WF_GenerWorkFlow"); DBAccess.RunSQL("DELETE FROM WF_ReturnWork"); DBAccess.RunSQL("DELETE FROM WF_SelectAccper"); DBAccess.RunSQL("DELETE FROM WF_TransferCustom"); DBAccess.RunSQL("DELETE FROM WF_RememberMe"); DBAccess.RunSQL("DELETE FROM Sys_FrmAttachmentDB"); DBAccess.RunSQL("DELETE FROM WF_CCList"); DBAccess.RunSQL("DELETE FROM WF_CH"); //删除考核. Flows fls = new Flows(); fls.RetrieveAll(); foreach (Flow item in fls) { try { DBAccess.RunSQL("DELETE FROM ND" + int.Parse(item.No) + "Track"); } catch { } } Nodes nds = new Nodes(); foreach (Node nd in nds) { try { Work wk = nd.HisWork; DBAccess.RunSQL("DELETE FROM " + wk.EnMap.PhysicsTable); } catch { } } MapDatas mds = new MapDatas(); mds.RetrieveAll(); foreach (MapData nd in mds) { try { DBAccess.RunSQL("DELETE FROM " + nd.PTable); } catch { } } MapDtls dtls = new MapDtls(); dtls.RetrieveAll(); foreach (MapDtl dtl in dtls) { try { DBAccess.RunSQL("DELETE FROM " + dtl.PTable); } catch { } } return("执行成功..."); }
void btn_Click(object sender, EventArgs e) { MapDtls dtl2s = new MapDtls(); dtl2s.Delete(MapDtlAttr.FK_MapData, this.MyPK); Nodes nds = new Nodes(BP.WF.Glo.GenerFlowNo(this.MyPK)); foreach (BP.WF.Node nd in nds) { if (nd.IsEndNode == false) { continue; } MapDtls dtls = new MapDtls("ND" + nd.NodeID); int i = 0; foreach (MapDtl dtl in dtls) { if (this.Pub1.GetCBByID("CB_" + dtl.No).Checked == false) { continue; } i++; // 生成从表让其可以在单个数据里显示他们。 MapDtl dtlNew = new MapDtl(); dtlNew.Copy(dtl); dtlNew.No = this.MyPK + i; dtlNew.FK_MapData = this.MyPK; dtlNew.GroupID = this.Pub1.GetDDLByID("DDL_" + dtl.No).SelectedItemIntVal; dtlNew.Insert(); // 删除原来的数据。 MapAttrs attrsDtl = new MapAttrs(); attrsDtl.Delete(MapAttrAttr.FK_MapData, dtlNew.No); // 复制到新的数据表里。 MapAttrs attrs = new MapAttrs(dtl.No); foreach (MapAttr attr in attrs) { MapAttr attrN = new MapAttr(); attrN.Copy(attr); attrN.FK_MapData = dtlNew.No; attrN.Insert(); } Cash.Map_Cash.Remove(dtlNew.No); #region 制成 主表.让其可以查询。 // 处理主表。 MapData md = new MapData(); md.Copy(dtlNew); md.No = "ND" + int.Parse(this.FK_Flow) + "RptDtl" + i.ToString(); md.Save(); // 删除原来的属性。 attrs.Delete(MapAttrAttr.FK_MapData, md.No); // 删除分组。 GroupField gfBase = new GroupField(); gfBase.Delete(GroupFieldAttr.EnName, md.No); // 增加基本信息分组。 gfBase.EnName = md.No; gfBase.Lab = md.Name; gfBase.Idx = 99; gfBase.Insert(); //生成基本信息属性。 foreach (MapAttr attr in attrs) { MapAttr attrN = new MapAttr(); attrN.Copy(attr); attrN.FK_MapData = md.No; attrN.GroupID = gfBase.OID; attrN.Insert(); } MapAttrs attrNs = new MapAttrs(md.No); // 对个别字段进行处理。 foreach (MapAttr attr in attrNs) { switch (attr.KeyOfEn) { case StartWorkAttr.FK_Dept: continue; //if (attr.UIContralType != UIContralType.DDL) //{ //attr.UIBindKey = "BP.Port.Depts"; //attr.UIContralType = UIContralType.DDL; //attr.LGType = FieldTypeS.FK; //attr.UIVisible = true; //// if (gfs.Contains(attr.GroupID) == false) //attr.GroupID = gfBase.OID;// gfs[0].GetValIntByKey("OID"); //attr.Update(); //// } break; case "FK_NY": //attr.Delete(); ////if (attr.UIContralType != UIContralType.DDL) ////{ //attr.UIBindKey = "BP.Pub.NYs"; //attr.UIContralType = UIContralType.DDL; //attr.LGType = FieldTypeS.FK; //attr.UIVisible = true; //// if (gfs.Contains(attr.GroupID) == false) //attr.GroupID = gfBase.OID; // gfs[0].GetValIntByKey("OID"); //attr.Update(); break; case "Rec": attr.UIBindKey = "BP.Port.Emps"; attr.UIContralType = UIContralType.DDL; attr.LGType = FieldTypeS.FK; attr.UIVisible = true; attr.Name = "最后处理人"; attr.GroupID = gfBase.OID; attr.Update(); break; default: break; } } // 生成流程基本信息属性。 GroupField gfFlow = new GroupField(); gfFlow.EnName = md.No; gfFlow.Idx = 0; gfFlow.Lab = "流程信息"; gfFlow.Insert(); MapAttr attrFlow = new BP.Sys.MapAttr(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "Title"; attrFlow.Name = "标题"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = true; attrFlow.UIIsEnable = true; attrFlow.UIIsLine = true; attrFlow.MinLen = 0; attrFlow.MaxLen = 1000; attrFlow.IDX = -100; attrFlow.GroupID = gfFlow.OID; attrFlow.Insert(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowStarter"; attrFlow.Name = "发起人"; //"发起人"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.DDL; attrFlow.UIBindKey = "BP.Port.Emps"; attrFlow.LGType = FieldTypeS.FK; attrFlow.UIVisible = true; attrFlow.UIIsEnable = false; attrFlow.UIIsLine = false; attrFlow.MaxLen = 20; attrFlow.MinLen = 0; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowStarterDept"; attrFlow.Name = "发起人部门"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.DDL; attrFlow.UIBindKey = "BP.Port.Depts"; attrFlow.LGType = FieldTypeS.FK; attrFlow.UIVisible = true; attrFlow.UIIsEnable = false; attrFlow.MaxLen = 20; attrFlow.MinLen = 0; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowEmps"; attrFlow.Name = "参与人"; // attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = true; attrFlow.UIIsEnable = true; attrFlow.UIIsLine = false; attrFlow.MinLen = 0; attrFlow.MaxLen = 1000; attrFlow.IDX = -100; attrFlow.GroupID = gfFlow.OID; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowStartRDT"; attrFlow.Name = "发起时间"; // attrFlow.MyDataType = BP.DA.DataType.AppDateTime; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = true; attrFlow.UIIsEnable = true; attrFlow.UIIsLine = false; attrFlow.MinLen = 0; attrFlow.MaxLen = 1000; attrFlow.IDX = -100; attrFlow.GroupID = gfFlow.OID; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowNY"; attrFlow.Name = "隶属年月"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.DDL; attrFlow.UIBindKey = "BP.Pub.NYs"; attrFlow.LGType = FieldTypeS.FK; attrFlow.UIVisible = true; attrFlow.UIIsEnable = false; attrFlow.MaxLen = 20; attrFlow.MinLen = 0; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "MyNum"; attrFlow.Name = "条"; // attrFlow.MyDataType = BP.DA.DataType.AppInt; attrFlow.DefVal = "1"; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = false; attrFlow.UIIsEnable = false; attrFlow.UIIsLine = false; attrFlow.IDX = -101; attrFlow.GroupID = gfFlow.OID; if (attrFlow.IsExits == false) { attrFlow.Insert(); } // 清除缓存的map. Cash.Map_Cash.Remove(md.No); //检查主表的正确性。 GEEntity ge = new GEEntity(md.No); ge.CheckPhysicsTable(); #endregion 制成 主表.让其可以查询。 } } this.WinClose(); }
public void BindList() { string text = ""; BP.WF.Node nd = new BP.WF.Node(this.FK_Node); FrmNodes fns = new FrmNodes(this.FK_Flow, this.FK_Node); #region 如果没有ndFrm 就增加上. bool isHaveNDFrm = false; foreach (FrmNode fn in fns) { if (fn.FK_Frm == "ND" + this.FK_Node) { isHaveNDFrm = true; break; } } if (isHaveNDFrm == false) { FrmNode fn = new FrmNode(); fn.FK_Flow = this.FK_Flow; fn.FK_Frm = "ND" + this.FK_Node; fn.FK_Node = this.FK_Node; fn.FrmEnableRole = FrmEnableRole.Disable; //就是默认不启用. fn.FrmSln = 0; // fn.IsEdit = true; fn.IsEnableLoadData = true; fn.Insert(); fns.AddEntity(fn); } #endregion 如果没有ndFrm 就增加上. string tfModel = SystemConfig.AppSettings["TreeFrmModel"]; this.Pub1.AddTable("width=100%"); this.Pub1.AddCaption("设置节点:(" + nd.Name + ")绑定表单"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("Idx"); this.Pub1.AddTDTitle("表单编号"); this.Pub1.AddTDTitle("名称"); if (tfModel == "1") { this.Pub1.AddTDTitle("关键字段"); } this.Pub1.AddTDTitle("启用规则"); // this.Pub1.AddTDTitle("可编辑否?"); this.Pub1.AddTDTitle("可打印否?"); this.Pub1.AddTDTitle("是否启用<br>装载填充事件"); this.Pub1.AddTDTitle("权限控制<br>方案"); this.Pub1.AddTDTitle("表单元素<br>自定义设置"); this.Pub1.AddTDTitle("谁是主键?"); this.Pub1.AddTDTitle("文件模版"); if (nd.HisRunModel == RunModel.FL || nd.HisRunModel == RunModel.FHL) { this.Pub1.AddTDTitle("是否1变N"); //add by zhoupeng 2016.03.25 for hainan. } if (nd.HisRunModel == RunModel.SubThread) { this.Pub1.AddTDTitle("数据汇总"); //add by zhoupeng 2016.03.25 for hainan. } this.Pub1.AddTDTitle("顺序"); this.Pub1.AddTDTitle(""); this.Pub1.AddTDTitle(""); this.Pub1.AddTREnd(); int idx = 1; foreach (FrmNode fn in fns) { MapData md = new MapData(); md.No = fn.FK_Frm; if (md.RetrieveFromDBSources() == 0) { fn.Delete(); //说明该表单不存在了,就需要把这个删除掉. continue; } this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD(fn.FK_Frm); if (fn.FK_Frm == "ND" + this.FK_Node) { this.Pub1.AddTDB("<a href=\"javascript:WinOpen('../MapDef/CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "');\" >" + md.Name + "</a>"); } else { this.Pub1.AddTD("<a href=\"javascript:WinOpen('../MapDef/CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "');\" >" + md.Name + "</a>"); } DDL ddl = new DDL(); //获取当前独立表单中的所有字段 add by 海南 zqp if (tfModel == "1") { //获取它的字段集合 MapAttrs attrs = new MapAttrs(); attrs.Retrieve(MapAttrAttr.FK_MapData, md.No); MapAttrs attrNs = new MapAttrs(); //去掉一些基础字段 foreach (MapAttr attr in attrs) { switch (attr.KeyOfEn) { case "Title": case "FK_Emp": case "MyNum": case "FK_NY": case WorkAttr.Emps: case WorkAttr.OID: case StartWorkAttr.Rec: case StartWorkAttr.FID: continue; default: break; } attrNs.AddEntity(attr); } //添加到页面中 DDL myddl = new DDL(); myddl.ID = "DDL_Attr_" + md.No; myddl.BindEntities(attrNs, MapAttrAttr.KeyOfEn, MapAttrAttr.Name); myddl.SetSelectItem(fn.GuanJianZiDuan); this.Pub1.AddTD(myddl); } //为了扩充的需要,把下拉框的模式去掉了. //ddl = new DDL(); //ddl.ID = "DDL_FrmEnableRole_" + md.No; //ddl.Items.Add(new ListItem("始终启用", "0")); //ddl.Items.Add(new ListItem("有数据时启用", "1")); //ddl.Items.Add(new ListItem("有参数时启用", "2")); //ddl.Items.Add(new ListItem("按表单字段条件", "3")); //ddl.Items.Add(new ListItem("按SQL表达式", "4")); //ddl.SetSelectItem(fn.FrmEnableRoleInt); //设置权限控制方案. //this.Pub1.AddTD(ddl); this.Pub1.AddTD("<a href=\"javascript:WinOpen('./FlowFrm/FrmEnableRole.aspx?FK_Node=" + fn.FK_Node + "&FK_MapData=" + fn.FK_Frm + "')\">设置(" + fn.FrmEnableRoleText + ")</a>"); CheckBox cb = new CheckBox(); //cb.ID = "CB_IsEdit_" + md.No; //cb.Text = "可编辑否?"; //cb.Checked = fn.IsEdit; //this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsPrint_" + md.No; cb.Text = "打印否?"; cb.Checked = fn.IsPrint; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsEnableLoadData_" + md.No; cb.Text = "启用否?"; cb.Checked = fn.IsEnableLoadData; this.Pub1.AddTD(cb); ddl = new DDL(); ddl.ID = "DDL_Sln_" + md.No; ddl.Items.Add(new ListItem("默认方案", "0")); ddl.Items.Add(new ListItem("自定义", this.FK_Node.ToString())); ddl.Items.Add(new ListItem("不可编辑", "1")); //让其不可编辑. ddl.SetSelectItem(fn.FrmSln); //设置权限控制方案. this.Pub1.AddTD(ddl); this.Pub1.AddTDBegin(); this.Pub1.Add("<a href=\"javascript:WinField('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >字段</a>"); this.Pub1.Add("-<a href=\"javascript:WinFJ('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >附件</a>"); this.Pub1.Add("-<a href=\"javascript:WinDtl('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >从表</a>"); if (md.HisFrmType == FrmType.ExcelFrm) { this.Pub1.Add("-<a href=\"javascript:ToolbarExcel('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >ToolbarExcel</a>"); } if (md.HisFrmType == FrmType.WordFrm) { this.Pub1.Add("-<a href=\"javascript:ToolbarWord('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >ToolbarWord</a>"); } this.Pub1.AddTDEnd(); ddl = new DDL(); ddl.ID = "DDL_WhoIsPK_" + md.No; ddl.BindSysEnum("WhoIsPK"); ddl.SetSelectItem((int)fn.WhoIsPK); //谁是主键?. this.Pub1.AddTD(ddl); if (md.HisFrmType == FrmType.ExcelFrm || md.HisFrmType == FrmType.WordFrm) { ddl = new DDL(); ddl.ID = "DDL_File_" + md.No; string[] files = System.IO.Directory.GetFiles(BP.Sys.SystemConfig.PathOfDataUser + "\\FrmOfficeTemplate\\", md.No + "*.xls"); foreach (string str in files) { //System.IO.FileInfo info=new System.IO.FileInfo( ddl.Items.Add(new ListItem(str.Substring(str.LastIndexOf(md.No)), str)); } this.Pub1.AddTD(ddl); } else { this.Pub1.AddTD("无效"); } if (nd.HisRunModel == RunModel.FL || nd.HisRunModel == RunModel.FHL) { cb = new CheckBox(); cb.ID = "CB_Is1ToN_" + md.No; cb.Text = "是否1变N?"; cb.Checked = fn.Is1ToN; this.Pub1.AddTD(cb);//add by zhoupeng 2016.03.25 for hainan. } if (nd.HisRunModel == RunModel.SubThread) { ddl = new DDL(); ddl.ID = "DDL_HuiZong_" + md.No; ddl.Items.Add(new ListItem("不汇总数据", "0")); BP.WF.Template.FrmNodes myfns = new FrmNodes(); myfns.Retrieve(FrmNodeAttr.FK_Flow, nd.FK_Flow); //组合这个字符串. string strs = ";" + fn.FK_Frm + ";"; foreach (BP.WF.Template.FrmNode myfrn in myfns) { if (strs.Contains(";" + myfrn.FK_Frm + ";") == true) { continue; } strs += ";" + myfrn.FK_Frm + ";"; //检查该frm 是否有dtl. MapDtls dtls = new MapDtls(myfrn.FK_Frm); if (dtls.Count == 0) { continue; } foreach (MapDtl dtl in dtls) { ddl.Items.Add(new ListItem("汇总到:" + myfrn.HisFrm.Name + "-" + dtl.Name, myfrn.HisFrm.No + "@" + dtl.No)); } } ddl.SetSelectItem(fn.HuiZong); //设置汇总.. this.Pub1.AddTD(ddl); } TextBox tb = new TextBox(); tb.ID = "TB_Idx_" + md.No; tb.Text = fn.Idx.ToString(); tb.Columns = 5; this.Pub1.AddTD(tb); this.Pub1.AddTDA("BindFrms.aspx?ShowType=EditPowerOrder&FK_Node=" + this.FK_Node + "&FK_Flow=" + this.FK_Flow + "&MyPK=" + fn.MyPK + "&DoType=Up", "上移"); this.Pub1.AddTDA("BindFrms.aspx?ShowType=EditPowerOrder&FK_Node=" + this.FK_Node + "&FK_Flow=" + this.FK_Flow + "&MyPK=" + fn.MyPK + "&DoType=Down", "下移"); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); text = "<input type=button onclick=\"javascript:BindFrms('" + this.FK_Node + "','" + this.FK_Flow + "');\" value='修改表单绑定' class=Btn />"; this.Pub1.Add(text); Button btn = new Button(); btn.ID = "Save"; btn.Text = "保存"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_SavePowerOrders_Click); this.Pub1.Add(btn); text = "<input type=button onclick=\"javascript:window.close();\" value='关闭' class=Btn />"; this.Pub1.Add(text); }
/// <summary> /// 保存从word中提取的数据 /// <param name="fk_mds">excel表单的编号</param> /// </summary> private void SaveFieldInfos(string[] fk_mds) { foreach (var fk_md in fk_mds) { var mes = new MapExts(fk_md); if (mes.Count == 0) { return; } var item = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.PageLoadFull) as MapExt; if (item == null) { return; } var fieldCount = 0; var prefix = "field_" + fk_md; foreach (var key in Request.Form.AllKeys) { var idx = 0; if (key.StartsWith(prefix) && key.Length > prefix.Length && int.TryParse(key.Substring(prefix.Length), out idx)) { fieldCount++; } } var fieldsJson = string.Empty; for (var i = 0; i < fieldCount; i++) { fieldsJson += Request[prefix + i]; } //var fieldsJson = Request["field"]; var fields = LitJson.JsonMapper.ToObject <List <ReplaceField> >(HttpUtility.UrlDecode(fieldsJson)); //更新主表数据 var en = new GEEntityExcelFrm(fk_md); var pk = en.OID = GetPK(fk_md); if (en.RetrieveFromDBSources() == 0) { throw new Exception("OID=" + pk + "的数据在" + fk_md + "中不存在,请检查!"); } //此处因为weboffice在上传的接口中,只有上传成功与失败的返回值,没有具体的返回信息参数,所以未做异常处理 foreach (var field in fields) { en.SetValByKey(field.key, field.value); } en.LastEditer = WebUser.Name; en.RDT = DataType.CurrentDataTime; en.Update(); //todo:更新明细表数据,此处逻辑可能还有待商榷 var mdtls = new MapDtls(fk_md); if (mdtls.Count == 0) { return; } var dtlsCount = 0; prefix = "dtls_" + fk_md; foreach (var key in Request.Form.AllKeys) { var idx = 0; if (key.StartsWith(prefix) && key.Length > prefix.Length && int.TryParse(key.Substring(prefix.Length), out idx)) { dtlsCount++; } } var dtlsJson = string.Empty; for (var i = 0; i < dtlsCount; i++) { dtlsJson += Request[prefix + i]; } //var dtlsJson = Request["dtls"]; var dtls = LitJson.JsonMapper.ToObject <List <ReplaceDtlTable> >(HttpUtility.UrlDecode(dtlsJson)); GEDtls gedtls = null; GEDtl gedtl = null; ReplaceDtlTable wdtl = null; foreach (MapDtl mdtl in mdtls) { wdtl = dtls.FirstOrDefault(o => o.dtlno == mdtl.No); if (wdtl == null || wdtl.dtl.Count == 0) { continue; } //此处不是真正意义上的更新,因为不知道明细表的主键,只能将原明细表中的数据删除掉,然后再重新插入新的数据 gedtls = new GEDtls(mdtl.No); gedtls.Delete(GEDtlAttr.RefPK, en.PKVal); foreach (var d in wdtl.dtl) { gedtl = gedtls.GetNewEntity as GEDtl; foreach (var cell in d.cells) { gedtl.SetValByKey(cell.key, cell.value); } gedtl.RefPK = en.PKVal.ToString(); gedtl.RDT = DataType.CurrentDataTime; gedtl.Rec = WebUser.No; gedtl.Insert(); } } } }