CRM0104 Create issue Store orders for products that aren't shipped

Basic Information

Module Crm.Sales
Code CRM0104
Parent Document Sales Order
Sub-document Store Order
Full Name Create issue Store orders for products that aren't shipped
Status ACTIVE
Deterministic YES
Supports Transitional Documents YES
Replaces GenerateStoreOrdersForNonShipped
Orphan Rows Ignore
Split Function SalesOrderLine.StoreSalesOrderLine.RequiredDeliveryDate
Introduced In Version 2019.1
Date of Suspension -

Business Logic

This Generation is used to create Store Orders for products from the current Sale Order that are not shipped (Product.ProductType.IsShipped = False) and are stocked (Product.ProductType.IsStocked = True). For the rest of the products, the Store Orders are created from the Shipment Orders documents. However, products that are not shipped does not participate in the Shipment Orders, for this reason, the current generation procedure needed in order for these products to be issued from the warehouse as well.

Different lines in the Sales Order may have different Stores or Required Delivery Dates, and for different values in these fields - different Store Orders should be created. Therefore, at the beginning of the generation procedure, all combinations of Store and Required Delivery Date from the Sales Order Lines are determined (but only for the lines that are not used for returning goods according to the classification in topic Sales Order Row Types and whose products are not shipped and are stocked).

For each of these combinations of Store and Required Delivery Date, a separate Store Order is created. The Store Order’s header is created based on the Sales Order’s header as follows:

StoreOrder.Store = Store

StoreOrder.MovementType = Issue

StoreOrder.DueDate = RequiredDeliveryDate

StoreOrder.PlannedReleaseDate = RequiredDeliveryDate

StoreOrder.PlannedCompletionDate = RequiredDeliveryDate

StoreOrder.IssuedByParty = Store.ResponsibleParty

StoreOrder.DocumentCurrency = SalesOrder.DocumentCurrency
Note

the attributes which are not specified here are filled in as described in Standard Document Attributes

Fulfillments

Name SalesOrderLineToStoreOrderLine
Parent Entity SalesOrderLine
Child Entity StoreOrderLine
Parent / Child Relationship StoreOrderLine.ParentDocument = SalesOrder;StoreOrderLine.ParentLineNo = SalesOrderLine.LineNo

Metrics

Fulfillment Name Metric Name Measurement Unit Parent Value Child Value New Record
SalesOrderLineToStoreOrderLine MStandardQuantityBase SalesOrderLine..Product.BaseMeasurementUnit SalesOrderLine.StandardQuantityBase StoreOrderLine.StandardQuantityBase YES
SalesOrderLineToStoreOrderLine MQuantity SalesOrderLine.QuantityUnit SalesOrderLine.Quantity StoreOrderLine.Quantity NO
SalesOrderLineToStoreOrderLine MQuantityBase SalesOrderLine.Product.BaseMeasurementUnit SalesOrderLine.QuantityBase StoreOrderLine.QuantityBase NO

The lines of the new document are created based on the data for the Fulfilled Part of quantities by Store Orders has already been created (for more information, see topic Discrepancy System and Metrics. The new StoreOrderLine is created as follows:

StoreOrderLine.LineNo = SalesOrderLine.LineNo

StoreOrderLine.ParentLineId = SalesOrderLine.SalesOrderLineId

StoreOrderLine.Product = SalesOrderLine.Product

StoreOrderLine.StoreBin = SalesOrderLine.StoreBin

StoreOrderLine.SerialNumber = SalesOrderLine.SerialNumber

StoreOrderLine.Quantity = SalesOrderLine.REMAINING(MQuantity)

StoreOrderLine.QuantityUnit = SalesOrderLine.QuantityUnit

StoreOrderLine.QuantityBase = SalesOrderLine.REMAINING(MQuantityBase)

StoreOrderLine.StandardQuantityBase = SalesOrderLine.REMAINING(MStandardQuantityBase)

StoreOrderLine.Lot = SalesOrderLine.Lot

StoreOrderLine.GuaranteePeriodDays =

​            if SalesOrderLine.GuaranteePeriodDays.HasValue

​            then SalesOrderLine.GuaranteePeriodDays

​            else SalesOrderLine.Product.GuaranteePeriodDays

StoreOrderLine.SalesOrderLine = SalesOrderLine

StoreOrderLine.Notes = SalesOrderLine.Notes

StoreOrderLine.PersistLot = SalesOrderLine.PersistLot

StoreOrderLine.ProductVariant = SalesOrderLine.ProductVariant
StoreOrderLine.ParentDocument = SalesOrder

StoreOrderLine.ParentLineNo = SalesOrderLine.LineNo
Note

WARNING: Any of the Shipment Orders created according to the description above is saved then and only when there is at least one line in it.