Exemple #1
0
        void _createISOMappingFolder(S_D_DBS parent, string parentDefineCode, List <Dictionary <string, object> > folderDefines, List <S_D_DBS> existFolderList,
                                     S_T_ISODefine objMode, S_T_DBSDefine defineInfo, IFormExport export)
        {
            var folderDefine = folderDefines.FirstOrDefault(d => d["ParentID"].ToString() == parentDefineCode);

            if (folderDefine == null)
            {
                return;
            }
            var value = objMode.GetPropertyString(folderDefine.GetValue("FieldName"));

            if (String.IsNullOrEmpty(value))
            {
                return;
            }
            if (!String.IsNullOrEmpty(folderDefine.GetValue("EnumKey")))
            {
                var enumService = FormulaHelper.GetService <IEnumService>();
                value = enumService.GetEnumText(folderDefine.GetValue("EnumKey"), value);
            }
            var folder = existFolderList.FirstOrDefault(d => d.Name == value && d.ParentID == parent.ID);

            if (folder == null)
            {
                folder                   = new S_D_DBS();
                folder.ID                = FormulaHelper.CreateGuid();
                folder.Name              = value;
                folder.DBSCode           = objMode.ID;
                folder.DBSType           = Project.Logic.DBSType.Mapping.ToString();
                folder.ConfigDBSID       = defineInfo.ID + "." + folderDefine.GetValue("FieldName");
                folder.ArchiveFolder     = folderDefine.GetValue("ArchiveFolder");
                folder.MappingType       = parent.MappingType;
                folder.ArchiveFolderName = folderDefine.GetValue("ArchiveFolderName");
                folder.SortIndex         = objMode.SortIndex;
                parent.AddChild(folder);
                existFolderList.Add(folder);
            }
            bool addOnDocument = Convert.ToBoolean(folderDefine.GetValue("AddProduct"));

            if (addOnDocument)
            {
                if (folder.DBSCode == objMode.ID)
                {
                    _createISOForm(objMode, folder, export);
                }
            }
        }
Exemple #2
0
        void _createProductMappingFolder(S_D_DBS parent, string parentDefineCode, List <Dictionary <string, object> > folderDefines, List <S_D_DBS> existFolderList,
                                         S_E_Product product, S_T_DBSDefine defineInfo)
        {
            var folderDefine = folderDefines.FirstOrDefault(d => d["ParentID"].ToString() == parentDefineCode);

            if (folderDefine == null)
            {
                return;
            }
            var value = product.GetPropertyString(folderDefine.GetValue("FieldName"));

            if (String.IsNullOrEmpty(value))
            {
                _createProductMappingFolder(parent, folderDefine.GetValue("FieldName"), folderDefines, existFolderList, product, defineInfo);
            }
            else
            {
                if (!String.IsNullOrEmpty(folderDefine.GetValue("EnumKey")))
                {
                    var enumService = FormulaHelper.GetService <IEnumService>();
                    value = enumService.GetEnumText(folderDefine.GetValue("EnumKey"), value);
                }
                var folder = existFolderList.FirstOrDefault(d => d.Name == value && d.ParentID == parent.ID);
                if (folder == null)
                {
                    folder                   = new S_D_DBS();
                    folder.ID                = FormulaHelper.CreateGuid();
                    folder.Name              = value;
                    folder.DBSCode           = folderDefine.GetValue("FieldName");
                    folder.DBSType           = Project.Logic.DBSType.Mapping.ToString();
                    folder.MappingType       = parent.MappingType;
                    folder.ConfigDBSID       = defineInfo.ID + "." + folderDefine.GetValue("FieldName");
                    folder.ArchiveFolder     = folderDefine.GetValue("ArchiveFolder");
                    folder.ArchiveFolderName = folderDefine.GetValue("ArchiveFolderName");
                    parent.AddChild(folder);
                    existFolderList.Add(folder);
                }

                bool addOnDocument = true;// Convert.ToBoolean(folderDefine.GetValue("AddProduct"));
                //根据归档结构决定是否添加成果
                var ansestorFolders = existFolderList.Where(d => folder.FullID.StartsWith(d.FullID)).OrderBy(d => d.FullID).ToList();
                var preFlag         = true;
                for (int i = 0; i < folderDefines.Count; i++)
                {
                    var fd      = folderDefines[i];
                    var pdValue = product.GetPropertyString(fd.GetValue("FieldName"));//成果的结构所属字段对应值(阶段、子项、专业、工作包)
                    if (!String.IsNullOrEmpty(fd.GetValue("EnumKey")))
                    {
                        var enumService = FormulaHelper.GetService <IEnumService>();
                        pdValue = enumService.GetEnumText(fd.GetValue("EnumKey"), pdValue);
                    }
                    if (preFlag)
                    {
                        if (!string.IsNullOrEmpty(pdValue) && !ansestorFolders.Any(a => a.Name == pdValue)) //非空校验处理,成果只有阶段、专业属性情况
                        {
                            addOnDocument = false;                                                          //成果不属于当前分支,继续创建分支
                            break;
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(pdValue)) //专业下有成果、工作包下也有成果,只有成果的工作包属性是空时,才归档在专业下
                        {
                            addOnDocument = false;
                            break;
                        }
                    }
                    if (fd == folderDefine)
                    {
                        preFlag = false;
                    }
                }
                if (addOnDocument)
                {
                    #region 增加成果至归档目录
                    _archiveProduct(folder, product);
                    #endregion
                }
                else
                {
                    _createProductMappingFolder(folder, folderDefine.GetValue("FieldName"), folderDefines, existFolderList, product, defineInfo);
                }
            }
        }