Ejemplo n.º 1
0
        public ListResultDto <CuttingSummaryDto> GetCuttingSummary(GetCuttingItemInput input)
        {
            var @cuttingmaster = _cuttingitemRepository.GetAll()

                                 .WhereIf(true, Y => Y.Date == input.From)
                                 .Select(m => new { m.CuttingMaster.StyleNo })
                                 .Distinct()
                                 .ToList();
            List <CuttingSummaryDto> list = new List <CuttingSummaryDto>();

            foreach (var row in @cuttingmaster)
            {
                int orderQty = 0;
                var orders   = _workorderRatioRepository.GetAll()

                               .WhereIf(true, X => X.WorkOrderHeader.StyleNo == row.StyleNo)

                               .ToList();
                int sum = 0;
                foreach (var or in orders)
                {
                    sum = or.Quantity + sum;
                }

                orderQty = sum;

                list.Add(new CuttingSummaryDto {
                    Date = input.From, StyleNo = row.StyleNo, OrderQty = orderQty, ActualQty = getDalyCut(row.StyleNo, input), Cumm = getCutCumm(row.StyleNo), Balance = getCutCumm(row.StyleNo) - orderQty
                });
            }



            return(new ListResultOutput <CuttingSummaryDto>(list.MapTo <List <CuttingSummaryDto> >()));
        }
Ejemplo n.º 2
0
        public ListResultDto <CuttingItemListDto> GetCuttingItems(GetCuttingItemInput input)
        {
            var @cuttingmaster = _cuttingitemRepository.GetAll()
                                 .Include(x => x.CuttingMaster)
                                 .WhereIf(true, Y => Y.Date >= input.From && Y.Date <= input.To)
                                 .OrderBy(x => x.CreationTime);



            return(new ListResultDto <CuttingItemListDto>(cuttingmaster.ProjectTo <CuttingItemListDto>().ToList()));
        }
Ejemplo n.º 3
0
        int getDalyCut(string _styleNo, GetCuttingItemInput input)
        {
            var item = _cuttingitemRepository.GetAll()
                       .WhereIf(true, X => X.CuttingMaster.StyleNo == _styleNo && X.Date == input.From)
                       .ToList();
            var sum = item
                      .GroupBy(x => x.CuttingMasterId)
                      .Select(x => x.Sum(y => y.NoOfItem));

            return(sum.FirstOrDefault());
        }
Ejemplo n.º 4
0
        public ListResultDto <CuttingItemListDto> GetCuttingItemsGroupByStyle(GetCuttingItemInput input)
        {
            var @cuttingmaster = _cuttingitemRepository.GetAll()

                                 .Include(x => new { x.CuttingMaster })

                                 .GroupBy(x => new { x.CuttingMaster.StyleNo, x.Date })

                                 .WhereIf(true, Y => Y.Key.Date >= input.From && Y.Key.Date <= input.To)

                                 .Select(x => new { StyleNo = x.Key.StyleNo, Date = x.Key.Date, Pcs = x.Sum(c => c.NoOfItem) });



            return(new ListResultDto <CuttingItemListDto>(cuttingmaster.ProjectTo <CuttingItemListDto>().ToList()));
            // return @cuttingmaster.MapTo<CuttingItemDto>();


            //  return new ListResultOutput<CuttingItemListDto>(cuttingmaster.MapTo<List<CuttingItemListDto>>());
        }