protected override void BaseSetup(Setup setup)
        {
            var nonSerialisedStates = new NonSerialisedInventoryItemStates(this.Session);
            var serialisedStates    = new SerialisedInventoryItemStates(this.Session);

            var merge = this.Cache.Merger().Action();

            merge(StandardId, v =>
            {
                v.Name = "Standard Inventory Strategy";

                v.AddAvailableToPromiseNonSerialisedState(nonSerialisedStates.Good);

                v.AddOnHandNonSerialisedState(nonSerialisedStates.Good);
                v.AddOnHandNonSerialisedState(nonSerialisedStates.SlightlyDamaged);
                v.AddOnHandNonSerialisedState(nonSerialisedStates.Defective);
                v.AddOnHandNonSerialisedState(nonSerialisedStates.Scrap);

                v.AddAvailableToPromiseSerialisedState(serialisedStates.Good);

                // Exclude serialisedStates.Sold
                // Exclude serialisedStates.InRent
                v.AddOnHandSerialisedState(serialisedStates.Good);
                v.AddOnHandSerialisedState(serialisedStates.SlightlyDamaged);
                v.AddOnHandSerialisedState(serialisedStates.Defective);
                v.AddOnHandSerialisedState(serialisedStates.Scrap);
            });
        }
예제 #2
0
        public void GivenFinishedGoodWithSerializedInventory_WhenDeriving_ThenQuantityOnHandUpdated()
        {
            // Arrange
            var available = new SerialisedInventoryItemStates(this.Session).Available;
            var warehouse = new Facilities(this.Session).FindBy(M.Facility.FacilityType, new FacilityTypes(this.Session).Warehouse);

            var kinds          = new InventoryItemKinds(this.Session);
            var unitsOfMeasure = new UnitsOfMeasure(this.Session);
            var unknown        = new InventoryTransactionReasons(this.Session).Unknown;

            var vatRate21   = new VatRateBuilder(this.Session).WithRate(21).Build();
            var category    = new ProductCategoryBuilder(this.Session).WithName("category").Build();
            var serialPart  = CreatePart("FG1", kinds.Serialised);
            var serialItem1 = new SerialisedItemBuilder(this.Session).WithSerialNumber("1").Build();
            var serialItem2 = new SerialisedItemBuilder(this.Session).WithSerialNumber("2").Build();
            var serialItem3 = new SerialisedItemBuilder(this.Session).WithSerialNumber("3").Build();

            serialPart.AddSerialisedItem(serialItem1);
            serialPart.AddSerialisedItem(serialItem2);
            serialPart.AddSerialisedItem(serialItem3);

            var good = CreateGood("10101", vatRate21, "good1", unitsOfMeasure.Piece, category, serialPart);

            // Act
            this.Session.Derive(true);

            CreateInventoryTransaction(1, unknown, serialPart, serialItem1);
            CreateInventoryTransaction(1, unknown, serialPart, serialItem2);
            CreateInventoryTransaction(1, unknown, serialPart, serialItem3);

            this.Session.Derive(true);

            // Assert
            Assert.Equal(3, serialPart.QuantityOnHand);
        }
