public List <FabricQCGradeTestsViewModel> GetForSPP(string no)
        {
            IQueryable <FabricQCGradeTestsViewModel> data;

            if (string.IsNullOrEmpty(no))
            {
                data = from qc in _repository.GetDbSet().AsNoTracking()
                       join dp in _dpSPPRepository.ReadAll()
                       on qc.DyeingPrintingAreaInputProductionOrderId equals dp.Id
                       select new FabricQCGradeTestsViewModel
                {
                    OrderNo       = qc.ProductionOrderNo,
                    OrderQuantity = dp.Balance
                };
            }
            else
            {
                data = from fabricqc in _repository.GetDbSet().AsNoTracking()
                       join fabricgt in _fgtRepository.GetDbSet().AsNoTracking() on fabricqc.Id equals fabricgt.FabricQualityControlId
                       join dp in _dpSPPRepository.ReadAll()
                       on fabricqc.DyeingPrintingAreaInputProductionOrderId equals dp.Id
                       where fabricqc.ProductionOrderNo == no
                       select new FabricQCGradeTestsViewModel
                {
                    OrderNo       = fabricqc.ProductionOrderNo,
                    OrderQuantity = dp.Balance,
                    Grade         = fabricgt.Grade
                };
            }
            return(data.AsNoTracking().ToList());
        }
