Quintiq file version 2.0
|
#parent: #root
|
Method SynchronizeDemoSupplyChainOverview (
|
String foldername
|
)
|
{
|
Description: 'Load sales demo supply chain overview xml file upon sales demo scenario creation'
|
TextBody:
|
[*
|
// Retrieve xml file path
|
dataPath := GlobalParameters_MP::GetDefinitonsDir();
|
scoPath := dataPath + "\" + GlobalParameters_MP::GetSalesDemoPath() + "\" + foldername + "\" + MacroPlan::SupplyChainOverviewXMLFileName();
|
scoPath := scoPath.ReplaceAll( '/', '\' );
|
scv := this.CreateSupplyChainView( GlobalParameters_MP::GetUserName() );
|
feedback_o := '';
|
|
|
|
// After scv has been created, its OnCreate will create StockingPoint nodes, Product nodes and Unit nodes
|
// this propagate is mainly used to propagate the declarative attributes in the nodes
|
Transaction::Transaction().Propagate();
|
|
// Construct OSFile and execute import
|
try
|
{
|
xml := OSFile::Construct( scoPath );
|
xml.Open();
|
if( xml.IsOpen() )
|
{
|
xmlString := xml.ReadBinary().ToString().Erase( 0, 1 );
|
scv.ImportFromXML( xmlString, feedback_o );
|
// Also store the view into default so that it can be restored
|
this.DefaultSupplyChainViewXMLString( xmlString );
|
}
|
}
|
onerror
|
{
|
debuginfo( 'XML file not found' );
|
debuginfo( 'File path: ' + scoPath );
|
}
|
*]
|
}
|