Ejemplo n.º 1
0
        /// <summary>
        /// 解析组件
        /// </summary>
        /// <param name="designerItems"></param>
        /// <returns></returns>
        public List <TradeFlow> SerializeDesignerItems(IEnumerable <DesignerItem> designerItems, List <string> connections)
        {
            var serializedItems = new List <TradeFlow>();

            foreach (var item in designerItems)
            {
                TradeFlow flow = new TradeFlow();
                flow.TradeCode = this.TradeCode;
                flow.CompCode  = item.ComponentCode;
                flow.FlowCode  = item.CurrentSerialNumber;
                string trade_FlowCode = "";
                connections.ForEach(x =>
                {
                    string[] str = x.Split('%');
                    if (str[0].ToString().Trim() == item.CurrentSerialNumber.ToString().Trim())
                    {
                        trade_FlowCode += str[1].ToString();
                    }
                });
                flow.Trade_Flow = trade_FlowCode == "" ? "#$" : trade_FlowCode += "#$";
                serializedItems.Add(flow);
            }
            return(serializedItems);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 解析组件
        /// </summary>
        /// <param name="designerItems"></param>
        /// <returns></returns>
        public List<TradeFlow> SerializeDesignerItems(IEnumerable<DesignerItem> designerItems, List<string> connections)
        {
            var serializedItems = new List<TradeFlow>();
            foreach (var item in designerItems)
            {
                TradeFlow flow = new TradeFlow();
                flow.TradeCode = this.TradeCode;
                flow.CompCode = item.ComponentCode;
                flow.FlowCode = item.CurrentSerialNumber;
                string trade_FlowCode = "";
                connections.ForEach(x =>
                {
                    string[] str = x.Split('%');
                    if (str[0].ToString().Trim() == item.CurrentSerialNumber.ToString().Trim())
                    {
                        trade_FlowCode += str[1].ToString();
                    }

                });
                flow.Trade_Flow = trade_FlowCode == "" ? "#$" : trade_FlowCode += "#$";
                serializedItems.Add(flow);
            }
            return serializedItems;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 打开流程
        /// </summary>
        /// <param name="tradeFlowListEntity">交易流程实体层</param>
        /// <param name="typeList">组件类型列表</param>
        /// <param name="subRelListEntity">映射关系实体层</param>

        public void Open(List <T_plt_tradeFlowEntity> tradeFlowListEntity, List <Label> typeList, List <T_plt_subrelEntity> subRelListEntity)
        {
            #region 初始化

            flowList = new List <TradeFlow>(); //流程实例列表
            var sublist = new List <SubRel>(); //参数关系列表
            //List<string> connectionOverList = new List<string>();//零时序号列表

            if (SerialNumber != null)
            {
                SerialNumber.Clear();       //清空序号
            }
            Children.Clear();               //清空画布
            SelectService.ClearSelection(); //清空画布引用关系
            #endregion
            #region 实体转换
            if (tradeFlowListEntity != null)
            {
                if (tradeFlowListEntity.Count() > 0)
                {
                    tradeFlowListEntity.ForEach(x5 =>
                    {
                        var flow        = new TradeFlow();
                        flow.TradeCode  = x5.TxCode.Trim();
                        flow.CompCode   = x5.CompCode.Trim();
                        flow.Trade_Flow = x5.TradeFlow.Trim();
                        flow.FlowCode   = x5.FlowCode.Trim();
                        flowList.Add(flow);
                    });
                }
            }
            if (subRelListEntity != null)
            {
                if (subRelListEntity.Count() > 0)
                {
                    subRelListEntity.ForEach(x =>
                    {
                        var rel          = new SubRel();
                        rel.TradeCode    = x.tx_code.Trim();
                        rel.CompCode     = x.comp_code.Trim();
                        rel.OutData      = x.out_data.Trim();
                        rel.InType       = x.in_data_type.Trim() == "1"?TypeOpt.常量:TypeOpt.表达式;
                        rel.InData       = x.in_data.Trim();
                        rel.Memo         = x.memo.Trim();
                        rel.SerialNumber = x.flow_no.Trim();
                        sublist.Add(rel);
                    });
                }
            }
            #endregion

            if (flowList.Count() < 1)
            {
                return;                         //如果不存在交易流程,返回
            }
            #region item和线的处理
            LayOut();//对容器的元素进行布局
            var i = 0;
            foreach (Tx_Node node in m_LstNodes)
            {
                SerialNumber.Add(Convert.ToInt32(node.Flow_code)); //组件
                var lbl = typeList.Where(z => z.Tag.ToString().Trim() == node.Component_code.Trim()).FirstOrDefault();
                if (lbl != null)
                {
                    var tmp = new List <SubRel>();
                    sublist.ForEach(x =>
                    {
                        if (x.SerialNumber == node.Flow_code)
                        {
                            tmp.Add(x);
                        }
                    });
                    var item = DeserializeDesignerItem(TradeCode, node.Flow_code, node.X, node.Y, lbl, m_Connection[node.Component_code], tmp);
                    if (!string.IsNullOrWhiteSpace(node.Sub_tx_code.Trim()))
                    {
                        item.IsDragConnectionOver = true;
                    }
                    Canvas.SetZIndex(item, 1);
                    this.Children.Add(item);
                    ControlTemplate template = DesignerItem.GetConnectorDecoratorTemplate(item) as ControlTemplate;
                    DesignerItem.SetConnectorDecoratorTemplate(item, template);
                }
                i++;
            }

            this.InvalidateVisual();//使元素的呈现无效,并强制执行完整的新布局处理过程。布局循环完成后
            if (m_LstEntrys == null)
            {
                return;
            }

            foreach (Tx_Entry entry in m_LstEntrys)
            {
                string sourceID = entry.StartNode;
                string sinkID   = entry.EndNode;
                if (!string.IsNullOrEmpty(sinkID) && !string.IsNullOrEmpty(sourceID))
                {
                    var sourceConnector = GetConnector(sourceID, 6);
                    var sinkConnector   = GetConnector(sinkID, 2);
                    var connection      = new Connection(sourceConnector, sinkConnector, entry.Condition, entry.ConditionList);
                    Canvas.SetZIndex(connection, 2);
                    this.Children.Add(connection);
                }
            }
            #endregion
            //value = SerialNumber.OrderByDescending(x2 => x2).FirstOrDefault() + 1;//出
            UpdateZIndex();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 打开流程
        /// </summary>
        /// <param name="tradeFlowListEntity">交易流程实体层</param>
        /// <param name="typeList">组件类型列表</param>
        /// <param name="subRelListEntity">映射关系实体层</param>
        public void Open(List<T_plt_tradeFlowEntity> tradeFlowListEntity, List<Label> typeList, List<T_plt_subrelEntity> subRelListEntity)
        {
            #region 初始化

            flowList = new List<TradeFlow>(); //流程实例列表
            var sublist = new List<SubRel>();//参数关系列表
            //List<string> connectionOverList = new List<string>();//零时序号列表

            if (SerialNumber != null)
            {
                SerialNumber.Clear(); //清空序号
            }
            Children.Clear();//清空画布
            SelectService.ClearSelection();//清空画布引用关系
            #endregion
            #region 实体转换
            if (tradeFlowListEntity != null)
            {
                if (tradeFlowListEntity.Count() > 0)
                {
                    tradeFlowListEntity.ForEach(x5 =>
                    {
                        var flow = new TradeFlow();
                        flow.TradeCode = x5.TxCode.Trim();
                        flow.CompCode = x5.CompCode.Trim();
                        flow.Trade_Flow = x5.TradeFlow.Trim();
                        flow.FlowCode = x5.FlowCode.Trim();
                        flowList.Add(flow);
                    });
                }
            }
            if (subRelListEntity != null)
            {
                if (subRelListEntity.Count() > 0)
                {
                    subRelListEntity.ForEach(x =>
                    {
                        var rel = new SubRel();
                        rel.TradeCode = x.tx_code.Trim();
                        rel.CompCode = x.comp_code.Trim();
                        rel.OutData = x.out_data.Trim();
                        rel.InType = x.in_data_type.Trim()=="1"?TypeOpt.常量:TypeOpt.表达式;
                        rel.InData = x.in_data.Trim();
                        rel.Memo = x.memo.Trim();
                        rel.SerialNumber = x.flow_no.Trim();
                        sublist.Add(rel);
                    });
                }
            }
            #endregion

            if (flowList.Count() < 1) return;   //如果不存在交易流程,返回

            #region item和线的处理
            LayOut();//对容器的元素进行布局
            var i = 0;
            foreach (Tx_Node node in m_LstNodes)
            {
                SerialNumber.Add(Convert.ToInt32(node.Flow_code)); //组件
                var lbl = typeList.Where(z => z.Tag.ToString().Trim() == node.Component_code.Trim()).FirstOrDefault();
                if (lbl != null)
                {
                    var tmp=new List<SubRel>();
                    sublist.ForEach(x =>
                    {
                        if (x.SerialNumber == node.Flow_code) tmp.Add(x);
                    });
                    var item = DeserializeDesignerItem(TradeCode,node.Flow_code, node.X, node.Y, lbl, m_Connection[node.Component_code], tmp);
                    if (!string.IsNullOrWhiteSpace(node.Sub_tx_code.Trim()))
                        item.IsDragConnectionOver = true;
                    Canvas.SetZIndex(item, 1);
                    this.Children.Add(item);
                    ControlTemplate template = DesignerItem.GetConnectorDecoratorTemplate(item) as ControlTemplate;
                    DesignerItem.SetConnectorDecoratorTemplate(item, template);

                }
                i++;
            }

            this.InvalidateVisual();//使元素的呈现无效,并强制执行完整的新布局处理过程。布局循环完成后
            if (m_LstEntrys == null)
            {
                return;
            }

            foreach (Tx_Entry entry in m_LstEntrys)
            {
                string sourceID = entry.StartNode;
                string sinkID = entry.EndNode;
                if (!string.IsNullOrEmpty(sinkID) && !string.IsNullOrEmpty(sourceID))
                {
                    var sourceConnector = GetConnector(sourceID, 6);
                    var sinkConnector = GetConnector(sinkID, 2);
                    var connection = new Connection(sourceConnector, sinkConnector, entry.Condition, entry.ConditionList);
                    Canvas.SetZIndex(connection, 2);
                    this.Children.Add(connection);
                }
            }
            #endregion
            //value = SerialNumber.OrderByDescending(x2 => x2).FirstOrDefault() + 1;//出
            UpdateZIndex();
        }