コード例 #1
0
        public virtual ActionResult InboundShipmentDetail(ShipmentSkuFilterModel filters, bool exportExcel = false)
        {
            int nMaxRowsToShow = 2000;
            var shipmentLists  = GetInboundShipmentDetailModels(filters, nMaxRowsToShow);
            var model          = new IntransitShipmentSkuListViewModel
            {
                Filters = filters
            };

            model.ShipmentLists = shipmentLists;
            //model.TotalShipmentRows = shipmentLists.Select(m => m.Shipments[0].TotalShipmentCount).FirstOrDefault();

            model.MaxRowsToShow = shipmentLists.Select(m => m.Shipments).Distinct().Count();

            model.SewingPlantList = (from item in _service.GetSewingPlantList()
                                     select new SelectListItem
            {
                Text = string.Format("{0}:{1}", item.SewingPlantCode, item.PlantName),
                Value = item.SewingPlantCode
            }).ToArray();

            if (exportExcel)
            {
                var result = new ExcelResult("Shipment_SKU_Detail");
                result.AddWorkSheet(model.TransferShipmentList, "Transfers", "List of Building Transfer Shipment");
                result.AddWorkSheet(model.UnknownShipmentList, "Unknown", "List of Unknown Shipment");
                result.AddWorkSheet(model.VendorShipmentList, "Vendors", "List of Vendor Shipment");
                return(result);
            }
            return(View(Views.IntransitShipmentSkuList, model));
        }
コード例 #2
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="other"></param>
 public ShipmentSkuFilterModel(ShipmentSkuFilterModel other)
 {
     SkuSource       = other.SkuSource;
     SkuStatus       = other.SkuStatus;
     SewingPlantCode = other.SewingPlantCode;
     MinClosedDate   = other.MinClosedDate;
     MaxClosedDate   = other.MaxClosedDate;
 }
コード例 #3
0
        private IList <ShipmentSkuGroup> GetInboundShipmentDetailModels(ShipmentSkuFilterModel filters, int maxRows)
        {
            ShipmentSkuFilters statusFilter = ShipmentSkuFilters.NoFilter;

            if (filters.SkuStatus == ShipmentSkuStatusType.Varience)
            {
                statusFilter |= ShipmentSkuFilters.VarianceSku;
            }
            switch (filters.SkuSource)
            {
            case null:
                break;

            case ShipmentSkuSourceType.Vendor:
                statusFilter |= ShipmentSkuFilters.VendorShipments;
                break;

            case ShipmentSkuSourceType.Transfer:
                statusFilter |= ShipmentSkuFilters.BuildingTransferShipments;
                break;

            default:
                throw new NotImplementedException();
            }


            var shipmentList = _service.GetInboundShipmentSkuDetail(statusFilter, filters.MaxClosedDate, filters.MinClosedDate, filters.SewingPlantCode, maxRows);
            var list         = from shipment in shipmentList
                               group shipment by new
            {
                InstransitType = string.IsNullOrWhiteSpace(shipment.IntransitType) || shipment.IntransitType == "IT" ? "" : shipment.IntransitType == "ZEL" || shipment.IntransitType == "TR" ? "ZEL" : "Unknown"
            }
            into g
                select new ShipmentSkuGroup
            {
                InstransitType = g.Key.InstransitType,
                Shipments      = (from p in g
                                  orderby p.UploadDate descending, p.ShipmentId, p.Style, p.Color, p.Dimension, p.SkuSize
                                  select new ShipmentDetailSkuModel(p)).ToList()
            };


            return(list.ToList());
        }