Quintiq file version 2.0
|
#parent: #root
|
StaticMethod WriteBackTheTransferPlan (
|
MacroPlan macroPlan,
|
Product_MPs selectedProducts
|
)
|
{
|
TextBody:
|
[*
|
traverse ( selectedProducts, Elements, p, p.IsLeaf() and exists( macroPlan, TransferPlanRow, tempTPR, tempTPR.ProductID() = p.ID() ) ) {
|
tprs := selectset( macroPlan, TransferPlanRow, tempTPR, tempTPR.ProductID() = p.ID() );
|
|
traverse ( tprs, Elements, tpr ) {
|
tpcells := selectsortedset( tpr, TransferPlanCell, tempTPCell, guard( [Number]tempTPCell.Value(), 0 ) >= 0.0, tempTPCell.TransferPlanColumn().ColumnDate() );
|
traverse ( tpcells, Elements, tpcell
|
// , tpcell.TransferPlanColumn().ColumnDate() = Date::Construct( 2025, 1, 11 )
|
) {
|
// info( "时间:", tpcell.TransferPlanColumn().ColumnName(), " ",
|
// tpcell.TransferPlanRow().SourceStockpoingPointID() + " To " + tpcell.TransferPlanRow().TargetStockpoingPointID(), " ",
|
// tpcell.Value() );
|
|
// selecte trip plan
|
unitName := tpcell.TransferPlanRow().SourceStockpoingPointID() + " " + "to" + " " + tpcell.TransferPlanRow().TargetStockpoingPointID() + " " + tpcell.TransferPlanRow().Category() + " " + "Transport"
|
pit := select( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
|
tempPIT.Trip().Departure().Date() = tpcell.TransferPlanColumn().ColumnDate() and
|
tempPIT.Trip().LaneLeg().Lane().Unit().Name() = unitName and
|
tempPIT.ProductID() = tpr.ProductID()
|
);
|
if ( not isnull( pit ) ) { // 有Trip情况
|
// info( pit.Quantity() );
|
if ( [Number]pit.Quantity() <> [Number]tpcell.Value() ) {
|
pit.Update( [Real]tpcell.Value(), true );
|
}
|
} else { // 无Trip情况
|
// error( "no trip" );
|
// info( tpr.ProductID(), " 数量:", [Number]tpcell.Value() );
|
//
|
// t := select( macroPlan, Unit.Lane.LaneLeg.Trip, tempP,
|
// tempP.LaneLeg().Lane().Unit().Name() = unitName and
|
// tempP.Departure().Date() = tpcell.TransferPlanColumn().ColumnDate() );
|
// p := select( macroPlan, Product_MP, tempPMP, tempPMP.ID() = tpr.ProductID() );
|
// info( not isnull( t ) );
|
// if ( [Number]tpcell.Value() > 0 and not isnull( t ) and not isnull( p ) ) {
|
// ProductInTrip::CreateOrUpdateForTrip( t, p, [Real]tpcell.Value() );
|
// Transaction::Transaction().PropagateAll();
|
// }
|
}
|
}
|
}
|
}
|
*]
|
}
|