Ejemplo n.º 1
0
        public GetJobCardEntryReportResponseDto GetJobCardEntryReport(GetJobCardEntryReportRequestDto getJobCardEntryReportRequestDto)
        {
            var response = new GetJobCardEntryReportResponseDto()
            {
                getJobCardEntryCommonList = new List <JobCardEntryCommon>()
            };
            var responseDto = new JobCardEntryCommon();

            var model = workOrderTypeRepository.GetJobCardEntryReport(getJobCardEntryReportRequestDto.WoNumber, getJobCardEntryReportRequestDto.WoSerial);

            if (model.GetJobCardEntryReportModel != null && model.GetJobCardEntryReportModel.Count() > 0)
            {
                var getsingle = new JobCardEntryCommon
                {
                    getJobCardEntrySerialList   = new List <JobCardEntrySerialList>(),
                    getJobCardEntrySequenceList = new List <JobCardEntrySequenceList>()
                };

                foreach (var workOrderMasterDetails in model.GetJobCardEntryReportModel)
                {
                    var getJobCardEntrySerialList = new JobCardEntrySerialList();
                    getJobCardEntrySerialList.HeatNo   = workOrderMasterDetails.HeatNo;
                    getJobCardEntrySerialList.SerialNo = workOrderMasterDetails.SerialNo;

                    var isExist = getsingle.getJobCardEntrySerialList.Any(serialNo => serialNo.SerialNo == workOrderMasterDetails.SerialNo);

                    if (!isExist)
                    {
                        getsingle.getJobCardEntrySerialList.Add(getJobCardEntrySerialList);
                    }

                    var getJobCardEntryProcessDetailsList = new List <JobCardEntryProcessDetails>();
                    var JobCardEntryProcessDetails        = new JobCardEntryProcessDetails();
                    var getJobCardEntrySequenceList       = new JobCardEntrySequenceList
                    {
                        getJobCardEntryProcessDetails = new List <JobCardEntryProcessDetails>()
                    };

                    JobCardEntryProcessDetails.Description  = workOrderMasterDetails.Description;
                    JobCardEntryProcessDetails.DimensionMax = workOrderMasterDetails.DimensionMax;
                    JobCardEntryProcessDetails.DimensionMin = workOrderMasterDetails.DimensionMin;
                    JobCardEntryProcessDetails.Serial       = workOrderMasterDetails.Serial;

                    getJobCardEntrySequenceList.SequenceNumber = workOrderMasterDetails.SequenceNumber;
                    getJobCardEntrySequenceList.SettingTime    = workOrderMasterDetails.SettingTime;
                    getJobCardEntrySequenceList.RunningTime    = workOrderMasterDetails.RunningTime;

                    var isSequenceExist = getsingle.getJobCardEntrySequenceList.Any(sequenceNo => sequenceNo.SequenceNumber == workOrderMasterDetails.SequenceNumber);

                    if (!isSequenceExist)
                    {
                        getJobCardEntrySequenceList.getJobCardEntryProcessDetails.Add(JobCardEntryProcessDetails);
                        getsingle.getJobCardEntrySequenceList.Add(getJobCardEntrySequenceList);
                    }
                    else
                    {
                        var indexForSequence = getsingle.getJobCardEntrySequenceList.FindIndex(a => a.SequenceNumber == workOrderMasterDetails.SequenceNumber);

                        var isSerialExist = getsingle.getJobCardEntrySequenceList[indexForSequence].getJobCardEntryProcessDetails.Any(serial => serial.Serial == workOrderMasterDetails.Serial);

                        if (!isSerialExist)
                        {
                            getsingle.getJobCardEntrySequenceList[indexForSequence].getJobCardEntryProcessDetails.Add(JobCardEntryProcessDetails);
                        }
                    }

                    getsingle.WoNumber                 = workOrderMasterDetails.WoNumber;
                    getsingle.WoSerial                 = workOrderMasterDetails.WoSerial;
                    getsingle.WoNoAndSI                = workOrderMasterDetails.WoNoAndSI;
                    getsingle.PartCode                 = workOrderMasterDetails.PartCode;
                    getsingle.ItemCode                 = workOrderMasterDetails.ItemCode;
                    getsingle.PartDescription          = workOrderMasterDetails.PartDescription;
                    getsingle.CustomerName             = workOrderMasterDetails.CustomerName;
                    getsingle.Description              = workOrderMasterDetails.Description;
                    getsingle.DrawingNumber            = workOrderMasterDetails.DrawingNumber;
                    getsingle.DrawingNumberRevision    = workOrderMasterDetails.DrawingNumberRevision;
                    getsingle.MaterialShortDescription = workOrderMasterDetails.MaterialShortDescription;
                }

                response.getJobCardEntryCommonList.Add(getsingle);
            }

            return(response);
        }