Beispiel #1
0
        public ShipmentFacts MapAllocationToFacts(InventoryItem item)
        {
            ShipmentFacts facts = null;

            var criteria = GetAllocationCriteria(item);

            OrderAllocationDetails allocationDetails =
                Scout.Core.Data
                .Get <OrderAllocationDetails>(item.Session)
                .ByCriteria(criteria);

            if (allocationDetails != null)
            {
                facts = new ShipmentFacts(
                    allocationDetails.SalesOrder,
                    item,
                    item.Qty,
                    allocationDetails.LineItemIdentifier,
                    allocationDetails
                    );

                ShipmentLabelValues = new object[] { allocationDetails.LineItemIdentifier, item.PartNumber };
            }

            return(facts);
        }
Beispiel #2
0
        public bool Run(ShipmentFacts facts, Packlist packlist)
        {
            m_uow = facts.SalesOrder.Session;

            // Associate shipment with sales order
            Shipment shipment = ShipmentMapper.MapFrom(facts);

            // Update the new lot qty after the shipment
            shipment.Item.Ship(shipment);

            // Create Transaction
            // implicit data record creation
            TransactionMapper.MapFrom(shipment);

            // Tell the line item to update its status from this shipment
            shipment.LineItem.UpdateStatusFromShipment(shipment.Qty);

            // Add shipment to packlist
            packlist.AddShipment(shipment);

            //Persist
            Scout.Core.Data.Save(m_uow);

            return(true);
        }
Beispiel #3
0
        public bool Ship(SalesOrder salesOrder, InventoryItem item, int shipQty)
        {
            // Create the shipping facts
            var facts = new ShipmentFacts(salesOrder, item, shipQty, "", null);

            return(Ship(facts));
        }
Beispiel #4
0
        /// <summary>
        /// Ships a inventory item via a ShipmentScript
        /// </summary>
        /// <param name="facts"></param>
        /// <returns></returns>
        public bool Ship(ShipmentFacts facts)
        {
            // Check if shipment is valid prior to shipping
            if (!new ShipmentValidator(m_facts).Validated())
            {
                return(false);
            }

            try
            {
                var shipper = Scout.Core.Container.GetInstance <IShipmentScript>();

                return
                    (shipper.Run(facts, facts.SalesOrder.GetCurrentPacklist()));
            }

            catch (Exception ex)
            {
                UserInteraction.Dialog.ShowMessage("There was a error saving this shipment. "
                                                   + ex.Message, UserMessageType.Exception);
            }

            return(false);
        }
Beispiel #5
0
 public string GetErrors(ShipmentFacts facts)
 {
     m_rules.Where(r => r.IsBroken(facts, m_messageBuilder));
     return(m_messageBuilder.FlatContents);
 }
Beispiel #6
0
 protected abstract bool HandleRequest(ShipmentFacts facts);
Beispiel #7
0
 public ShipmentValidator(ShipmentFacts facts)
 {
     m_shipQty    = facts.ShipQty;
     m_salesOrder = facts.SalesOrder;
     m_item       = facts.Item;
 }