Quintiq file version 2.0
|
#parent: #root
|
StaticMethod CreateOldOfflinePlanData (
|
MacroPlan macroPlan
|
) as OfflinePlanTable
|
{
|
TextBody:
|
[*
|
nopt := maxselect( macroPlan, NewOfflinePlanTable, tempNOPT, true, tempNOPT.SaveDateTime() );
|
|
macroPlan.OfflinePlanTable( relflush );
|
|
opt := macroPlan.OfflinePlanTable( relnew, SaveDateTime := nopt.SaveDateTime() );
|
|
// 创建列
|
firstColumn := opt.OfflinePlanColumn( relnew, ColumnDate := macroPlan.StartOfPlanning().Date() - 2 );
|
secondColumn := opt.OfflinePlanColumn( relnew, ColumnDate := macroPlan.StartOfPlanning().Date() - 1 );
|
traverse ( nopt, NewOfflinePlanColumn, nopc ) {
|
opt.OfflinePlanColumn( relnew, ColumnDate := nopc.StartDate() );
|
}
|
|
pls := selectuniquevalues( nopt, NewOfflinePlanRow, tempNOPR, true, tempNOPR.ProductionLine() );
|
|
traverse ( pls, Elements, pl ) {
|
// 创建明细行
|
detailNOPRs := selectsortedset( nopt, NewOfflinePlanRow, tempNOPR, tempNOPR.ProductionLine() = pl and tempNOPR.Type() = "1", tempNOPR.ProductionLine(), tempNOPR.ProductID() );
|
traverse ( detailNOPRs, Elements, nopr ) {
|
quantityOPR := opt.OfflinePlanRow( relnew, ProductionLine := nopr.ProductionLine(), ProductID := nopr.ProductID(), Type := "1" );
|
orderOPR := opt.OfflinePlanRow( relnew, ProductionLine := nopr.ProductionLine(), ProductID := nopr.ProductID(), Type := "2" );
|
|
// 第一列
|
quantityOPR.OfflinePlanCell( relnew, OfflinePlanColumn := firstColumn, Value := nopr.Name() );
|
orderOPR.OfflinePlanCell( relnew, OfflinePlanColumn := firstColumn, Value := "" );
|
|
// 第二列
|
quantityOPR.OfflinePlanCell( relnew, OfflinePlanColumn := secondColumn, Value := "Quantity" );
|
orderOPR.OfflinePlanCell( relnew, OfflinePlanColumn := secondColumn, Value := "Order" );
|
|
// 时间列
|
traverse ( nopr, NewOfflinePlanCell, nopcell ) {
|
opc := select( opt, OfflinePlanColumn, tempOPC, tempOPC.ColumnDate() = nopcell.StartDate() );
|
quantityOPR.OfflinePlanCell( relnew, OfflinePlanColumn := opc, Value := [String]nopcell.Quantity() );
|
orderOPR.OfflinePlanCell( relnew, OfflinePlanColumn := opc, Value := nopcell.Order() );
|
}
|
}
|
|
// 创建合计行
|
totalNOPR := select( nopt, NewOfflinePlanRow, tempNOPR, tempNOPR.ProductionLine() = pl and tempNOPR.Type() = "2" );
|
|
totalOPR := opt.OfflinePlanRow( relnew, ProductionLine := totalNOPR.ProductionLine(), ProductID := "Z", Type := "3" );
|
shiftPatternNameOPR := opt.OfflinePlanRow( relnew, ProductionLine := totalNOPR.ProductionLine(), ProductID := "Z", Type := "4" );
|
shiftPatternStartOPR := opt.OfflinePlanRow( relnew, ProductionLine := totalNOPR.ProductionLine(), ProductID := "Z", Type := "5" );
|
shiftPatternEndOPR := opt.OfflinePlanRow( relnew, ProductionLine := totalNOPR.ProductionLine(), ProductID := "Z", Type := "6" );
|
|
// 第一列
|
totalOPR.OfflinePlanCell( relnew, OfflinePlanColumn := firstColumn, Value := "合计" );
|
shiftPatternNameOPR.OfflinePlanCell( relnew, OfflinePlanColumn := firstColumn, Value := "" );
|
shiftPatternStartOPR.OfflinePlanCell( relnew, OfflinePlanColumn := firstColumn, Value := "" );
|
shiftPatternEndOPR.OfflinePlanCell( relnew, OfflinePlanColumn := firstColumn, Value := "" );
|
|
// 第二列
|
totalOPR.OfflinePlanCell( relnew, OfflinePlanColumn := secondColumn, Value := "总量" );
|
shiftPatternNameOPR.OfflinePlanCell( relnew, OfflinePlanColumn := secondColumn, Value := "班次" );
|
shiftPatternStartOPR.OfflinePlanCell( relnew, OfflinePlanColumn := secondColumn, Value := "班次开始时间" );
|
shiftPatternEndOPR.OfflinePlanCell( relnew, OfflinePlanColumn := secondColumn, Value := "班次结束时间" );
|
|
// 时间列
|
traverse ( totalNOPR, NewOfflinePlanCell, nopcell ) {
|
opc := select( opt, OfflinePlanColumn, tempOPC, tempOPC.ColumnDate() = nopcell.StartDate() );
|
totalOPR.OfflinePlanCell( relnew, OfflinePlanColumn := opc, Value := [String]nopcell.TotalQuantity() );
|
shiftPatternNameOPR.OfflinePlanCell( relnew, OfflinePlanColumn := opc, Value := nopcell.ShiftPatternName() );
|
shiftPatternStartOPR.OfflinePlanCell( relnew, OfflinePlanColumn := opc, Value := nopcell.ShiftPatternStart() );
|
shiftPatternEndOPR.OfflinePlanCell( relnew, OfflinePlanColumn := opc, Value := nopcell.ShiftPatternEnd() );
|
}
|
}
|
|
return opt;
|
*]
|
}
|