Beispiel #1
0
        public void RunInventoryCapture(InventoryCapture capture, InventoryItem item)
        {
            string captureReason = capture.Message;

            if (capture.Hold)
            {
                // Create Hold
                InventoryHold hold = new InventoryHold(item, capture.Type);
                hold.Capture          = capture;
                hold.AllowStationData = capture.AllowStationData;

                // Create transaction
                Transaction transaction = new CaptureTransactionMapper().MapFrom(hold);

                if (capture.HoldStation != null)
                {
                    Scout.Core.Service <IShopfloorService>().MoveUnitToNewStation
                        (item.CurrentProcess, capture.HoldStation);
                }
            }

            // Apply Shopfloor Condition
            item.ShopfloorConditions = capture.ApplyCondition;

            UserInteraction.Dialog.ShowMessage("This unit is to be captured for: " + captureReason, UserMessageType.Warning);

            Scout.Core.Data.Save(item.Session);

            Logging.Log("Captured item " + item.SerialNumber + " for " + captureReason, LogType.Information);
        }
Beispiel #2
0
        public bool ReleaseHold(InventoryHold hold, Domain moveToDomain)
        {
            if (!new HoldResolutionValidator(hold).Validated())
            {
                return(false);
            }

            Logging.Log("Releasing hold [" + hold.Reason + "] for " + hold.Item.LotId, LogType.Information);

            if (moveToDomain == null)
            {
                moveToDomain = hold.Item.Domain;
            }

            // Transfer the item to the specified domain
            Scout.Core.Service <IInventoryService>()
            .TransferItemToDomain(hold.Item, moveToDomain);

            InventoryItem item = hold.Item;

            // Write transaction
            Scout.Core.Service <ITransactionService>().CreateTransaction(
                "CAPRELEASE", item, item.Domain.FullLocation, moveToDomain.FullLocation, hold.Resolution, "");

            // Remove the hold from the item
            item.Hold = null;

            // Close the hold
            hold.Status = HoldStatus.Closed;

            UserInteraction.Dialog.ShowMessage("Hold Released", UserMessageType.Information);

            return(true);
        }
Beispiel #3
0
        public InventoryHold CreateHoldForMultipleCaptures(InventoryItem item, IList <InventoryCapture> captures)
        {
            if (captures.Count < 2)
            {
                throw new NotSupportedException("The list of inventory captures must be more than 1.");
            }

            InventoryHold hold = new InventoryHold(item, "MULTIPLE_CAPTURES");

            hold.ReleaseAction = HoldReleaseAction.ExecuteCaptureFromList;

            StringBuilder builder = new StringBuilder();

            foreach (InventoryCapture c in captures)
            {
                builder.Append(c.Id.ToString() + ",");
            }

            hold.MultipleCaptureIds = builder.ToString(0, builder.Length - 1);

            Logging.Log("Creating multi hold capture for " + item.LotId, LogType.Information);

            Scout.Core.Data.Save(item.Session);

            return(hold);
        }
        public HoldResolutionValidator(MessageListener listener, InventoryHold hold) : base(listener)
        {
            if (m_listener == null)
            {
                throw new NoNullAllowedException("MessageListener cannot be null");
            }

            m_hold = hold;
        }
Beispiel #5
0
        public void ExecuteMultipleHighPriorityCapture(InventoryCapture capture, InventoryItem item)
        {
            Logging.Log("Executing multiple high priority capture for " + item.LotId, LogType.Information);

            InventoryHold hold = item.Hold;

            hold.Resolution     = "Multiple Capture Selected";
            hold.ResolutionDate = DateTime.Now;
            ReleaseHold(item.Hold, capture.HoldDomain);
            RunInventoryCapture(capture, item);
            UserInteraction.Dialog.ShowMessage("Capture Executed", UserMessageType.Information);
        }
Beispiel #6
0
        public bool RunCaptureCheck(InventoryItem item, string transType)
        {
            Logging.Log("Running capture check for " + item.LotId, LogType.Information);

            IList <InventoryCapture> captures = GetCaptures(item);

            if (captures == null)
            {
                return(false);
            }

            IList <InventoryCapture> highPriorities =
                new List <InventoryCapture>();

            foreach (InventoryCapture ic in captures)
            {
                if (ic.Priority == CapturePriority.High)
                {
                    highPriorities.Add(ic);
                }
            }

            // If only 1 high priority capture is found run it and return
            if (highPriorities.Count == 1)
            {
                RunInventoryCapture(highPriorities[0], item);
                return(true);
            }

            // Send multiple high priority capture to resolution queue.
            if (highPriorities.Count > 1)
            {
                InventoryHold hold = CreateHoldForMultipleCaptures(item, highPriorities);
                UserInteraction.Dialog.ShowMessage
                    ("This unit should be put on hold for " + hold.Reason, UserMessageType.Warning, stubborn: true);
                return(true);
            }

            // Process first normal priority capture
            RunInventoryCapture(captures[0], item);
            return(true);
        }
Beispiel #7
0
        public InventoryHold CreateHold(InventoryItem item, string reason)
        {
            InventoryHold hold = new InventoryHold(item, reason);

            return(hold);
        }
 public HoldResolutionValidator(InventoryHold hold) : base()
 {
     m_hold = hold;
 }