Example #1
0
        public string CheckFlowChart(FlowChartExcelImportParas parasItem)
        {
            string isValid = string.Empty;
            var    budItem = systemBUDRepository.GetMany(m => m.BU_D_Name == parasItem.BU_D_Name).FirstOrDefault();

            //如果budItem没有,说明不存在这个客户
            if (budItem != null)
            {
                if (parasItem.isEdit)
                {
                    var masterItem = flowChartMasterRepository.GetById(parasItem.FlowChart_Master_UID);
                    if (masterItem.System_Project.Project_Name == parasItem.Project_Name && masterItem.System_Project.System_BU_D.BU_D_Name == parasItem.BU_D_Name &&
                        masterItem.System_Project.Product_Phase == parasItem.Product_Phase && masterItem.Part_Types == parasItem.Part_Types)
                    {
                        isValid = string.Format("{0}_{1}_{2}_{3}", masterItem.FlowChart_Master_UID, masterItem.Project_UID, masterItem.FlowChart_Version, masterItem.System_Project.Organization_UID);
                    }
                    else
                    {
                        isValid = string.Format("客户{0},专案名称{1},部件{2},阶段{3}不匹配,不能更新", parasItem.BU_D_Name, parasItem.Project_Name, parasItem.Part_Types, parasItem.Product_Phase);
                    }
                }
                else
                {
                    var projetItem = systemProjectRepository.GetMany(m => m.BU_D_UID == budItem.BU_D_UID && m.Project_Name == parasItem.Project_Name &&
                                                                     m.Product_Phase == parasItem.Product_Phase && parasItem.Organization_UIDList.Contains(m.Organization_UID)).FirstOrDefault();
                    //如果projectUIDList没有,说明该数据不存在
                    if (projetItem != null)
                    {
                        //如果flItem为空,说明可以新导入这条数据
                        var flItem = flowChartMasterRepository.GetMany(m => m.Project_UID == projetItem.Project_UID && m.Part_Types == parasItem.Part_Types).FirstOrDefault();
                        if (flItem == null)
                        {
                            isValid = string.Format("{0}_{1}", projetItem.Project_UID.ToString(), projetItem.Organization_UID);
                        }
                        else
                        {
                            isValid = string.Format("导入的专案{0}已经存在,不能新增专案", parasItem.Project_Name);
                        }
                    }
                    else
                    {
                        isValid = string.Format("客户{0}或专案名称{1}或阶段{2}不存在,或者用户没有该专案的权限,不能导入", parasItem.BU_D_Name, parasItem.Project_Name, parasItem.Product_Phase);
                    }
                }
            }
            else
            {
                isValid = string.Format("客户名称{0}不存在", parasItem.BU_D_Name);
            }
            return(isValid);
        }
Example #2
0
        public Dictionary <int, string> GetPartTypesByProject(int ProjectUID)
        {
            Dictionary <int, string> dirList = new Dictionary <int, string>();

            dirList.Add(StructConstants.ReportStatus.AllKey, StructConstants.ReportStatus.AllValue);
            var list = flowChartMasterRepository.GetMany(m => m.Project_UID == ProjectUID).ToList();

            list.ForEach(m => dirList.Add(m.FlowChart_Master_UID, m.Part_Types));
            return(dirList);
        }