コード例 #1
0
        /// <summary>
        /// 保存工艺规程和卡片
        /// </summary>
        /// <param name="?"></param>
        /// <param name="processPlanning"></param>
        public void SaveProcessPlanning(
            List <ProcessCardModule> processCardModules,
            ProcessPlanning processPlanning)
        {
            ProcessCardModuleBLL processCardModuleBLL = new ProcessCardModuleBLL();

            try
            {
                /// 保存工艺规程
                ProcessPlanningBLL.AddProcesPlanning(processPlanning);

                //保存文件夹
                ProcessVersion version = new ProcessVersion();
                version.FolderId   = tvProcessCard.SelectedNode.Tag.ToString();
                version.BaseId     = processPlanning.ProcessPlanningId.ToString();
                version.Name       = processPlanning.Name;
                version.CategoryId = "A9FE1F2B-730A-4DA7-8323-557C664B9734";
                Kingdee.CAPP.BLL.ProcessCardBLL.InsertProcessVersion(version, null);

                /// 保存工艺卡片
                ProcessCardBLL processCardBLL = new ProcessCardBLL();
                ProcessCard = new List <Model.ProcessCard>();

                int i = 1;
                foreach (var pcm in processCardModules)
                {
                    ProcessCard processCard = new ProcessCard();
                    //processCard.ID = Guid.NewGuid();
                    processCard.Name         = string.Format(processPlanning.Name + "-{0}", i); //Guid.NewGuid().ToString();
                    processCard.CardModuleId = pcm.Id;
                    processCard.Card         = processCardModuleBLL.GetCardModule(pcm.Id);
                    processCard.CreateTime   = DateTime.Now;
                    processCard.IsCheckOut   = false;
                    processCard.IsDelete     = 0;
                    processCard.UpdateTime   = DateTime.Now;

                    Guid id = processCardBLL.InsertProcessCard(processCard);
                    processCard.ID = id;
                    ProcessCard.Add(processCard);

                    ///保存工艺规程和卡片映射
                    PlanningCardRelationBLL.AddProcesPlanningData(
                        new PlanningCardRelation()
                    {
                        ProcessPlanningId      = processPlanning.ProcessPlanningId,
                        PlanningCardRelationId = Guid.NewGuid(),
                        ProcessCardId          = id,
                        CardSort = 0
                    });
                    i++;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// 方法说明:根据BusinessId删除模版或文件夹
        /// 作      者:jason.tang
        /// 完成时间:2013-07-24
        /// </summary>
        /// <param name="Id">业务ID</param>
        private void RemoveTreeNode(TreeNode currentNode)
        {
            if (currentNode == null)
            {
                return;
            }

            bool result = false;

            if (currentNode.ImageKey == "planning")
            {
                Guid planningId = new Guid(currentNode.Tag.ToString());
                result = ProcessPlanningBLL.DeletePlanningById(planningId);
                ProcessCardBLL.DeleteProcessVersion(planningId.ToString(), currentNode.Parent.Tag.ToString());
            }
            else
            {
                int  splitIndex = currentNode.Tag.ToString().IndexOf("@");
                Guid cardid     = new Guid(currentNode.Tag.ToString().Substring(0, splitIndex));
                Guid planningId = new Guid(currentNode.Parent.Tag.ToString());
                result = PlanningCardRelationBLL.DeleteRelationByCardId(cardid, planningId);
            }

            if (result)
            {
                if (currentNode.Parent != null && !string.IsNullOrEmpty(currentNode.Parent.ImageKey))
                {
                    tvProcessProcedure.SelectedNode     = currentNode.Parent;
                    tvProcessProcedure.SelectedImageKey = currentNode.Parent.ImageKey;
                }
                else
                {
                    tvProcessProcedure.SelectedNode = tvProcessProcedure.Nodes[0];
                    ///  如果选中的节点为空,默认为卡片
                    tvProcessProcedure.SelectedImageKey = tvProcessProcedure.Nodes[0].ImageKey;
                }

                //Remove treeview
                tvProcessProcedure.Nodes.Remove(currentNode);
                tvProcessProcedure.SelectedNode.Expand();
            }
        }
コード例 #3
0
        /// <summary>
        /// 查看时调用, 显示工艺规程和卡片模版树
        /// </summary>
        /// <param name="processCardModules"></param>
        public void ShowProcessPlanningTreeFromView()
        {
            processPlanningList
                = ProcessPlanningBLL.GetProcesPlanningList(null);

            foreach (var pp in processPlanningList)
            {
                TreeNode planningNode = new TreeNode();
                planningNode.Text     = pp.Name;
                planningNode.Tag      = pp.ProcessPlanningId + "@" + pp.FolderId;
                planningNode.ImageKey = "planning";
                planningNode.Name     = pp.Sort.ToString();
                planningNode.Expand();

                /// 调用
                ShowProcessCardByProcessPlanningId(pp.ProcessPlanningId, planningNode);


                tvProcessProcedure.Nodes.Add(planningNode);
            }
        }