Exemplo n.º 1
0
        public FlowChartDetailGet QueryFLDetailByID(int id)
        {
            FlowChartDetailGet detailItem = new FlowChartDetailGet();
            var item = flowChartDetailRepository.GetById(id);

            detailItem.FlowChartDetailDTO = AutoMapper.Mapper.Map <FlowChartDetailDTO>(item);
            //获取父节点制程信息
            Dictionary <int, string> FatherProcessDict = new Dictionary <int, string>();
            //去掉重复的process后的制程信息
            Dictionary <int, string> DistinctFatherProcessDict = new Dictionary <int, string>();

            //var fatherProcessItem = flowChartDetailRepository.GetById(detailItem.FlowChartDetailDTO.FatherProcess);
            switch (item.Process_Seq)
            {
            case 1:
                //取后面4个Seq
                var seqListOne = new List <int> {
                    2, 3, 4, 5
                };
                var afterSeqList = flowChartDetailRepository.GetMany(m => m.FlowChart_Master_UID == item.FlowChart_Master_UID && m.FlowChart_Version == item.FlowChart_Version &&
                                                                     seqListOne.Contains(m.Process_Seq))
                                   .Select(m => new { m.FlowChart_Detail_UID, m.Process }).ToList();
                foreach (var afterSeqItem in afterSeqList)
                {
                    FatherProcessDict.Add(afterSeqItem.FlowChart_Detail_UID, afterSeqItem.Process);
                }
                break;

            //取Seq=1和Seq=3,4
            case 2:
                var seqListTwo = new List <int> {
                    1, 3, 4, 5
                };
                var afterSeqTwoList = flowChartDetailRepository.GetMany(m => m.FlowChart_Master_UID == item.FlowChart_Master_UID && m.FlowChart_Version == item.FlowChart_Version &&
                                                                        seqListTwo.Contains(m.Process_Seq))
                                      .Select(m => new { m.FlowChart_Detail_UID, m.Process }).ToList();
                foreach (var afterSeqItem in afterSeqTwoList)
                {
                    FatherProcessDict.Add(afterSeqItem.FlowChart_Detail_UID, afterSeqItem.Process);
                }
                break;

            //取前两个Seq和后两个Seq
            default:
                var frontOne     = item.Process_Seq - 1;
                var frontTwo     = item.Process_Seq - 2;
                var behindOne    = item.Process_Seq + 1;
                var behindTwo    = item.Process_Seq + 2;
                var seqListThree = new List <int> {
                    frontOne, frontTwo, behindOne, behindTwo
                };
                var seqThreeList = flowChartDetailRepository.GetMany(m => m.FlowChart_Master_UID == item.FlowChart_Master_UID && m.FlowChart_Version == item.FlowChart_Version &&
                                                                     seqListThree.Contains(m.Process_Seq))
                                   .Select(m => new { m.FlowChart_Detail_UID, m.Process }).ToList();
                foreach (var afterSeqItem in seqThreeList)
                {
                    FatherProcessDict.Add(afterSeqItem.FlowChart_Detail_UID, afterSeqItem.Process);
                }
                break;
            }
            var groupByValues = FatherProcessDict.GroupBy(m => m.Value);

            foreach (var groupItem in groupByValues)
            {
                var hasItem = FatherProcessDict.Where(m => m.Value == groupItem.Key).FirstOrDefault();
                DistinctFatherProcessDict.Add(hasItem.Key, hasItem.Value);
            }
            detailItem.FatherProcess    = DistinctFatherProcessDict;
            detailItem.FunPlant         = item.System_Function_Plant.FunPlant;
            detailItem.Organization_UID = item.System_Function_Plant.System_FunPlant_UID;
            return(detailItem);
        }
Exemplo n.º 2
0
        public PagedListModel <FlowChartDetailGet> QueryFLDetailWUXI_MList(int id, int Version)
        {
            var totalCount = 0;
            var masterItem = flowChartMasterRepository.GetById(id);

            if (masterItem != null)
            {
                IList <FlowChartDetailGet> importList = new List <FlowChartDetailGet>();

                var flChartList = flowChartMasterRepository.QueryFLDetailWUXI_MList(id, Version, out totalCount);
                //importItem.FlowChartMasterDTO = AutoMapper.Mapper.Map<FlowChartMasterDTO>(masterItem);
                foreach (var flChartItem in flChartList)
                {
                    FlowChartDetailGet importDetailItem = new FlowChartDetailGet();
                    importDetailItem.FlowChartDetailDTO = AutoMapper.Mapper.Map <FlowChartDetailDTO>(flChartItem);
                    //没合并前注释掉
                    //importDetailItem.FlowChartDetailDTO.Process_Seq = flChartItem.ItemNo;
                    if (flChartItem.FatherProcess_UID != null)
                    {
                        var process = flChartList.Where(m => m.FlowChart_Detail_UID == flChartItem.FatherProcess_UID).Select(m => m.Process).First();
                        importDetailItem.FlowChartDetailDTO.FatherProcess = process;
                    }

                    switch (flChartItem.IsQAProcess)
                    {
                    case StructConstants.IsQAProcessType.InspectKey:     //IPQC全检
                        importDetailItem.FlowChartDetailDTO.IsQAProcessName = StructConstants.IsQAProcessType.InspectText;
                        break;

                    case StructConstants.IsQAProcessType.PollingKey:     //IPQC巡检
                        importDetailItem.FlowChartDetailDTO.IsQAProcessName = StructConstants.IsQAProcessType.PollingText;
                        break;

                    case StructConstants.IsQAProcessType.InspectOQCKey:     //OQC检测
                        importDetailItem.FlowChartDetailDTO.IsQAProcessName = StructConstants.IsQAProcessType.InspectOQCText;
                        break;

                    case StructConstants.IsQAProcessType.InspectAssembleKey:     //组装检测
                        importDetailItem.FlowChartDetailDTO.IsQAProcessName = StructConstants.IsQAProcessType.InspectAssembleText;
                        break;

                    case StructConstants.IsQAProcessType.AssembleOQCKey:     //组装&OQC检测
                        importDetailItem.FlowChartDetailDTO.IsQAProcessName = StructConstants.IsQAProcessType.AssembleOQCText;
                        break;

                    default:
                        importDetailItem.FlowChartDetailDTO.IsQAProcessName = string.Empty;
                        break;
                    }

                    //importDetailItem.FlowChartMgDataDTO = AutoMapper.Mapper.Map<FlowChartMgDataDTO>(flChartItem.FlowChart_MgData.FirstOrDefault());
                    importDetailItem.SystemUserDTO = AutoMapper.Mapper.Map <SystemUserDTO>(flChartItem.System_Users);
                    importDetailItem.FunPlant      = flChartItem.System_Function_Plant.FunPlant;
                    importList.Add(importDetailItem);
                }

                return(new PagedListModel <FlowChartDetailGet>(0, importList));
            }
            else
            {
                return(null);
            }
        }