예제 #3
0
        protected override void AppsSetup(Setup setup)
        {
            base.AppsSetup(setup);

            var nonSerialisedStates = new NonSerialisedInventoryItemStates(this.Session);
            var serialisedStates    = new SerialisedInventoryItemStates(this.Session);

            new InventoryStrategyBuilder(this.Session)
            .WithUniqueId(StandardId)
            .WithName("Standard Inventory Strategy")
            .Build();

            this.Standard.AddAvailableToPromiseNonSerialisedState(nonSerialisedStates.Good);

            this.Standard.AddOnHandNonSerialisedState(nonSerialisedStates.Good);
            this.Standard.AddOnHandNonSerialisedState(nonSerialisedStates.BeingRepaired);
            this.Standard.AddOnHandNonSerialisedState(nonSerialisedStates.SlightlyDamaged);
            this.Standard.AddOnHandNonSerialisedState(nonSerialisedStates.Defective);
            this.Standard.AddOnHandNonSerialisedState(nonSerialisedStates.Scrap);

            this.Standard.AddAvailableToPromiseSerialisedState(serialisedStates.Good);
            this.Standard.AddAvailableToPromiseSerialisedState(serialisedStates.Available);

            this.Standard.AddOnHandSerialisedState(serialisedStates.Good);
            this.Standard.AddOnHandSerialisedState(serialisedStates.BeingRepaired);
            this.Standard.AddOnHandSerialisedState(serialisedStates.SlightlyDamaged);
            this.Standard.AddOnHandSerialisedState(serialisedStates.Defective);
            this.Standard.AddOnHandSerialisedState(serialisedStates.Scrap);
            this.Standard.AddOnHandSerialisedState(serialisedStates.Available);
            // Exclude serialisedStates.Sold
            // Exclude serialisedStates.InRent
            this.Standard.AddOnHandSerialisedState(serialisedStates.Assigned);
        }
예제 #4
0
        public void GivenInventoryItem_WhenBuild_ThenPostBuildRelationsMustExist()
        {
            // Arrange
            var available = new SerialisedInventoryItemStates(this.Session).Available;
            var warehouse = new Facilities(this.Session).FindBy(M.Facility.FacilityType, new FacilityTypes(this.Session).Warehouse);
            var kinds     = new InventoryItemKinds(this.Session);

            var serialItem   = new SerialisedItemBuilder(this.Session).WithSerialNumber("1").Build();
            var finishedGood = CreatePart("1", kinds.Serialised);

            finishedGood.AddSerialisedItem(serialItem);
            var serialInventoryItem = new SerialisedInventoryItemBuilder(this.Session).WithSerialisedItem(serialItem).WithPart(finishedGood).Build();

            // Act
            this.Session.Derive(true);

            // Assert
            Assert.Equal(available, serialInventoryItem.SerialisedInventoryItemState);
            Assert.Equal(warehouse, serialInventoryItem.Facility);
        }
