Exemplo n.º 1
0
        public PagedListModel <MES_StationDataRecordDTO> GetMESSyncReport(MES_StationDataRecordDTO MesInfo, Page page)
        {
            List <MES_StationDataRecordDTO> mesResultList = new List <MES_StationDataRecordDTO>();
            var result       = MesDataSyncRepository.GetMESSyncReport(MesInfo);
            var sumdataList  = result.GroupBy(p => new { p.PIS_ProcessID, p.MES_ProcessID, p.TimeInterVal });
            var mesAllConfig = ProcessIDTRSConfigRepository.GetAll().ToList();

            foreach (var item in sumdataList)
            {
                MES_StationDataRecordDTO model = new MES_StationDataRecordDTO();
                model.PIS_ProcessID   = item.Key.PIS_ProcessID;
                model.PIS_ProcessName = item.FirstOrDefault().PIS_ProcessName;
                model.MES_ProcessID   = item.Key.MES_ProcessID;
                model.MES_ProcessName = item.FirstOrDefault().MES_ProcessName;
                model.ProcessType     = item.FirstOrDefault().ProcessType;
                model.ProductQuantity = item.Sum(p => p.ProductQuantity);
                model.TimeInterVal    = item.Key.TimeInterVal;
                var colorModel = mesAllConfig.Where(p => p.PIS_ProcessID == item.Key.PIS_ProcessID).FirstOrDefault();
                if (colorModel != null)
                {
                    model.Color = colorModel.Color;
                    mesResultList.Add(model);
                }
            }

            mesResultList = mesResultList.OrderBy(p => p.PIS_ProcessID).ThenBy(m => m.TimeInterVal).ToList();
            var totalCount = mesResultList.Count();
            var resultList = mesResultList.Skip(page.PageSize * page.PageNumber).Take(page.PageSize).ToList();

            return(new PagedListModel <MES_StationDataRecordDTO>(totalCount, resultList));
        }
Exemplo n.º 2
0
        public PagedListModel <ProcessIDTransformConfigDTO> GetProcessIDConfigData(ProcessIDTransformConfigDTO serchModel, Page page)
        {
            var result = ProcessIDTRSConfigRepository.GetAll();
            List <ProcessIDTransformConfigDTO> dtoList = AutoMapper.Mapper.Map <List <ProcessIDTransformConfigDTO> >(result);

            if (serchModel.Binding_Seq != 0)
            {
                dtoList = dtoList.Where(p => p.Binding_Seq == serchModel.Binding_Seq).ToList();
            }

            if (serchModel.PIS_ProcessID != 0)
            {
                dtoList = dtoList.Where(p => p.PIS_ProcessID == serchModel.PIS_ProcessID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.PIS_ProcessName))
            {
                dtoList = dtoList.Where(p => p.PIS_ProcessName == serchModel.PIS_ProcessName).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_NgID))
            {
                dtoList = dtoList.Where(p => p.MES_NgID == serchModel.MES_NgID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_PickingID))
            {
                dtoList = dtoList.Where(p => p.MES_PickingID == serchModel.MES_PickingID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_GoodProductID))
            {
                dtoList = dtoList.Where(p => p.MES_GoodProductID == serchModel.MES_GoodProductID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_ReworkID))
            {
                dtoList = dtoList.Where(p => p.MES_ReworkID == serchModel.MES_ReworkID).ToList();
            }
            if (!string.IsNullOrEmpty(serchModel.Color))
            {
                dtoList = dtoList.Where(p => p.Color == serchModel.Color).ToList();
            }

            if (serchModel.Modified_UID != 0)
            {
                dtoList = dtoList.Where(p => p.Modified_UID == serchModel.Modified_UID).ToList();
            }

            if (serchModel.VM_IsEnabled != "全部" && !string.IsNullOrEmpty(serchModel.VM_IsEnabled))
            {
                serchModel.IsEnabled = serchModel.VM_IsEnabled == "1" ? true : false;
                dtoList = dtoList.Where(p => p.IsEnabled == serchModel.IsEnabled).ToList();
            }

            if (serchModel.VM_IsSyncNG != "全部" && !string.IsNullOrEmpty(serchModel.VM_IsSyncNG))
            {
                serchModel.IsSyncNG = serchModel.VM_IsSyncNG == "1" ? true : false;
                dtoList             = dtoList.Where(p => p.IsSyncNG == serchModel.IsSyncNG).ToList();
            }

            var totalCount = dtoList.Count();
            var resultList = dtoList.Skip(page.PageSize * page.PageNumber).Take(page.PageSize).ToList();

            return(new PagedListModel <ProcessIDTransformConfigDTO>(totalCount, resultList));
        }