Quintiq file version 2.0
|
#parent: #root
|
StaticMethod SynchronizeToNewSupply (
|
MacroPlan macroPlan,
|
NewOfflinePlanTable nopt,
|
NewOfflinePlanRows selectedRows
|
)
|
{
|
TextBody:
|
[*
|
traverse ( selectedRows, Elements.NewOfflinePlanCell, cell,
|
cell.NewOfflinePlanRow().Type() = "1" and cell.Quantity() >= 0.0
|
// and cell.NewOfflinePlanRow().ProductionLine() = "eMotor Assy (France)" and cell.NewOfflinePlanColumn().StartDate() = Date::Construct( 2020, 4, 4 )
|
)
|
{
|
pto := select( macroPlan, Unit.Operation.PeriodTaskOperation, tempPTO,
|
exists( tempPTO, NewSupply, tempNS, tempNS.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID() = cell.NewOfflinePlanRow().ProductID() ) and
|
tempPTO.Operation().UnitID() = cell.NewOfflinePlanRow().ProductionLine() and
|
tempPTO.Start().Date() = cell.NewOfflinePlanColumn().StartDate() );
|
if ( isnull( pto ) and cell.Quantity() > 0 ) {
|
o := select( macroPlan, Unit.Operation, tempO, tempO.ID() = cell.NewOfflinePlanRow().OperationID() );
|
up := select( macroPlan, Unit.UnitPeriod, tempUP, tempUP.UnitID() = cell.NewOfflinePlanRow().ProductionLine() and tempUP.StartDate() = cell.NewOfflinePlanColumn().StartDate() );
|
if ( not isnull( o ) and not isnull( up ) ) {
|
PeriodTaskOperation::Create( o, up, cell.Quantity(), true );
|
}
|
} else if ( not isnull( pto ) ) {
|
if ( [Number]cell.Quantity() <> [Number]pto.Quantity() ) {
|
pto.Update( cell.Quantity(), true );
|
}
|
}
|
|
}
|
*]
|
}
|