Exemple #1
0
        /// <summary>
        /// Restocks carton
        /// </summary>
        /// <param name="carton">RestockCarton entity</param>
        /// <param name="locationId">string</param>
        public void RestockCarton(RestockCarton carton, string locationId)
        {
            if (carton == null || string.IsNullOrWhiteSpace(carton.CartonId))
            {
                throw new ArgumentNullException("carton");
            }

            if (string.IsNullOrWhiteSpace(locationId))
            {
                throw new ArgumentNullException("locationId");
            }
            using (var trans = _repos.BeginTransaction())
            {
                _repos.RestockCarton(carton, locationId);
                _repos.CaptureProductivity(carton, true);
                trans.Commit();
            }
            CartonCache.Remove(carton.CartonId);

            // Remove assigned locations of SKU from the cache so that we can see updated pieces at location
            if (carton.SkuId.HasValue)
            {
                // Safety check
                IList <AssignedLocation> dummy;
                SkuLocationCache.TryRemove(carton.SkuId.Value, out dummy);
            }
        }
Exemple #2
0
        /// <summary>
        /// Retreives Scanned Carton details
        /// </summary>
        /// <param name="cartonId">string</param>
        /// <returns>RestockCarton model</returns>
        public RestockCarton GetCartonDetails(string cartonId, bool ignoreCache)
        {
            RestockCarton carton;
            var           isInCache = CartonCache.Contains(cartonId);

            if (!ignoreCache && isInCache)
            {
                carton = CartonCache[cartonId];
            }
            else
            {
                carton = _repos.GetCartonDetails(cartonId);
                if (carton != null)
                {
                    if (isInCache)
                    {
                        CartonCache.Remove(carton.CartonId);
                    }
                    CartonCache.Add(carton);
                }
            }
            if (carton == null)
            {
                return(null);
            }

            IList <AssignedLocation> assignedLocations;

            if (carton.SkuId.HasValue)
            {
                if (!SkuLocationCache.TryGetValue(carton.SkuId.Value, out assignedLocations))
                {
                    assignedLocations = _repos.GetAssignedLocations(carton.SkuId.Value);

                    SkuLocationCache.TryAdd(carton.SkuId.Value, assignedLocations);
                }
            }
            else
            {
                assignedLocations = new AssignedLocation[0];
            }

            carton.AssignedLocations = assignedLocations.Where(p => p.AssignedVwhId == carton.VwhId).OrderByDescending(p => p.SpaceAvailable).ToList();

            if (carton.AssignedLocations.Count == 0 && carton.SkuId.HasValue)
            {
                SkuLocationCache.TryRemove(carton.SkuId.Value, out assignedLocations);
            }
            carton.RestockableQualities = RestockableQualities;
            return(carton);
        }
Exemple #3
0
 /// <summary>
 /// Puts carton in suspense
 /// </summary>
 /// <param name="carton">String</param>
 public void SuspenseCarton(RestockCarton carton)
 {
     if (carton == null || string.IsNullOrWhiteSpace(carton.CartonId))
     {
         throw new ArgumentNullException("carton");
     }
     using (var trans = _repos.BeginTransaction())
     {
         _repos.SuspenseCarton(carton.CartonId);
         _repos.CaptureProductivity(carton, false);
         trans.Commit();
     }
     CartonCache.Remove(carton.CartonId);
 }