Wednesday 22 November 2023

Map as parameters in X++

 We might have some challenges in using map as a parameter in the contract classes. Usually contract classes in SysOperation framework  we may have to have a map as a parameter so the calculated map can be passed to the service classed.

These scenarios might arise mostly in case of Multi threading  where the records will be split and passed in to the contract parameter. Most of the cases we use containers in the contract class and pass the containers as maps and other collection classes are not allowed.

He is a scenario where list of items and prices should be passed in contract class. We cannot pass a map in to contract class and so if we try to use the containers then multiple values cannot be passed.


Below is a code example to achieve this scenario.


Map             map = new Map(Types::String, Types::Real);
    MapEnumerator   me;
    
    container       cnt;
    str             xml;
    XmlDocument     xmlDocument;
 
map.insert("ItemA", 100);
map.insert("ItemB", 200);
map.insert("ItemC", 300);
map.insert("ItemD", 400);
 
    // pack Map to container
    cnt = map.pack();

Now this container can be passed on to the contract class.


//unpack container to map
To get back the map from the container in the service class we can use the below code

   map = Map::create(cnt);


Similar way to get the map as XML and create a map from XML we can use the below code.
 
    // pack/unpack Map to/from XML
    xml         = map.xml();
    xmlDocument = XmlDocument::newXml(xml);
    map         = Map::createFromXML(xmlDocument.root() as XmlNode);

Wednesday 8 November 2023

Order Promising

 

  • Order promising helps you reliably promise delivery dates to your customers
  • Order promising calculates earliest ship and receipt dates based on delivery date control method and transport days

Delivery Date Control Methods

  • Sales lead time - based on default number of days, doesn't consider stock availability, known demand, or planned supply
  • ATP (available-to-promise) - includes uncommitted inventory, lead times, planned receipts, and issues
  • ATP + Issue margin - shipping date equals ATP date plus issue margin for the item
  • CTP (capable-to-promise) - availability calculated through explosion, not allowed with Planning Optimization
  • CTP for Planning Optimization - use CTP calculation provided by Planning Optimization

Updating Order Promising Information

  • Order promising information is updated only if existing date can't be fulfilled
  • If current date can't be met, order promising is triggered
  • If current date can still be fulfilled, order promising isn't triggered and current date remains

ATP Calculations

  • ATP quantity calculated using 'cumulative ATP with look-ahead' method
  • ATP quantity includes uncommitted inventory balance in first period
  • ATP quantity calculated for each period in which a receipt is scheduled
  • ATP calculated based on formula ATP = ATP for previous period + Receipts for current period - Issues for current period - Net issue quantity for each future period
  • ATP quantity always greater than or equal to 0
  • Negative ATP quantity automatically set to 0

ATP Backward Demand and Supply

  • ATP backward demand time fence controls how far back to look for delayed demand orders or inventory issues
  • ATP backward supply time fence controls how far back to look for delayed supply orders or inventory receipts
  • ATP delayed demand offset time and ATP delayed supply offset time control when delayed demand or supply considered
  • Example: 7 entered in ATP backward demand and supply time fence fields, and 1 in ATP delayed demand and supply offset time fields

CTP Calculations

  • CTP functionality provides realistic delivery dates based on existing inventory, production capacity, and transportation times.
  • It considers availability of both materials and capacity, giving a more accurate picture of whether demand can be satisfied within a given time frame.

CTP for Planning Optimization

  • CTP for Planning Optimization supports a subset of CTP scenarios available in the built-in engine.
  • For detailed information on using CTP with each engine, refer to the 'Calculate sales order delivery dates using CTP' guide.

Delivery Alternatives

  • Explore delivery alternatives to meet customer demands.
  • Inventory visibility and on-hand change schedules can help determine the best option.