예제 #5
0
        protected override void AppsSetup(Setup setup)
        {
            base.AppsSetup(setup);

            var dutchLocale         = new Locales(this.Session).DutchNetherlands;
            var serialisedStates    = new SerialisedInventoryItemStates(this.Session);
            var nonSerialisedStates = new NonSerialisedInventoryItemStates(this.Session);

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("Sales Order")
            .WithLocalisedName(new LocalisedTextBuilder(this.Session).WithText("Bestelling").WithLocale(dutchLocale).Build())      //TODO
            .WithUniqueId(SalesOrderId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(false)
            .WithIncreasesQuantityCommittedOut(true) // Increases Quantity
            .WithIncreasesQuantityExpectedIn(null)   // Does not affect Quantity
            .WithIncreasesQuantityOnHand(null)       // Does not affect Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Good)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Good)
            .Build();

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("Outbound Shipment")
            .WithLocalisedName(new LocalisedTextBuilder(this.Session).WithText("Verscheping uitgaand").WithLocale(dutchLocale).Build())
            .WithUniqueId(OutgoingShipmentId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(false)
            .WithIncreasesQuantityCommittedOut(false) // Decreases Quantity
            .WithIncreasesQuantityExpectedIn(null)    // Does not affect Quantity
            .WithIncreasesQuantityOnHand(false)       // Decreases Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Good)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Good)
            .Build();

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("Inbound Shipment")
            .WithLocalisedName(new LocalisedTextBuilder(this.Session).WithText("Verscheping inkomend").WithLocale(dutchLocale).Build())
            .WithUniqueId(IncomingShipmentId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(false)
            .WithIncreasesQuantityCommittedOut(null) // Decreases Quantity
            .WithIncreasesQuantityExpectedIn(null)   // Does not affect Quantity
            .WithIncreasesQuantityOnHand(true)       // Decreases Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Good)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Good)
            .Build();

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("Theft")
            .WithLocalisedName(new LocalisedTextBuilder(this.Session).WithText("Diefstal").WithLocale(dutchLocale).Build())
            .WithUniqueId(TheftId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(true)
            .WithIncreasesQuantityCommittedOut(null) // Does not affect Quantity
            .WithIncreasesQuantityExpectedIn(null)   // Does not affect Quantity
            .WithIncreasesQuantityOnHand(false)      // Decreases Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Good)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Good)
            .Build();

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("Shrinkage")
            .WithLocalisedName(new LocalisedTextBuilder(this.Session).WithText("Inkrimping").WithLocale(dutchLocale).Build())
            .WithUniqueId(ShrinkageId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(true)
            .WithIncreasesQuantityCommittedOut(null) // Does not affect Quantity
            .WithIncreasesQuantityExpectedIn(null)   // Does not affect Quantity
            .WithIncreasesQuantityOnHand(false)      // Decreases Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Good)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Good)
            .Build();

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("Unknown")
            .WithLocalisedName(new LocalisedTextBuilder(this.Session).WithText("Onbekend").WithLocale(dutchLocale).Build())
            .WithUniqueId(UnknownId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(true)
            .WithIncreasesQuantityCommittedOut(null) // Does not affect Quantity
            .WithIncreasesQuantityExpectedIn(null)   // Does not affect Quantity
            .WithIncreasesQuantityOnHand(true)       // Affects Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Good)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Good)
            .Build();

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("State change")
            .WithLocalisedName(new LocalisedTextBuilder(this.Session).WithText("Status update").WithLocale(dutchLocale).Build())
            .WithUniqueId(StateId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(false)
            .WithIncreasesQuantityCommittedOut(null) // Does not affect Quantity
            .WithIncreasesQuantityExpectedIn(null)   // Does not affect Quantity
            .WithIncreasesQuantityOnHand(null)       // Does not affect Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Scrap)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Scrap)
            .Build();

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("Physical Count")
            .WithUniqueId(PhysicalCountId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(true)
            .WithIncreasesQuantityCommittedOut(null) // Does not affect Quantity
            .WithIncreasesQuantityExpectedIn(null)   // Does not affect Quantity
            .WithIncreasesQuantityOnHand(true)       // Increases Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Good)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Good)
            .Build();

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("Consumption")
            .WithUniqueId(ConsumptionId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(false)
            .WithIncreasesQuantityCommittedOut(false) // Decreases Quantity
            .WithIncreasesQuantityExpectedIn(null)    // Does not affect Quantity
            .WithIncreasesQuantityOnHand(false)       // Decreases Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Good)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Good)
            .Build();

            new InventoryTransactionReasonBuilder(this.Session)
            .WithName("Reservation")
            .WithUniqueId(ReservationId)
            .WithIsActive(true)
            .WithIsManualEntryAllowed(false)
            .WithIncreasesQuantityCommittedOut(true) // Increases Quantity
            .WithIncreasesQuantityExpectedIn(null)   // Does not affect Quantity
            .WithIncreasesQuantityOnHand(null)       // Does not affect Quantity
            .WithDefaultSerialisedInventoryItemState(serialisedStates.Good)
            .WithDefaultNonSerialisedInventoryItemState(nonSerialisedStates.Good)
            .Build();
        }
        protected override void BaseSetup(Setup setup)
        {
            var dutchLocale         = new Locales(this.Session).DutchNetherlands;
            var serialisedStates    = new SerialisedInventoryItemStates(this.Session);
            var nonSerialisedStates = new NonSerialisedInventoryItemStates(this.Session);

            var merge         = this.Cache.Merger().Action();
            var localisedName = new LocalisedTextAccessor(this.Meta.LocalisedNames);

            merge(SalesOrderId, v =>
            {
                v.Name = "Sales Order";
                localisedName.Set(v, dutchLocale, "Bestelling");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = false;
                v.IncreasesQuantityCommittedOut          = true; // Increases Quantity
                v.IncreasesQuantityExpectedIn            = null; // Does not affect Quantity
                v.IncreasesQuantityOnHand                = null; // Does not affect Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Good;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Good;
            });

            merge(OutgoingShipmentId, v =>
            {
                v.Name = "Outbound Shipment";
                localisedName.Set(v, dutchLocale, "Verscheping uitgaand");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = false;
                v.IncreasesQuantityCommittedOut          = false; // Decreases Quantity
                v.IncreasesQuantityExpectedIn            = null;  // Does not affect Quantity
                v.IncreasesQuantityOnHand                = false; // Decreases Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Good;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Good;
            });

            merge(IncomingShipmentId, v =>
            {
                v.Name = "Inbound Shipment";
                localisedName.Set(v, dutchLocale, "Verscheping inkomend");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = false;
                v.IncreasesQuantityCommittedOut          = null; // Decreases Quantity
                v.IncreasesQuantityExpectedIn            = null; // Does not affect Quantity
                v.IncreasesQuantityOnHand                = true; // Decreases Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Good;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Good;
            });

            merge(TheftId, v =>
            {
                v.Name = "Theft";
                localisedName.Set(v, dutchLocale, "Diefstal");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = true;
                v.IncreasesQuantityCommittedOut          = null;  // Does not affect Quantity
                v.IncreasesQuantityExpectedIn            = null;  // Does not affect Quantity
                v.IncreasesQuantityOnHand                = false; // Decreases Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Good;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Good;
            });

            merge(ShrinkageId, v =>
            {
                v.Name = "Theft";
                localisedName.Set(v, dutchLocale, "Shrinkage");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = true;
                v.IncreasesQuantityCommittedOut          = null;  // Does not affect Quantity
                v.IncreasesQuantityExpectedIn            = null;  // Does not affect Quantity
                v.IncreasesQuantityOnHand                = false; // Decreases Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Good;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Good;
            });

            merge(UnknownId, v =>
            {
                v.Name = "Unknown";
                localisedName.Set(v, dutchLocale, "Onbekend");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = true;
                v.IncreasesQuantityCommittedOut          = null; // Does not affect Quantity
                v.IncreasesQuantityExpectedIn            = null; // Does not affect Quantity
                v.IncreasesQuantityOnHand                = true; // Affects Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Good;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Good;
            });

            merge(StateId, v =>
            {
                v.Name = "State change";
                localisedName.Set(v, dutchLocale, "Status update");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = false;
                v.IncreasesQuantityCommittedOut          = null; // Does not affect Quantity
                v.IncreasesQuantityExpectedIn            = null; // Does not affect Quantity
                v.IncreasesQuantityOnHand                = null; // Does not affect Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Scrap;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Scrap;
            });

            merge(PhysicalCountId, v =>
            {
                v.Name = "Physical Count";
                localisedName.Set(v, dutchLocale, "Stocktelling");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = true;
                v.IncreasesQuantityCommittedOut          = null; // Does not affect Quantity
                v.IncreasesQuantityExpectedIn            = null; // Does not affect Quantity
                v.IncreasesQuantityOnHand                = true; // Increases Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Good;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Good;
            });

            merge(ConsumptionId, v =>
            {
                v.Name = "Consumption";
                localisedName.Set(v, dutchLocale, "Verbruik");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = false;
                v.IncreasesQuantityCommittedOut          = false; // Decreases Quantity
                v.IncreasesQuantityExpectedIn            = null;  // Does not affect Quantity
                v.IncreasesQuantityOnHand                = false; // Decreases Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Good;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Good;
            });

            merge(ReservationId, v =>
            {
                v.Name = "Reservation";
                localisedName.Set(v, dutchLocale, "Gereserveerd");
                v.IsActive                               = true;
                v.IsManualEntryAllowed                   = false;
                v.IncreasesQuantityCommittedOut          = true; // Increases Quantity
                v.IncreasesQuantityExpectedIn            = null; // Does not affect Quantity
                v.IncreasesQuantityOnHand                = null; // Does not affect Quantity
                v.DefaultSerialisedInventoryItemState    = serialisedStates.Good;
                v.DefaultNonSerialisedInventoryItemState = nonSerialisedStates.Good;
            });
        }