Ejemplo n.º 2
0
        public ListResult <InputInspectionMaterialProductionOrderViewModel> ReadProductionOrders(int page, int size, string filter, string order, string keyword)
        {
            var           query            = _productionOrderRepository.ReadAll();
            List <string> SearchAttributes = new List <string>()
            {
                "ProductionOrderNo"
            };

            query = QueryHelper <DyeingPrintingAreaInputProductionOrderModel> .Search(query, SearchAttributes, keyword);

            Dictionary <string, object> FilterDictionary = JsonConvert.DeserializeObject <Dictionary <string, object> >(filter);

            query = QueryHelper <DyeingPrintingAreaInputProductionOrderModel> .Filter(query, FilterDictionary);

            Dictionary <string, string> OrderDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(order);

            query = QueryHelper <DyeingPrintingAreaInputProductionOrderModel> .Order(query, OrderDictionary);

            var data = query.Skip((page - 1) * size).Take(size).Select(s => new InputInspectionMaterialProductionOrderViewModel()
            {
                Id                 = s.Id,
                Balance            = s.Balance,
                BalanceRemains     = s.BalanceRemains,
                InputQuantity      = s.InputQuantity,
                Buyer              = s.Buyer,
                CartNo             = s.CartNo,
                BuyerId            = s.BuyerId,
                Color              = s.Color,
                Construction       = s.Construction,
                HasOutputDocument  = s.HasOutputDocument,
                IsChecked          = s.IsChecked,
                Motif              = s.Motif,
                PackingInstruction = s.PackingInstruction,
                MaterialWidth      = s.MaterialWidth,
                FinishWidth        = s.FinishWidth,
                Material           = new Material()
                {
                    Id   = s.MaterialId,
                    Name = s.MaterialName
                },
                YarnMaterial = new CommonViewModelObjectProperties.YarnMaterial()
                {
                    Id   = s.YarnMaterialId,
                    Name = s.YarnMaterialName
                },
                ProcessType = new CommonViewModelObjectProperties.ProcessType()
                {
                    Id   = s.ProcessTypeId,
                    Name = s.ProcessTypeName
                },
                Grade = s.Grade,
                MaterialConstruction = new MaterialConstruction()
                {
                    Name = s.MaterialConstructionName,
                    Id   = s.MaterialConstructionId
                },
                ProductionOrder = new ProductionOrder()
                {
                    Id   = s.ProductionOrderId,
                    No   = s.ProductionOrderNo,
                    Type = s.ProductionOrderType
                },
                Unit           = s.Unit,
                UomUnit        = s.UomUnit,
                DateIn         = s.DateIn,
                DateOut        = s.DateOut,
                MaterialOrigin = s.MaterialOrigin
            });

            return(new ListResult <InputInspectionMaterialProductionOrderViewModel>(data.ToList(), page, size, query.Count()));
        }
        public ListResult <InputShippingProductionOrderViewModel> ReadProductionOrders(int page, int size, string filter, string order, string keyword)
        {
            var           query            = _productionOrderRepository.ReadAll();
            List <string> SearchAttributes = new List <string>()
            {
                "ProductionOrderNo"
            };

            query = QueryHelper <DyeingPrintingAreaInputProductionOrderModel> .Search(query, SearchAttributes, keyword);

            Dictionary <string, object> FilterDictionary = JsonConvert.DeserializeObject <Dictionary <string, object> >(filter);

            query = QueryHelper <DyeingPrintingAreaInputProductionOrderModel> .Filter(query, FilterDictionary);

            Dictionary <string, string> OrderDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(order);

            query = QueryHelper <DyeingPrintingAreaInputProductionOrderModel> .Order(query, OrderDictionary);

            var data = query.Skip((page - 1) * size).Take(size).Select(s => new InputShippingProductionOrderViewModel()
            {
                Id            = s.Id,
                DeliveryOrder = new DeliveryOrderSales()
                {
                    Id = s.DeliveryOrderSalesId,
                    No = s.DeliveryOrderSalesNo
                },
                DeliveryOrderRetur = new DeliveryOrderRetur()
                {
                    Id = s.DeliveryOrderReturId,
                    No = s.DeliveryOrderReturNo
                },
                ProductionOrder = new ProductionOrder()
                {
                    Id            = s.ProductionOrderId,
                    No            = s.ProductionOrderNo,
                    OrderQuantity = s.ProductionOrderOrderQuantity,
                    Type          = s.ProductionOrderType
                },
                MaterialWidth = s.MaterialWidth,
                FinishWidth   = s.FinishWidth,
                Material      = new Material()
                {
                    Id   = s.MaterialId,
                    Name = s.MaterialName
                },
                MaterialConstruction = new MaterialConstruction()
                {
                    Name = s.MaterialConstructionName,
                    Id   = s.MaterialConstructionId
                },
                ProcessType = new CommonViewModelObjectProperties.ProcessType()
                {
                    Id   = s.ProcessTypeId,
                    Name = s.ProcessTypeName
                },
                YarnMaterial = new CommonViewModelObjectProperties.YarnMaterial()
                {
                    Id   = s.YarnMaterialId,
                    Name = s.YarnMaterialName
                },
                Remark                    = s.Remark,
                CartNo                    = s.CartNo,
                Buyer                     = s.Buyer,
                BuyerId                   = s.BuyerId,
                Construction              = s.Construction,
                Color                     = s.Color,
                Motif                     = s.Motif,
                PackingType               = s.PackagingType,
                Grade                     = s.Grade,
                QtyPacking                = s.PackagingQty,
                InputQtyPacking           = s.InputPackagingQty,
                Packing                   = s.PackagingUnit,
                Qty                       = s.Balance,
                InputQuantity             = s.InputQuantity,
                UomUnit                   = s.UomUnit,
                PackingLength             = s.PackagingLength,
                HasOutputDocument         = s.HasOutputDocument,
                ProductSKUId              = s.ProductSKUId,
                FabricSKUId               = s.FabricSKUId,
                ProductSKUCode            = s.ProductSKUCode,
                HasPrintingProductSKU     = s.HasPrintingProductSKU,
                ProductPackingId          = s.ProductPackingId,
                FabricPackingId           = s.FabricPackingId,
                ProductPackingCode        = s.ProductPackingCode,
                HasPrintingProductPacking = s.HasPrintingProductPacking,
                DateIn                    = s.DateIn
            });

            return(new ListResult <InputShippingProductionOrderViewModel>(data.ToList(), page, size, query.Count()));
        }
        public List <InputAvalTransformationProductionOrderViewModel> GetInputAvalProductionOrders(string avalType)
        {
            var productionOrders = _inputProductionOrderRepository.ReadAll().OrderByDescending(s => s.LastModifiedUtc)
                                   .Where(s => s.Area == DyeingPrintingArea.GUDANGAVAL && !s.HasOutputDocument && !s.DyeingPrintingAreaInput.IsTransformedAval && s.AvalType == avalType);
            var data = productionOrders.Select(s => new InputAvalTransformationProductionOrderViewModel()
            {
                Id              = s.Id,
                Machine         = s.Machine,
                ProductionOrder = new ProductionOrder()
                {
                    Id            = s.ProductionOrderId,
                    No            = s.ProductionOrderNo,
                    OrderQuantity = s.ProductionOrderOrderQuantity,
                    Type          = s.ProductionOrderType
                },
                MaterialWidth = s.MaterialWidth,
                FinishWidth   = s.FinishWidth,
                Material      = new Material()
                {
                    Id   = s.MaterialId,
                    Name = s.MaterialName
                },
                MaterialConstruction = new MaterialConstruction()
                {
                    Name = s.MaterialConstructionName,
                    Id   = s.MaterialConstructionId
                },
                ProcessType = new CommonViewModelObjectProperties.ProcessType()
                {
                    Id   = s.ProcessTypeId,
                    Name = s.ProcessTypeName
                },
                YarnMaterial = new CommonViewModelObjectProperties.YarnMaterial()
                {
                    Id   = s.YarnMaterialId,
                    Name = s.YarnMaterialName
                },
                Buyer                     = s.Buyer,
                BuyerId                   = s.BuyerId,
                Construction              = s.Construction,
                Color                     = s.Color,
                Motif                     = s.Motif,
                Unit                      = s.Unit,
                UomUnit                   = s.UomUnit,
                InputId                   = s.DyeingPrintingAreaInputId,
                AvalType                  = s.AvalType,
                BonNo                     = s.DyeingPrintingAreaInput.BonNo,
                CartNo                    = s.CartNo,
                Quantity                  = s.Balance,
                InputQuantity             = s.Balance,
                ProductSKUId              = s.ProductSKUId,
                FabricSKUId               = s.FabricSKUId,
                ProductSKUCode            = s.ProductSKUCode,
                HasPrintingProductSKU     = s.HasPrintingProductSKU,
                ProductPackingId          = s.ProductPackingId,
                FabricPackingId           = s.FabricPackingId,
                ProductPackingCode        = s.ProductPackingCode,
                HasPrintingProductPacking = s.HasPrintingProductPacking
            });

            return(data.ToList());
        }