Quintiq file version 2.0
|
#parent: #root
|
StaticMethod GenerateData (
|
InterfaceDataset owner,
|
String werk,
|
String version,
|
Date startdate,
|
Date enddate,
|
String executor
|
)
|
{
|
TextBody:
|
[*
|
// 甄兰鸽 Aug-23-2024 (created)
|
loginfo := maxobject( owner, InterfaceLoginfo, loginfo, loginfo.Name() = Translations::InterfaceDataset_AOnlineAndMOfflinePlanPIR_Name(), loginfo.InterfaceDateTime() );
|
if( not isnull( loginfo ) ){
|
if( not loginfo.IsShow() ){
|
loginfo.Delete();
|
}else{
|
loginfo.Last( false );
|
}
|
// owner.AOnlineAndMOfflinePlanPIR( relflush );
|
}
|
owner.AOnlineAndMOfflinePlanPIR( relflush );
|
nowdate := DateTime::ActualTime();
|
productids := construct( Strings );
|
loginfo := owner.InterfaceLoginfo( relnew, ExecuteUser := executor
|
, Name := Translations::InterfaceDataset_AOnlineAndMOfflinePlanPIR_Name()
|
, InterfaceDateTime := nowdate
|
, Message := '装配上线计划 + 机加下线计划 - PIR'
|
// , IsShow := false
|
, Last := true
|
, ReturnSuccess := true
|
, ReturnMsg := 'Success'
|
, Success := true
|
);
|
pir := owner.AOnlineAndMOfflinePlanPIR( relnew, ZPPPSCode := OS::GenerateGUIDAsString(), Werk := AOnlineAndMOfflinePlanPIR::GetWerk( werk ), Version := version, StartDate := startdate, EndDate := enddate );
|
loginfo.AOnlineAndMOfflinePlanPIR( relinsert, pir );
|
traverse( owner, AssemblyOnlinePlanVersion, verison, not verison.IsShow() ){
|
traverse( verison, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() >= startdate and column.StartDate() <= enddate ){
|
traverse( column, Cell, cell, ( werk = 'All' or cell.Row().ProductionLine().FindString( werk, 0 ) > -1 )
|
and cell.Row().Type() = '1' ){
|
quantityrow := cell.Row();
|
if( not exists( productids, Elements, e, e = quantityrow.ProductID() ) ){
|
productids.Add( quantityrow.ProductID() );
|
}
|
|
pir.PIRData( relnew, Product := quantityrow.ProductID()
|
, PlanningDate := column.StartDate()
|
, PlanningQty := [Number]cell.Value());
|
}
|
}
|
}
|
|
traverse( owner, OfflinePlanArchiveVersion, table ){
|
traverse( table, Column, column, column.StartDate() >= startdate and column.StartDate() <= enddate ){
|
traverse( column, Cell, cell, ( werk = 'All' or cell.Row().ProductionLine().FindString( werk, 0 ) > -1 )
|
and ( cell.Row().ProductionLine() <> 'DL_MOMO' or cell.Row().ProductionLine() <> 'CC_MOMO' )
|
and cell.Row().Type() = '1' ){
|
row := cell.Row();
|
if( not exists( productids, Elements, e, e = row.ProductID() ) ){
|
productids.Add( row.ProductID() );
|
}
|
pirdata := selectobject( pir, PIRData, pirdata, pirdata.Product() = row.ProductID() and pirdata.PlanningDate() = column.StartDate() );
|
if( isnull( pirdata ) ){
|
pirdata := pir.PIRData( relnew, Product := row.ProductID()
|
, PlanningDate := column.StartDate()
|
, PlanningQty := 0 );
|
}
|
pirdata.PlanningQty( pirdata.PlanningQty() + [Number]cell.Value() );
|
}
|
}
|
}
|
traverse( productids, Elements, e ){
|
for( date := startdate.StartOfWeek(); date <= enddate; date := ( date + Duration::Days( 1 ) ).Date() ){
|
if( not exists( pir, PIRData, pirdata, pirdata.Product() = e and pirdata.PlanningDate() = date ) ){
|
pir.PIRData( relnew, Product := e
|
, PlanningDate := date
|
, PlanningQty := 0 );
|
}
|
}
|
}
|
loginfo.TotalRow( pir.PIRData( relsize ) );
|
InterfaceLoginfo::CallInterfaceForSAPGet( owner, loginfo );
|
*]
|
}
|