|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 处理日历事件 | 
|---|
|  |  |  | //pls := selectuniquevalues( macroPlan, AssemblyOnlinePlanRow, tempAOPR, true, tempAOPR.ProductionLine() ); | 
|---|
|  |  |  | //traverse ( pls, Elements, pl ) { | 
|---|
|  |  |  | //  targetQuantity := ifexpr( pl = "CC MoMo", guard( macroPlan.AssemblyOnlineQuantity().CCMoMo(), 0 ), | 
|---|
|  |  |  | //                            ifexpr( pl = "DL MoMo", guard( macroPlan.AssemblyOnlineQuantity().DLMoMo(), 0 ), guard( macroPlan.AssemblyOnlineQuantity().DLZKM(), 0 ) ) | 
|---|
|  |  |  | //                           ); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //  u           := select( macroPlan, Unit, tempU, tempU.ID() = pl ); | 
|---|
|  |  |  | //  drainPs     := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "拉空" ), false ) ); | 
|---|
|  |  |  | //  lineLyingPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "铺线" ), false ) ); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //  // 处理排空 | 
|---|
|  |  |  | pls := selectuniquevalues( macroPlan, NewAssemblyOnlinePlanRow, tempNAOPR, true, tempNAOPR.ProductionLine() ); | 
|---|
|  |  |  | traverse ( pls, Elements, pl ) { | 
|---|
|  |  |  | targetQuantity := ifexpr( pl = "CC MoMo", guard( macroPlan.AssemblyOnlineQuantity().CCMoMo(), 0 ), | 
|---|
|  |  |  | ifexpr( pl = "DL MoMo", guard( macroPlan.AssemblyOnlineQuantity().DLMoMo(), 0 ), guard( macroPlan.AssemblyOnlineQuantity().DLZKM(), 0 ) ) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | u           := select( macroPlan, Unit, tempU, tempU.ID() = pl ); | 
|---|
|  |  |  | drainPs     := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "拉空" ), false ) ); | 
|---|
|  |  |  | lineLyingPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "铺线" ), false ) ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 处理拉空 | 
|---|
|  |  |  | //  info( "当前产线:", pl, "    处理拉空--------------------------" ); | 
|---|
|  |  |  | //  traverse ( drainPs, Elements, p ) { | 
|---|
|  |  |  | //    traverse ( p, ExplicitTimeInterval, eti ) { | 
|---|
|  |  |  | traverse ( drainPs, Elements, p ) { | 
|---|
|  |  |  | traverse ( p, ExplicitTimeInterval, eti ) { | 
|---|
|  |  |  | //      info( "开始时间:", eti.Start().Format( "Y-M2-D2" ), "    结束时间:", eti.End().Format( "Y-M2-D2" ) ); | 
|---|
|  |  |  | //      // 前一天日历 | 
|---|
|  |  |  | //      aopc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = ( eti.Start().Date() - 1 ) ); | 
|---|
|  |  |  | //      info( "需要拉空的上线计划时间:", aopc.ColumnDate().Format( "Y-M2-D2" ) ); | 
|---|
|  |  |  | //      aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and | 
|---|
|  |  |  | //                          exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) ); | 
|---|
|  |  |  | //      aopr  := maxselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc, | 
|---|
|  |  |  | //                          [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) ); | 
|---|
|  |  |  | //      cell  := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and | 
|---|
|  |  |  | //                       tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() ); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //      cell.Value( [String] ( [Number]cell.Value() - targetQuantity ) ); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //  } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //  info( "当前产线:", pl, "    处理铺线--------------------------" ); | 
|---|
|  |  |  | //  // 处理铺线 | 
|---|
|  |  |  | //  traverse ( lineLyingPs, Elements, p ) { | 
|---|
|  |  |  | //    traverse ( p, ExplicitTimeInterval, eti ) { | 
|---|
|  |  |  | //      info( "开始时间:", eti.Start().Format( "Y-M2-D2" ), "    结束时间:", eti.End().Format( "Y-M2-D2" ) ); | 
|---|
|  |  |  | //      info( "需要铺线的上线计划时间:", eti.Start().Format( "Y-M2-D2" ) ); | 
|---|
|  |  |  | //      aopc  := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = eti.Start().Date() ); | 
|---|
|  |  |  | //      aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and | 
|---|
|  |  |  | //                          exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) ); | 
|---|
|  |  |  | //      aopr  := minselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc, | 
|---|
|  |  |  | //                          [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) ); | 
|---|
|  |  |  | //      cell  := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and | 
|---|
|  |  |  | //                       tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() ); | 
|---|
|  |  |  | //      cell.Value( [String] ( [Number]cell.Value() + targetQuantity ) ); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //  } | 
|---|
|  |  |  | //} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | cell  := maxselect( macroPlan, NewAssemblyOnlinePlanRow.NewAssemblyOnlinePlanCell, tempNAOPCell, | 
|---|
|  |  |  | tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl                         and | 
|---|
|  |  |  | tempNAOPCell.NewAssemblyOnlinePlanColumn().StartDate()   = ( eti.Start().Date() - 1 ) and | 
|---|
|  |  |  | tempNAOPCell.NewAssemblyOnlinePlanRow().Type()           = "1", | 
|---|
|  |  |  | tempNAOPCell.OrderNr() ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if ( not isnull( cell ) ) { | 
|---|
|  |  |  | cell.Quantity( cell.Quantity() - targetQuantity ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | info( "当前产线:", pl, "    处理铺线--------------------------" ); | 
|---|
|  |  |  | // 处理铺线 | 
|---|
|  |  |  | traverse ( lineLyingPs, Elements, p ) { | 
|---|
|  |  |  | traverse ( p, ExplicitTimeInterval, eti ) { | 
|---|
|  |  |  | info( "开始时间:", eti.Start().Format( "Y-M2-D2" ), "    结束时间:", eti.End().Format( "Y-M2-D2" ) ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | cell  := minselect( macroPlan, NewAssemblyOnlinePlanRow.NewAssemblyOnlinePlanCell, tempNAOPCell, | 
|---|
|  |  |  | tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl                 and | 
|---|
|  |  |  | tempNAOPCell.NewAssemblyOnlinePlanColumn().StartDate()   = eti.Start().Date() and | 
|---|
|  |  |  | tempNAOPCell.NewAssemblyOnlinePlanRow().Type()           = "1"                and | 
|---|
|  |  |  | tempNAOPCell.OrderNr()                                   > 0, | 
|---|
|  |  |  | tempNAOPCell.OrderNr() ); | 
|---|
|  |  |  | if ( not isnull( cell ) ) { | 
|---|
|  |  |  | cell.Quantity( cell.Quantity() + targetQuantity ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | *] | 
|---|
|  |  |  | } | 
|---|