Quintiq file version 2.0
|
#parent: #root
|
StaticMethod GenerateReport (
|
MacroPlan macroPlan
|
)
|
{
|
TextBody:
|
[*
|
macroPlan.TransferPlanRow( relflush );
|
macroPlan.TransferPlanColumn( relflush );
|
|
rowNr := 0;
|
|
// 生成调拨计划
|
traverse ( macroPlan, Unit, u, u.HasCapacityTypeTransportQuantity() ) {
|
traverse ( u, Lane.LaneLeg.Trip, t ) {
|
traverse ( t, ProductInTrip, pit, pit.Quantity() > 0.0 ) {
|
// 找行
|
tpr := TransferPlanRow::FindTransferPlanRowTypeIndex( t.LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().Name(),
|
t.LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().Name(),
|
pit.Product_MP().ID() );
|
if ( isnull( tpr ) ) {
|
tpr := macroPlan.TransferPlanRow( relnew,
|
RowNr := rowNr,
|
SourceStockpoingPointID := t.LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().Name(),
|
TargetStockpoingPointID := t.LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().Name(),
|
ProductID := pit.Product_MP().ID() );
|
}
|
|
// 找列
|
tpc := TransferPlanColumn::FindTransferPlanColumnTypeIndex( t.Departure().Date() );
|
if ( isnull( tpc ) ) {
|
tpc := macroPlan.TransferPlanColumn( relnew,
|
ColumnDate := t.Departure().Date() );
|
}
|
|
// 赋值单元格
|
cell := select( tpc, TransferPlanCell, tempTPC, tempTPC.TransferPlanRow() = tpr );
|
if ( isnull( cell ) ) {
|
cell := tpc.TransferPlanCell( relnew, Value := [String]pit.Quantity().Round( 0 ) );
|
cell.TransferPlanRow( relset, tpr );
|
} else {
|
cell.Value( [String] ( [Number]cell.Value() + pit.Quantity().Round( 0 ) ) );
|
}
|
}
|
}
|
}
|
|
// 补齐空列
|
indexDate := minselect( macroPlan, TransferPlanColumn, tempTPC, true, tempTPC.ColumnDate() ).ColumnDate();
|
endDate := maxselect( macroPlan, TransferPlanColumn, tempTPC, true, tempTPC.ColumnDate() ).ColumnDate();
|
while ( indexDate <= endDate ) {
|
if ( isnull( TransferPlanColumn::FindTransferPlanColumnTypeIndex( indexDate ) ) ) {
|
macroPlan.TransferPlanColumn( relnew,
|
ColumnDate := indexDate );
|
}
|
indexDate := indexDate + 1;
|
}
|
|
|
// 生成产品列
|
minDateTPC := macroPlan.TransferPlanColumn( relnew,
|
ColumnDate := Date::MinDate() );
|
traverse ( macroPlan, TransferPlanRow, tpr ) {
|
productCell := minDateTPC.TransferPlanCell( relnew, Value := tpr.ProductID() );
|
productCell.TransferPlanRow( relset, tpr );
|
}
|
|
// 调拨数量调整
|
*]
|
}
|