Example #1
0
        public IQueryable <FacilityProductionDataInfo> GetFacilityProductionDataInfos(string craftNO)
        {
            Type facilityProductionDataType = FacilityProductionDataInfo.GetFacilityProductionDataType(craftNO);

            return((IQueryable <FacilityProductionDataInfo>) this.Set(facilityProductionDataType));
        }
Example #2
0
        public FacilityProductionDataListResponse Execute(FacilityProductionDataListRequest request)
        {
            FacilityProductionDataListResponse      dataListResponse        = new FacilityProductionDataListResponse();
            IPagedList <FacilityProductionDataInfo> pagedList               = ServiceHelper.LoadService <IFacilityProductionDataService>().GetPagedList(request.PageNumber, request.PageSize);
            List <FacilityProductionDataModel>      productionDataModelList = new List <FacilityProductionDataModel>();

            int[] array1 = pagedList.Select(m => m.No).Distinct().ToArray();
            int[] array2 = pagedList.Select(m => m.Iden).Distinct().ToArray();
            Dictionary <int, Domain.Entities.ProcessInfo> dictionary1 = ServiceHelper.LoadService <IProductionService>().GetProcesses(array1).ToDictionary(m => m.CraftDID);
            Dictionary <int, FacilityInfo> dictionary2 = ServiceHelper.LoadService <IProductionService>().GetFacilities(array2).ToDictionary(m => m.FacilityDID);

            foreach (FacilityProductionDataInfo productionDataInfo in pagedList)
            {
                FacilityProductionDataModel productionDataModel = (FacilityProductionDataModel)Mapper.Map(productionDataInfo, FacilityProductionDataInfo.GetFacilityProductionDataType(request.CraftNO), FacilityProductionDataModel.GetFacilityProductionDataType(request.CraftNO));
                productionDataModel.DeviceGroupName = dictionary2.ContainsKey(productionDataInfo.No) ? dictionary2[productionDataInfo.Iden].MMName : null;
                productionDataModel.DeviceGroupName = dictionary1.ContainsKey(productionDataInfo.No) ? dictionary1[productionDataInfo.No].ProcessName : null;
                productionDataModelList.Add(productionDataModel);
            }
            dataListResponse.FacilityProductionDatas = new PagedData <FacilityProductionDataModel>(productionDataModelList, pagedList);
            return(dataListResponse);
        }