LOG0108 Create issue store order with break down by lots

Basic Information

Module Log.Shipments
Code LOG0108
Parent Document Shipment Order
Sub-document Store Order
Full Name Create issue store order with break down by lots
Status ACTIVE
Deterministic NO
Supports Transitional Documents NO
Supports Single Execution YES
Replaces GenerateStoreOrderWithLotsIssue
Orphan Rows Forbid
Split Function
Introduced In Version 2022
Date of Suspension -

Business Logic

This Generation is used to create Store Orders from the Shipment Order and break down rows by Available To Promise Lots.

If for the current row of the Shipment Order there is no enough quantity from first Lot then is created another row in the Store Orders with remaining Quantity and another Available Lot.

If there is no Available Lot then the Lot is Null.

StoreOrder.DocumentDate = ShipmentOrder.DocumentDate

StoreOrder.Store = ShipmentOrder.ShipFromStore

StoreOrder.MovementType = Issue

StoreOrder.DueDate = ShipmentOrder.RequiredDeliveryDate

StoreOrder.PlannedReleaseDate = ShipmentOrder.RequiredDeliveryDate

StoreOrder.PlannedCompletionDate = ShipmentOrder.RequiredDeliveryDate

StoreOrder.IssuedByParty = ShipmentOrder.ShipFromStore.ResponsibleParty

StoreOrder.DocumentCurrency =  

​                          If COUNT ( DISTINCT ShipmentOrderLines.ParentSalesOrderLine.SalesOrder.DocumentCurrency) = 1

​                          then ShipmentOrderLines.ParentSalesOrderLine.SalesOrder.DocumentCurrency

​                          else Error "There are rows in the shipment order that refer to sales orders with different currencies"

StoreOrder.FromParty = ShipmentOrder.FromParty

StoreOrder.ToParty = ShipmentOrder.ToParty

Fulfillments

Name ShipmentOrderLineToStoreOrderLine
Parent Entity ShipmentOrderLine
Child Entity StoreOrderLine
Parent / Child Relationship StoreOrderLine.ParentDocument = ShipmentOrder;StoreOrderLine.ParentLineNo = ShipmentOrderLine.LineNo

Metrics

Fulfillment Name Metric Name Measurement Unit Parent Value Child Value New Record
ShipmentOrderLineToStoreOrderLine MStandardQuantityBase ShipmentOrderLine.Product.BaseMeasurementUnit ShipmentOrderLine.StandardQuantityBase StoreOrderLine.StandardQuantityBase YES
ShipmentOrderLineToStoreOrderLine MQuantity ShipmentOrderLine.QuantityUnit ShipmentOrderLine.Quantity StoreOrderLine.Quantity NO
ShipmentOrderLineToStoreOrderLine MQuantityBase ShipmentOrderLine.Product.BaseMeasurementUnit ShipmentOrderLine.QuantityBase StoreOrderLine.QuantityBase NO
StoreOrderLine.LineNo = ShipmentOrderLine.LineNo

StoreOrderLine.ParentLineId = ShipmentOrderLine.ShipmentOrderLineId

StoreOrderLine.Product = ShipmentOrderLine.ParentSalesOrderLine.Product

StoreOrderLine.ProductVariant = ShipmentOrderLine.ParentSalesOrderLine.ProductVariant

StoreOrderLine.StoreBin = ShipmentOrderLine.StoreBin

StoreOrderLine.SerialNumber = ShipmentOrderLine.SerialNumber

StoreOrderLine.Quantity = ShipmentOrderLine.REMAINING(MQuantity)

StoreOrderLine.QuantityUnit = ShipmentOrderLine.QuantityUnit

StoreOrderLine.QuantityBase = ShipmentOrderLine.REMAINING(MQuantityBase)

StoreOrderLine.StandardQuantityBase = ShipmentOrderLine.REMAINING(MStandardQuantityBase)

StoreOrderLine.UnitCost = empty

StoreOrderLine.LineCost = empty

StoreOrderLine.Lot =

​                 if ShipmentOrderLine.Lot is not Null then ShipmentOrderLine.Lot

​                 else if Lots Issue is Null then Null else Lots Issue

StoreOrderLine.GuaranteePeriodDays =

​                 if ShipmentOrderLine.GuaranteePeriodDays.HasValue   

​                 then ShipmentOrderLine.GuaranteePeriodDays

​                 else ShipmentOrderLine.ParentSalesOrderLine.Product.GuaranteePeriodDays

StoreOrderLine.SalesOrderLine = ShipmentOrderLine.ParentSalesOrderLine

StoreOrderLine.Notes = ShipmentOrderLine.Notes

StoreOrderLine.PersistLot = ShipmentOrderLine.PersistLot

StoreOrderLine.ParentDocument = ShipmentOrder

StoreOrderLine.ParentLineNo = ShipmentOrderLine.LineNo

StoreOrderLine.TransactionTimestamp = 

​                       if ShipmentOrderLine.Quantity >= 0 Then Null

​                       else

​                       MAX (OriginalSalesOrderLine.ShipmentOrderLines.StoreOrderLine.StoreTransactionLine.TransactionTimestamp)

​                       WHERE

​                       OriginalSalesOrderLine =

​                                    if ShipmentOrderLines.ParentSalesOrderLine.ReturnForSalesOrderLine is not Null

​                                    then ShipmentOrderLines.ParentSalesOrderLine.ReturnForSalesOrderLine

​                                    else ShipmentOrderLines.ParentSalesOrderLine


                         ShipmentOrderLines.ShipmentOrder.IsReleased = True
                         ShipmentOrderLines.ShipmentOrder.Void = False
                         StoreOrderLine.StoreOrder.IsReleased = True
                         StoreOrderLine.StoreOrder.Void = False
                         StoreTransactionLine.StoreTransaction.IsReleased = True
                         StoreTransactionLine.StoreTransaction.Void = False

Lots Issue is the algorithm that determines Lots from Available To Promise Lots.

If there is no enough quantity from first Lot then current row is break down to multiple rows as in next row is filled another Lots that is available.

If there is no available Lot for the current row then Lot = Null.

Note

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